Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x0D66BD5197a4758Ed4D1140CDA10d35d76EfCC92
Balance 0 ETH
Nonce 1
Code Size 15804 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

15804 bytes
0x608060405234801561001057600080fd5b50600436106103825760003560e01c8063804d9426116101de578063adf8252d1161010f578063d1f52983116100ad578063dd6624e41161007c578063dd6624e4146108e0578063ef5cfb8c14610900578063f1127ed814610913578063f7c618c11461095057600080fd5b8063d1f529831461085a578063d505accf14610881578063d547741f14610894578063dd62ed3e146108a757600080fd5b8063b8162dd2116100e9578063b8162dd2146107e4578063c3cda5201461080d578063c89039c514610820578063ca15c8731461084757600080fd5b8063adf8252d14610778578063ae22192e1461078b578063b182eb91146107c457600080fd5b806395d89b411161017c578063a16cdbb111610156578063a16cdbb114610723578063a217fddf1461074a578063a457c2d714610752578063a9059cbb1461076557600080fd5b806395d89b41146106f55780639ab24eb0146106fd5780639afdb2c21461071057600080fd5b80638e539e8c116101b85780638e539e8c146106965780638f2203f6146106a95780639010d07c146106cf57806391d14854146106e257600080fd5b8063804d942614610650578063857184d1146106705780638dbdbe6d1461068357600080fd5b80633a46b1a8116102b85780636fcfff451161025657806378b4330f1161023057806378b4330f146106185780637cd0b5c7146106215780637e245d79146106345780637ecebe001461063d57600080fd5b80636fcfff45146105b657806370a08231146105de57806376175b06146105f157600080fd5b8063587cde1e11610292578063587cde1e1461052557806359974e38146105695780635c19a95c1461057c57806368570e6a1461058f57600080fd5b80633a46b1a8146104c457806354c5b696146104d757806357c2c2ba146104fe57600080fd5b806323b872dd11610325578063313ce567116102ff578063313ce567146104875780633644e5151461049657806336568abe1461049e57806339509351146104b157600080fd5b806323b872dd1461043e578063248a9ca3146104515780632f2ff15d1461047457600080fd5b8063095ea7b311610361578063095ea7b3146103d957806310accecc146103ec57806318160ddd1461040d57806318f9e2911461041557600080fd5b8062f714ce1461038757806301ffc9a71461039c57806306fdde03146103c4575b600080fd5b61039a6103953660046138f5565b610977565b005b6103af6103aa36600461393a565b610ca9565b60405190151581526020015b60405180910390f35b6103cc610cd4565b6040516103bb9190613aaa565b6103af6103e73660046137f8565b610d66565b6103ff6103fa366004613704565b610d7c565b6040519081526020016103bb565b6002546103ff565b6103ff610423366004613704565b6001600160a01b03166000908152600b602052604090205490565b6103af61044c366004613752565b610e03565b6103ff61045f3660046138dc565b6000908152600c602052604090206001015490565b61039a6104823660046138f5565b610eaf565b604051601281526020016103bb565b6103ff610eda565b61039a6104ac3660046138f5565b610ee9565b6103af6104bf3660046137f8565b610f67565b6103ff6104d23660046137f8565b610fa3565b6103ff7f000000000000000000000000000000000000000000000000000000000000000081565b6103ff7f000000000000000000000000000000000000000000000000000000000000000081565b610551610533366004613704565b6001600160a01b039081166000908152600660205260409020541690565b6040516001600160a01b0390911681526020016103bb565b61039a6105773660046138dc565b611016565b61039a61058a366004613704565b611057565b6105517f000000000000000000000000000000000000000000000000000000000000000081565b6105c96105c4366004613704565b611061565b60405163ffffffff90911681526020016103bb565b6103ff6105ec366004613704565b611083565b6103ff7fd9d917c4034cff8a8c5fa1e40f9fbaf906b827c33ae3ab1fcabbb616cb8ef24d81565b6103ff61025881565b6103ff61062f366004613704565b61109e565b6103ff60095481565b6103ff61064b366004613704565b6110ca565b61066361065e366004613704565b6110e8565b6040516103bb9190613a43565b6103ff61067e366004613704565b611186565b61039a61069136600461397d565b61120e565b6103ff6106a43660046138dc565b611408565b6106b76001600160801b0381565b6040516001600160801b0390911681526020016103bb565b6105516106dd366004613918565b611464565b6103af6106f03660046138f5565b61147c565b6103cc6114a7565b6103ff61070b366004613704565b6114b6565b61039a61071e366004613752565b61153d565b6103ff7f0000000000000000000000000000000000000000000000000000000002d1cd4081565b6103ff600081565b6103af6107603660046137f8565b61163e565b6103af6107733660046137f8565b6116d7565b6103ff6107863660046138dc565b6116e4565b61079e6107993660046137f8565b61174d565b6040805193845267ffffffffffffffff92831660208501529116908201526060016103bb565b6103ff6107d2366004613704565b600a6020526000908152604090205481565b6103ff6107f2366004613704565b6001600160a01b03166000908152600e602052604090205490565b61039a61081b366004613822565b61179e565b6105517f000000000000000000000000dac657ffd44a3b9d8aba8749830bf14beb66ff2d81565b6103ff6108553660046138dc565b6118d4565b6103ff7f000000000000000000000000000000000000000000000000000000000000000081565b61039a61088f36600461378e565b6118eb565b61039a6108a23660046138f5565b611a4f565b6103ff6108b536600461371f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6103ff6108ee366004613704565b600b6020526000908152604090205481565b61039a61090e366004613704565b611a75565b61092661092136600461387a565b611c3f565b60408051825163ffffffff1681526020928301516001600160e01b031692810192909252016103bb565b6105517f000000000000000000000000dac657ffd44a3b9d8aba8749830bf14beb66ff2d81565b336000908152600e602052604090205482106109f05760405162461bcd60e51b815260206004820152602d60248201527f54696d654c6f636b506f6f6c2e77697468647261773a204465706f736974206460448201526c1bd95cc81b9bdd08195e1a5cdd609a1b60648201526084015b60405180910390fd5b336000908152600e60205260408120805484908110610a1157610a11613d5a565b6000918252602091829020604080516060810182526002909302909101805483526001015467ffffffffffffffff80821694840194909452600160401b90049092169181018290529150421015610aaa5760405162461bcd60e51b815260206004820152601f60248201527f54696d654c6f636b506f6f6c2e77697468647261773a20746f6f20736f6f6e0060448201526064016109e7565b6000670de0b6b3a7640000610adb83602001518460400151610acc9190613c3f565b67ffffffffffffffff166116e4565b8351610ae79190613c09565b610af19190613b62565b336000908152600e60205260409020805491925090610b1290600190613c28565b81548110610b2257610b22613d5a565b9060005260206000209060020201600e6000610b3b3390565b6001600160a01b03166001600160a01b031681526020019081526020016000208581548110610b6c57610b6c613d5a565b600091825260208083208454600293909302019182556001938401805494909201805467ffffffffffffffff95861667ffffffffffffffff1982168117835593546001600160801b0319909116909317600160401b93849004909516909202939093179055338152600e90915260409020805480610bec57610bec613d44565b60008281526020812060026000199093019283020190815560010180546001600160801b03191690559055610c27610c213390565b82611ecc565b8151610c5f906001600160a01b037f000000000000000000000000dac657ffd44a3b9d8aba8749830bf14beb66ff2d16908590611ee8565b815160405190815233906001600160a01b0385169086907fe5df19de43c8c04fd192bc68e484b2593570925fbb6ad8c07ccafbc2aa5c37a19060200160405180910390a450505050565b60006001600160e01b03198216635a05180f60e01b1480610cce5750610cce82611f18565b92915050565b606060038054610ce390613cab565b80601f0160208091040260200160405190810160405280929190818152602001828054610d0f90613cab565b8015610d5c5780601f10610d3157610100808354040283529160200191610d5c565b820191906000526020600020905b815481529060010190602001808311610d3f57829003601f168201915b5050505050905090565b6000610d73338484611f4d565b50600192915050565b6001600160a01b0381166000908152600a60205260408120546001600160801b0390610df390610de4610dd28663ffffffff7f000000000000000000000000000000000000000000000000000003a10000108316565b600954610ddf9190613c09565b612071565b610dee9190613add565b6120df565b610cce9190613b62565b60025490565b6000610e10848484612131565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610e955760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084016109e7565b610ea28533858403611f4d565b60019150505b9392505050565b6000828152600c6020526040902060010154610ecb813361216c565b610ed583836121d0565b505050565b6000610ee46121f2565b905090565b6001600160a01b0381163314610f595760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109e7565b610f638282612319565b5050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610d73918590610f9e908690613b1e565b611f4d565b6000438210610ff45760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e65640060448201526064016109e7565b6001600160a01b0383166000908152600760205260409020610ea8908361233b565b61104b7f000000000000000000000000dac657ffd44a3b9d8aba8749830bf14beb66ff2d6001600160a01b03163330846123f8565b61105481612436565b50565b6110543382612547565b6001600160a01b038116600090815260076020526040812054610cce906125d6565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0381166000908152600b60205260408120546110c083610d7c565b610cce9190613c28565b6001600160a01b038116600090815260056020526040812054610cce565b6001600160a01b0381166000908152600e60209081526040808320805482518185028101850190935280835260609492939192909184015b8282101561117b57600084815260209081902060408051606081018252600286029092018054835260019081015467ffffffffffffffff80821685870152600160401b90910416918301919091529083529092019101611120565b505050509050919050565b60008060005b6001600160a01b0384166000908152600e6020526040902054811015611207576001600160a01b0384166000908152600e602052604090208054829081106111d6576111d6613d5a565b906000526020600020906002020160000154826111f39190613b1e565b9150806111ff81613ce0565b91505061118c565b5092915050565b6000831161126d5760405162461bcd60e51b815260206004820152602660248201527f54696d654c6f636b506f6f6c2e6465706f7369743a2063616e6e6f742064657060448201526506f73697420360d41b60648201526084016109e7565b6000611299837f0000000000000000000000000000000000000000000000000000000002d1cd4061263b565b90506112a781610258612651565b90506112de7f000000000000000000000000dac657ffd44a3b9d8aba8749830bf14beb66ff2d6001600160a01b03163330876123f8565b600e6000836001600160a01b03166001600160a01b0316815260200190815260200160002060405180606001604052808681526020014267ffffffffffffffff16815260200183426113309190613b36565b67ffffffffffffffff908116909152825460018181018555600094855260208086208551600290940201928355840151910180546040909401518316600160401b026001600160801b03199094169190921617919091179055670de0b6b3a764000061139b836116e4565b6113a59087613c09565b6113af9190613b62565b90506113bb8382612661565b604080518681526020810184905233916001600160a01b038616917f34194be2f096bdb2ad418add902a4da76d3d6f6d387d86d857f56c7711ecca70910160405180910390a35050505050565b60004382106114595760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e65640060448201526064016109e7565b610cce60088361233b565b6000828152600d60205260408120610ea89083612681565b6000918252600c602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610ce390613cab565b6001600160a01b038116600090815260076020526040812054801561152a576001600160a01b03831660009081526007602052604090206114f8600183613c28565b8154811061150857611508613d5a565b60009182526020909120015464010000000090046001600160e01b031661152d565b60005b6001600160e01b03169392505050565b6115677fd9d917c4034cff8a8c5fa1e40f9fbaf906b827c33ae3ab1fcabbb616cb8ef24d3361147c565b6115c85760405162461bcd60e51b815260206004820152602c60248201527f546f6b656e53617665722e6f6e6c79546f6b656e53617665723a207065726d6960448201526b1cdcda5bdb8819195b9a595960a21b60648201526084016109e7565b6115dc6001600160a01b0384168383611ee8565b826001600160a01b0316826001600160a01b03166115f73390565b6001600160a01b03167f30d87cec6b4c56cede1018725d1e6d9304e2f7ee6d25b004b7e2183f793f26bc8460405161163191815260200190565b60405180910390a4505050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156116c05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016109e7565b6116cd3385858403611f4d565b5060019392505050565b6000610d73338484612131565b60007f0000000000000000000000000000000000000000000000000000000002d1cd40611731837f0000000000000000000000000000000000000000000000000000000000000000613c09565b61173b9190613b62565b610cce90670de0b6b3a7640000613b1e565b600e602052816000526040600020818154811061176957600080fd5b60009182526020909120600290910201805460019091015490925067ffffffffffffffff8082169250600160401b9091041683565b834211156117ee5760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e6174757265206578706972656400000060448201526064016109e7565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b038816918101919091526060810186905260808101859052600090611868906118609060a0016040516020818303038152906040528051906020012061268d565b8585856126db565b905061187381612703565b86146118c15760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e63650000000000000060448201526064016109e7565b6118cb8188612547565b50505050505050565b6000818152600d60205260408120610cce9061272b565b8342111561193b5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016109e7565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c988888861196a8c612703565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120905060006119c58261268d565b905060006119d5828787876126db565b9050896001600160a01b0316816001600160a01b031614611a385760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016109e7565b611a438a8a8a611f4d565b50505050505050505050565b6000828152600c6020526040902060010154611a6b813361216c565b610ed58383612319565b6000611a8033612735565b90506000670de0b6b3a7640000611ab77f000000000000000000000000000000000000000000000000000000000000000084613c09565b611ac19190613b62565b90506000611acf8284613c28565b90508115801590611b0857507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615155b15611bb657604051638dbdbe6d60e01b8152600481018390527f000000000000000000000000000000000000000000000000000000000000000060248201526001600160a01b0385811660448301527f00000000000000000000000000000000000000000000000000000000000000001690638dbdbe6d90606401600060405180830381600087803b158015611b9d57600080fd5b505af1158015611bb1573d6000803e3d6000fd5b505050505b6001811115611bf357611bf36001600160a01b037f000000000000000000000000dac657ffd44a3b9d8aba8749830bf14beb66ff2d168583611ee8565b60408051838152602081018390526001600160a01b0386169133917fd92c424393cb3ccdf7d5e36602e3bfa34f24490579ba47978f4bcfad496995f2910160405180910390a350505050565b60408051808201909152600080825260208201526001600160a01b0383166000908152600760205260409020805463ffffffff8416908110611c8357611c83613d5a565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090046001600160e01b0316918101919091529392505050565b801580611d4c5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015611d1257600080fd5b505afa158015611d26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4a9190613964565b155b611db75760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016109e7565b6040516001600160a01b038316602482015260448101829052610ed590849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127ca565b611e24828261147c565b610f63576000828152600c602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611e5c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610ea8836001600160a01b03841661289c565b6060611ec484846000856128eb565b949350505050565b611ed68282612a13565b610f6382611ee383612071565b612a2b565b6040516001600160a01b038316602482015260448101829052610ed590849063a9059cbb60e01b90606401611de3565b60006001600160e01b03198216637965db0b60e01b1480610cce57506301ffc9a760e01b6001600160e01b0319831614610cce565b6001600160a01b038316611faf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016109e7565b6001600160a01b0382166120105760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016109e7565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006001600160ff1b038211156120db5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b60648201526084016109e7565b5090565b6000808212156120db5760405162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f73697469766560448201526064016109e7565b60405162461bcd60e51b815260206004820152601060248201526f4e4f4e5f5452414e5346455241424c4560801b60448201526064016109e7565b612176828261147c565b610f635761218e816001600160a01b03166014612a7b565b612199836020612a7b565b6040516020016121aa9291906139ce565b60408051601f198184030181529082905262461bcd60e51b82526109e791600401613aaa565b6121da8282611e1a565b6000828152600d60205260409020610ed59082611ea0565b6000306001600160a01b037f0000000000000000000000000d66bd5197a4758ed4d1140cda10d35d76efcc921614801561224b57507f000000000000000000000000000000000000000000000000000000000000000146145b1561227557507f929d7f0060a3bb17e04ad673be6fb3037c6104baff44311150eb8da635b1ff3590565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f65a9df027e2c4a847f4cc5cae09c90cf6887476fff74a16dd39ee8982bf750d4828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6123238282612c17565b6000828152600d60205260409020610ed59082612c7e565b8154600090815b8181101561239f5760006123568284612c93565b90508486828154811061236b5761236b613d5a565b60009182526020909120015463ffffffff16111561238b57809250612399565b612396816001613b1e565b91505b50612342565b81156123e357846123b1600184613c28565b815481106123c1576123c1613d5a565b60009182526020909120015464010000000090046001600160e01b03166123e6565b60005b6001600160e01b031695945050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526124309085906323b872dd60e01b90608401611de3565b50505050565b60006124647f000000000000000000000000000000000000000000000000000003bc00000dfd63ffffffff16565b9050600081116124dc5760405162461bcd60e51b815260206004820152603e60248201527f4162737472616374526577617264732e5f64697374726962757465526577617260448201527f64733a20746f74616c20736861726520737570706c79206973207a65726f000060648201526084016109e7565b8115610f6357806124f46001600160801b0384613c09565b6124fe9190613b62565b60095461250b9190613b1e565b60095560405182815233907fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece0869060200160405180910390a25050565b6001600160a01b038281166000908152600660205260408120549091169061256e84611083565b6001600160a01b0385811660008181526006602052604080822080546001600160a01b031916898616908117909155905194955093928616927f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4612430828483612cae565b600063ffffffff8211156120db5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201526532206269747360d01b60648201526084016109e7565b600081831061264a5781610ea8565b5090919050565b60008183101561264a5781610ea8565b61266b8282612deb565b610f638261267883612071565b611ee390613cfb565b6000610ea88383612e75565b6000610cce61269a6121f2565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006126ec87878787612e9f565b915091506126f981612f8c565b5095945050505050565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b6000610cce825490565b6000806127418361109e565b90508015610cce576001600160a01b0383166000908152600b602052604090205461276d908290613b1e565b6001600160a01b0384166000818152600b6020526040908190209290925590517f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e503161906127bc9084815260200190565b60405180910390a292915050565b600061281f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611eb59092919063ffffffff16565b805190915015610ed5578080602001905181019061283d91906138ba565b610ed55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109e7565b60008181526001830160205260408120546128e357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cce565b506000610cce565b60608247101561294c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109e7565b843b61299a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109e7565b600080866001600160a01b031685876040516129b691906139b2565b60006040518083038185875af1925050503d80600081146129f3576040519150601f19603f3d011682016040523d82523d6000602084013e6129f8565b606091505b5091509150612a08828286613147565b979650505050505050565b612a1d8282613180565b61243060086132d5836132e1565b600954612a389082613b84565b6001600160a01b0383166000908152600a6020526040902054612a5b9190613add565b6001600160a01b039092166000908152600a602052604090209190915550565b60606000612a8a836002613c09565b612a95906002613b1e565b67ffffffffffffffff811115612aad57612aad613d70565b6040519080825280601f01601f191660200182016040528015612ad7576020820181803683370190505b509050600360fc1b81600081518110612af257612af2613d5a565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612b2157612b21613d5a565b60200101906001600160f81b031916908160001a9053506000612b45846002613c09565b612b50906001613b1e565b90505b6001811115612bc8576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612b8457612b84613d5a565b1a60f81b828281518110612b9a57612b9a613d5a565b60200101906001600160f81b031916908160001a90535060049490941c93612bc181613c94565b9050612b53565b508315610ea85760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e7565b612c21828261147c565b15610f63576000828152600c602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610ea8836001600160a01b03841661345a565b6000612ca26002848418613b62565b610ea890848416613b1e565b816001600160a01b0316836001600160a01b031614158015612cd05750600081115b15610ed5576001600160a01b03831615612d5e576001600160a01b03831660009081526007602052604081208190612d0b906132d5856132e1565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612d53929190918252602082015260400190565b60405180910390a250505b6001600160a01b03821615610ed5576001600160a01b03821660009081526007602052604081208190612d949061354d856132e1565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051612ddc929190918252602082015260400190565b60405180910390a25050505050565b612df58282613559565b6002546001600160e01b031015612e675760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201526f766572666c6f77696e6720766f74657360801b60648201526084016109e7565b612430600861354d836132e1565b6000826000018281548110612e8c57612e8c613d5a565b9060005260206000200154905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612ed65750600090506003612f83565b8460ff16601b14158015612eee57508460ff16601c14155b15612eff5750600090506004612f83565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612f53573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612f7c57600060019250925050612f83565b9150600090505b94509492505050565b6000816004811115612fa057612fa0613d2e565b1415612fa95750565b6001816004811115612fbd57612fbd613d2e565b141561300b5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016109e7565b600281600481111561301f5761301f613d2e565b141561306d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016109e7565b600381600481111561308157613081613d2e565b14156130da5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016109e7565b60048160048111156130ee576130ee613d2e565b14156110545760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016109e7565b60608315613156575081610ea8565b8251156131665782518084602001fd5b8160405162461bcd60e51b81526004016109e79190613aaa565b6001600160a01b0382166131e05760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016109e7565b6001600160a01b038216600090815260208190526040902054818110156132545760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016109e7565b6001600160a01b0383166000908152602081905260408120838303905560028054849290613283908490613c28565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3610ed58360008461363c565b6000610ea88284613c28565b82546000908190801561332c57856132fa600183613c28565b8154811061330a5761330a613d5a565b60009182526020909120015464010000000090046001600160e01b031661332f565b60005b6001600160e01b0316925061334883858763ffffffff16565b915060008111801561338657504386613362600184613c28565b8154811061337257613372613d5a565b60009182526020909120015463ffffffff16145b156133e6576133948261366e565b866133a0600184613c28565b815481106133b0576133b0613d5a565b9060005260206000200160000160046101000a8154816001600160e01b0302191690836001600160e01b03160217905550613451565b8560405180604001604052806133fb436125d6565b63ffffffff16815260200161340f8561366e565b6001600160e01b0390811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b50935093915050565b6000818152600183016020526040812054801561354357600061347e600183613c28565b855490915060009061349290600190613c28565b90508181146134f75760008660000182815481106134b2576134b2613d5a565b90600052602060002001549050808760000184815481106134d5576134d5613d5a565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061350857613508613d44565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610cce565b6000915050610cce565b6000610ea88284613b1e565b6001600160a01b0382166135af5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016109e7565b80600260008282546135c19190613b1e565b90915550506001600160a01b038216600090815260208190526040812080548392906135ee908490613b1e565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3610f63600083835b6001600160a01b03838116600090815260066020526040808220548584168352912054610ed592918216911683612cae565b60006001600160e01b038211156120db5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20326044820152663234206269747360c81b60648201526084016109e7565b80356001600160a01b03811681146136ee57600080fd5b919050565b803560ff811681146136ee57600080fd5b60006020828403121561371657600080fd5b610ea8826136d7565b6000806040838503121561373257600080fd5b61373b836136d7565b9150613749602084016136d7565b90509250929050565b60008060006060848603121561376757600080fd5b613770846136d7565b925061377e602085016136d7565b9150604084013590509250925092565b600080600080600080600060e0888a0312156137a957600080fd5b6137b2886136d7565b96506137c0602089016136d7565b955060408801359450606088013593506137dc608089016136f3565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561380b57600080fd5b613814836136d7565b946020939093013593505050565b60008060008060008060c0878903121561383b57600080fd5b613844876136d7565b95506020870135945060408701359350613860606088016136f3565b92506080870135915060a087013590509295509295509295565b6000806040838503121561388d57600080fd5b613896836136d7565b9150602083013563ffffffff811681146138af57600080fd5b809150509250929050565b6000602082840312156138cc57600080fd5b81518015158114610ea857600080fd5b6000602082840312156138ee57600080fd5b5035919050565b6000806040838503121561390857600080fd5b82359150613749602084016136d7565b6000806040838503121561392b57600080fd5b50508035926020909101359150565b60006020828403121561394c57600080fd5b81356001600160e01b031981168114610ea857600080fd5b60006020828403121561397657600080fd5b5051919050565b60008060006060848603121561399257600080fd5b83359250602084013591506139a9604085016136d7565b90509250925092565b600082516139c4818460208701613c68565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613a06816017850160208801613c68565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613a37816028840160208801613c68565b01602801949350505050565b602080825282518282018190526000919060409081850190868401855b82811015613a9d578151805185528681015167ffffffffffffffff9081168887015290860151168585015260609093019290850190600101613a60565b5091979650505050505050565b6020815260008251806020840152613ac9816040850160208701613c68565b601f01601f19169190910160400192915050565b600080821280156001600160ff1b0384900385131615613aff57613aff613d18565b600160ff1b8390038412811615613b1857613b18613d18565b50500190565b60008219821115613b3157613b31613d18565b500190565b600067ffffffffffffffff808316818516808303821115613b5957613b59613d18565b01949350505050565b600082613b7f57634e487b7160e01b600052601260045260246000fd5b500490565b60006001600160ff1b0381841382841380821686840486111615613baa57613baa613d18565b600160ff1b6000871282811687830589121615613bc957613bc9613d18565b60008712925087820587128484161615613be557613be5613d18565b87850587128184161615613bfb57613bfb613d18565b505050929093029392505050565b6000816000190483118215151615613c2357613c23613d18565b500290565b600082821015613c3a57613c3a613d18565b500390565b600067ffffffffffffffff83811690831681811015613c6057613c60613d18565b039392505050565b60005b83811015613c83578181015183820152602001613c6b565b838111156124305750506000910152565b600081613ca357613ca3613d18565b506000190190565b600181811c90821680613cbf57607f821691505b6020821081141561272557634e487b7160e01b600052602260045260246000fd5b6000600019821415613cf457613cf4613d18565b5060010190565b6000600160ff1b821415613d1157613d11613d18565b5060000390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220a6616c3240b3dac7a93ebed55d9e0242bfffdb8e766bb4ac809fbb341691f1cf64736f6c63430008070033

