Address Contract Partially Verified
Address
0xDFC8cD9F2f2d306b7C0d109F005DF661E14f4ff2
Balance
0 ETH
Nonce
1
Code Size
16368 bytes
Creator
0x8D85e7c9...0112 at tx 0xa616d48c...fd1771
Indexed Transactions
0
Contract Bytecode
16368 bytes
0x608060405234801561001057600080fd5b50600436106103e65760003560e01c806388a8d6021161020a578063be8f166811610125578063d905777e116100b8578063ec0c7e2811610087578063ec0c7e28146107f0578063ed27f7c914610803578063ef8b30f71461080b578063f629b7901461081e578063fc7b9c181461083157600080fd5b8063d905777e146107af578063d9a0e97a146107c2578063dd62ed3e146107ca578063df69b22a146107dd57600080fd5b8063c6e6f592116100f4578063c6e6f5921461076e578063c8c2fe6c14610781578063ce96cb7714610789578063d505accf1461079c57600080fd5b8063be8f166814610743578063bf86d6901461074b578063c3535b5214610753578063c63d75b61461075b57600080fd5b8063a457c2d71161019d578063b3d7f6b91161016c578063b3d7f6b914610701578063b460af9414610714578063ba08765214610727578063bc063e1a1461073a57600080fd5b8063a457c2d7146106c0578063a9059cbb146106d3578063aa290e6d146106e6578063aced1661146106f957600080fd5b80639aa7df94116101d95780639aa7df941461067f5780639d6fdde7146106875780639f40a7b31461069a578063a318c1a4146106ad57600080fd5b806388a8d6021461065457806394bf804d1461065c57806395d89b411461066f57806399530b061461067757600080fd5b806335da3394116103055780635312ea8e1161029857806370a082311161026757806370a08231146105f7578063748747e61461060a57806376c7a3c71461061d5780637ecebe0014610639578063877887821461064c57600080fd5b80635312ea8e146105b65780636a5f1aa2146105c95780636e553f65146105dc57806370905dce146105ef57600080fd5b8063402d267d116102d4578063402d267d14610580578063440368a3146105935780634cdad5061461059b5780635141eebb146105ae57600080fd5b806335da33941461054a5780633644e5151461055d57806338d52e0f14610565578063395093511461056d57600080fd5b80631d3b72271161037d5780632d6326921161034c5780632d632692146104f85780632dd31000146105005780632ecfe3151461051b578063313ce5671461053057600080fd5b80631d3b72271461049457806323b872dd146104a757806325829410146104ba5780632606a10b146104db57600080fd5b8063095ea7b3116103b9578063095ea7b3146104365780630a28a477146104595780630b68f46f1461046c57806318160ddd1461048c57600080fd5b806301e1d114146103eb57806306fdde031461040657806307a2d13a1461041b5780630952864e1461042e575b600080fd5b6103f3610839565b6040519081526020015b60405180910390f35b61040e610856565b6040516103fd9190613711565b6103f3610429366004613744565b6108f1565b6103f3610927565b61044961044436600461377d565b610940565b60405190151581526020016103fd565b6103f3610467366004613744565b610957565b61047461099c565b6040516001600160a01b0390911681526020016103fd565b6103f36109b8565b6104496104a23660046137a9565b6109dd565b6104496104b53660046137c6565b610a53565b604080518082019091526005815264332e302e3160d81b602082015261040e565b6104e3610a75565b604080519283526020830191909152016103fd565b6103f3610ed4565b61047473e9e8c89c8fc7e8b8f23425688eb68987231178e581565b61052e610529366004613876565b610ef0565b005b610538611182565b60405160ff90911681526020016103fd565b61052e6105583660046137a9565b61119c565b6103f36111fc565b61047461122d565b61044961057b36600461377d565b611246565b6103f361058e3660046137a9565b611268565b61052e6112f5565b6103f36105a9366004613744565b6113c7565b6103f36113d2565b61052e6105c4366004613744565b6113e5565b61052e6105d73660046137a9565b6114f8565b6103f36105ea36600461393b565b6115d3565b6104746116e2565b6103f36106053660046137a9565b6116fe565b61052e6106183660046137a9565b611771565b6106266101f481565b60405161ffff90911681526020016103fd565b6103f36106473660046137a9565b6117d1565b6106266117fd565b61047461181c565b6103f361066a36600461393b565b611838565b61040e611933565b6103f36119d1565b6103f36119f4565b6104496106953660046137a9565b611a07565b6103f36106a836600461396b565b611a86565b6103f36106bb36600461396b565b611b9e565b6104496106ce36600461377d565b611cb2565b6104496106e136600461377d565b611ccf565b61052e6106f43660046139c3565b611cdc565b610474611dc5565b6103f361070f366004613744565b611de1565b6103f36107223660046139e0565b611e09565b6103f36107353660046139e0565b611e18565b61062661138881565b61052e611e28565b610449611e84565b6103f3611ea1565b6103f36107693660046137a9565b611ec4565b6103f361077c366004613744565b611f6a565b61052e611fa5565b6103f36107973660046137a9565b612075565b61052e6107aa366004613a31565b61210c565b6103f36107bd3660046137a9565b612312565b6103f36123a6565b6103f36107d8366004613aa2565b6123b0565b61052e6107eb366004613744565b6123ea565b6104496107fe3660046137a9565b6124cb565b610474612529565b6103f3610819366004613744565b61254c565b61052e61082c3660046137a9565b612557565b6103f36125dd565b6000806108446125f0565b60098101546008909101540192915050565b60606108606125f0565b600101805461086e90613ad0565b80601f016020809104026020016040519081016040528092919081815260200182805461089a90613ad0565b80156108e75780601f106108bc576101008083540402835291602001916108e7565b820191906000526020600020905b8154815290600101906020018083116108ca57829003601f168201915b5050505050905090565b6000806108fc6109b8565b9050801561091e5761091961090f610839565b849083600061261e565b610920565b825b9392505050565b60006109316125f0565b600c015463ffffffff16919050565b600061094d33848461267b565b5060015b92915050565b600080610962610839565b9050600061096e6109b8565b90508160000361098f578015610985576000610987565b835b949350505050565b610987848284600161261e565b60006109a66125f0565b600f01546001600160a01b0316919050565b60006109c26127b0565b6109ca6125f0565b600201546109d89190613b20565b905090565b6000806109e86125f0565b600e8101549091506001600160a01b0384811691161480610a185750600d8101546001600160a01b038481169116145b61094d5760405162461bcd60e51b815260206004820152600760248201526610b5b2b2b832b960c91b60448201526064015b60405180910390fd5b6000610a60843384612829565b610a6b8484846128a3565b5060019392505050565b6000806000610a826125f0565b6010810154909150600160a01b900460ff1615610ab15760405162461bcd60e51b8152600401610a4a90613b33565b60108101805460ff60a01b1916600160a01b179055610acf336109dd565b506000610ada6125f0565b90506000816009015482600801540190506000306001600160a01b03166349317f1d6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610b2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b519190613b6a565b9050610b5b612a65565b600c8301546000908190819063ffffffff1685851115610cbc57600c8701548686039a5061271090640100000000900461ffff168b02049350600080808615610c6257600073e9e8c89c8fc7e8b8f23425688eb68987231178e56001600160a01b0316635153b1996040518163ffffffff1660e01b81526004016040805180830381865afa158015610bf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c159190613b99565b9450905061ffff811615610c4157612710610c3461ffff83168a613bc8565b610c3e9190613bdf565b96505b610c4c878903611f6a565b92508615610c6057610c5d87611f6a565b91505b505b8315610c7f57610c73878e03611f6a565b9450610c7f3086612acd565b8115610ca457600c8a0154610ca490600160301b90046001600160a01b031683612acd565b8015610cb457610cb48382612acd565b505050610d01565b848603985088600014610d0157306000908152600688016020526040812054610ced90610ce88c611f6a565b612b97565b90508015610cff57610cff3082612ba6565b505b3060009081526006880160205260409020548015610dbc57600b8801546000906001600160801b031642811115610d455784830342826001600160801b0316030291505b600083610d528688613bc8565b610d5c9085613c01565b610d669190613bdf565b905080610d7864e8d4a5100086613bc8565b610d829190613bdf565b600a8c0155610d918142613c01565b600b8c0180546001600160801b0319166001600160801b039290921691909117905550610dc4915050565b6000600a8901555b87546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e309190613b6a565b60088a018190559050610e438188613b20565b60098a0155600b890180546001600160801b03428116600160801b0291161790557fecdd072e4d5bd913a75a37f02daedcea7e2dc0281f9942c0063cfd1cfe5c4c4f8c8c87610e92818b613b20565b60408051948552602085019390935291830152606082015260800160405180910390a15050506010909601805460ff60a01b1916905550959694955050505050565b6000610ede6125f0565b600b01546001600160801b0316919050565b6000610efa6125f0565b80549091506001600160a01b031615610f435760405162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b6044820152606401610a4a565b80546001600160a01b0319166001600160a01b03871617815560018101610f6a8682613c62565b50856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcd9190613d22565b815460ff91909116600160a01b0260ff60a01b19909116178155466003820155610ff5612c8d565b6004820155600c8101805463ffffffff1916620d2f001790556001600160a01b0383166110345760405162461bcd60e51b8152600401610a4a90613d3f565b306001600160a01b038416036110755760405162461bcd60e51b8152600401610a4a9060208082526004908201526339b2b63360e11b604082015260600190565b600c810180546503e80000000065ffff00000000196001600160a01b03808816600160301b0291909116640100000000600160d01b03199093169290921717909155600b820180546001600160801b03428116600160801b02911617905584166110f15760405162461bcd60e51b8152600401610a4a90613d3f565b600d810180546001600160a01b038087166001600160a01b031992831617909255600e8301805485841692169190911790556040805180820182526005815264332e302e3160d81b602082015290519188169130917ffb1616746b8474b6b7c67f2fe5ada156ed24774d0efe8bfe529cf537ba173330916111729190613711565b60405180910390a3505050505050565b600061118c6125f0565b54600160a01b900460ff16919050565b6111a5336124cb565b50806111af6125f0565b60100180546001600160a01b0319166001600160a01b03928316179055604051908216907f2bf242d027263e45fab022c28b4144255c97b30b8e54c30f1f5757906d487f0990600090a250565b6000806112076125f0565b9050806003015446146112215761121c612c8d565b611227565b80600401545b91505090565b60006112376125f0565b546001600160a01b0316919050565b600033610a6b81858561125983836123b0565b6112639190613c01565b61267b565b60006112726125f0565b60100154600160a81b900460ff161561128d57506000919050565b604051632355178960e11b81526001600160a01b038316600482015230906346aa2f1290602401602060405180830381865afa1580156112d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109519190613b6a565b60006112ff6125f0565b6010810154909150600160a01b900460ff161561132e5760405162461bcd60e51b8152600401610a4a90613b33565b60108101805460ff60a01b1916600160a01b17905561134c336109dd565b5030639d7fb70c61135b6125f0565b600801546040518263ffffffff1660e01b815260040161137d91815260200190565b600060405180830381600087803b15801561139757600080fd5b505af11580156113ab573d6000803e3d6000fd5b505050506113b7612d49565b601001805460ff60a01b19169055565b6000610951826108f1565b60006113dc6125f0565b600a0154905090565b60006113ef6125f0565b6010810154909150600160a01b900460ff161561141e5760405162461bcd60e51b8152600401610a4a90613b33565b60108101805460ff60a01b1916600160a01b17905561143c33611a07565b506114456125f0565b60100154600160a81b900460ff1661148e5760405162461bcd60e51b815260206004820152600c60248201526b3737ba1039b43aba3237bbb760a11b6044820152606401610a4a565b604051631fbd027560e31b815260048101839052309063fde813a890602401600060405180830381600087803b1580156114c757600080fd5b505af11580156114db573d6000803e3d6000fd5b505050506114e7612d49565b601001805460ff60a01b1916905550565b611501336124cb565b506001600160a01b0381166115285760405162461bcd60e51b8152600401610a4a90613d3f565b306001600160a01b038216036115715760405162461bcd60e51b815260206004820152600e60248201526d21b0b73737ba1031329039b2b63360911b6044820152606401610a4a565b8061157a6125f0565b600c0180546601000000000000600160d01b031916600160301b6001600160a01b0393841602179055604051908216907f9ebbf695dd251e855d9d15a146a72f5f654dc6f8630fbc11212f27e0c88ba11a90600090a250565b6000806115de6125f0565b6010810154909150600160a01b900460ff161561160d5760405162461bcd60e51b8152600401610a4a90613b33565b60108101805460ff60a01b1916600160a01b17905561162b83611268565b84111561167a5760405162461bcd60e51b815260206004820152601e60248201527f455243343632363a206465706f736974206d6f7265207468616e206d617800006044820152606401610a4a565b6116838461254c565b9150816000036116c35760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b6044820152606401610a4a565b6116ce838584612e55565b601001805460ff60a01b1916905592915050565b60006116ec6125f0565b601001546001600160a01b0316919050565b6000306001600160a01b03831603611747576117186127b0565b6117206125f0565b6001600160a01b038416600090815260069190910160205260409020546109519190613b20565b61174f6125f0565b6001600160a01b03909216600090815260069290920160205250604090205490565b61177a336124cb565b50806117846125f0565b600e0180546001600160a01b0319166001600160a01b03928316179055604051908216907fd7f49e282c36d417b290d4181a56943f6d670aaa2987c0d40e60d39919c6888290600090a250565b60006117db6125f0565b6001600160a01b03909216600090815260059290920160205250604090205490565b60006118076125f0565b600c0154640100000000900461ffff16919050565b60006118266125f0565b600d01546001600160a01b0316919050565b6000806118436125f0565b6010810154909150600160a01b900460ff16156118725760405162461bcd60e51b8152600401610a4a90613b33565b60108101805460ff60a01b1916600160a01b17905561189083611ec4565b8411156118df5760405162461bcd60e51b815260206004820152601b60248201527f455243343632363a206d696e74206d6f7265207468616e206d617800000000006044820152606401610a4a565b6118e884611de1565b9150816000036119285760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f41535345545360a81b6044820152606401610a4a565b6116ce838386612e55565b606061193d6125f0565b54604080516395d89b4160e01b815290516001600160a01b03909216916395d89b41916004808201926000929091908290030181865afa158015611985573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526119ad9190810190613d65565b6040516020016119bd9190613dd3565b604051602081830303815290604052905090565b60006109d86119de6125f0565b5461042990600160a01b900460ff16600a613ee1565b60006119fe6125f0565b60080154905090565b600080611a126125f0565b60108101549091506001600160a01b0384811691161480611a425750600d8101546001600160a01b038481169116145b61094d5760405162461bcd60e51b815260206004820152601560248201527408595b595c99d95b98de48185d5d1a1bdc9a5e9959605a1b6044820152606401610a4a565b600080611a916125f0565b6010810154909150600160a01b900460ff1615611ac05760405162461bcd60e51b8152600401610a4a90613b33565b60108101805460ff60a01b1916600160a01b179055611ade84612312565b861115611b2d5760405162461bcd60e51b815260206004820152601d60248201527f455243343632363a2072656465656d206d6f7265207468616e206d61780000006044820152606401610a4a565b6000611b38876113c7565b905080600003611b785760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f41535345545360a81b6044820152606401610a4a565b611b858686838a88613099565b925050601001805460ff60a01b19169055949350505050565b600080611ba96125f0565b6010810154909150600160a01b900460ff1615611bd85760405162461bcd60e51b8152600401610a4a90613b33565b60108101805460ff60a01b1916600160a01b179055611bf684612075565b861115611c455760405162461bcd60e51b815260206004820152601f60248201527f455243343632363a207769746864726177206d6f7265207468616e206d6178006044820152606401610a4a565b611c4e86610957565b915081600003611c8e5760405162461bcd60e51b815260206004820152600b60248201526a5a45524f5f53484152455360a81b6044820152606401610a4a565b611c9b8585888587613099565b50601001805460ff60a01b19169055949350505050565b600033610a6b818585611cc583836123b0565b6112639190613b20565b600061094d3384846128a3565b611ce5336124cb565b506101f461ffff82161015611d265760405162461bcd60e51b81526020600482015260076024820152664d494e2046454560c81b6044820152606401610a4a565b61138861ffff82161115611d665760405162461bcd60e51b81526020600482015260076024820152664d41582046454560c81b6044820152606401610a4a565b80611d6f6125f0565b600c01805465ffff00000000191664010000000061ffff9384160217905560405190821681527fdc843735e683348ec21c302ffff45462399c5c46f75f67b0a1a5395c535997539060200160405180910390a150565b6000611dcf6125f0565b600e01546001600160a01b0316919050565b600080611dec6109b8565b9050801561091e57610919611dff610839565b849083600161261e565b60006109878484846000611b9e565b6000610987848484612710611a86565b611e3133611a07565b506001611e3c6125f0565b6010018054911515600160a81b0260ff60a81b199092169190911790556040517ffc1249757a7f27c510c8173c55d03ba442e0d33d9223e06ceb416feac8c7693f90600090a1565b6000611e8e6125f0565b60100154600160a81b900460ff16919050565b6000611eab6125f0565b600b0154600160801b90046001600160801b0316919050565b6000611ece6125f0565b60100154600160a81b900460ff1615611ee957506000919050565b604051632355178960e11b81526001600160a01b038316600482015230906346aa2f1290602401602060405180830381865afa158015611f2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f519190613b6a565b90506000198114611f655761095181611f6a565b919050565b600080611f75610839565b90506000611f816109b8565b905081600003611f98578015610985576000610987565b610987848284600061261e565b611fad6125f0565b600f01546001600160a01b03163314611ff35760405162461bcd60e51b81526020600482015260086024820152672170656e64696e6760c01b6044820152606401610a4a565b33611ffc6125f0565b600d0180546001600160a01b0319166001600160a01b039290921691909117905560006120276125f0565b600f0180546001600160a01b0319166001600160a01b039290921691909117905560405133907fff54978127edd34aec0f9061fb3b155fbe0ededdfa881ee3e0d541d3a1eef43890600090a2565b6040516304bd462960e01b81526001600160a01b038216600482015260009030906304bd462990602401602060405180830381865afa1580156120bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e09190613b6a565b905060001981036120f757610951610429836116fe565b610951612106610429846116fe565b82612b97565b4284101561215c5760405162461bcd60e51b815260206004820152601e60248201527f45524332303a205045524d49545f444541444c494e455f4558504952454400006044820152606401610a4a565b600060016121686111fc565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98a8a8a6121946125f0565b6001600160a01b038f8116600090815260059290920160209081526040928390208054600181019091558351808301989098529582168784015293166060860152608085019190915260a084019290925260c08084018b90528251808503909101815260e08401909252815191012061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015612283573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906122b95750876001600160a01b0316816001600160a01b0316145b6122fd5760405162461bcd60e51b815260206004820152601560248201527422a92199181d1024a72b20a624a22fa9a4a3a722a960591b6044820152606401610a4a565b61230881888861267b565b5050505050505050565b6040516304bd462960e01b81526001600160a01b038216600482015260009030906304bd462990602401602060405180830381865afa158015612359573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237d9190613b6a565b9050600019810361239157610951826116fe565b61095161239d82610957565b610ce8846116fe565b60006109d86127b0565b60006123ba6125f0565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205490565b6123f3336124cb565b506301e185588111156124335760405162461bcd60e51b8152602060048201526008602482015267746f6f206c6f6e6760c01b6044820152606401610a4a565b600061243d6125f0565b90508160000361247d573060008181526006830160205260409020546124639190612ba6565b6000600a820155600b810180546001600160801b03191690555b600c8101805463ffffffff191663ffffffff84161790556040518281527ff361aed463da6fa20358e45c6209f1d3e16d4eca706e6eab0b0aeb338729c77a9060200160405180910390a15050565b60006124d56125f0565b600d01546001600160a01b038381169116146125215760405162461bcd60e51b815260206004820152600b60248201526a085b585b9859d95b595b9d60aa1b6044820152606401610a4a565b506001919050565b60006125336125f0565b600c0154600160301b90046001600160a01b0316919050565b600061095182611f6a565b612560336124cb565b506001600160a01b0381166125875760405162461bcd60e51b8152600401610a4a90613d3f565b806125906125f0565b600f0180546001600160a01b0319166001600160a01b03928316179055604051908216907fd74668a8c80a07cc56d7c3318a06439eaa815e740d97dcd83487e1fc75076b8b90600090a250565b60006125e76125f0565b60090154905090565b60008061095160017fd2841a5d2692465040bd5e06a6f3b37483952c866e0f304dc0e03f76a1f8a0b1613b20565b60008061262c8686866133ae565b9050600183600281111561264257612642613ef0565b14801561265f57506000848061265a5761265a613b83565b868809115b156126725761266f600182613c01565b90505b95945050505050565b6001600160a01b0383166126dd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a4a565b6001600160a01b03821661273e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a4a565b806127476125f0565b6001600160a01b038581166000818152600793909301602090815260408085209388168086529382529384902094909455915184815290927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000806127bb6125f0565b600b8101549091506001600160801b03164281111561280057600b820154600a83015464e8d4a5100091600160801b90046001600160801b0316420302049250505090565b6001600160801b038116156128245730600090815260068301602052604090205492505b505090565b600061283584846123b0565b9050600019811461289d57818110156128905760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610a4a565b61289d848484840361267b565b50505050565b6001600160a01b0383166129075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610a4a565b6001600160a01b0382166129695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610a4a565b306001600160a01b038316036129c15760405162461bcd60e51b815260206004820152601a60248201527f4552433230207472616e7366657220746f2073747261746567790000000000006044820152606401610a4a565b60006129cb6125f0565b6001600160a01b03851660009081526006820160205260408120805492935084929091906129fa908490613b20565b90915550506001600160a01b038084166000818152600684016020526040908190208054860190555190918616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612a579086815260200190565b60405180910390a350505050565b6000612a6f6127b0565b905080600003612a7c5750565b42612a856125f0565b600b01546001600160801b03161115612ac05742612aa16125f0565b600b0180546001600160801b03928316600160801b0292169190911790555b612aca3082612ba6565b50565b6001600160a01b038216612b235760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610a4a565b6000612b2d6125f0565b905081816002016000828254612b439190613c01565b90915550506001600160a01b03831660008181526006830160209081526040808320805487019055518581527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91016127a3565b600081831061091e5781610920565b6001600160a01b038216612c065760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610a4a565b6000612c106125f0565b6001600160a01b0384166000908152600682016020526040812080549293508492909190612c3f908490613b20565b909155505060028101805483900390556040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016127a3565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f612cb86125f0565b600101604051612cc89190613f06565b6040805191829003822082820182526005835264332e302e3160d81b6020938401528151928301939093528101919091527fc63fef2293a1f92e82ea14ecff0fffda4a757b8c20dd61198c8b9ebef0985ef460608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6000612d536125f0565b80546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612da0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dc49190613b6a565b905080826008015403612dd5575050565b6000612ddf610839565b9050808210612dfb576008830181905560006009840155612e0b565b6008830182905581810360098401555b612e13610839565b8114612e505760405162461bcd60e51b815260206004820152600c60248201526b21746f74616c41737365747360a01b6044820152606401610a4a565b505050565b306001600160a01b03841603612ea55760405162461bcd60e51b815260206004820152601560248201527422a9219a1b191b1d1036b4b73a103a379039b2b63360591b6044820152606401610a4a565b6000612eaf6125f0565b80549091506001600160a01b0316612ec98133308761345d565b6000848360080154612edb9190613c01565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a0823190602401602060405180830381865afa158015612f25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f499190613b6a565b60405163503160d960e01b815260048101849052909150309063503160d990602401600060405180830381600087803b158015612f8557600080fd5b505af1158015612f99573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201526000925061301c91506001600160a01b038616906370a0823190602401602060405180830381865afa158015612fe8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300c9190613b6a565b6130169084613b20565b84612b97565b9050808560090160008282546130329190613c01565b909155505080830360088601556130498887612acd565b60408051888152602081018890526001600160a01b038a169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a35050505050505050565b60006001600160a01b0386166130c15760405162461bcd60e51b8152600401610a4a90613d3f565b6127108211156131055760405162461bcd60e51b815260206004820152600f60248201526e65786365656473204d41585f42505360881b6044820152606401610a4a565b336001600160a01b0386161461312057613120853385612829565b600061312a6125f0565b805460088201549192506001600160a01b03169086811015613329576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa15801561318d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b19190613b6a565b604051633d6cb57560e01b8152838a0360048201529091503090633d6cb57590602401600060405180830381600087803b1580156131ee57600080fd5b505af1158015613202573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201526000925061328b915083906001600160a01b038716906370a0823190602401602060405180830381865afa158015613253573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132779190613b6a565b6132819190613b20565b8660090154612b97565b92830192905060008984101561330357508289036127108810156132ff576127106132b6898c613bc8565b6132c09190613bdf565b8111156132ff5760405162461bcd60e51b815260206004820152600d60248201526c746f6f206d756368206c6f737360981b6044820152606401610a4a565b8399505b61330d8183613c01565b8660090160008282546133209190613b20565b90915550505050505b6133338782613b20565b60088401556133428887612ba6565b6133566001600160a01b0383168a896134c8565b60408051888152602081018890526001600160a01b03808b1692908c169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a45094979650505050505050565b60008080600019858709858702925082811083820303915050806000036133e8578382816133de576133de613b83565b0492505050610920565b8084116133f457600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6040516001600160a01b038085166024830152831660448201526064810182905261289d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526134f8565b6040516001600160a01b038316602482015260448101829052612e5090849063a9059cbb60e01b90606401613491565b600061354d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166135ca9092919063ffffffff16565b805190915015612e50578080602001905181019061356b9190613f7c565b612e505760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a4a565b6060610987848460008585600080866001600160a01b031685876040516135f19190613f9e565b60006040518083038185875af1925050503d806000811461362e576040519150601f19603f3d011682016040523d82523d6000602084013e613633565b606091505b50915091506136448783838761364f565b979650505050505050565b606083156136be5782516000036136b7576001600160a01b0385163b6136b75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a4a565b5081610987565b61098783838151156136d35781518083602001fd5b8060405162461bcd60e51b8152600401610a4a9190613711565b60005b838110156137085781810151838201526020016136f0565b50506000910152565b60208152600082518060208401526137308160408501602087016136ed565b601f01601f19169190910160400192915050565b60006020828403121561375657600080fd5b5035919050565b6001600160a01b0381168114612aca57600080fd5b8035611f658161375d565b6000806040838503121561379057600080fd5b823561379b8161375d565b946020939093013593505050565b6000602082840312156137bb57600080fd5b81356109208161375d565b6000806000606084860312156137db57600080fd5b83356137e68161375d565b925060208401356137f68161375d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561384657613846613807565b604052919050565b600067ffffffffffffffff82111561386857613868613807565b50601f01601f191660200190565b600080600080600060a0868803121561388e57600080fd5b85356138998161375d565b9450602086013567ffffffffffffffff8111156138b557600080fd5b8601601f810188136138c657600080fd5b80356138d96138d48261384e565b61381d565b8181528960208385010111156138ee57600080fd5b8160208401602083013760006020838301015280965050505061391360408701613772565b925061392160608701613772565b915061392f60808701613772565b90509295509295909350565b6000806040838503121561394e57600080fd5b8235915060208301356139608161375d565b809150509250929050565b6000806000806080858703121561398157600080fd5b8435935060208501356139938161375d565b925060408501356139a38161375d565b9396929550929360600135925050565b61ffff81168114612aca57600080fd5b6000602082840312156139d557600080fd5b8135610920816139b3565b6000806000606084860312156139f557600080fd5b833592506020840135613a078161375d565b91506040840135613a178161375d565b809150509250925092565b60ff81168114612aca57600080fd5b600080600080600080600060e0888a031215613a4c57600080fd5b8735613a578161375d565b96506020880135613a678161375d565b955060408801359450606088013593506080880135613a8581613a22565b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215613ab557600080fd5b8235613ac08161375d565b915060208301356139608161375d565b600181811c90821680613ae457607f821691505b602082108103613b0457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561095157610951613b0a565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600060208284031215613b7c57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b60008060408385031215613bac57600080fd5b8251613bb7816139b3565b60208401519092506139608161375d565b808202811582820484141761095157610951613b0a565b600082613bfc57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561095157610951613b0a565b601f821115612e5057600081815260208120601f850160051c81016020861015613c3b5750805b601f850160051c820191505b81811015613c5a57828155600101613c47565b505050505050565b815167ffffffffffffffff811115613c7c57613c7c613807565b613c9081613c8a8454613ad0565b84613c14565b602080601f831160018114613cc55760008415613cad5750858301515b600019600386901b1c1916600185901b178555613c5a565b600085815260208120601f198616915b82811015613cf457888601518255948401946001909101908401613cd5565b5085821015613d125787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215613d3457600080fd5b815161092081613a22565b6020808252600c908201526b5a45524f204144445245535360a01b604082015260600190565b600060208284031215613d7757600080fd5b815167ffffffffffffffff811115613d8e57600080fd5b8201601f81018413613d9f57600080fd5b8051613dad6138d48261384e565b818152856020838501011115613dc257600080fd5b6126728260208301602086016136ed565b61797360f01b815260008251613df08160028501602087016136ed565b9190910160020192915050565b600181815b80851115613e38578160001904821115613e1e57613e1e613b0a565b80851615613e2b57918102915b93841c9390800290613e02565b509250929050565b600082613e4f57506001610951565b81613e5c57506000610951565b8160018114613e725760028114613e7c57613e98565b6001915050610951565b60ff841115613e8d57613e8d613b0a565b50506001821b610951565b5060208310610133831016604e8410600b8410161715613ebb575081810a610951565b613ec58383613dfd565b8060001904821115613ed957613ed9613b0a565b029392505050565b600061092060ff841683613e40565b634e487b7160e01b600052602160045260246000fd5b6000808354613f1481613ad0565b60018281168015613f2c5760018114613f4157613f70565b60ff1984168752821515830287019450613f70565b8760005260208060002060005b85811015613f675781548a820152908401908201613f4e565b50505082870194505b50929695505050505050565b600060208284031215613f8e57600080fd5b8151801515811461092057600080fd5b60008251613fb08184602087016136ed565b919091019291505056fea2646970667358221220a32d9b4163fbbdc0998c038789f9392c6e248cd860adef34f18696c4171a158e64736f6c63430008120033
Verified Source Code Partial Match
Compiler: v0.8.18+commit.87f61d96
EVM: paris
Optimization: Yes (200 runs)
TokenizedStrategy.sol 3350 lines
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.18;
/**$$$$$$$$$$$$$$$$$$$$$$$$$$$&Mr/|1+~>>iiiiiiiiiii>~+{|tuMW$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$B#j]->iiiiiiiiiiiiiiiiiiiiiiiiiiii>-?f*B$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$@zj}~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii~}fv@$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$@z(+iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii+)zB$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$Mf~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii~t#@$$$$$$$$$$$$$$$
$$$$$$$$$$$$$@u[iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii?n@$$$$$$$$$$$$$
$$$$$$$$$$$@z]iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii?u@$$$$$$$$$$$
$$$$$$$$$$v]iiiiiiiiiiiiiiii,.';iiiiiiiiiiiiiiiiiiiiiiiiii;'."iiiiiiiiiiiiiiii?u$$$$$$$$$$
$$$$$$$$%)>iiiiiiiiiiiiiii,. ';iiiiiiiiiiiiiiiiiiiiii;' ."iiiiiiiiiiiiiiii1%$$$$$$$$
$$$$$$$c~iiiiiiiiiiiiiii,. ';iiiiiiiiiiiiiiiiii;' ."iiiiiiiiiiiiiii~u$$$$$$$
$$$$$B/>iiiiiiiiiiiiii!' `IiiiiiiiiiiiiiiI` .Iiiiiiiiiiiiiii>|%$$$$$
$$$$@)iiiiiiiiiiiiiiiii;' `Iiiiiiiiiiil` ';iiiiiiiiiiiiiiiii}@$$$$
$$$B|iiiiiiiiiiiiiiiiiiii;' `Iiiiiiil` ';iiiiiiiiiiiiiiiiiiii1B$$$
$$@)iiiiiiiiiiiiiiiiiiiiiii:' `;iiI` ':iiiiiiiiiiiiiiiiiiiiiii{B$$
$$|iiiiiiiiiiiiiiiiiiiiiiiiii;' `` ':iiiiiiiiiiiiiiiiiiiiiiiiii1$$
$v>iiiiiiiiiiiiiiiiiiiiiiiiiiii:' ':iiiiiiiiiiiiiiiiiiiiiiiiiiii>x$
&?iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii:' .,iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii-W
ziiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii:' .,iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiv
-iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii:' .,iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii-
<iiiiiiiiiiiiiiiiiiii!.':iiiiiiiiiiiiii, "iiiiiiiiiiiiii;'.Iiiiiiiiiiiiiiiiiiiii<
iiiiiiiiiiiiiiiiiiiii' ';iiiiiiiiiiiii Iiiiiiiiiiiii;' .iiiiiiiiiiiiiiiiiiiii
iiiiiiiiiiiiiiiiiiii, ';iiiiiiiiiii IiiiiiiiiiiI` `iiiiiiiiiiiiiiiiiiii
iiiiiiiiiiiiiiiiiiii. `Iiiiiiiiii Iiiiiiiii!` !iiiiiiiiiiiiiiiiiii
iiiiiiiiiiiiiiiiiii; :iiiiiiiii Iiiiiiiii! ,iiiiiiiiiiiiiiiiiii
iiiiiiiiiiiiiiiiiii, iiiiiiiiii Iiiiiiiiii. ^iiiiiiiiiiiiiiiiiii
<iiiiiiiiiiiiiiiiii, iiiiiiiiii Iiiiiiiiii' ^iiiiiiiiiiiiiiiiii<
-iiiiiiiiiiiiiiiiii; Iiiiiiiiii Iiiiiiiiii. "iiiiiiiiiiiiiiiiii-
ziiiiiiiiiiiiiiiiiii. 'iiiiiiiii''''''''''liiiiiiii^ liiiiiiiiiiiiiiiiiiv
&?iiiiiiiiiiiiiiiiii^ ^iiiiiiiiiiiiiiiiiiiiiiiiii, `iiiiiiiiiiiiiiiiii_W
$u>iiiiiiiiiiiiiiiiii. `!iiiiiiiiiiiiiiiiiiiiiii^ .liiiiiiiiiiiiiiiiiir$
$$(iiiiiiiiiiiiiiiiii;. ."iiiiiiiiiiiiiiiiiiii,. :iiiiiiiiiiiiiiiiii}$$
$$@{iiiiiiiiiiiiiiiiii;. .`:iiiiiiiiiiiiii;^. :iiiiiiiiiiiiiiiiii}B$$
$$$B)iiiiiiiiiiiiiiiiii!' '`",::::,"`'. .Iiiiiiiiiiiiiiiiiii{%$$$
$$$$@1iiiiiiiiiiiiiiiiiii,. ^iiiiiiiiiiiiiiiiiii[@$$$$
$$$$$B|>iiiiiiiiiiiiiiiiii!^. `liiiiiiiiiiiiiiiiii>)%$$$$$
$$$$$$$c~iiiiiiiiiiiiiiiiiiii"' ."!iiiiiiiiiiiiiiiiiii~n$$$$$$$
$$$$$$$$B)iiiiiiiiiiiiiiiiiiiii!,`. .'"liiiiiiiiiiiiiiiiiiiii1%$$$$$$$$
$$$$$$$$$@u]iiiiiiiiiiiiiiiiiiiiiiil,^`'.. ..''^,liiiiiiiiiiiiiiiiiiiiiii-x@$$$$$$$$$
$$$$$$$$$$$@v?iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii-x$$$$$$$$$$$$
$$$$$$$$$$$$$@n?iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii-rB$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$/~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii<\*@$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$Bc1~iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii~{v%$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$Bvf]<iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii<]tuB$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$%zt-+>iiiiiiiiiiiiiiiiiiiiiiiiiiiii+_tc%$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$W#u/|{+~>iiiiiiiiiiii><+{|/n#W$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
/**
* @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);
}
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @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;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
/**
* @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);
}
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
/**
* @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);
}
}
}
/**
* @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-functio...
// [truncated — 127211 bytes total]
Read Contract
DOMAIN_SEPARATOR 0x3644e515 → bytes32
FACTORY 0x2dd31000 → address
MAX_FEE 0xbc063e1a → uint16
MIN_FEE 0x76c7a3c7 → uint16
allowance 0xdd62ed3e → uint256
apiVersion 0x25829410 → string
asset 0x38d52e0f → address
balanceOf 0x70a08231 → uint256
convertToAssets 0x07a2d13a → uint256
convertToShares 0xc6e6f592 → uint256
decimals 0x313ce567 → uint8
emergencyAdmin 0x70905dce → address
fullProfitUnlockDate 0x2d632692 → uint256
isEmergencyAuthorized 0x9d6fdde7 → bool
isKeeperOrManagement 0x1d3b7227 → bool
isManagement 0xec0c7e28 → bool
isShutdown 0xbf86d690 → bool
keeper 0xaced1661 → address
lastReport 0xc3535b52 → uint256
management 0x88a8d602 → address
maxDeposit 0x402d267d → uint256
maxMint 0xc63d75b6 → uint256
maxRedeem 0xd905777e → uint256
maxWithdraw 0xce96cb77 → uint256
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
pendingManagement 0x0b68f46f → address
performanceFee 0x87788782 → uint16
performanceFeeRecipient 0xed27f7c9 → address
previewDeposit 0xef8b30f7 → uint256
previewMint 0xb3d7f6b9 → uint256
previewRedeem 0x4cdad506 → uint256
previewWithdraw 0x0a28a477 → uint256
pricePerShare 0x99530b06 → uint256
profitMaxUnlockTime 0x0952864e → uint256
profitUnlockingRate 0x5141eebb → uint256
symbol 0x95d89b41 → string
totalAssets 0x01e1d114 → uint256
totalDebt 0xfc7b9c18 → uint256
totalIdle 0x9aa7df94 → uint256
totalSupply 0x18160ddd → uint256
unlockedShares 0xd9a0e97a → uint256
Write Contract 24 functions
These functions modify contract state and require a wallet transaction to execute.
acceptManagement 0xc8c2fe6c
No parameters
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
deposit 0x6e553f65
uint256 assets
address receiver
returns: uint256
emergencyWithdraw 0x5312ea8e
uint256 amount
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
init 0x2ecfe315
address _asset
string _name
address _management
address _performanceFeeRecipient
address _keeper
mint 0x94bf804d
uint256 shares
address receiver
returns: uint256
permit 0xd505accf
address owner
address spender
uint256 value
uint256 deadline
uint8 v
bytes32 r
bytes32 s
redeem 0x9f40a7b3
uint256 shares
address receiver
address owner
uint256 maxLoss
returns: uint256
redeem 0xba087652
uint256 shares
address receiver
address owner
returns: uint256
report 0x2606a10b
No parameters
returns: uint256, uint256
setEmergencyAdmin 0x35da3394
address _emergencyAdmin
setKeeper 0x748747e6
address _keeper
setPendingManagement 0xf629b790
address _management
setPerformanceFee 0xaa290e6d
uint16 _performanceFee
setPerformanceFeeRecipient 0x6a5f1aa2
address _performanceFeeRecipient
setProfitMaxUnlockTime 0xdf69b22a
uint256 _profitMaxUnlockTime
shutdownStrategy 0xbe8f1668
No parameters
tend 0x440368a3
No parameters
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
withdraw 0xa318c1a4
uint256 assets
address receiver
address owner
uint256 maxLoss
returns: uint256
withdraw 0xb460af94
uint256 assets
address receiver
address owner
returns: uint256
Recent Transactions
No transactions found for this address