Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xE8E1F50392Bd61D0F8F48E8E7aF51D3b8a52090a
Balance 0 ETH
Nonce 1
Code Size 6977 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

6977 bytes
0x608060405234801561001057600080fd5b50600436106101825760003560e01c806370a08231116100d8578063c45a01551161008c578063de0e9a3e11610066578063de0e9a3e14610550578063ea598cb01461056d578063fc0c546a1461058a57610182565b8063c45a015514610486578063d505accf146104b7578063dd62ed3e1461051557610182565b80637ecebe00116100bd5780637ecebe001461041257806395d89b4114610445578063a9059cbb1461044d57610182565b806370a08231146103a657806379cc6790146103d957610182565b806330adf81f1161013a57806340c10f191161011457806340c10f191461031557806342966c68146103505780635dbd60591461036d57610182565b806330adf81f146102e7578063313ce567146102ef5780633644e5151461030d57610182565b806318160ddd1161016b57806318160ddd1461025157806323b872dd1461026b57806326599850146102ae57610182565b806306fdde0314610187578063095ea7b314610204575b600080fd5b61018f610592565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101c95781810151838201526020016101b1565b50505050905090810190601f1680156101f65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023d6004803603604081101561021a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561063e565b604080519115158252519081900360200190f35b610259610655565b60408051918252519081900360200190f35b61023d6004803603606081101561028157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135909116906040013561065b565b610259600480360360408110156102c457600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff1661073a565b61025961082d565b6102f7610851565b6040805160ff9092168252519081900360200190f35b61025961085a565b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610860565b005b61034e6004803603602081101561036657600080fd5b5035610b54565b6102596004803603604081101561038357600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610b98565b610259600480360360208110156103bc57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610c74565b61034e600480360360408110156103ef57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610c86565b6102596004803603602081101561042857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f7a565b61018f610f8c565b61023d6004803603604081101561046357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611004565b61048e611011565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61034e600480360360e08110156104cd57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c0013561102d565b6102596004803603604081101561052b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166112f9565b6102596004803603602081101561056657600080fd5b5035611316565b6102596004803603602081101561058357600080fd5b5035611322565b61048e61132e565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156106365780601f1061060b57610100808354040283529160200191610636565b820191906000526020600020905b81548152906001019060200180831161061957829003601f168201915b505050505081565b600061064b33848461134a565b5060015b92915050565b60035481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146107255773ffffffffffffffffffffffffffffffffffffffff841660009081526005602090815260408083203384529091529020546106f3908363ffffffff6113b916565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083203384529091529020555b61073084848461142b565b5060019392505050565b60008083116107aa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4665773a2063616e27742077726170207a65726f20746f6b656e000000000000604482015290519081900360640190fd5b6009546107cf9073ffffffffffffffffffffffffffffffffffffffff1633308661150c565b6107d982846116dc565b60408051848152905173ffffffffffffffffffffffffffffffffffffffff84169133917feb5580a0908e96b78bdcb1a3c5638793b491a6073c3ff56061a069cb205817739181900360200190a35090919050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60025460ff1681565b60065481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2f4eb266040518163ffffffff1660e01b815260040160206040518083038186803b1580156108c857600080fd5b505afa1580156108dc573d6000803e3d6000fd5b505050506040513d60208110156108f257600080fd5b5051604080517faa271e1a000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff9092169163aa271e1a91602480820192602092909190829003018186803b15801561096257600080fd5b505afa158015610976573d6000803e3d6000fd5b505050506040513d602081101561098c57600080fd5b50516109f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f436f72655265663a2043616c6c6572206973206e6f742061206d696e74657200604482015290519081900360640190fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6157600080fd5b505afa158015610a75573d6000803e3d6000fd5b505050506040513d6020811015610a8b57600080fd5b505115610af957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f436f72655265663a2043616c6c65722069732070617573656400000000000000604482015290519081900360640190fd5b610b0382826116dc565b60408051828152905173ffffffffffffffffffffffffffffffffffffffff84169133917fbcad3d7d3dfccb90d49c6063bf70f828901fefc88937d90af74e58e6e55bc39d9181900360200190a35050565b610b5e338261178d565b604080518281529051339182917fdbdf9b8e4b75e75b162d151ec8fc7f0561cabab5fcccfa2600be62223e4300c49181900360200190a350565b6000808311610bf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611abc6023913960400191505060405180910390fd5b610bfc338461178d565b600954610c209073ffffffffffffffffffffffffffffffffffffffff168385611851565b60408051848152905173ffffffffffffffffffffffffffffffffffffffff84169133917f12d6424519838e57637c6db9df31af32d7926ff0a53dd37007c191d0fe3028189181900360200190a35090919050565b60046020526000908152604090205481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2f4eb266040518163ffffffff1660e01b815260040160206040518083038186803b158015610cee57600080fd5b505afa158015610d02573d6000803e3d6000fd5b505050506040513d6020811015610d1857600080fd5b5051604080517f4334614a000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff90921691634334614a91602480820192602092909190829003018186803b158015610d8857600080fd5b505afa158015610d9c573d6000803e3d6000fd5b505050506040513d6020811015610db257600080fd5b5051610e1f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f436f72655265663a2043616c6c6572206973206e6f742061206275726e657200604482015290519081900360640190fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635c975abb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e8757600080fd5b505afa158015610e9b573d6000803e3d6000fd5b505050506040513d6020811015610eb157600080fd5b505115610f1f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f436f72655265663a2043616c6c65722069732070617573656400000000000000604482015290519081900360640190fd5b610f29828261178d565b60408051828152905173ffffffffffffffffffffffffffffffffffffffff84169133917fdbdf9b8e4b75e75b162d151ec8fc7f0561cabab5fcccfa2600be62223e4300c49181900360200190a35050565b60076020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156106365780601f1061060b57610100808354040283529160200191610636565b600061064b33848461142b565b60085473ffffffffffffffffffffffffffffffffffffffff1681565b4284101561109c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4665773a20455850495245440000000000000000000000000000000000000000604482015290519081900360640190fd5b60065473ffffffffffffffffffffffffffffffffffffffff80891660008181526007602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa1580156111fd573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81161580159061127857508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b6112e357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4665773a20494e56414c49445f5349474e415455524500000000000000000000604482015290519081900360640190fd5b6112ee89898961134a565b505050505050505050565b600560209081526000928352604080842090915290825290205481565b600061064f8233610b98565b600061064f823361073a565b60095473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b8082038281111561064f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260046020526040902054611461908263ffffffff6113b916565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526004602052604080822093909355908416815220546114a3908263ffffffff611a1816565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017815292518251600094606094938a169392918291908083835b602083106115ea57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016115ad565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461164c576040519150601f19603f3d011682016040523d82523d6000602084013e611651565b606091505b509150915081801561167f57508051158061167f575080806020019051602081101561167c57600080fd5b50515b6116d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611a8b6031913960400191505060405180910390fd5b505050505050565b6003546116ef908263ffffffff611a1816565b60035573ffffffffffffffffffffffffffffffffffffffff8216600090815260046020526040902054611728908263ffffffff611a1816565b73ffffffffffffffffffffffffffffffffffffffff831660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600460205260409020546117c3908263ffffffff6113b916565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600460205260409020556003546117fc908263ffffffff6113b916565b60035560408051828152905160009173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b6020831061192757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016118ea565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611989576040519150601f19603f3d011682016040523d82523d6000602084013e61198e565b606091505b50915091508180156119bc5750805115806119bc57508080602001905160208110156119b957600080fd5b50515b611a11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180611adf602d913960400191505060405180910390fd5b5050505050565b8082018281101561064f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe5472616e7366657248656c7065723a3a7472616e7366657246726f6d3a207472616e7366657246726f6d206661696c65644665773a207a65726f20616d6f756e7420756e77726170206e6f7420616c6c6f7765645472616e7366657248656c7065723a3a736166655472616e736665723a207472616e73666572206661696c6564a2646970667358221220a6e8991d1c9bb458886caf6747ba791abf4d04a0ed92291519c07b76fb5e6db664736f6c63430006060033

