Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x0DF24D02681CFFbd740eC2cB8D719b1cB3c5C83C
Balance 0 ETH
Nonce 1
Code Size 9182 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

9182 bytes
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80638da5cb5b116100f9578063c7fab1db11610097578063e79fdedf11610071578063e79fdedf1461049b578063e7a4f2f0146104b7578063f2fde38b146104d5578063fc0c546a146104f1576101c4565b8063c7fab1db14610443578063d871950b14610461578063e01384761461047d576101c4565b8063b1360c8e116100d3578063b1360c8e146103cc578063b28ca2a2146103e8578063bd7dcb5d14610406578063c6ff8f6414610427576101c4565b80638da5cb5b14610374578063907592a814610392578063ae2d2c39146103ae576101c4565b806343cf65d1116101665780635c975abb116101405780635c975abb14610300578063715018a61461031e5780637ad3def2146103285780638239955a14610344576101c4565b806343cf65d1146102aa5780634df68ada146102c65780635060176d146102e2576101c4565b806319ff1cf5116101a257806319ff1cf51461021f5780631e75d1bc1461023b5780632131c68c1461025c57806332f6e7761461027a576101c4565b8063013b490c146101c957806304dc57d8146101e5578063159e2e8114610201575b600080fd5b6101e360048036038101906101de9190611836565b61050f565b005b6101ff60048036038101906101fa9190611899565b61055b565b005b610209610714565b60405161021691906118d5565b60405180910390f35b6102396004803603810190610234919061192e565b61073a565b005b610243610772565b6040516102539493929190611990565b60405180910390f35b6102646107d2565b60405161027191906118d5565b60405180910390f35b610294600480360381019061028f9190611836565b6107f8565b6040516102a191906119d5565b60405180910390f35b6102c460048036038101906102bf9190611836565b610810565b005b6102e060048036038101906102db9190611a28565b61085c565b005b6102ea610883565b6040516102f791906119d5565b60405180910390f35b610308610889565b6040516103159190611a64565b60405180910390f35b61032661089f565b005b610342600480360381019061033d9190611a7f565b6108b3565b005b61035e60048036038101906103599190611836565b6108ff565b60405161036b91906119d5565b60405180910390f35b61037c610917565b60405161038991906118d5565b60405180910390f35b6103ac60048036038101906103a79190611899565b610940565b005b6103b6610b57565b6040516103c391906119d5565b60405180910390f35b6103e660048036038101906103e19190611899565b610b5d565b005b6103f0610d16565b6040516103fd91906119d5565b60405180910390f35b61040e610d1c565b60405161041e9493929190611990565b60405180910390f35b610441600480360381019061043c9190611899565b610d7c565b005b61044b610f93565b60405161045891906118d5565b60405180910390f35b61047b60048036038101906104769190611aac565b610fb9565b005b61048561100d565b60405161049291906118d5565b60405180910390f35b6104b560048036038101906104b09190611aac565b611033565b005b6104bf611087565b6040516104cc91906119d5565b60405180910390f35b6104ef60048036038101906104ea9190611836565b61108d565b005b6104f9611110565b6040516105069190611b4b565b60405180910390f35b610517611136565b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6105636111b4565b61056b6111fe565b80600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e490611bc3565b60405180910390fd5b80600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461063c9190611c12565b9250508190555080600460008282546106559190611c12565b925050819055506106a93382600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661124d9092919063ffffffff16565b7fcfe262dac8c1dee9ec9fb4094def3a2e25751740c7acd74aec3e6c529284c0a6600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16823360026040516107019493929190611c8e565b60405180910390a16107116112d3565b50565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610742611136565b61076d81838573ffffffffffffffffffffffffffffffffffffffff1661124d9092919063ffffffff16565b505050565b600080600080600354600454600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16935093509350935090919293565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b6020528060005260406000206000915090505481565b610818611136565b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610864611136565b8015610877576108726112dc565b610880565b61087f61133f565b5b50565b60035481565b60008060149054906101000a900460ff16905090565b6108a7611136565b6108b160006113a1565b565b6108bb611136565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600c6020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6109486111b4565b6109506111fe565b80600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b81526004016109ac91906118d5565b602060405180830381865afa1580156109c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ed9190611ce8565b1015610a2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2590611d61565b60405180910390fd5b610a7d333083600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611465909392919063ffffffff16565b80600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610acc9190611d81565b925050819055508060046000828254610ae59190611d81565b925050819055507fb7e8834a5d7fc810f9c77164aea21fd9d01248765a6cf4c16ad3a9db51c6fbb8600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682336002604051610b449493929190611c8e565b60405180910390a1610b546112d3565b50565b60045481565b610b656111b4565b610b6d6111fe565b80600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610bef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be690611bc3565b60405180910390fd5b80600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c3e9190611c12565b925050819055508060036000828254610c579190611c12565b92505081905550610cab3382600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661124d9092919063ffffffff16565b7fcfe262dac8c1dee9ec9fb4094def3a2e25751740c7acd74aec3e6c529284c0a6600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682336001604051610d039493929190611df0565b60405180910390a1610d136112d3565b50565b60085481565b600080600080600754600854600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16935093509350935090919293565b610d846111b4565b610d8c6111fe565b80600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401610de891906118d5565b602060405180830381865afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e299190611ce8565b1015610e6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6190611d61565b60405180910390fd5b610eb9333083600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611465909392919063ffffffff16565b80600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f089190611d81565b925050819055508060036000828254610f219190611d81565b925050819055507fb7e8834a5d7fc810f9c77164aea21fd9d01248765a6cf4c16ad3a9db51c6fbb8600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682336001604051610f809493929190611df0565b60405180910390a1610f906112d3565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610fc1611136565b8160088190555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61103b611136565b8160078190555080600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60075481565b611095611136565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611104576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fb90611ea7565b60405180910390fd5b61110d816113a1565b50565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61113e6114ee565b73ffffffffffffffffffffffffffffffffffffffff1661115c610917565b73ffffffffffffffffffffffffffffffffffffffff16146111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990611f13565b60405180910390fd5b565b6111bc610889565b156111fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f390611f7f565b60405180910390fd5b565b600260015403611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90611feb565b60405180910390fd5b6002600181905550565b6112ce8363a9059cbb60e01b848460405160240161126c92919061200b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506114f6565b505050565b60018081905550565b6112e46111b4565b6001600060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586113286114ee565b60405161133591906118d5565b60405180910390a1565b6113476115bd565b60008060146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61138a6114ee565b60405161139791906118d5565b60405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6114e8846323b872dd60e01b85858560405160240161148693929190612034565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506114f6565b50505050565b600033905090565b6000611558826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166116069092919063ffffffff16565b90506000815111156115b857808060200190518101906115789190612080565b6115b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ae9061211f565b60405180910390fd5b5b505050565b6115c5610889565b611604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115fb9061218b565b60405180910390fd5b565b6060611615848460008561161e565b90509392505050565b606082471015611663576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165a9061221d565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161168c91906122ae565b60006040518083038185875af1925050503d80600081146116c9576040519150601f19603f3d011682016040523d82523d6000602084013e6116ce565b606091505b50915091506116df878383876116eb565b92505050949350505050565b6060831561174d5760008351036117455761170585611760565b611744576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173b90612311565b60405180910390fd5b5b829050611758565b6117578383611783565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156117965781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ca9190612386565b60405180910390fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611803826117d8565b9050919050565b611813816117f8565b811461181e57600080fd5b50565b6000813590506118308161180a565b92915050565b60006020828403121561184c5761184b6117d3565b5b600061185a84828501611821565b91505092915050565b6000819050919050565b61187681611863565b811461188157600080fd5b50565b6000813590506118938161186d565b92915050565b6000602082840312156118af576118ae6117d3565b5b60006118bd84828501611884565b91505092915050565b6118cf816117f8565b82525050565b60006020820190506118ea60008301846118c6565b92915050565b60006118fb826117f8565b9050919050565b61190b816118f0565b811461191657600080fd5b50565b60008135905061192881611902565b92915050565b600080600060608486031215611947576119466117d3565b5b600061195586828701611919565b935050602061196686828701611884565b925050604061197786828701611821565b9150509250925092565b61198a81611863565b82525050565b60006080820190506119a56000830187611981565b6119b26020830186611981565b6119bf60408301856118c6565b6119cc60608301846118c6565b95945050505050565b60006020820190506119ea6000830184611981565b92915050565b60008115159050919050565b611a05816119f0565b8114611a1057600080fd5b50565b600081359050611a22816119fc565b92915050565b600060208284031215611a3e57611a3d6117d3565b5b6000611a4c84828501611a13565b91505092915050565b611a5e816119f0565b82525050565b6000602082019050611a796000830184611a55565b92915050565b600060208284031215611a9557611a946117d3565b5b6000611aa384828501611919565b91505092915050565b60008060408385031215611ac357611ac26117d3565b5b6000611ad185828601611884565b9250506020611ae285828601611821565b9150509250929050565b6000819050919050565b6000611b11611b0c611b07846117d8565b611aec565b6117d8565b9050919050565b6000611b2382611af6565b9050919050565b6000611b3582611b18565b9050919050565b611b4581611b2a565b82525050565b6000602082019050611b606000830184611b3c565b92915050565b600082825260208201905092915050565b7f6c6f636b65642062616c616e636520746f6f206c6f7700000000000000000000600082015250565b6000611bad601683611b66565b9150611bb882611b77565b602082019050919050565b60006020820190508181036000830152611bdc81611ba0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611c1d82611863565b9150611c2883611863565b9250828203905081811115611c4057611c3f611be3565b5b92915050565b6000819050919050565b600060ff82169050919050565b6000611c78611c73611c6e84611c46565b611aec565b611c50565b9050919050565b611c8881611c5d565b82525050565b6000608082019050611ca36000830187611b3c565b611cb06020830186611981565b611cbd60408301856118c6565b611cca6060830184611c7f565b95945050505050565b600081519050611ce28161186d565b92915050565b600060208284031215611cfe57611cfd6117d3565b5b6000611d0c84828501611cd3565b91505092915050565b7f746f6b656e2062616c616e636520746f6f206c6f770000000000000000000000600082015250565b6000611d4b601583611b66565b9150611d5682611d15565b602082019050919050565b60006020820190508181036000830152611d7a81611d3e565b9050919050565b6000611d8c82611863565b9150611d9783611863565b9250828201905080821115611daf57611dae611be3565b5b92915050565b6000819050919050565b6000611dda611dd5611dd084611db5565b611aec565b611c50565b9050919050565b611dea81611dbf565b82525050565b6000608082019050611e056000830187611b3c565b611e126020830186611981565b611e1f60408301856118c6565b611e2c6060830184611de1565b95945050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611e91602683611b66565b9150611e9c82611e35565b604082019050919050565b60006020820190508181036000830152611ec081611e84565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611efd602083611b66565b9150611f0882611ec7565b602082019050919050565b60006020820190508181036000830152611f2c81611ef0565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611f69601083611b66565b9150611f7482611f33565b602082019050919050565b60006020820190508181036000830152611f9881611f5c565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611fd5601f83611b66565b9150611fe082611f9f565b602082019050919050565b6000602082019050818103600083015261200481611fc8565b9050919050565b600060408201905061202060008301856118c6565b61202d6020830184611981565b9392505050565b600060608201905061204960008301866118c6565b61205660208301856118c6565b6120636040830184611981565b949350505050565b60008151905061207a816119fc565b92915050565b600060208284031215612096576120956117d3565b5b60006120a48482850161206b565b91505092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000612109602a83611b66565b9150612114826120ad565b604082019050919050565b60006020820190508181036000830152612138816120fc565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b6000612175601483611b66565b91506121808261213f565b602082019050919050565b600060208201905081810360008301526121a481612168565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611b66565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b600081519050919050565b600081905092915050565b60005b83811015612271578082015181840152602081019050612256565b60008484015250505050565b60006122888261223d565b6122928185612248565b93506122a2818560208601612253565b80840191505092915050565b60006122ba828461227d565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b60006122fb601d83611b66565b9150612306826122c5565b602082019050919050565b6000602082019050818103600083015261232a816122ee565b9050919050565b600081519050919050565b6000601f19601f8301169050919050565b600061235882612331565b6123628185611b66565b9350612372818560208601612253565b61237b8161233c565b840191505092915050565b600060208201905081810360008301526123a0818461234d565b90509291505056fea2646970667358221220b1807c479283860505e63f02388f9b963567d59556f31dcd42259cd900dcb52364736f6c63430008120033