Verified Source Code Partial Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: Yes (200 runs)
TimeLockNonTransferablePool.sol 3248 lines
// File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol


// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

// File: @openzeppelin/contracts/utils/introspection/IERC165.sol


// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// File: @openzeppelin/contracts/utils/introspection/ERC165.sol


// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;


/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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


// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

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


// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;


/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

// File: contracts/interfaces/IAbstractRewards.sol


pragma solidity 0.8.7;

interface IAbstractRewards {
	/**
	 * @dev Returns the total amount of rewards a given address is able to withdraw.
	 * @param account Address of a reward recipient
	 * @return A uint256 representing the rewards `account` can withdraw
	 */
	function withdrawableRewardsOf(address account) external view returns (uint256);

  /**
	 * @dev View the amount of funds that an address has withdrawn.
	 * @param account The address of a token holder.
	 * @return The amount of funds that `account` has withdrawn.
	 */
	function withdrawnRewardsOf(address account) external view returns (uint256);

	/**
	 * @dev View the amount of funds that an address has earned in total.
	 * accumulativeFundsOf(account) = withdrawableRewardsOf(account) + withdrawnRewardsOf(account)
	 * = (pointsPerShare * balanceOf(account) + pointsCorrection[account]) / POINTS_MULTIPLIER
	 * @param account The address of a token holder.
	 * @return The amount of funds that `account` has earned in total.
	 */
	function cumulativeRewardsOf(address account) external view returns (uint256);

