Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xc003BE0fAF0B06F66FDf8264540B6A1e2e93faa3
Balance 0 ETH
Nonce 1
Code Size 9735 bytes
Indexed Transactions Index loading...
External Etherscan · Sourcify

Contract Bytecode

9735 bytes
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80638456cb5911610097578063af81c5b911610066578063af81c5b91461024f578063bd5c54201461026b578063db006a7514610287578063f2fde38b146102a3576100f5565b80638456cb59146101d957806385c15d9a146101e35780638da5cb5b146102135780639ef09efc14610231576100f5565b80635c975abb116100d35780635c975abb1461016557806360ca46cd146101835780636ff1c9bc146101b3578063715018a6146101cf576100f5565b806332a46857146100fa57806336c5d72414610118578063584794c414610134575b600080fd5b6101026102bf565b60405161010f91906117a7565b60405180910390f35b610132600480360381019061012d91906117fd565b6102e5565b005b61014e600480360381019061014991906117fd565b6104ad565b60405161015c9291906119b8565b60405180910390f35b61016d6106eb565b60405161017a9190611a0a565b60405180910390f35b61019d600480360381019061019891906117fd565b610701565b6040516101aa9190611a34565b60405180910390f35b6101cd60048036038101906101c89190611a8d565b610740565b005b6101d76107a5565b005b6101e16107b9565b005b6101fd60048036038101906101f89190611ae6565b6107e5565b60405161020a9190611b22565b60405180910390f35b61021b6107fd565b6040516102289190611a34565b60405180910390f35b610239610826565b6040516102469190611b22565b60405180910390f35b61026960048036038101906102649190611b3d565b61084a565b005b61028560048036038101906102809190611b3d565b610a7f565b005b6102a1600480360381019061029c91906117fd565b610be2565b005b6102bd60048036038101906102b89190611ae6565b610fae565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6102ed611031565b60006003828154811061030357610302611b7d565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009055600360016003805490506103879190611bdb565b8154811061039857610397611b7d565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481106103d7576103d6611b7d565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600380548061043157610430611c0f565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590558073ffffffffffffffffffffffffffffffffffffffff167f4c910b69fe65a61f7531b9c5042b2329ca7179c77290aa7e2eb3afa3c8511fd360405160405180910390a25050565b606080600060038054905067ffffffffffffffff8111156104d1576104d0611c3e565b5b6040519080825280602002602001820160405280156104ff5781602001602082028036833780820191505090505b50905060005b600380549050811015610655577f0000000000000000000000000000000000000000000000000de0b6b3a7640000600460006003848154811061054b5761054a611b7d565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054866105bc9190611c6d565b6105c69190611cde565b8282815181106105d9576105d8611b7d565b5b60200260200101818152505060008282815181106105fa576105f9611b7d565b5b602002602001015111610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063990611d6c565b60405180910390fd5b808061064d90611d8c565b915050610505565b50600381818054806020026020016040519081016040528092919081815260200182805480156106da57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610690575b505050505091509250925050915091565b60008060149054906101000a900460ff16905090565b6003818154811061071157600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610748611031565b6107a26107536107fd565b61077c308473ffffffffffffffffffffffffffffffffffffffff166110af90919063ffffffff16565b8373ffffffffffffffffffffffffffffffffffffffff166111ff9092919063ffffffff16565b50565b6107ad611031565b6107b76000611354565b565b6107c1611031565b6107c96106eb565b6107da576107d5611418565b6107e3565b6107e261147b565b5b565b60046020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b610852611031565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b890611e20565b60405180910390fd5b60008111610904576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108fb90611e8c565b60405180910390fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610986576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097d90611ef8565b60405180910390fd5b6003829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167ff4c563a3ea86ff1f4275e8c207df0375a51963f2b831b7bf4da8be938d92876c82604051610a739190611b22565b60405180910390a25050565b610a87611031565b60008111610aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac190611f64565b60405180910390fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610b4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4390611fd0565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f33f2543e3c6781690cf64ec858faed743b394bb23d1965451414ae98c88ad94d82604051610bd69190611b22565b60405180910390a25050565b610bea6114dd565b610bf2611527565b80610c3e33600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110af90919063ffffffff16565b1015610c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c769061203c565b60405180910390fd5b610cce333083600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611576909392919063ffffffff16565b60005b600380549050811015610fa25760007f0000000000000000000000000000000000000000000000000de0b6b3a76400006004600060038581548110610d1957610d18611b7d565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484610d8a9190611c6d565b610d949190611cde565b905060008111610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd090611d6c565b60405180910390fd5b80610e413060038581548110610df257610df1611b7d565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110af90919063ffffffff16565b1015610e82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e79906120a8565b60405180910390fd5b610eeb338260038581548110610e9b57610e9a611b7d565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111ff9092919063ffffffff16565b60038281548110610eff57610efe611b7d565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f27d4634c833b7622a0acddbf7f746183625f105945e95c723ad1d5a9f2a0b6fc83604051610f869190611b22565b60405180910390a3508080610f9a90611d8c565b915050610cd1565b50610fab6116ce565b50565b610fb6611031565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611025576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101c9061213a565b60405180910390fd5b61102e81611354565b50565b6110396116d7565b73ffffffffffffffffffffffffffffffffffffffff166110576107fd565b73ffffffffffffffffffffffffffffffffffffffff16146110ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a4906121a6565b60405180910390fd5b565b60008060008473ffffffffffffffffffffffffffffffffffffffff166370a0823160e01b856040516024016110e49190611a34565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161114e9190612237565b600060405180830381855afa9150503d8060008114611189576040519150601f19603f3d011682016040523d82523d6000602084013e61118e565b606091505b50915091508180156111a257506020815110155b6111e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d89061229a565b60405180910390fd5b808060200190518101906111f591906122cf565b9250505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b85856040516024016112349291906122fc565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161129e9190612237565b6000604051808303816000865af19150503d80600081146112db576040519150601f19603f3d011682016040523d82523d6000602084013e6112e0565b606091505b509150915081801561130e575060008151148061130d57508080602001905181019061130c9190612351565b5b5b61134d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611344906123ca565b60405180910390fd5b5050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6114206114dd565b6001600060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114646116d7565b6040516114719190611a34565b60405180910390a1565b6114836116df565b60008060146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6114c66116d7565b6040516114d39190611a34565b60405180910390a1565b6114e56106eb565b15611525576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151c90612436565b60405180910390fd5b565b60026001540361156c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611563906124a2565b60405180910390fd5b6002600181905550565b6000808573ffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b8686866040516024016115ad939291906124c2565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116179190612237565b6000604051808303816000865af19150503d8060008114611654576040519150601f19603f3d011682016040523d82523d6000602084013e611659565b606091505b509150915081801561168757506000815114806116865750808060200190518101906116859190612351565b5b5b6116c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bd90612545565b60405180910390fd5b505050505050565b60018081905550565b600033905090565b6116e76106eb565b611726576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171d906125b1565b60405180910390fd5b565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061176d61176861176384611728565b611748565b611728565b9050919050565b600061177f82611752565b9050919050565b600061179182611774565b9050919050565b6117a181611786565b82525050565b60006020820190506117bc6000830184611798565b92915050565b600080fd5b6000819050919050565b6117da816117c7565b81146117e557600080fd5b50565b6000813590506117f7816117d1565b92915050565b600060208284031215611813576118126117c2565b5b6000611821848285016117e8565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600061186182611728565b9050919050565b61187181611856565b82525050565b60006118838383611868565b60208301905092915050565b6000602082019050919050565b60006118a78261182a565b6118b18185611835565b93506118bc83611846565b8060005b838110156118ed5781516118d48882611877565b97506118df8361188f565b9250506001810190506118c0565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61192f816117c7565b82525050565b60006119418383611926565b60208301905092915050565b6000602082019050919050565b6000611965826118fa565b61196f8185611905565b935061197a83611916565b8060005b838110156119ab5781516119928882611935565b975061199d8361194d565b92505060018101905061197e565b5085935050505092915050565b600060408201905081810360008301526119d2818561189c565b905081810360208301526119e6818461195a565b90509392505050565b60008115159050919050565b611a04816119ef565b82525050565b6000602082019050611a1f60008301846119fb565b92915050565b611a2e81611856565b82525050565b6000602082019050611a496000830184611a25565b92915050565b6000611a5a82611856565b9050919050565b611a6a81611a4f565b8114611a7557600080fd5b50565b600081359050611a8781611a61565b92915050565b600060208284031215611aa357611aa26117c2565b5b6000611ab184828501611a78565b91505092915050565b611ac381611856565b8114611ace57600080fd5b50565b600081359050611ae081611aba565b92915050565b600060208284031215611afc57611afb6117c2565b5b6000611b0a84828501611ad1565b91505092915050565b611b1c816117c7565b82525050565b6000602082019050611b376000830184611b13565b92915050565b60008060408385031215611b5457611b536117c2565b5b6000611b6285828601611ad1565b9250506020611b73858286016117e8565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611be6826117c7565b9150611bf1836117c7565b9250828203905081811115611c0957611c08611bac565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000611c78826117c7565b9150611c83836117c7565b9250828202611c91816117c7565b91508282048414831517611ca857611ca7611bac565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611ce9826117c7565b9150611cf4836117c7565b925082611d0457611d03611caf565b5b828204905092915050565b600082825260208201905092915050565b7f416d6f756e74206e6f7420656e6f756768000000000000000000000000000000600082015250565b6000611d56601183611d0f565b9150611d6182611d20565b602082019050919050565b60006020820190508181036000830152611d8581611d49565b9050919050565b6000611d97826117c7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611dc957611dc8611bac565b5b600182019050919050565b7f546f6b656e20616464726573732063616e6e6f74206265207a65726f00000000600082015250565b6000611e0a601c83611d0f565b9150611e1582611dd4565b602082019050919050565b60006020820190508181036000830152611e3981611dfd565b9050919050565b7f45786368616e6765526174652063616e6e6f7420626520300000000000000000600082015250565b6000611e76601883611d0f565b9150611e8182611e40565b602082019050919050565b60006020820190508181036000830152611ea581611e69565b9050919050565b7f546f6b656e20616c726561647920657869737473000000000000000000000000600082015250565b6000611ee2601483611d0f565b9150611eed82611eac565b602082019050919050565b60006020820190508181036000830152611f1181611ed5565b9050919050565b7f546f6b656e20726174652063616e6e6f74206265207a65726f00000000000000600082015250565b6000611f4e601983611d0f565b9150611f5982611f18565b602082019050919050565b60006020820190508181036000830152611f7d81611f41565b9050919050565b7f546f6b656e20646f6573206e6f74206578697374000000000000000000000000600082015250565b6000611fba601483611d0f565b9150611fc582611f84565b602082019050919050565b60006020820190508181036000830152611fe981611fad565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000612026601483611d0f565b915061203182611ff0565b602082019050919050565b6000602082019050818103600083015261205581612019565b9050919050565b7f496e73756666696369656e742062616c616e6365206f6620636f6e7472616374600082015250565b6000612092602083611d0f565b915061209d8261205c565b602082019050919050565b600060208201905081810360008301526120c181612085565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612124602683611d0f565b915061212f826120c8565b604082019050919050565b6000602082019050818103600083015261215381612117565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612190602083611d0f565b915061219b8261215a565b602082019050919050565b600060208201905081810360008301526121bf81612183565b9050919050565b600081519050919050565b600081905092915050565b60005b838110156121fa5780820151818401526020810190506121df565b60008484015250505050565b6000612211826121c6565b61221b81856121d1565b935061222b8185602086016121dc565b80840191505092915050565b60006122438284612206565b915081905092915050565b7f426f72696e6745524332303a2042616c616e63654f66206661696c6564000000600082015250565b6000612284601d83611d0f565b915061228f8261224e565b602082019050919050565b600060208201905081810360008301526122b381612277565b9050919050565b6000815190506122c9816117d1565b92915050565b6000602082840312156122e5576122e46117c2565b5b60006122f3848285016122ba565b91505092915050565b60006040820190506123116000830185611a25565b61231e6020830184611b13565b9392505050565b61232e816119ef565b811461233957600080fd5b50565b60008151905061234b81612325565b92915050565b600060208284031215612367576123666117c2565b5b60006123758482850161233c565b91505092915050565b7f426f72696e6745524332303a205472616e73666572206661696c656400000000600082015250565b60006123b4601c83611d0f565b91506123bf8261237e565b602082019050919050565b600060208201905081810360008301526123e3816123a7565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000612420601083611d0f565b915061242b826123ea565b602082019050919050565b6000602082019050818103600083015261244f81612413565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b600061248c601f83611d0f565b915061249782612456565b602082019050919050565b600060208201905081810360008301526124bb8161247f565b9050919050565b60006060820190506124d76000830186611a25565b6124e46020830185611a25565b6124f16040830184611b13565b949350505050565b7f426f72696e6745524332303a205472616e7366657246726f6d206661696c6564600082015250565b600061252f602083611d0f565b915061253a826124f9565b602082019050919050565b6000602082019050818103600083015261255e81612522565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061259b601483611d0f565b91506125a682612565565b602082019050919050565b600060208201905081810360008301526125ca8161258e565b905091905056fea2646970667358221220acd9a0f0c3203d8a07d31f9ed77ccabad687f0da55c984326719b0927af47c0964736f6c63430008130033