Verified Source Code Partial Match

Compiler: v0.8.18+commit.87f61d96 EVM: paris Optimization: No
LockPool.sol 1105 lines
// File: contracts/util/IERC20.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;
    }
}


// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}


/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// File: @openzeppelin/contracts/utils/Context.sol


// 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;
    }
}

// File: @openzeppelin/contracts/security/Pausable.sol


// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;


/**
 * @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());
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol


// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;


/**
 * @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. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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);
    }
}

// File: contracts/ExchangePool.sol

pragma solidity ^0.8.0;
pragma abicoder v2;




contract LockPool is Ownable, Pausable, ReentrancyGuard {        
    using SafeERC20 for IERC20;
    using SafeMath for uint256;    

    IERC20 public token;    
    uint256 public rateNumber1 = 800 * (10 ** 18);
    uint256 public rateNumber2 = 200 * (10 ** 18);
    address public daoAddress;
    address public exchangePool;

    uint256 public fixRatenewReceiver1 = 1;
    uint256 public fixRatenewReceiver2 = 0;
    address public newReceiver1;
    address public newReceiver2;

    mapping(address => uint256) public userLockedAmount1;
    mapping(address => uint256) public userLockedAmount2;  

    // EVENTS
    event Lock(IERC20 _token, uint256 _amount, address _sender, uint8 _pool);
    event Unlock(IERC20 _token, uint256 _amount, address _sender, uint8 _pool);

    constructor(IERC20 _token, address _daoAddress, address _exchangePool) {
        token = _token;
        daoAddress = _daoAddress;
        newReceiver1 = _daoAddress;
        exchangePool = _exchangePool;
    }

    function updateToken(IERC20 _token) external onlyOwner {
        token = _token;
    }

    function updateDaoAddress(address _daoAddress) external onlyOwner {
        daoAddress = _daoAddress;
    }
    
    function updateExchangePool(address _exchangePool) external onlyOwner {
        exchangePool = _exchangePool;
    }
    
    function enable(bool en) external onlyOwner {
        if (en) {
            _pause();
        } else {
            _unpause();
        }
    }

    function lock1(uint256 _amount) external whenNotPaused nonReentrant {
        require(token.balanceOf(msg.sender) >= _amount, "token balance too low");
        token.safeTransferFrom(msg.sender, address(this), _amount);
        userLockedAmount1[msg.sender] += _amount;
        rateNumber1 += _amount;
        emit Lock(token, _amount, msg.sender, 1);
    }

    function lock2(uint256 _amount) external whenNotPaused nonReentrant {
        require(token.balanceOf(msg.sender) >= _amount, "token balance too low");
        token.safeTransferFrom(msg.sender, address(this), _amount);
        userLockedAmount2[msg.sender] += _amount;
        rateNumber2 += _amount;
        emit Lock(token, _amount, msg.sender, 2);
    }

    function unlock1(uint256 _amount) external whenNotPaused nonReentrant {
        require(userLockedAmount1[msg.sender] >= _amount, "locked balance too low");
        userLockedAmount1[msg.sender] -= _amount;
        rateNumber1 -= _amount;
        token.safeTransfer(msg.sender, _amount);
        emit Unlock(token, _amount, msg.sender, 1);
    }

    function unlock2(uint256 _amount) external whenNotPaused nonReentrant {
        require(userLockedAmount2[msg.sender] >= _amount, "locked balance too low");
        userLockedAmount2[msg.sender] -= _amount;
        rateNumber2 -= _amount;
        token.safeTransfer(msg.sender, _amount);
        emit Unlock(token, _amount, msg.sender, 2);
    }

    function updateReciever1(uint256 _fixRate1, address _newReceiver1) external onlyOwner {
        fixRatenewReceiver1 = _fixRate1;
        newReceiver1 = _newReceiver1;
    }
    function updateReciever2(uint256 _fixRate2, address _newReceiver2) external onlyOwner {
        fixRatenewReceiver2 = _fixRate2;
        newReceiver2 = _newReceiver2;
    }
    
    function getETHSplitterRate() external view returns (uint256, uint256, address, address) {
        return (rateNumber1, rateNumber2 , daoAddress, exchangePool);
    }

    function getETHSPlitterRateAfterXHhonoPoolDepleted() external view returns (uint256, uint256, address, address) {
        return (fixRatenewReceiver1, fixRatenewReceiver2, newReceiver1, newReceiver2);
    }
    // Owner can drain tokens that are sent here by mistake
    function drainToken(IERC20 _token, uint256 _amount, address _to) external onlyOwner {
        _token.safeTransfer(_to, _amount);
    }
}

Read Contract

daoAddress 0x2131c68c → address
exchangePool 0xe0138476 → address
fixRatenewReceiver1 0xe7a4f2f0 → uint256
fixRatenewReceiver2 0xb28ca2a2 → uint256
getETHSPlitterRateAfterXHhonoPoolDepleted 0xbd7dcb5d → uint256, uint256, address, address
getETHSplitterRate 0x1e75d1bc → uint256, uint256, address, address
newReceiver1 0x159e2e81 → address
newReceiver2 0xc7fab1db → address
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
rateNumber1 0x5060176d → uint256
rateNumber2 0xae2d2c39 → uint256
token 0xfc0c546a → address
userLockedAmount1 0x32f6e776 → uint256
userLockedAmount2 0x8239955a → uint256

Write Contract 13 functions

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

drainToken 0x19ff1cf5
address _token
uint256 _amount
address _to
enable 0x4df68ada
bool en
lock1 0xc6ff8f64
uint256 _amount
lock2 0x907592a8
uint256 _amount
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
unlock1 0xb1360c8e
uint256 _amount
unlock2 0x04dc57d8
uint256 _amount
updateDaoAddress 0x013b490c
address _daoAddress
updateExchangePool 0x43cf65d1
address _exchangePool
updateReciever1 0xe79fdedf
uint256 _fixRate1
address _newReceiver1
updateReciever2 0xd871950b
uint256 _fixRate2
address _newReceiver2
updateToken 0x7ad3def2
address _token

Recent Transactions

No transactions found for this address