Verified Source Code Full Match

Compiler: v0.6.6+commit.6c089d02 EVM: istanbul Optimization: Yes (999999 runs)
ICore.sol 14 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

interface ICore {
    // ----------- Getters -----------

    function isBurner(address _address) external view returns (bool);

    function isMinter(address _address) external view returns (bool);

    function isGovernor(address _address) external view returns (bool);

    function isGuardian(address _address) external view returns (bool);
}
ICoreRef.sol 14 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import '../core/ICore.sol';

/// @title CoreRef interface
interface ICoreRef {
    event CoreUpdate(address indexed _core);

    function setCore(address coreAddress) external;
    function pause() external;
    function unpause() external;
    function core() external view returns (ICore);
}
FewWrappedToken.sol 191 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.6.6;

import '@uniswap/lib/contracts/libraries/TransferHelper.sol';

import './interfaces/IFewWrappedToken.sol';
import './libraries/SafeMath.sol';
import './refs/ICoreRef.sol';
import './interfaces/IFewFactory.sol';

/// @title Few Wrapped Token
contract FewWrappedToken is IFewWrappedToken {
    using SafeMath for uint;

    string public override name;
    string public override symbol;
    uint8 public override decimals;
    uint  public override totalSupply;
    mapping(address => uint) public override balanceOf;
    mapping(address => mapping(address => uint)) public override allowance;

    bytes32 public override DOMAIN_SEPARATOR;
    // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32 public override constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
    mapping(address => uint) public override nonces;

    address public override factory;
    address public override token;

    modifier onlyMinter() {
        require(ICoreRef(factory).core().isMinter(msg.sender), "CoreRef: Caller is not a minter");
        _;
    }

    modifier onlyBurner() {
        require(ICoreRef(factory).core().isBurner(msg.sender), "CoreRef: Caller is not a burner");
        _;
    }

    modifier whenNotPaused() {
        require(!IFewFactory(factory).paused(), "CoreRef: Caller is paused");
        _;
    }

    event Mint(address indexed minter, uint256 amount, address indexed to);
    event Burn(address indexed burner, uint256 amount, address indexed to);
    event Wrap(address indexed sender, uint256 amount, address indexed to);
    event Unwrap(address indexed sender, uint256 amount, address indexed to);

    /// @notice Few wrapped token constructor
    constructor() public {
        uint chainId;
        assembly {
            chainId := chainid()
        }

        factory = msg.sender;
        token = IFewFactory(msg.sender).parameter();
        name = string(abi.encodePacked("Few Wrapped ", IERC20(token).name()));
        symbol = string(abi.encodePacked("fw", IERC20(token).symbol()));
        decimals = IERC20(token).decimals();

        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
                keccak256(bytes(name)),
                keccak256(bytes('1')),
                chainId,
                address(this)
            )
        );
    }

    function _mint(address to, uint value) internal {
        totalSupply = totalSupply.add(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint value) internal {
        balanceOf[from] = balanceOf[from].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(from, address(0), value);
    }

    function _approve(address owner, address spender, uint value) internal {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) private {
        balanceOf[from] = balanceOf[from].sub(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint value) external override returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external override returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external override returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external override {
        require(deadline >= block.timestamp, 'Few: EXPIRED');
        bytes32 digest = keccak256(
            abi.encodePacked(
                '\x19\x01',
                DOMAIN_SEPARATOR,
                keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
            )
        );
        address recoveredAddress = ecrecover(digest, v, r, s);
        require(recoveredAddress != address(0) && recoveredAddress == owner, 'Few: INVALID_SIGNATURE');
        _approve(owner, spender, value);
    }

    /// @notice mint Few wrapped tokens
    /// @param account the account to mint to
    /// @param amount the amount to mint
    function mint(address account, uint256 amount)
        external
        override
        onlyMinter
        whenNotPaused
    {
        _mint(account, amount);
        emit Mint(msg.sender, amount, account);
    }

    /// @notice burn Few wrapped tokens from caller
    /// @param amount the amount to burn
    function burn(uint256 amount) public override {
        _burn(msg.sender, amount);
        emit Burn(msg.sender, amount, msg.sender);
    }

    /// @notice burn Few wrapped tokens from specified account
    /// @param account the account to burn from
    /// @param amount the amount to burn
    function burnFrom(address account, uint256 amount)
        public
        override
        onlyBurner
        whenNotPaused
    {
        _burn(account, amount);
        emit Burn(msg.sender, amount, account);
    }

    /// @notice exchanges token to Few wrapped token
    /// @param amount the amount to wrap
    /// @param to wrapped token reciver address
    function wrapTo(uint256 amount, address to) public override returns (uint256) {
        require(amount > 0, "Few: can't wrap zero token");
        TransferHelper.safeTransferFrom(token, msg.sender, address(this), amount);
        _mint(to, amount);
        emit Wrap(msg.sender, amount, to);
        return amount;
    }

    function wrap(uint256 amount) external override returns (uint256) {
        return wrapTo(amount, msg.sender);
    }

    /// @notice exchange Few wrapped token to token
    /// @param amount the amount to unwrap
    /// @param to token receiver address
    function unwrapTo(uint256 amount, address to) public override returns (uint256) {
        require(amount > 0, "Few: zero amount unwrap not allowed");
        _burn(msg.sender, amount);
        TransferHelper.safeTransfer(address(token), to, amount);
        emit Unwrap(msg.sender, amount, to);
        return amount;
    }

    function unwrap(uint256 amount) external override returns (uint256) {
        return unwrapTo(amount, msg.sender);
    }
}
IERC20.sol 17 lines
pragma solidity >=0.5.0;

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
}
SafeMath.sol 17 lines
pragma solidity =0.6.6;

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMath {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, 'ds-math-add-overflow');
    }

    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'ds-math-sub-underflow');
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
    }
}
IFewERC20.sol 12 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import './IERC20.sol';

