Address Contract Verified
Address
0x9D7977891e0d4D3Bc84456DD2838beE6ad484D87
Balance
0 ETH
Nonce
1
Code Size
13020 bytes
Creator
0x29ee65cb...54F3 at tx 0xee2a2aa6...4da1a7
Indexed Transactions
0
Contract Bytecode
13020 bytes
0x608060405234801561001057600080fd5b506004361061025e5760003560e01c8063715018a611610146578063c5f956af116100c3578063ddc6326211610087578063ddc63262146105c3578063e3f8a79c146105d6578063e90a95be146105e9578063e985e9c5146105fc578063f2fde38b1461060f578063f996f5c41461062257600080fd5b8063c5f956af1461056e578063c87b56dd14610581578063d201114a14610594578063db006a751461059d578063dc7d35df146105b057600080fd5b806391ddd9871161010a57806391ddd9871461052457806395d89b411461053757806398bdf6f51461053f578063a22cb46514610548578063bc4ff5d31461055b57600080fd5b8063715018a6146104b357806375220bb4146104bb578063863560e5146104ed57806386b4de68146105005780638da5cb5b1461051357600080fd5b8063404d2cf8116101df5780636352211e116101a35780636352211e146103c45780636605bfda146103d757806368626081146103ea5780636f37a2c9146103fd5780636f9b327a1461041057806370a08231146104a057600080fd5b8063404d2cf814610365578063444719f2146103785780634f6ccce71461038b57806359d88c2e1461039e5780635a9241dd146103b157600080fd5b8063181d989b11610226578063181d989b146102e657806323b872dd146103195780632aabff151461032c5780632e17de781461033f5780632f745c591461035257600080fd5b806306fdde0314610263578063081812fc14610281578063095ea7b3146102ac5780630f119377146102c157806318160ddd146102d4575b600080fd5b61026b6106c6565b6040516102789190612cb1565b60405180910390f35b61029461028f366004612ce4565b610758565b6040516001600160a01b039091168152602001610278565b6102bf6102ba366004612d14565b6107f2565b005b6102bf6102cf366004612d55565b610908565b6009545b604051908152602001610278565b6103096102f4366004612d70565b60126020526000908152604090205460ff1681565b6040519015158152602001610278565b6102bf610327366004612d8b565b61096e565b6102d861033a366004612e12565b6109e9565b6102d861034d366004612ce4565b610a76565b6102d8610360366004612d14565b610c30565b6102bf610373366004612d70565b610cc9565b6102d8610386366004612e53565b610d26565b6102d8610399366004612ce4565b610d7c565b6102d86103ac366004612eb7565b610e0f565b6102bf6103bf366004612ef3565b611013565b6102946103d2366004612ce4565b611121565b6102bf6103e5366004612d70565b611198565b6102d86103f8366004612ce4565b6111f3565b6102d861040b366004612f15565b611410565b61046461041e366004612ce4565b6011602052600090815260409020805460018201546002830154600590930154919290916001600160401b0380821691600160401b8104821691600160801b9091041686565b604080519687526020870195909552938501929092526001600160401b03908116606085015290811660808401521660a082015260c001610278565b6102d86104ae366004612d70565b61161b565b6102bf6116a2565b600d546104d590600160401b90046001600160401b031681565b6040516001600160401b039091168152602001610278565b6102bf6104fb366004612ce4565b6116e7565b600d546104d5906001600160401b031681565b600b546001600160a01b0316610294565b6102bf610532366004612d55565b611798565b61026b6117f4565b6102d8600c5481565b6102bf610556366004612f56565b611803565b6102bf610569366004612f8d565b611812565b600f54610294906001600160a01b031681565b61026b61058f366004612ce4565b6119c8565b6102d8600e5481565b6102d86105ab366004612ce4565b611b25565b6102bf6105be366004612fc8565b611d93565b6102d86105d1366004612ce4565b611e8f565b6102bf6105e4366004612d70565b611e9a565b6102d86105f7366004612e12565b611ef4565b61030961060a366004612ff4565b611f46565b6102bf61061d366004612d70565b611f74565b610683610630366004612ce4565b6010602052600090815260409020805460018201546002830154600390930154919290916001600160401b0380831692600160401b8104821692600160801b8204831692600160c01b9092049091169087565b6040805197885260208801969096526001600160401b03948516958701959095529183166060860152821660808501521660a083015260c082015260e001610278565b6060600080546106d59061301e565b80601f01602080910402602001604051908101604052809291908181526020018280546107019061301e565b801561074e5780601f106107235761010080835404028352916020019161074e565b820191906000526020600020905b81548152906001019060200180831161073157829003601f168201915b5050505050905090565b6000818152600360205260408120546001600160a01b03166107d65760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b60006107fd82611121565b9050806001600160a01b0316836001600160a01b0316141561086b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016107cd565b336001600160a01b038216148061088757506108878133611f46565b6108f95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016107cd565b6109038383612041565b505050565b3361091b600b546001600160a01b031690565b6001600160a01b0316146109415760405162461bcd60e51b81526004016107cd90613059565b600d80546001600160401b03909216600160401b0267ffffffffffffffff60401b19909216919091179055565b61097833826120af565b6109de5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6044820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b60648201526084016107cd565b610903838383612186565b6000805b82811015610a3457610a16848483818110610a0a57610a0a61308e565b9050602002013561232d565b610a2090836130ba565b915080610a2c816130d2565b9150506109ed565b507f31a908ae5661ad1a8af4681296ba891f4f0eb047550f719aac1ff914e4307b67838383604051610a68939291906130ed565b60405180910390a192915050565b6000610a81826124f7565b6000828152601060209081526040808320805484526011909252909120600501546002820154600f546001600160401b039283169280831692600160401b900416906001600160a01b0316331415610ad857600092505b6001600160401b03811615610b225760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481d5b9cdd185ad95960821b60448201526064016107cd565b610b2c8383613133565b6001600160401b0316426001600160401b03161015610b7f5760405162461bcd60e51b815260206004820152600f60248201526e07374696c6c20696e206c6f636b757608c1b60448201526064016107cd565b610b888661232d565b60018581015460028701805467ffffffffffffffff60401b1916600160401b6001600160401b034216021790558654600090815260116020526040812090920180549398509092839290610bdd90849061315e565b9250508190555080600e6000828254610bf6919061315e565b909155505060405187907ff1f1db1ecefb0a90b3cd6a1903d29374b4a935df69fd25c7fc6ed397d3683c2690600090a25050505050919050565b6000610c3b8361161b565b8210610c9d5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016107cd565b506001600160a01b03821660009081526007602090815260408083208484529091529020545b92915050565b33610cdc600b546001600160a01b031690565b6001600160a01b031614610d025760405162461bcd60e51b81526004016107cd90613059565b6001600160a01b03166000908152601260205260409020805460ff19166001179055565b6000805b84811015610d7357610d55868683818110610d4757610d4761308e565b905060200201358585610e0f565b610d5f90836130ba565b915080610d6b816130d2565b915050610d2a565b50949350505050565b6000610d8760095490565b8210610dea5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016107cd565b60098281548110610dfd57610dfd61308e565b90600052602060002001549050919050565b6000600c54841115610e525760405162461bcd60e51b815260206004820152600c60248201526b1b9bdd08195e1a5cdd195b9d60a21b60448201526064016107cd565b600084815260106020526040902060028101546001600160401b038085169116101580610e9257506002810154600160401b90046001600160401b031615155b15610ea157600091505061100c565b60028101546001600160401b0380861691161115610eca5760028101546001600160401b031693505b8054600090815260116020526040902060018201546004820180545b80156110065780610ef681613175565b9150506000828281548110610f0d57610f0d61308e565b9060005260206000200160000160089054906101000a90046001600160401b031690506000838381548110610f4457610f4461308e565b6000918252602090912001546001600160401b03908116915089811690831610610f6f575050610ee6565b896001600160401b0316826001600160401b031610610fc45780610f93838b61318c565b610fa6906001600160401b0316876131b4565b610fb091906131b4565b610fba90896130ba565b9750819850610fff565b80610fcf8b8b61318c565b610fe2906001600160401b0316876131b4565b610fec91906131b4565b610ff690896130ba565b97505050611006565b5050610ee6565b50505050505b9392505050565b3360009081526012602052604090205460ff166110635760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b60448201526064016107cd565b61106c82612543565b6000828152601160209081526040918290208251808401909352838352916003830191810161109961201e565b6001600160401b0390811690915282546001808201855560009485526020948590208451600290930201918255928401519201805467ffffffffffffffff191692909116919091179055604080518581529182018490527f958740ea6ebf691fabab737173356de81596654a8a7ab76e3bb52f940cf23db291015b60405180910390a1505050565b6000818152600360205260408120546001600160a01b031680610cc35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016107cd565b336111ab600b546001600160a01b031690565b6001600160a01b0316146111d15760405162461bcd60e51b81526004016107cd90613059565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000600c548211156112365760405162461bcd60e51b815260206004820152600c60248201526b1b9bdd08195e1a5cdd195b9d60a21b60448201526064016107cd565b60008281526010602052604090206002810154600160401b90046001600160401b0316156112675750600092915050565b80546000908152601160205260408120600183015490919061128e90600160601b906131b4565b905080600061129b61201e565b6002860154600386018054929350600160c01b9091046001600160401b0316915b80156113e957806112cc81613175565b91505060008282815481106112e3576112e361308e565b6000918252602082206001600290920201015484546001600160401b0390911692508490849081106113175761131761308e565b90600052602060002090600202016000015490506000826001600160401b0316876001600160401b0316101561134f575050506112bc565b856001600160401b0316836001600160401b0316106113a857610e10611375848961318c565b61137f91906131e9565b6001600160401b0316905061139e61139783836125b2565b899061260f565b97508296506113e1565b610e106113b5878961318c565b6113bf91906131e9565b6001600160401b031690506113d761139783836125b2565b97505050506113e9565b5050506112bc565b600160601b6113f8878761315e565b611402919061320f565b9a9950505050505050505050565b600080821161144f5760405162461bcd60e51b815260206004820152600b60248201526a0616d6f756e7420697320360ac1b60448201526064016107cd565b61145883612543565b6040516323b872dd60e01b8152336004820152306024820152604481018390527f0000000000000000000000000173661769325565d4f011b2e5cda688689cc87c6001600160a01b0316906323b872dd906064016020604051808303816000875af11580156114cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ef9190613223565b506001600c600082825461150391906130ba565b9091555050600c5490506115178482612626565b6115213082612041565b60008181526010602052604090208381556001810183905560028101805467ffffffffffffffff1916426001600160401b031617905561155f61201e565b6002820180546001600160401b0392909216600160c01b026001600160c01b03909216919091179055600084815260116020526040812060010180548592906115a99084906130ba565b9250508190555082600e60008282546115c291906130ba565b9091555050604080516001600160a01b03871681526020810186905290810184905282907f3f991e971d7c9f35e42f28a2f9f7937a7c31e42a6738bbc54248e6088d5c05959060600160405180910390a2509392505050565b60006001600160a01b0382166116865760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016107cd565b506001600160a01b031660009081526004602052604090205490565b336116b5600b546001600160a01b031690565b6001600160a01b0316146116db5760405162461bcd60e51b81526004016107cd90613059565b6116e56000612774565b565b336116fa600b546001600160a01b031690565b6001600160a01b0316146117205760405162461bcd60e51b81526004016107cd90613059565b61172981612543565b60008181526011602090815260409182902060058101805467ffffffffffffffff60801b1916600160801b6001600160401b034216021790558251848152925190927f76ea635240e43b72b06fc5187986b33eccd576d2bbce1c1513ae09c3d28094f692908290030190a15050565b336117ab600b546001600160a01b031690565b6001600160a01b0316146117d15760405162461bcd60e51b81526004016107cd90613059565b600d805467ffffffffffffffff19166001600160401b0392909216919091179055565b6060600180546106d59061301e565b61180e3383836127c6565b5050565b33611825600b546001600160a01b031690565b6001600160a01b03161461184b5760405162461bcd60e51b81526004016107cd90613059565b600084815260116020526040902060050154600160401b90046001600160401b0316156118ac5760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4818dc99585d1959608a1b60448201526064016107cd565b600084815260116020908152604091829020868155825180840190935284835291600383019181016118dc61201e565b6001600160401b0390811690915282546001808201855560009485526020808620855160029094020192835593840151918101805492841667ffffffffffffffff199093169290921790915560408051808201825287841681524284168186018181526004890180549586018155885296869020915191909301805496519185166001600160801b031997881617600160401b928616830217905560058701805491909302938a16951694909417919091179055815187815291517f6b70138d2b1ac6c6c366b880fd69a916ea592a176331c95355ed15efccbd3f369281900390910190a15050505050565b6000818152600360205260409020546060906001600160a01b0316611a475760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016107cd565b600060028054611a569061301e565b80601f0160208091040260200160405190810160405280929190818152602001828054611a829061301e565b8015611acf5780601f10611aa457610100808354040283529160200191611acf565b820191906000526020600020905b815481529060010190602001808311611ab257829003601f168201915b505050505090506000815111611af4576040518060200160405280600081525061100c565b80611afe84612895565b604051602001611b0f929190613240565b6040516020818303038152906040529392505050565b6000611b30826124f7565b60008281526010602052604090206002810154600d54600f546001600160401b03600160401b808504821694600160801b9004821693041690336001600160a01b039091161415611b7f575060005b6000836001600160401b031611611bc75760405162461bcd60e51b815260206004820152600c60248201526b1b9bdd081d5b9cdd185ad95960a21b60448201526064016107cd565b611bd18184613133565b6001600160401b0316426001600160401b03161015611c245760405162461bcd60e51b815260206004820152600f60248201526e07374696c6c20696e206c6f636b757608c1b60448201526064016107cd565b6001600160401b03821615611c6e5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b60448201526064016107cd565b6000611c7987611121565b9050611c8633308961096e565b611c8f87612992565b600185015460405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390529197507f0000000000000000000000000173661769325565d4f011b2e5cda688689cc87c9091169063a9059cbb906044016020604051808303816000875af1158015611d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2c9190613223565b5060028501805467ffffffffffffffff60801b1916600160801b426001600160401b03160217905560405186815287907fe3829d5463fae0f748d927f86f762044188c9ce53d91a394eb93e98354cc30929060200160405180910390a25050505050919050565b3360009081526012602052604090205460ff16611de35760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b60448201526064016107cd565b611dec82612543565b6000828152601160209081526040808320815180830183526001600160401b0386811680835242821683870190815260048501805460018101825590895297879020935193909701805497518316600160401b026001600160801b03199098169390921692909217959095179094558151868152928301939093527fbd1e0a597106edf33153c6b88a76e698670f0caf8869b859ca7fbc46e9d929929101611114565b6000610cc38261232d565b33611ead600b546001600160a01b031690565b6001600160a01b031614611ed35760405162461bcd60e51b81526004016107cd90613059565b6001600160a01b03166000908152601260205260409020805460ff19169055565b6000805b82811015611f3f57611f21848483818110611f1557611f1561308e565b905060200201356111f3565b611f2b90836130ba565b915080611f37816130d2565b915050611ef8565b5092915050565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b33611f87600b546001600160a01b031690565b6001600160a01b031614611fad5760405162461bcd60e51b81526004016107cd90613059565b6001600160a01b0381166120125760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107cd565b61201b81612774565b50565b600061202c610e104261320f565b61203890610e106131b4565b905090565b4290565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061207682611121565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600360205260408120546001600160a01b03166121285760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107cd565b600061213383611121565b9050806001600160a01b0316846001600160a01b0316148061216e5750836001600160a01b031661216384610758565b6001600160a01b0316145b8061217e575061217e8185611f46565b949350505050565b826001600160a01b031661219982611121565b6001600160a01b0316146121fd5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016107cd565b6001600160a01b03821661225f5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107cd565b61226a838383612a39565b612275600082612041565b6001600160a01b038316600090815260046020526040812080546001929061229e90849061315e565b90915550506001600160a01b03821660009081526004602052604081208054600192906122cc9084906130ba565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600d546000906001600160401b0316426001600160401b031610156123865760405162461bcd60e51b815260206004820152600f60248201526e31b7b6b2903130b1b5903630ba32b960891b60448201526064016107cd565b61238f826124f7565b612398826111f3565b905080156124f2577f0000000000000000000000000173661769325565d4f011b2e5cda688689cc87c6001600160a01b03166340c10f196123d884611121565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561242057600080fd5b505af1158015612434573d6000803e3d6000fd5b5050506000838152601060205260409020905061244f61201e565b8160020160186101000a8154816001600160401b0302191690836001600160401b031602179055508181600301600082825461248b91906130ba565b909155505080546000908152601160205260408120600281018054919285926124b59084906130ba565b909155505060405183815284907f6c8433a8e155f0af04dba058d4e4695f7da554578963d876bdf4a6d8d6399d9c9060200160405180910390a250505b919050565b3361250182611121565b6001600160a01b03161461201b5760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064016107cd565b600081815260116020526040902060050154600160801b90046001600160401b03161561201b5760405162461bcd60e51b815260206004820152601760248201527f7374616b696e6720706c616e206e6f742061637469766500000000000000000060448201526064016107cd565b6000816125c45750600160601b610cc3565b81600114156125d4575081610cc3565b6125e8836125e360028561320f565b6125b2565b90506125f4818261260f565b9050612601600283613266565b60011415610cc35761100c81845b6000606061261d83856131b4565b901c9392505050565b6001600160a01b03821661267c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107cd565b6000818152600360205260409020546001600160a01b0316156126e15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107cd565b6126ed60008383612a39565b6001600160a01b03821660009081526004602052604081208054600192906127169084906130ba565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156128285760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107cd565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6060816128b95750506040805180820190915260018152600360fc1b602082015290565b8160005b81156128e357806128cd816130d2565b91506128dc9050600a8361320f565b91506128bd565b6000816001600160401b038111156128fd576128fd61327a565b6040519080825280601f01601f191660200182016040528015612927576020820181803683370190505b5090505b841561217e5761293c60018361315e565b9150612949600a86613266565b6129549060306130ba565b60f81b8183815181106129695761296961308e565b60200101906001600160f81b031916908160001a90535061298b600a8661320f565b945061292b565b600061299d82611121565b90506129ab81600084612a39565b6129b6600083612041565b6001600160a01b03811660009081526004602052604081208054600192906129df90849061315e565b909155505060008281526003602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b038316612a9457612a8f81600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b612ab7565b816001600160a01b0316836001600160a01b031614612ab757612ab78382612af1565b6001600160a01b038216612ace5761090381612b8e565b826001600160a01b0316826001600160a01b031614610903576109038282612c3d565b60006001612afe8461161b565b612b08919061315e565b600083815260086020526040902054909150808214612b5b576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b5060009182526008602090815260408084208490556001600160a01b039094168352600781528383209183525290812055565b600954600090612ba09060019061315e565b6000838152600a602052604081205460098054939450909284908110612bc857612bc861308e565b906000526020600020015490508060098381548110612be957612be961308e565b6000918252602080832090910192909255828152600a90915260408082208490558582528120556009805480612c2157612c21613290565b6001900381819060005260206000200160009055905550505050565b6000612c488361161b565b6001600160a01b039093166000908152600760209081526040808320868452825280832085905593825260089052919091209190915550565b60005b83811015612c9c578181015183820152602001612c84565b83811115612cab576000848401525b50505050565b6020815260008251806020840152612cd0816040850160208701612c81565b601f01601f19169190910160400192915050565b600060208284031215612cf657600080fd5b5035919050565b80356001600160a01b03811681146124f257600080fd5b60008060408385031215612d2757600080fd5b612d3083612cfd565b946020939093013593505050565b80356001600160401b03811681146124f257600080fd5b600060208284031215612d6757600080fd5b61100c82612d3e565b600060208284031215612d8257600080fd5b61100c82612cfd565b600080600060608486031215612da057600080fd5b612da984612cfd565b9250612db760208501612cfd565b9150604084013590509250925092565b60008083601f840112612dd957600080fd5b5081356001600160401b03811115612df057600080fd5b6020830191508360208260051b8501011115612e0b57600080fd5b9250929050565b60008060208385031215612e2557600080fd5b82356001600160401b03811115612e3b57600080fd5b612e4785828601612dc7565b90969095509350505050565b60008060008060608587031215612e6957600080fd5b84356001600160401b03811115612e7f57600080fd5b612e8b87828801612dc7565b9095509350612e9e905060208601612d3e565b9150612eac60408601612d3e565b905092959194509250565b600080600060608486031215612ecc57600080fd5b83359250612edc60208501612d3e565b9150612eea60408501612d3e565b90509250925092565b60008060408385031215612f0657600080fd5b50508035926020909101359150565b600080600060608486031215612f2a57600080fd5b612f3384612cfd565b95602085013595506040909401359392505050565b801515811461201b57600080fd5b60008060408385031215612f6957600080fd5b612f7283612cfd565b91506020830135612f8281612f48565b809150509250929050565b60008060008060808587031215612fa357600080fd5b84359350612fb360208601612d3e565b925060408501359150612eac60608601612d3e565b60008060408385031215612fdb57600080fd5b82359150612feb60208401612d3e565b90509250929050565b6000806040838503121561300757600080fd5b61301083612cfd565b9150612feb60208401612cfd565b600181811c9082168061303257607f821691505b6020821081141561305357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156130cd576130cd6130a4565b500190565b60006000198214156130e6576130e66130a4565b5060010190565b6040808252810183905260006001600160fb1b0384111561310d57600080fd5b8360051b8086606085013760009083016060019081526020909201929092529392505050565b60006001600160401b03808316818516808303821115613155576131556130a4565b01949350505050565b600082821015613170576131706130a4565b500390565b600081613184576131846130a4565b506000190190565b60006001600160401b03838116908316818110156131ac576131ac6130a4565b039392505050565b60008160001904831182151516156131ce576131ce6130a4565b500290565b634e487b7160e01b600052601260045260246000fd5b60006001600160401b0380841680613203576132036131d3565b92169190910492915050565b60008261321e5761321e6131d3565b500490565b60006020828403121561323557600080fd5b815161100c81612f48565b60008351613252818460208801612c81565b835190830190613155818360208801612c81565b600082613275576132756131d3565b500690565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603160045260246000fdfea2646970667358221220d8f1d551ba3775a6fd9e5ef21c2fe7c5d88f0096e85b8b67e0c408e82308f6bc64736f6c634300080b0033
Verified Source Code Full Match
Compiler: v0.8.11+commit.d7f03943
EVM: london
Optimization: Yes (200 runs)
StakedQLT.sol 2243 lines
// Sources flattened with hardhat v2.8.0 https://hardhat.org
// File contracts/libraries/Ownable.sol
// SPDX-License-Identifier: AGPL-3.0
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 {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(msg.sender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File contracts/interfaces/IERC721.sol
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId)
external
view
returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
}
// File contracts/libraries/Strings.sol
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length)
internal
pure
returns (string memory)
{
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File contracts/libraries/ERC721.sol
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is IERC721 {
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Base URI
string private _baseURI;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(
string memory name_,
string memory symbol_,
string memory baseURI_
) {
_name = name_;
_symbol = symbol_;
_baseURI = baseURI_;
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner)
public
view
virtual
override
returns (uint256)
{
require(
owner != address(0),
"ERC721: balance query for the zero address"
);
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
address owner = _owners[tokenId];
require(
owner != address(0),
"ERC721: owner query for nonexistent token"
);
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI;
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
_setApprovalForAll(msg.sender, operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(msg.sender, tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_transfer(from, to, tokenId);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(
ERC721.ownerOf(tokenId) == from,
"ERC721: transfer from incorrect owner"
);
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` 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 tokenId
) internal virtual {}
}
// File contracts/interfaces/IERC721Enumerable.sol
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
external
view
returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
// File contracts/libraries/ERC721Enumerable.sol
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
virtual
override
returns (uint256)
{
require(
index < ERC721.balanceOf(owner),
"ERC721Enumerable: owner index out of bounds"
);
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index)
public
view
virtual
override
returns (uint256)
{
require(
index < ERC721Enumerable.totalSupply(),
"ERC721Enumerable: global index out of bounds"
);
return _allTokens[index];
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId)
private
{
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
// File contracts/libraries/Math.sol
library Math {
function compound(uint256 rewardRateX96, uint256 nCompounds)
internal
pure
returns (uint256 compoundedX96)
{
if (nCompounds == 0) {
compoundedX96 = 2**96;
} else if (nCompounds == 1) {
compoundedX96 = rewardRateX96;
} else {
compoundedX96 = compound(rewardRateX96, nCompounds / 2);
compoundedX96 = mulX96(compoundedX96, compoundedX96);
if (nCompounds % 2 == 1) {
compoundedX96 = mulX96(compoundedX96, rewardRateX96);
}
}
}
// ref: https://blogs.sas.com/content/iml/2016/05/16/babylonian-square-roots.html
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
function mulX96(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = (x * y) >> 96;
}
function divX96(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = (x << 96) / y;
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
// File contracts/libraries/Time.sol
library Time {
function current_hour_timestamp() internal view returns (uint64) {
return uint64((block.timestamp / 1 hours) * 1 hours);
}
function block_timestamp() internal view returns (uint64) {
return uint64(block.timestamp);
}
}
// File contracts/interfaces/IUniswapV3Factory.sol
/// @title The interface for the Uniswap V3 Factory
/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees
interface IUniswapV3Factory {
/// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist
/// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
/// @param tokenA The contract address of either token0 or token1
/// @param tokenB The contract address of the other token
/// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
/// @return pool The pool address
function getPool(
address tokenA,
address tokenB,
uint24 fee
) external view returns (address pool);
/// @notice Creates a pool for the given two tokens and fee
/// @param tokenA One of the two tokens in the desired pool
/// @param tokenB The other of the two tokens in the desired pool
/// @param fee The desired fee for the pool
/// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved
/// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments
/// are invalid.
/// @return pool The address of the newly created pool
function createPool(
address tokenA,
address tokenB,
uint24 fee
) external returns (address pool);
}
// File contracts/interfaces/IUniswapV3Pool.sol
interface IUniswapV3Pool {
/// @notice Sets the initial price for the pool
/// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
/// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
function initialize(uint160 sqrtPriceX96) external;
/// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
/// when accessed externally.
/// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
/// tick The current tick of the pool, i.e. according to the last tick transition that was run.
/// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
/// boundary.
/// observationIndex The index of the last oracle observation that was written,
/// observationCardinality The current maximum number of observations stored in the pool,
/// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
/// feeProtocol The protocol fee for both tokens of the pool.
/// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
/// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
/// unlocked Whether the pool is currently locked to reentrancy
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
bool unlocked
);
/// @notice Increase the maximum number of price and liquidity observations that this pool will store
/// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
/// the input observationCardinalityNext.
/// @param observationCardinalityNext The desired minimum number of observations for the pool to store
function increaseObservationCardinalityNext(
uint16 observationCardinalityNext
) external;
/// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
/// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
/// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
/// you must call it with secondsAgos = [3600, 0].
/// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
/// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
/// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
/// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
/// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
/// timestamp
function observe(uint32[] calldata secondsAgos)
external
view
returns (
int56[] memory tickCumulatives,
uint160[] memory secondsPerLiquidityCumulativeX128s
);
}
// File contracts/interfaces/IERC20.sol
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File contracts/libraries/ERC20.sol
/**
* @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.zeppelin.solutions/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 IERC20 {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @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_,
uint8 decimals_
) {
_name = name_;
_symbol = symbol_;
_decimals = decimals_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual 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 returns (uint8) {
return _decimals;
}
/**
* @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:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(msg.sender, recipient, 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)
{
_approve(msg.sender, 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:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
uint256 currentAllowance = _allowances[sender][msg.sender];
if (currentAllowance != type(uint256).max) {
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, msg.sender, currentAllowance - amount);
}
}
_transfer(sender, recipient, 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)
{
_approve(
msg.sender,
spender,
_allowances[msg.sender][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)
{
uint256 currentAllowance = _allowances[msg.sender][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
unchecked {
_approve(msg.sender, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* 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:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, 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;
_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;
}
_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 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 {}
}
// File contracts/libraries/TickMath.sol
/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
/// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
int24 internal constant MIN_TICK = -887272;
/// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
int24 internal constant MAX_TICK = -MIN_TICK;
/// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
uint160 internal constant MIN_SQRT_RATIO = 4295128739;
/// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
uint160 internal constant MAX_SQRT_RATIO =
1461446703485210103287273052203988822378723970342;
/// @notice Calculates sqrt(1.0001^tick) * 2^96
/// @dev Throws if |tick| > max tick
/// @param tick The input tick for the above formula
/// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
/// at the given tick
function getSqrtRatioAtTick(int24 tick)
internal
pure
returns (uint160 sqrtPriceX96)
{
uint256 absTick = tick < 0
? uint256(-int256(tick))
: uint256(int256(tick));
require(absTick <= uint256(int256(MAX_TICK)), "T");
uint256 ratio = absTick & 0x1 != 0
? 0xfffcb933bd6fad37aa2d162d1a594001
: 0x100000000000000000000000000000000;
if (absTick & 0x2 != 0)
ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
if (absTick & 0x4 != 0)
ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
if (absTick & 0x8 != 0)
ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
if (absTick & 0x10 != 0)
ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
if (absTick & 0x20 != 0)
ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
if (absTick & 0x40 != 0)
ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
if (absTick & 0x80 != 0)
ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
if (absTick & 0x100 != 0)
ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
if (absTick & 0x200 != 0)
ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
if (absTick & 0x400 != 0)
ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
if (absTick & 0x800 != 0)
ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
if (absTick & 0x1000 != 0)
ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
if (absTick & 0x2000 != 0)
ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
if (absTick & 0x4000 != 0)
ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
if (absTick & 0x8000 != 0)
ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
if (absTick & 0x10000 != 0)
ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
if (absTick & 0x20000 != 0)
ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
if (absTick & 0x40000 != 0)
ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
if (absTick & 0x80000 != 0)
ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;
if (tick > 0) ratio = type(uint256).max / ratio;
// this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
// we then downcast because we know the result always fits within 160 bits due to our tick input constraint
// we round up in the division so getTickAtSqrtRatio of the output price is always consistent
sqrtPriceX96 = uint160(
(ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)
);
}
/// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
/// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
/// ever return.
/// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
/// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
function getTickAtSqrtRatio(uint160 sqrtPriceX96)
internal
pure
returns (int24 tick)
{
// second inequality must be < because the price can never reach the price at the max tick
require(
sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO,
"R"
);
uin...
// [truncated — 71481 bytes total]
Read Contract
authorizedOperators 0x181d989b → bool
balanceOf 0x70a08231 → uint256
getAllRewardsToHarvest 0xe90a95be → uint256
getAllStakingPower 0x444719f2 → uint256
getApproved 0x081812fc → address
getRewardsToHarvest 0x68626081 → uint256
getStakingPower 0x59d88c2e → uint256
harvestStartTime 0x86b4de68 → uint64
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
stakingInfos 0xf996f5c4 → bytes32, uint256, uint64, uint64, uint64, uint64, uint256
stakingPlans 0x6f9b327a → bytes32, uint256, uint256, uint64, uint64, uint64
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenIdCounter 0x98bdf6f5 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalStakingAmount 0xd201114a → uint256
totalSupply 0x18160ddd → uint256
treasuryAddress 0xc5f956af → address
unstakeLockupPeriod 0x75220bb4 → uint64
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
addAuthorizedOperator 0x404d2cf8
address account
addStakingPlan 0xbc4ff5d3
bytes32 name
uint64 lockupPeriod
uint256 rewardRateX96
uint64 multiplier
approve 0x095ea7b3
address to
uint256 tokenId
deactivateStakingPlan 0x863560e5
bytes32 name
harvest 0xddc63262
uint256 tokenId
returns: uint256
harvestAll 0x2aabff15
uint256[] tokenIds
returns: uint256
redeem 0xdb006a75
uint256 tokenId
returns: uint256
removeAuthorizedOperator 0xe3f8a79c
address account
renounceOwnership 0x715018a6
No parameters
setApprovalForAll 0xa22cb465
address operator
bool approved
setHarvestStartTime 0x91ddd987
uint64 _harvestStartTime
setTreasuryAddress 0x6605bfda
address _treasuryAddress
setUnstakeLockupPeriod 0x0f119377
uint64 _unstakeLockupPeriod
stake 0x6f37a2c9
address recipient
bytes32 stakingPlan
uint256 amount
returns: uint256
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
unstake 0x2e17de78
uint256 tokenId
returns: uint256
updateStakingPowerMultiplier 0xdc7d35df
bytes32 name
uint64 multiplier
updateStakingRewardRate 0x5a9241dd
bytes32 name
uint256 rewardRateX96
Recent Transactions
No transactions found for this address