	/**
	 * @dev This event emits when new funds are distributed
	 * @param by the address of the sender who distributed funds
	 * @param rewardsDistributed the amount of funds received for distribution
	 */
	event RewardsDistributed(address indexed by, uint256 rewardsDistributed);

	/**
	 * @dev This event emits when distributed funds are withdrawn by a token holder.
	 * @param by the address of the receiver of funds
	 * @param fundsWithdrawn the amount of funds that were withdrawn
	 */
	event RewardsWithdrawn(address indexed by, uint256 fundsWithdrawn);
}
// File: contracts/interfaces/ITimeLockPool.sol


pragma solidity 0.8.7;
interface ITimeLockPool {
    function deposit(uint256 _amount, uint256 _duration, address _receiver) external;
}
// File: contracts/interfaces/IBasePool.sol


pragma solidity 0.8.7;
interface IBasePool {
    function distributeRewards(uint256 _amount) external;
}


// File: @openzeppelin/contracts/utils/math/SafeCast.sol


// OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol)

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

// File: contracts/base/AbstractRewards.sol


pragma solidity 0.8.7;



/**
 * @dev Based on: https://github.com/indexed-finance/dividends/blob/master/contracts/base/AbstractDividends.sol
 * Renamed dividends to rewards.
 * @dev (OLD) Many functions in this contract were taken from this repository:
 * https://github.com/atpar/funds-distribution-token/blob/master/contracts/FundsDistributionToken.sol
 * which is an example implementation of ERC 2222, the draft for which can be found at
 * https://github.com/atpar/funds-distribution-token/blob/master/EIP-DRAFT.md
 *
 * This contract has been substantially modified from the original and does not comply with ERC 2222.
 * Many functions were renamed as "rewards" rather than "funds" and the core functionality was separated
 * into this abstract contract which can be inherited by anything tracking ownership of reward shares.
 */