interface IFewERC20 is IERC20 {
    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
IFewFactory.sol 13 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

interface IFewFactory {
    event WrappedTokenCreated(address indexed originalToken, address wrappedToken, uint);

    function getWrappedToken(address originalToken) external view returns (address wrappedToken);
    function allWrappedTokens(uint) external view returns (address wrappedToken);
    function parameter() external view returns (address);
    function allWrappedTokensLength() external view returns (uint);
    function paused() external view returns (bool);
    function createToken(address originalToken) external returns (address wrappedToken);
}
IFewWrappedToken.sol 22 lines
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import '../interfaces/IFewERC20.sol';

interface IFewWrappedToken is IFewERC20 {
    event Mint(address indexed minter, uint256 amount, address indexed to);
    event Burn(address indexed burner, uint256 amount, address indexed to);
    event Wrap(address indexed sender, uint256 amount, address indexed to);
    event Unwrap(address indexed sender, uint256 amount, address indexed to);

    function factory() external view returns (address);
    function token() external view returns (address);

    function mint(address account, uint256 amount) external;
    function burn(uint256 amount) external;
    function burnFrom(address account, uint256 amount) external;
    function wrapTo(uint256 amount, address to) external returns (uint256);
    function wrap(uint256 amount) external returns (uint256);
    function unwrapTo(uint256 amount, address to) external returns (uint256);
    function unwrap(uint256 amount) external returns (uint256);
}
TransferHelper.sol 51 lines
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeApprove: approve failed'
        );
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::safeTransfer: transfer failed'
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            'TransferHelper::transferFrom: transferFrom failed'
        );
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
    }
}

Read Contract

DOMAIN_SEPARATOR 0x3644e515 → bytes32
PERMIT_TYPEHASH 0x30adf81f → bytes32
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
factory 0xc45a0155 → address
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
symbol 0x95d89b41 → string
token 0xfc0c546a → address
totalSupply 0x18160ddd → uint256

Write Contract 11 functions

These functions modify contract state and require a wallet transaction to execute.

approve 0x095ea7b3
address spender
uint256 value
returns: bool
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
mint 0x40c10f19
address account
uint256 amount
permit 0xd505accf
address owner
address spender
uint256 value
uint256 deadline
uint8 v
bytes32 r
bytes32 s
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
unwrap 0xde0e9a3e
uint256 amount
returns: uint256
unwrapTo 0x5dbd6059
uint256 amount
address to
returns: uint256
wrap 0xea598cb0
uint256 amount
returns: uint256
wrapTo 0x26599850
uint256 amount
address to
returns: uint256

Recent Transactions

No transactions found for this address