Verified Source Code Full Match

Compiler: v0.8.19+commit.7dd6d404 EVM: paris Optimization: No
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
Pausable.sol 105 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
ReentrancyGuard.sol 69 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
IERC20.sol 57 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC20 {
    // transfer and tranferFrom have been removed, because they don't work on all tokens (some aren't ERC20 complaint).
    // By removing them you can't accidentally use them.
    // name, symbol and decimals have been removed, because they are optional and sometimes wrongly implemented (MKR).
    // Use BoringERC20 with `using BoringERC20 for IERC20` and call `safeTransfer`, `safeTransferFrom`, etc instead.
    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /// @notice EIP 2612
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

interface IStrictERC20 {
    // This is the strict ERC20 interface. Don't use this, certainly not if you don't control the ERC20 token you're calling.
    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 (uint256);
    function balanceOf(address _owner) external view returns (uint256 balance);
    function transfer(address _to, uint256 _value) external returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
    function approve(address _spender, uint256 _value) external returns (bool success);
    function allowance(address _owner, address _spender) external view returns (uint256 remaining);

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /// @notice EIP 2612
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}
BoringERC20.sol 106 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interfaces/IERC20.sol";

// solhint-disable avoid-low-level-calls

library BoringERC20 {
    bytes4 private constant SIG_SYMBOL = 0x95d89b41; // symbol()
    bytes4 private constant SIG_NAME = 0x06fdde03; // name()
    bytes4 private constant SIG_DECIMALS = 0x313ce567; // decimals()
    bytes4 private constant SIG_BALANCE_OF = 0x70a08231; // balanceOf(address)
    bytes4 private constant SIG_TOTALSUPPLY = 0x18160ddd; // balanceOf(address)
    bytes4 private constant SIG_TRANSFER = 0xa9059cbb; // transfer(address,uint256)
    bytes4 private constant SIG_TRANSFER_FROM = 0x23b872dd; // transferFrom(address,address,uint256)

    function returnDataToString(bytes memory data) internal pure returns (string memory) {
        if (data.length >= 64) {
            return abi.decode(data, (string));
        } else if (data.length == 32) {
            uint8 i = 0;
            while (i < 32 && data[i] != 0) {
                i++;
            }
            bytes memory bytesArray = new bytes(i);
            for (i = 0; i < 32 && data[i] != 0; i++) {
                bytesArray[i] = data[i];
            }
            return string(bytesArray);
        } else {
            return "???";
        }
    }

    /// @notice Provides a safe ERC20.symbol version which returns '???' as fallback string.
    /// @param token The address of the ERC-20 token contract.
    /// @return (string) Token symbol.
    function safeSymbol(IERC20 token) internal view returns (string memory) {
        (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_SYMBOL));
        return success ? returnDataToString(data) : "???";
    }

    /// @notice Provides a safe ERC20.name version which returns '???' as fallback string.
    /// @param token The address of the ERC-20 token contract.
    /// @return (string) Token name.
    function safeName(IERC20 token) internal view returns (string memory) {
        (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_NAME));
        return success ? returnDataToString(data) : "???";
    }

    /// @notice Provides a safe ERC20.decimals version which returns '18' as fallback value.
    /// @param token The address of the ERC-20 token contract.
    /// @return (uint8) Token decimals.
    function safeDecimals(IERC20 token) internal view returns (uint8) {
        (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_DECIMALS));
        return success && data.length == 32 ? abi.decode(data, (uint8)) : 18;
    }

    /// @notice Provides a gas-optimized balance check to avoid a redundant extcodesize check in addition to the returndatasize check.
    /// @param token The address of the ERC-20 token.
    /// @param to The address of the user to check.
    /// @return amount The token amount.
    function safeBalanceOf(IERC20 token, address to) internal view returns (uint256 amount) {
        (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_BALANCE_OF, to));
        require(success && data.length >= 32, "BoringERC20: BalanceOf failed");
        amount = abi.decode(data, (uint256));
    }

    /// @notice Provides a gas-optimized totalSupply to avoid a redundant extcodesize check in addition to the returndatasize check.
    /// @param token The address of the ERC-20 token.
    /// @return totalSupply The token totalSupply.
    function safeTotalSupply(IERC20 token) internal view returns (uint256 totalSupply) {
        (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_TOTALSUPPLY));
        require(success && data.length >= 32, "BoringERC20: totalSupply failed");
        totalSupply = abi.decode(data, (uint256));
    }

    /// @notice Provides a safe ERC20.transfer version for different ERC-20 implementations.
    /// Reverts on a failed transfer.
    /// @param token The address of the ERC-20 token.
    /// @param to Transfer tokens to.
    /// @param amount The token amount.
    function safeTransfer(
        IERC20 token,
        address to,
        uint256 amount
    ) internal {
        (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(SIG_TRANSFER, to, amount));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: Transfer failed");
    }

    /// @notice Provides a safe ERC20.transferFrom version for different ERC-20 implementations.
    /// Reverts on a failed transfer.
    /// @param token The address of the ERC-20 token.
    /// @param from Transfer tokens from.
    /// @param to Transfer tokens to.
    /// @param amount The token amount.
    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(SIG_TRANSFER_FROM, from, to, amount));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: TransferFrom failed");
    }
}
Redemption.sol 190 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./libraries/BoringERC20.sol";