abstract contract AbstractRewards is IAbstractRewards {
  using SafeCast for uint128;
  using SafeCast for uint256;
  using SafeCast for int256;

/* ========  Constants  ======== */
  uint128 public constant POINTS_MULTIPLIER = type(uint128).max;

/* ========  Internal Function References  ======== */
  function(address) view returns (uint256) private immutable getSharesOf;
  function() view returns (uint256) private immutable getTotalShares;

/* ========  Storage  ======== */
  uint256 public pointsPerShare;
  mapping(address => int256) public pointsCorrection;
  mapping(address => uint256) public withdrawnRewards;

  constructor(
    function(address) view returns (uint256) getSharesOf_,
    function() view returns (uint256) getTotalShares_
  ) {
    getSharesOf = getSharesOf_;
    getTotalShares = getTotalShares_;
  }

/* ========  Public View Functions  ======== */
  /**
   * @dev Returns the total amount of rewards a given address is able to withdraw.
   * @param _account Address of a reward recipient
   * @return A uint256 representing the rewards `account` can withdraw
   */
  function withdrawableRewardsOf(address _account) public view override returns (uint256) {
    return cumulativeRewardsOf(_account) - withdrawnRewards[_account];
  }

  /**
   * @notice View the amount of rewards that an address has withdrawn.
   * @param _account The address of a token holder.
   * @return The amount of rewards that `account` has withdrawn.
   */
  function withdrawnRewardsOf(address _account) public view override returns (uint256) {
    return withdrawnRewards[_account];
  }

  /**
   * @notice View the amount of rewards that an address has earned in total.
   * @dev accumulativeFundsOf(account) = withdrawableRewardsOf(account) + withdrawnRewardsOf(account)
   * = (pointsPerShare * balanceOf(account) + pointsCorrection[account]) / POINTS_MULTIPLIER
   * @param _account The address of a token holder.
   * @return The amount of rewards that `account` has earned in total.
   */
  function cumulativeRewardsOf(address _account) public view override returns (uint256) {
    return ((pointsPerShare * getSharesOf(_account)).toInt256() + pointsCorrection[_account]).toUint256() / POINTS_MULTIPLIER;
  }

/* ========  Dividend Utility Functions  ======== */

  /** 
   * @notice Distributes rewards to token holders.
   * @dev It reverts if the total shares is 0.
   * It emits the `RewardsDistributed` event if the amount to distribute is greater than 0.
   * About undistributed rewards:
   *   In each distribution, there is a small amount which does not get distributed,
   *   which is `(amount * POINTS_MULTIPLIER) % totalShares()`.
   *   With a well-chosen `POINTS_MULTIPLIER`, the amount of funds that are not getting
   *   distributed in a distribution can be less than 1 (base unit).
   */
  function _distributeRewards(uint256 _amount) internal {
    uint256 shares = getTotalShares();
    require(shares > 0, "AbstractRewards._distributeRewards: total share supply is zero");

    if (_amount > 0) {
      pointsPerShare = pointsPerShare + (_amount * POINTS_MULTIPLIER / shares);
      emit RewardsDistributed(msg.sender, _amount);
    }
  }

  /**
   * @notice Prepares collection of owed rewards
   * @dev It emits a `RewardsWithdrawn` event if the amount of withdrawn rewards is
   * greater than 0.
   */
  function _prepareCollect(address _account) internal returns (uint256) {
    uint256 _withdrawableDividend = withdrawableRewardsOf(_account);
    if (_withdrawableDividend > 0) {
      withdrawnRewards[_account] = withdrawnRewards[_account] + _withdrawableDividend;
      emit RewardsWithdrawn(_account, _withdrawableDividend);
    }
    return _withdrawableDividend;
  }

  function _correctPointsForTransfer(address _from, address _to, uint256 _shares) internal {
    int256 _magCorrection = (pointsPerShare * _shares).toInt256();
    pointsCorrection[_from] = pointsCorrection[_from] + _magCorrection;
    pointsCorrection[_to] = pointsCorrection[_to] - _magCorrection;
  }

  /**
   * @dev Increases or decreases the points correction for `account` by
   * `shares*pointsPerShare`.
   */
  function _correctPoints(address _account, int256 _shares) internal {
    pointsCorrection[_account] = pointsCorrection[_account] + (_shares * (int256(pointsPerShare)));
  }
}
// File: @openzeppelin/contracts/utils/Counters.sol


// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

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


// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @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: @openzeppelin/contracts/utils/cryptography/ECDSA.sol


// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;


/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

// File: @openzeppelin/contracts/utils/cryptography/draft-EIP712.sol


// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;


/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract...

// [truncated — 115922 bytes total]

Read Contract

DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
DOMAIN_SEPARATOR 0x3644e515 → bytes32
MIN_LOCK_DURATION 0x78b4330f → uint256
POINTS_MULTIPLIER 0x8f2203f6 → uint128
TOKEN_SAVER_ROLE 0x76175b06 → bytes32
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
checkpoints 0xf1127ed8 → tuple
cumulativeRewardsOf 0x10accecc → uint256
decimals 0x313ce567 → uint8
delegates 0x587cde1e → address
depositToken 0xc89039c5 → address
depositsOf 0xae22192e → uint256, uint64, uint64
escrowDuration 0x57c2c2ba → uint256
escrowPool 0x68570e6a → address
escrowPortion 0xd1f52983 → uint256
getDepositsOf 0x804d9426 → tuple[]
getDepositsOfLength 0xb8162dd2 → uint256
getMultiplier 0xadf8252d → uint256
getPastTotalSupply 0x8e539e8c → uint256
getPastVotes 0x3a46b1a8 → uint256
getRoleAdmin 0x248a9ca3 → bytes32
getRoleMember 0x9010d07c → address
getRoleMemberCount 0xca15c873 → uint256
getTotalDeposit 0x857184d1 → uint256
getVotes 0x9ab24eb0 → uint256
hasRole 0x91d14854 → bool
maxBonus 0x54c5b696 → uint256
maxLockDuration 0xa16cdbb1 → uint256
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
numCheckpoints 0x6fcfff45 → uint32
pointsCorrection 0xb182eb91 → int256
pointsPerShare 0x7e245d79 → uint256
rewardToken 0xf7c618c1 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
withdrawableRewardsOf 0x7cd0b5c7 → uint256
withdrawnRewards 0xdd6624e4 → uint256
withdrawnRewardsOf 0x18f9e291 → uint256

Write Contract 16 functions

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

approve 0x095ea7b3
address spender
uint256 amount
returns: bool
claimRewards 0xef5cfb8c
address _receiver
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
delegate 0x5c19a95c
address delegatee
delegateBySig 0xc3cda520
address delegatee
uint256 nonce
uint256 expiry
uint8 v
bytes32 r
bytes32 s
deposit 0x8dbdbe6d
uint256 _amount
uint256 _duration
address _receiver
distributeRewards 0x59974e38
uint256 _amount
grantRole 0x2f2ff15d
bytes32 role
address account
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
permit 0xd505accf
address owner
address spender
uint256 value
uint256 deadline
uint8 v
bytes32 r
bytes32 s
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
saveToken 0x9afdb2c2
address _token
address _receiver
uint256 _amount
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
withdraw 0x00f714ce
uint256 _depositId
address _receiver

Recent Transactions

No transactions found for this address