/**
 * @title Redemption
 * @notice Allows users to redeem a specific ERC20 token (`fromToken`) for multiple other ERC20 tokens (`toTokens`) based on predefined exchange rates.
 * @dev Inherits from Ownable, Pausable, and ReentrancyGuard for access control, pausing functionality, and security against reentrancy attacks.
 */
contract Redemption is Ownable, Pausable, ReentrancyGuard {
    using BoringERC20 for IERC20;

    /// @dev The ERC20 token users can redeem from.
    IERC20 public fromToken;

    /// @dev List of ERC20 tokens users can redeem to.
    address[] public toTokens;

    /// @dev Denominator based on the decimals of `fromToken` used for exchange rate calculations.
    uint256 public immutable fromDenominator;

    /// @dev Mapping from target token address to its exchange rate.
    mapping(address => uint256) public exchangeRates;

    /**
     * @dev Emitted when a user redeems `fromToken` for a `toToken`.
     * @param user The address of the user who performed the redemption.
     * @param toToken The address of the token that was redeemed to.
     * @param amount The amount of `toToken` redeemed.
     */
    event Redeemed(
        address indexed user,
        address indexed toToken,
        uint256 amount
    );

    /**
     * @dev Emitted when a new token is added to the redemption list.
     * @param token The address of the token that was added.
     * @param exchangeRate The exchange rate set for the new token.
     */
    event TokenAdded(address indexed token, uint256 exchangeRate);

    /**
     * @dev Emitted when a token is removed from the redemption list.
     * @param token The address of the token that was removed.
     */
    event TokenRemoved(address indexed token);

    /**
     * @dev Emitted when the exchange rate of a token is updated.
     * @param token The address of the token whose exchange rate was changed.
     * @param exchangeRate The new exchange rate of the token.
     */
    event ExchangeRateChanged(address indexed token, uint256 exchangeRate);

    /**
     * @notice Initializes the Redemption contract with the specified tokens and their exchange rates.
     * @param _fromToken The ERC20 token that users will redeem from.
     * @param _toTokens An array of ERC20 token addresses that users can redeem to.
     * @param _exchangeRates An array of exchange rates corresponding to each `toToken`.
     */
    constructor(
        IERC20 _fromToken,
        address[] memory _toTokens,
        uint256[] memory _exchangeRates
    ) {
        require(
            _toTokens.length == _exchangeRates.length,
            "Array lengths must be equal"
        );
        fromToken = _fromToken;
        fromDenominator = 10 ** fromToken.safeDecimals();
        toTokens = _toTokens;
        for (uint256 i = 0; i < toTokens.length; i++) {
            require(_exchangeRates[i] > 0, "Invalid exchange rate");
            exchangeRates[toTokens[i]] = _exchangeRates[i];
        }
    }

    /**
     * @notice Redeems a specified amount of `fromToken` for each supported `toToken`.
     * @param amount The amount of `fromToken` to be redeemed.
     * @dev Transfers `amount` of `fromToken` from the caller to the contract, then distributes equivalent `toTokens` based on exchange rates.
     */
    function redeem(uint256 amount) public whenNotPaused nonReentrant {
        require(
            fromToken.safeBalanceOf(msg.sender) >= amount,
            "Insufficient balance"
        );

        fromToken.safeTransferFrom(msg.sender, address(this), amount);

        for (uint256 i = 0; i < toTokens.length; i++) {
            uint256 toAmount = (amount * exchangeRates[toTokens[i]]) / fromDenominator;
            require(toAmount > 0, "Amount not enough");
            require(
                IERC20(toTokens[i]).safeBalanceOf(address(this)) >= toAmount,
                "Insufficient balance of contract"
            );
            IERC20(toTokens[i]).safeTransfer(msg.sender, toAmount);
            emit Redeemed(msg.sender, toTokens[i], toAmount);
        }
    }

    /**
     * @notice Adds a new supported ERC20 token with its exchange rate.
     * @param token The address of the token being added.
     * @param exchangeRate The exchange rate of the new token.
     * @dev Ensures the token is not already added and sets its exchange rate based on its decimals.
     */
    function addToken(address token, uint256 exchangeRate) public onlyOwner {
        require(token != address(0), "Token address cannot be zero");
        require(exchangeRate > 0, "ExchangeRate cannot be 0");
        require(exchangeRates[token] == 0, "Token already exists");

        toTokens.push(token);
        exchangeRates[token] = exchangeRate;
        emit TokenAdded(token, exchangeRate);
    }

    /**
     * @notice Removes a supported ERC20 token by its index.
     * @param index The index of the token being removed.
     * @dev Deletes the exchange rate and removes the token from the `toTokens` array.
     */
    function removeToken(uint256 index) public onlyOwner {
        address _token = toTokens[index];
        delete exchangeRates[_token];
        toTokens[index] = toTokens[toTokens.length - 1];
        toTokens.pop();
        emit TokenRemoved(_token);
    }

    /**
     * @notice Sets the exchange rate for a supported ERC20 token.
     * @param token The address of the token for which the exchange rate is being set.
     * @param exchangeRate The new exchange rate of the token.
     * @dev Updates the exchange rate based on the token's decimals.
     */
    function setExchangeRate(
        address token,
        uint256 exchangeRate
    ) public onlyOwner {
        require(exchangeRate > 0, "Token rate cannot be zero");
        require(exchangeRates[token] > 0, "Token does not exist");
        exchangeRates[token] = exchangeRate;
        emit ExchangeRateChanged(token, exchangeRate);
    }

    /**
     * @notice Toggles the paused state of the contract.
     * @dev If the contract is paused, it will be unpaused and vice versa.
     */
    function pause() public onlyOwner {
        paused() ? _unpause() : _pause();
    }

    /**
     * @notice Withdraws all of a specific ERC20 token to the owner in case of emergency.
     * @param token The ERC20 token to withdraw.
     * @dev Transfers the entire balance of the specified `token` to the contract owner.
     */
    function emergencyWithdraw(IERC20 token) external onlyOwner {
        token.safeTransfer(owner(), token.safeBalanceOf(address(this)));
    }

    /**
     * @notice Calculates the amounts of each `toToken` that can be redeemed for a given `fromToken` amount.
     * @param amount The amount of `fromToken` to be redeemed.
     * @return address[] An array of `toToken` addresses.
     * @return uint256[] An array of redeemable amounts for each `toToken`.
     * @dev Ensures that each calculated redeemable amount is greater than zero.
     */
    function calculateRedeem(
        uint256 amount
    ) external view returns (address[] memory, uint256[] memory) {
        uint[] memory toAmount = new uint[](toTokens.length);
        for (uint256 i = 0; i < toTokens.length; i++) {
            toAmount[i] = (amount * exchangeRates[toTokens[i]]) / fromDenominator;
            require(toAmount[i] > 0, "Amount not enough");
        }

        return (toTokens, toAmount);
    }
}

Read Contract

calculateRedeem 0x584794c4 → address[], uint256[]
exchangeRates 0x85c15d9a → uint256
fromDenominator 0x9ef09efc → uint256
fromToken 0x32a46857 → address
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
toTokens 0x60ca46cd → address

Write Contract 8 functions

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

addToken 0xaf81c5b9
address token
uint256 exchangeRate
emergencyWithdraw 0x6ff1c9bc
address token
pause 0x8456cb59
No parameters
redeem 0xdb006a75
uint256 amount
removeToken 0x36c5d724
uint256 index
renounceOwnership 0x715018a6
No parameters
setExchangeRate 0xbd5c5420
address token
uint256 exchangeRate
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

Transaction index is loading. Only unfinalized transactions are shown while the index starts up.