Search is not available for this dataset
chain_id
uint64 1
1
| block_number
uint64 19.5M
20M
| block_hash
stringlengths 64
64
| transaction_hash
stringlengths 64
64
| deployer_address
stringlengths 40
40
| factory_address
stringlengths 40
40
| contract_address
stringlengths 40
40
| creation_bytecode
stringlengths 0
98.3k
| runtime_bytecode
stringlengths 0
49.2k
| creation_sourcecode
stringlengths 0
976k
|
---|---|---|---|---|---|---|---|---|---|
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | eadb14b1219fbd7e782d9a8f4193eefb15a60cbc4069d2fb420eebeca11ab5da | 3f5024731c03aadd970c37b118abd7aa0ed8d8ff | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 06680f47be0d291768cf2ff5a012a3595eb14dfc | 3d602d80600a3d3981f3363d3d373d3d3d363d7378382fb58c5d5768ba5d3ece8a290d40fe7237d85af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7378382fb58c5d5768ba5d3ece8a290d40fe7237d85af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | c709ccfb55d001eb75777416a522e7f001ff620cd0f10f8542485ab2a3db3e8b | 56384d8d9b29258743502585e52099739d7a1d1e | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 211759a45bd468baf1330bbc5606018931ef51f8 | 3d602d80600a3d3981f3363d3d373d3d3d363d73b9dcd7aa562f7f7a677a75134946e0ec36ea6d2e5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73b9dcd7aa562f7f7a677a75134946e0ec36ea6d2e5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 8bcfad3b46e8f4a867938405affbc72585020081cad688ea7aa3d849fb3366f2 | 2fe0cafe7b51c3517002b97e3213dc6539a692a2 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 573bf8ae3f634e54ded43bb9cfe82c1095906880 | 3d602d80600a3d3981f3363d3d373d3d3d363d73d31ca712a932b14ca22a2699b1f531bc16b279cb5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73d31ca712a932b14ca22a2699b1f531bc16b279cb5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | a63892176c979e7b6a2301147ee9b04e0ca85cdafa0393d420f6cc1373f1745c | 3e9443951e445dd21a91150e7a6f1c46ea10d362 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | d4a04f8703af55ef9ce38aa01a84a6a50bdb7bad | 3d602d80600a3d3981f3363d3d373d3d3d363d73c96933650242379351ad5e32b7bf43a0b820aa5c5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73c96933650242379351ad5e32b7bf43a0b820aa5c5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 3cc30c3210a85c271da1fb0ec8e44b8711f9419dd78e508ccf596f631bc8ba15 | 417deb00af76318e19174b6e9ec175ec3f9ec75b | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | d3a4fb514b5b590a93cd9c5342b5a83156621624 | 3d602d80600a3d3981f3363d3d373d3d3d363d73a20629fece49f2e989f1451fee360a991a38faeb5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73a20629fece49f2e989f1451fee360a991a38faeb5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 891629cb86b1aa957e58d61429ee0d6035df4cfa7cbb8eff3c97a9786f1f82c6 | 8ced4b5ea39134171dd3ff11cc9bc15ccf6b5174 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | fb6cd13cbf107d520785c43a26dae240354aad5b | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | fd500dcf743c5dc99e743dba0d0f8b089f847cf130eb69b15fbe83d672d07ea2 | d05498da967797d1b02e7c37414ea7efde5ed42e | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | e193d9ec1b647e22c9ad415d1da0bbd1438e0404 | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | fae9ac1522fbfa68f25bfdd37b4fd9ebad7d36c0eef8ffd4d56e2f181ccf190d | 5e0f468ed80996f2aa9acf871ec24eaa91aa4c1a | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 8a767435ae43a7909793934fea1f378feaba6185 | 3d602d80600a3d3981f3363d3d373d3d3d363d73dddc4e3949e7c0da66f2e211cac7bce8fa09ff955af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73dddc4e3949e7c0da66f2e211cac7bce8fa09ff955af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | bbb58691a4117c9bc1804ecac33f50515b928d3c045132c722f277abbb61203a | 75c9bef365ec074af52b2e7876bd5f0ce08bfb37 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 283f67cca66fabd1a4a4e11f86cfb5a7e6e29813 | 3d602d80600a3d3981f3363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | e3aa5876a6e4148222f9f5ad3985d19be7180822242cd31f356fb03287bbf988 | 84488a7a7f7673ae94ffc67f82ff821ae8b486a3 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | edc375be22fe59608e28b8fc51d8577d3da6fd48 | 3d602d80600a3d3981f3363d3d373d3d3d363d733af54988df338264a464189eebce1d794f647d635af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d733af54988df338264a464189eebce1d794f647d635af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 1885ea459cdd91166ad2a5ddcf734637748feb4942356864bd2f3532facc62ae | 6e60846a0e55cb16ca6d1793bdb65209f07d912c | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 638bc08f601b69fb0f746ef5238fdb4eb42141e3 | 3d602d80600a3d3981f3363d3d373d3d3d363d73609ae25cfbe7648519db74c17e253a1e7c785d8a5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73609ae25cfbe7648519db74c17e253a1e7c785d8a5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 3745b6825536b0bfbb5bbdbf8098dd535bb1a7f83313deb3b380fd9ad95fd1cf | 34cacab05597469951bafe38d34b2aa1dc0c4d5d | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | f92cef7e2de37eec8821e40614cbbf6508ad7835 | 3d602d80600a3d3981f3363d3d373d3d3d363d731c7e386d840bf92c9942d95e61d74f74e3dc91c55af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d731c7e386d840bf92c9942d95e61d74f74e3dc91c55af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | fb4a0790ef6a3da59e21d6c78308131399d0d21303e8b28648ba78677758c9d1 | f97ab082f4967e596528700eb79a86247cdd67b5 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 7d5432a8fb6038f5cf24ca8e9760ba84626942ba | 3d602d80600a3d3981f3363d3d373d3d3d363d731770515e6cbc148c75c6c0caca421d6a3022d13a5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d731770515e6cbc148c75c6c0caca421d6a3022d13a5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | de59fa13d96212b743f2343e76f8d0da86100230ce5c84e3e89034fa9131f55c | 51da3bc9221268bf060a73386bf2baa185f3a495 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 8463ebde36bfe0f0cb7c2cee7f2dfa48b2b204be | 3d602d80600a3d3981f3363d3d373d3d3d363d73073605508c8ac0f8dfd3c8c4db035e1cde42a3605af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73073605508c8ac0f8dfd3c8c4db035e1cde42a3605af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | dd3f3ed9ae089488ba2ac8d8b8e831bd7d5fee092be00bdf19a65b46afb61b53 | f475b2bed9aa6693d1f7ad290c5546a351c0cee8 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 59ef6f28523ff0a57e25a49f6fe65d2cb755c8e2 | 3d602d80600a3d3981f3363d3d373d3d3d363d73a17b2c4201dfa2dc8d902cbfc9d396e67a0ebfb85af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73a17b2c4201dfa2dc8d902cbfc9d396e67a0ebfb85af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | a968ccf041e4d562fd787caa58d953118b6530698879478d3945466cb0435be7 | 3f8ff6be12338db7b3ec2110112ff118bace6bff | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | f66735f219e4a7e4477b56ed7fffa7ebba95a9e8 | 3d602d80600a3d3981f3363d3d373d3d3d363d730e7d127385be31d6c62f2fd0a0c3df2ed7794e3d5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d730e7d127385be31d6c62f2fd0a0c3df2ed7794e3d5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 1cf43b7ed29649d9dd403f3a8cc3187e4aef08e7002a8ecd85a4aa80047664cb | ef2b3b90ae85fbcb8bdfdbd8f7d9c90cf4864232 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | a90625eba8c1f0837fb1bbef02069806d58b45e1 | 3d602d80600a3d3981f3363d3d373d3d3d363d73efbcc621cf2179c917a3bce529a9e08fe91f61465af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73efbcc621cf2179c917a3bce529a9e08fe91f61465af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | b0856c1d4e7a06a671053de0fed882c73edc01d327ae0b545b396b19b8ef5317 | b34c640c822db769358e772faa94dfd159c75ec2 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 0ba670a6bdedec8e5355799b739ee71c6add81ee | 3d602d80600a3d3981f3363d3d373d3d3d363d73c96933650242379351ad5e32b7bf43a0b820aa5c5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73c96933650242379351ad5e32b7bf43a0b820aa5c5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 023e61a2f3b015b1ed4b00fa94eaa5d6439eac7fe08d0be30aec05bc5d3e55a1 | 17258de6a6f4b1b1775a6fc3fba7cd2c068bc862 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 5ba36d3dbd10a76955109b57fe563f0cd4e00063 | 3d602d80600a3d3981f3363d3d373d3d3d363d73a99bf1a615d0d08f2e0a4795f457fb1e96d000bc5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73a99bf1a615d0d08f2e0a4795f457fb1e96d000bc5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 03216f941886f257c13ba75d691e3439f895d7141fd908eafdab8a852d75141f | f342204a98613d08376238f8fa656def72732014 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | c6b04692c8ade0ad7b9ff16f4ceada2b800bab98 | 3d602d80600a3d3981f3363d3d373d3d3d363d73236a3f9c4868e04d4a6bdc8e0f6d4a34219a82065af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73236a3f9c4868e04d4a6bdc8e0f6d4a34219a82065af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 93731355a96ef854c7ce45ce786f3abbe4cf147af2c04981a058f788b720848a | 1d22fcf3d32b24d4a21c8a27e4e69d59a6215a8f | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 7e333438a20da7280253272567dfdc1023c0d7e0 | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 60f06cb621ee75c3e032eaa27d3470ed37d62a49b95add703dd83764638548c6 | 2f270af2149c92c4d223e7aa9a653962b801feaa | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 85bb7ac874973d8926781810b175ce58de6633a5 | 3d602d80600a3d3981f3363d3d373d3d3d363d73a6f6b1d91694e9a67459112b6508609b143f34c75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73a6f6b1d91694e9a67459112b6508609b143f34c75af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | f57d85c4955be20d8ac61b008f272dd8419169630224f8b04b9445eebb615b7c | 993186f040a406cc377e70320d89275d5ac5f400 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 5a49f8966e1869dc3404016c6dcd206c994da95e | 3d602d80600a3d3981f3363d3d373d3d3d363d733661d0ab4c10c6215787d3db9b0948f00252dcca5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d733661d0ab4c10c6215787d3db9b0948f00252dcca5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 6a7c1df306a5e30c66770d68b421a8bfe7faf4d2163fcfa9cb22cb62413d21ba | 95ba65d707f0b4e0d47da705263c0bb5384bf1ed | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 4bca2958fe98b5013f756c2439fc5bb9cc5f41b7 | 3d602d80600a3d3981f3363d3d373d3d3d363d739b2606c0533c2886159282f02fdd917470bb36945af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739b2606c0533c2886159282f02fdd917470bb36945af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 034c865e5609190300e9e6f18128577ef49cdafc60767a2ea4f84988a1b2e83c | d77995986bb2ebaf0d313c738cf95e3577771d3f | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 36e0f5d793d03001c469862517562ccdd9a966a9 | 3d602d80600a3d3981f3363d3d373d3d3d363d73b1273da0dbc3c4f5eed587f5d467430c3cea60975af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73b1273da0dbc3c4f5eed587f5d467430c3cea60975af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 60f3a79d2a9a58fa8561b52b32187807e733df9a7880a260417c441429725118 | 62fbc384c2677d00d4bd58fccdf0399977fdefe4 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 0b4d780f8a096e4da20a40e570a6c61f930ac152 | 3d602d80600a3d3981f3363d3d373d3d3d363d735810907fcc7393a44e8d9dda8540c6f9248f8a4a5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d735810907fcc7393a44e8d9dda8540c6f9248f8a4a5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 68c59fca8caaebea4cca1717b32c91604bf22285262b4678011ea6f4731c25cb | cbe8134bd55da0e8ec83504ef519bce6bc65280e | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 662efae10b7d19b385986c8e693dfc47402ab635 | 3d602d80600a3d3981f3363d3d373d3d3d363d7378382fb58c5d5768ba5d3ece8a290d40fe7237d85af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7378382fb58c5d5768ba5d3ece8a290d40fe7237d85af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | f36c2fbdd6fab71bae3ea778a35332297ff2d9242abe2adc5a8fd18568439650 | a16d2e90197dd5d3dfc6bf746130c2e96f3279ad | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 07ff16276a361950d3308e11926c4bdebd6f6685 | 3d602d80600a3d3981f3363d3d373d3d3d363d73f02a8258ea60a3e383ebbd9f0c228315ccf1bec05af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73f02a8258ea60a3e383ebbd9f0c228315ccf1bec05af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 3c54286480820b24d775cfdc6cfbe5ff312e247406ce8bc66191ae96ab39523f | 87dda0299a846abd1259681e5785a549d4dad4fb | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 18f620bb73f418ae70cc1604a608eb38d8b3169d | 3d602d80600a3d3981f3363d3d373d3d3d363d739866373f4da648759702b996d4931ad42bb875f85af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739866373f4da648759702b996d4931ad42bb875f85af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 0cc80e5429984727e32f5cf90500033fbd5e9883c854cb61c48fc37c0cc1c8d1 | 95e59f599d5ec771fb0ef6c41faaf03f120d1b1f | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | ba74f6a099e726cd206e9cd0485b5b1e2ee452de | 3d602d80600a3d3981f3363d3d373d3d3d363d733af54988df338264a464189eebce1d794f647d635af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d733af54988df338264a464189eebce1d794f647d635af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | b922feab5696d5508cc596d9f3f287516333fa111f247bfbc7516db329043b75 | 27410480db437cbd47b613f15a44f84e4908f116 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | e37142b0d359f9a5e23417041a03a6d670391aa2 | 3d602d80600a3d3981f3363d3d373d3d3d363d73c8753cbad7ccd967d108beab90a6e2870a11b4925af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73c8753cbad7ccd967d108beab90a6e2870a11b4925af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 7fb218fb83b57b230c78379af9d0b63c1a3bac6bbb936b260608cbaef55fdaed | 9f0f850e8f6efa3072e8c156288ce0f908ab1d91 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 143c07063ed90d5ad738df537b2ba94d0a7765e4 | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 971aeca5e42b29b1056d3f8b30d907c48249e7f48f9e8f720e5975235847fd30 | 538253b102c78c522b6183030ea11610ff906c38 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | cc5a9e3f86220d343aaebfb3807de945d2c3234c | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | b43ae2f5ed579201337d4dad3b48e1b9ac787b6c8904285431d4fbd180c484d7 | 229fbcef452cc728820eebe5dc26158be07ff5dd | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 37a5146ea08d10280227d07c7147890c7e308616 | 3d602d80600a3d3981f3363d3d373d3d3d363d73240318eeabd7c181f0a5b08a6e7addb094ef175e5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73240318eeabd7c181f0a5b08a6e7addb094ef175e5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 538de20d213a6e02dad3d975a0e63e82fccb06f879958de21d28ef9352196c79 | 168775a13f7153f6213eed15f8beecfdc7fae38c | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 8474dc81456a4b78c0e527beba5435bb3e85f3d6 | 3d602d80600a3d3981f3363d3d373d3d3d363d730e7d127385be31d6c62f2fd0a0c3df2ed7794e3d5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d730e7d127385be31d6c62f2fd0a0c3df2ed7794e3d5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 58b3ca4dff707944be23a7ce895e0d600ca94c0d841e1f3fa1c05f59b0e59352 | ccb66b6e4a41551dcbd06c26fbeceecdffb99a6f | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 6d268e832d3a8b4228dc7c295169f9a25453f90e | 3d602d80600a3d3981f3363d3d373d3d3d363d739800aaafbf2f5473b8a28f1f5a069e8a231c407d5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739800aaafbf2f5473b8a28f1f5a069e8a231c407d5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | de1edc8db2f9ea205560fb9eaf0a2c4f191d78d1f2dd70be97640c9662bf8d8d | 2f5bf5641d125ff7b12b4cd327035f3253eefdb4 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 93397dc5636f50e74e9a42cd8cec72a6ae097671 | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 3be097a4eb5009f93720ab1e4251079d408f7a4df49875045645e627c51f00a3 | 07b25b8325664b090c91bee48745c4f0cfad9cba | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 8a621c387951f48f654840e41c7db8c919c2b9fb | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | ba89af6cf3c7ba5d39a1bfa7cbcb95e2ac518bf7e53778fb4c80d2be6a2dbd01 | f013411e9448092857c20c3894d9f1091d17cdcd | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 7c9e298899db3b0e794437b859ccfe629c50092b | 3d602d80600a3d3981f3363d3d373d3d3d363d7378382fb58c5d5768ba5d3ece8a290d40fe7237d85af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7378382fb58c5d5768ba5d3ece8a290d40fe7237d85af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | c071484f0f11d5dad9cad3551c5ff8a20f60d46c755aaa7c5cfbb79359f5724c | 72e3ee1a6d568a5f216eacadd468c2de2e7e48d0 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | ecd4028cb6e24fbab9d122a068f14264fa6dbb71 | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 5170f25def131ca68f4f16fe828822ec1e86f9a724ef2b5dd56a1e67c8152fb0 | 03ae4712558e6f0a409aad2df2406c90fc47b38f | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 4b370641d835cddcb2f9bd7acd0bcc4861ebdc44 | 3d602d80600a3d3981f3363d3d373d3d3d363d731a328845ad1527ab0fe2c0d46ab99e9343e33cbd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d731a328845ad1527ab0fe2c0d46ab99e9343e33cbd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 8b4345e9cf837e03ef667f328a2a04aa6e525b499037a607914b05841861aa15 | 442354a668418a47308c729452349adfd100e493 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 78caebc045f4ec7d08ff455f4ad8b482612a2826 | 3d602d80600a3d3981f3363d3d373d3d3d363d735efda7da02832ef3afa8a79b4a26b1f1d918f2b45af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d735efda7da02832ef3afa8a79b4a26b1f1d918f2b45af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 7c084632d27a94c175dadb78df2c88088f2f273a51074c352752888f003e17f0 | c3b3c2b557b69adf47e14023a85acd62c45a9b97 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | bc6735386e482cc42e9cae9d9ff6cb3bf17a77e2 | 3d602d80600a3d3981f3363d3d373d3d3d363d7353c631f3e1c41ac04b515242bf0c59bede2d459e5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7353c631f3e1c41ac04b515242bf0c59bede2d459e5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 88d624beaa0087e911da8045d593345ac1ddd784d6cbdc7b082766fcbd3f9ddf | 7a5034c669cbd7cc5a33c22db1106f531af3988e | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 243caf9f0a71061f5cb8aada4e85b569df03cefb | 3d602d80600a3d3981f3363d3d373d3d3d363d73ce2cfadebbbf7b8920b99dbfad9aa5d145b8bba55af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73ce2cfadebbbf7b8920b99dbfad9aa5d145b8bba55af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 445625d10908bdbc940f55b9427bdab088b5bf1b9174829536d1016f9f7556d1 | 86b0c3841c6956aff47f3b65cf1c15c6beab36fa | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 00c2bfa3507a181b23a955946a3d36edef9de91d | 3d602d80600a3d3981f3363d3d373d3d3d363d73df91a7b07accf740181b95f1ae408b5f15b0b51a5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73df91a7b07accf740181b95f1ae408b5f15b0b51a5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | ceb2d62eb791d944d01da92cf1c89e0c18f9f11ae0d12c63c647d8ddbce777d3 | a4c1ab1aec2a6b50525770d906f524e6e87d08f7 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 6a8cfb7cfa506a4b3c7b8ce03fce325edc7aaf86 | 3d602d80600a3d3981f3363d3d373d3d3d363d7318d2c3748fb735054f5cf860e4eae69aa38064285af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7318d2c3748fb735054f5cf860e4eae69aa38064285af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 0dd11b4aa9264afbd0b8e299936c27452d62382abe749166a08a7c7d349e7fb0 | 2ca1d870d73f48bffaa9887597f63b67d9198479 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 91aefa158d1cfd21b3013f86e8944e42a46a8d78 | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 2ab70d3febed459b7a3a7373def690eb50a285ab370278118362312c7f7196fe | 1fafa7c7fd13a9bfbaf5c2b706c60cc39246d34a | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | ce27edb0ccbdcfa89974bed2964ac1aae26bf351 | 3d602d80600a3d3981f3363d3d373d3d3d363d73a99bf1a615d0d08f2e0a4795f457fb1e96d000bc5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73a99bf1a615d0d08f2e0a4795f457fb1e96d000bc5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 8c8920c677c24c1267521bd2b6c3541629257b2043ada7e8eb0786ac9c2dff1a | c769e40c97db46e0eeb0640276e186acb5f41fa8 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 7d25b4f0fc026c0dc34a9e8db6dec8157b4d471c | 3d602d80600a3d3981f3363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 198091182fac5fa4f1ac4f3dffdb3f461c39b2c7aa1f3fa2bea98f05899dc075 | fd2d62a37ed6ea6ace403bea360c94259391a7c2 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 637729140edd5c2962aa3123d27d44a5c0a185a2 | 3d602d80600a3d3981f3363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | a758220937e95a1ad2b88bba0566650b0d3677b12992a2fd2826c000bf3e2732 | 28d6524b604a036c1718aca489d448bf2b00a612 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 0b81cee59ea393fddab693f0e18289384990a385 | 3d602d80600a3d3981f3363d3d373d3d3d363d736277236576e51621b98eb02b20a85eef7db245985af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d736277236576e51621b98eb02b20a85eef7db245985af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | e985fe8ea3491236238a5ac5c9960be675cbfe66641fec711f6347fa68422d22 | b0badfab155b935683f4db6f1fe89dae9e5ce499 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | b1e05505bbc849079da368854829897c3a6b2587 | 3d602d80600a3d3981f3363d3d373d3d3d363d734e0a726d2a4a61471eb90b0ebe1a66e9c1e65cbd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d734e0a726d2a4a61471eb90b0ebe1a66e9c1e65cbd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | b0d451a072af940a786158533d3e73e2e3061099c7969ae29e2cfd555cc5279b | d77d6f3a6f36d5a6bdb8aa7e9ae647ff42508ffe | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 80d65b3189f6e4b6c0d2ed7bcffcff0fad2329a1 | 3d602d80600a3d3981f3363d3d373d3d3d363d73f1513d0f2869627e8a8d6e9508553f1ce387819f5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73f1513d0f2869627e8a8d6e9508553f1ce387819f5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 141d352a305a041e12bdb3a5910c8358e141cd955e501ccedcbcf79b133bd59e | e9dd218a5cc900412fd746c7cc54d31ce4b2e4b8 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | bce406535bf2a8e5fc196d63465b013ed8e0b99e | 3d602d80600a3d3981f3363d3d373d3d3d363d73c3260faa0d846229566e5a43869f563b8070e60e5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73c3260faa0d846229566e5a43869f563b8070e60e5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 18d310d3c1c7784d8118a7ee52fd5e952a9db3eaf1c8c2fd09b71662016bb064 | 2a1b5d8b4cb7f28fa11411a2db57f79748e3d5bc | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 6cf9c62908b044f6a32257d396b311971db41319 | 3d602d80600a3d3981f3363d3d373d3d3d363d73f1513d0f2869627e8a8d6e9508553f1ce387819f5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73f1513d0f2869627e8a8d6e9508553f1ce387819f5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | a66051e24d896bd2a6d8ed973d4b54e5c7b9f0a9bc272456f321053be3f69cf9 | 14bdeec831cad93b562e7a24543d512a2ddffac3 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 25fefc619707922cd303765b989e503e9bc223eb | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | d5a0927ce09ad64c72e19cb58ac8fa1b7a75617c368d010efc860bb1273a5bff | 3b49a57d00bb106df4f773ea48fe33e1d635a9c5 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 18298eb084aeaee5dcd78dbb4360a84485912f9a | 3d602d80600a3d3981f3363d3d373d3d3d363d73609ae25cfbe7648519db74c17e253a1e7c785d8a5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73609ae25cfbe7648519db74c17e253a1e7c785d8a5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 628fab96d6b47480cc0db32baa942a8200688138a5da2552df98694c6a44a042 | 4ebe7baed86537f08eb88899b23f585c8791c10f | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 9df9ae69d2ae87626a30c6e3b4e8a38a2abc6129 | 3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | 8ccfab37e7125b1acb4835f0756b0fa6d893a609f087cdf84ec000bfa8627bcc | 8bbd8035fe0d1a81ea45ab14d1c7017481caad8e | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 14c8233223ec12b2892884308afc50b15e501a37 | 3d602d80600a3d3981f3363d3d373d3d3d363d73ef03e99d5261e4239861493c3f60b6f7553f0cf65af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73ef03e99d5261e4239861493c3f60b6f7553f0cf65af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | c107f3ef3c334333266b6ff3ff24c7fecfded3bc89e527a73f160d94cda2dfa2 | 491f0e250d01ffb6232eb88f7be01c80272271d7 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 3f65073ccab475fc1c8c99a53ca68f42d03b6aa1 | 3d602d80600a3d3981f3363d3d373d3d3d363d73046c290be3683f28a457e64393e6a119b28e88335af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73046c290be3683f28a457e64393e6a119b28e88335af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | afeac3d6f07d30cfec1f3f78eb8007d102cfa8db15bbd5cc52fcca889091f94e | 051b71d7f36d6ef23bf3c102d24641ea86242dbb | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 2ea0826738095025cab4b6c3f32d1f0692d204b0 | 3d602d80600a3d3981f3363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,140 | 4529f1fc3d7d2306802165aa6e824a0dbea8790834a62b00c1ad1bdde664a9e0 | b5779a850a68081f593159f9f8b776d18cf31aed17dd8a10dda3b297460dab7f | 4041a3f61a1e453402d584da99b6d6d8abe6c75e | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 573c08278ac96ffe3fb39609f788fc84c166e7fc | 3d602d80600a3d3981f3363d3d373d3d3d363d730e7d127385be31d6c62f2fd0a0c3df2ed7794e3d5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d730e7d127385be31d6c62f2fd0a0c3df2ed7794e3d5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 27e0f02a43212baf3bfc1c73179c299e802e55e7801a0330e3a5f79a55339860 | a9a0b8a5e1adca0caccc63a168f053cd3be30808 | 01cd62ed13d0b666e2a10d13879a763dfd1dab99 | 053afc3bd00b3881a56b4548a74acff23be218b2 | 3d602d80600a3d3981f3363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | fc9ad794b39d8bf2a43d113c9f1622ad09bfa08e235033f5c7663a206dc85cae | 4a7395c34d0df55827d948b3a9e7e5e508b9cb3b | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 07f9aee0be3dbd7423dd5e344103e2a9bb1de1b3 | 3d602d80600a3d3981f3363d3d373d3d3d363d73f22e106f6a491ca790bbcefc2e8a9d64b6506ba35af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73f22e106f6a491ca790bbcefc2e8a9d64b6506ba35af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 07e622666f4453d04d8a0a30c9968cbe60e43b1afc84ab1b596d2482e7b502a0 | 73d7dc5e44f34eff4fbaa3a2158dfffd96cb59e7 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | d5de188c7a40a3289f0d1b322972d1aebc534439 | 3d602d80600a3d3981f3363d3d373d3d3d363d730e4986cf2421441e3529c797ed04e3e87e2a01155af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d730e4986cf2421441e3529c797ed04e3e87e2a01155af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 209fa01c122ecd3377862e26660ac6da91675ab67975b77523791cbcfe286825 | 1d595d595469aa66ee84039ec40c2b70868d36f4 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 1318a8b4c1c6dfa57fb93777ae02a8bbdfad7711 | 3d602d80600a3d3981f3363d3d373d3d3d363d7387e55a70424b450a71718e412cf8b75830b7dd025af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7387e55a70424b450a71718e412cf8b75830b7dd025af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 46c56c070e4c87aa7c4e93e19aa896cb0d2074c656647c4b06a51fd81fd0cfd5 | 6bd6894761b2fa3a5064deb7de7afb758c2fbbf6 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | be75d5f167e1547c0b752305f4aa2f4aa27e74d4 | 3d602d80600a3d3981f3363d3d373d3d3d363d73182c60dfea1c336729a97caecf27ee54c0e4febf5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73182c60dfea1c336729a97caecf27ee54c0e4febf5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 9cb39eb39dc3a931214a305bc90067d718c068f96ffc09504470540833dd2b32 | 3353e94f088cec9467135a15d72e6c7983985375 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 77505c9bca8a920f70dcf59eb030ac2434dd7e3f | 3d602d80600a3d3981f3363d3d373d3d3d363d73b1273da0dbc3c4f5eed587f5d467430c3cea60975af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73b1273da0dbc3c4f5eed587f5d467430c3cea60975af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 44f3d07895aa08959c1311d03c53573262cf4139101bb597a7b3b891a856cb42 | b0b0012e63470a86b8065ef06c61f4e4b68ce62b | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 748e1268e11ed73baaf5f54c855338f787d4f6fb | 3d602d80600a3d3981f3363d3d373d3d3d363d73ebd061906551f78d184b27426bd79b05953a3cef5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73ebd061906551f78d184b27426bd79b05953a3cef5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | d014079b6c44bc3fa5538fef8237908752d6711e92f940cbf741cb3f21278267 | 57641ae3ca656b27cbac3cb03d1768c0f9b56e7a | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 643773a38eb7f07949e26ccb43abe4bb51033c38 | 3d602d80600a3d3981f3363d3d373d3d3d363d73044c7d8d7da3d5252530dcf89c050cf4d305f4cd5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73044c7d8d7da3d5252530dcf89c050cf4d305f4cd5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 7179e9be21a467b3f5ebd31519fe1a60ca19b8b282a13936e3cb6cfb3afdbf27 | 91071bb13fe9ed85e58c585a6d0b027517061014 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 8aedfe12710c8f60e960a2ba944efaa1a529ba21 | 3d602d80600a3d3981f3363d3d373d3d3d363d734b53e66815edc42716abc2f52a9aa2d18e5edbe85af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d734b53e66815edc42716abc2f52a9aa2d18e5edbe85af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 17fedcee972fddde6b38f1f9e2e594237ee28d8635ac16ef435ed82990b7c88f | 272286ed3963380d9e6342845d9385d7f672a54c | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 2d353128e276f9b50e2fd41fa6f74f94e900327d | 3d602d80600a3d3981f3363d3d373d3d3d363d73ce2cfadebbbf7b8920b99dbfad9aa5d145b8bba55af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73ce2cfadebbbf7b8920b99dbfad9aa5d145b8bba55af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,145 | f1c563f7d41462c53dfbff1fb58684d54c2db1036d3a4e4f87b7ec05dc44f819 | 8e507ae154c4c176a1c60bbdf113333ce078cedc448db8b4e48e45b909663c2b | 628f75f0fab3ae6bffab32dbdf88f422b9837782 | 881d4032abe4188e2237efcd27ab435e81fc6bb1 | 1ed0ebbdc7dc7641ab05eeb066dec98f172300d5 | 3d602d80600a3d3981f3363d3d373d3d3d363d73270822c788ad0499a1dab97b078d5880e5350c625af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73270822c788ad0499a1dab97b078d5880e5350c625af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,147 | 57e70e1a76fab763b2e680d1e2eee6d7fda4f073e5f01046f87fe14dffc68778 | 77f69625284911840d98232e89a634a27e05ac0965ecb81fef7de9a8e4d493a7 | 00bdb5699745f5b860228c8f939abf1b9ae374ed | ffa397285ce46fb78c588a9e993286aac68c37cd | f5ef187a163da2580e054b9b0f589f157d91c510 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,147 | 57e70e1a76fab763b2e680d1e2eee6d7fda4f073e5f01046f87fe14dffc68778 | 055b6dd359aa5386de6e4e2b3aa45c7981c627d2f24e7026c27fa1e5b7ae32e9 | 00bdb5699745f5b860228c8f939abf1b9ae374ed | ffa397285ce46fb78c588a9e993286aac68c37cd | 0d8eacefde8214d5e45a475b31a61e58a6516398 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,148 | d900270f988eba8f32fe7b1a1182c740e9c753f9d7e52d7de94e73bf378f4714 | 388b05a5eba0502d4d5cdf85afd68c4d7dfe9013ec34f1f49abeca2b407d5ae5 | 8bf0c74d5810c9611e435c21b3eedfb47158f027 | 115934131916c8b277dd010ee02de363c09d037c | 0124634e7a6325babbbe39fed7d7f9a6bce2c88f | 60806040526001600f5534801561001557600080fd5b50604080518082018252601281527129b434b130a9bbb0b8102628102a37b5b2b760711b6020918201528151808301835260018152603160f81b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818301527f02ec6135c0effd6344c1d59f3fe7c85b41f59a70843703824e29619d57cdf3e0818401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a0808301919091528351808303909101815260c09091019092528151910120600355600580546001600160a01b0319163317905561299e806101106000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80637464fc3d1161010f578063c45a0155116100a2578063db1d0fd511610071578063db1d0fd5146105f4578063dd62ed3e146105fc578063fc061a4f1461062a578063fff6cae914610653576101e5565b8063c45a015514610551578063d13f90b414610559578063d21220a71461059b578063d505accf146105a3576101e5565b80639faa3c91116100de5780639faa3c91146104ef578063a9059cbb146104f7578063ba9a7a5614610523578063bc25cf771461052b576101e5565b80637464fc3d1461047a5780637ecebe001461048257806389afcb44146104a857806395d89b41146104e7576101e5565b806323b872dd116101875780635909c0d5116101565780635909c0d51461041e5780635a3d5493146104265780636a6278421461042e57806370a0823114610454576101e5565b806323b872dd146103ba57806330adf81f146103f0578063313ce567146103f85780633644e51514610416576101e5565b8063095ea7b3116101c3578063095ea7b3146103345780630dfe16811461037457806318160ddd146103985780631df4ccfc146103b2576101e5565b8063022c0d9f146101ea57806306fdde03146102785780630902f1ac146102f5575b600080fd5b6102766004803603608081101561020057600080fd5b8135916020810135916001600160a01b03604083013516919081019060808101606082013564010000000081111561023757600080fd5b82018360208201111561024957600080fd5b8035906020019184600183028401116401000000008311171561026b57600080fd5b50909250905061065b565b005b610280610bcd565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102ba5781810151838201526020016102a2565b50505050905090810190601f1680156102e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102fd610c06565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b6103606004803603604081101561034a57600080fd5b506001600160a01b038135169060200135610c5b565b604080519115158252519081900360200190f35b61037c610c72565b604080516001600160a01b039092168252519081900360200190f35b6103a0610c81565b60408051918252519081900360200190f35b6103a0610c87565b610360600480360360608110156103d057600080fd5b506001600160a01b03813581169160208101359091169060400135610c8d565b6103a0610d3f565b610400610d63565b6040805160ff9092168252519081900360200190f35b6103a0610d68565b6103a0610d6e565b6103a0610d74565b6103a06004803603602081101561044457600080fd5b50356001600160a01b0316610d7a565b6103a06004803603602081101561046a57600080fd5b50356001600160a01b0316611276565b6103a0611288565b6103a06004803603602081101561049857600080fd5b50356001600160a01b031661128e565b6104ce600480360360208110156104be57600080fd5b50356001600160a01b03166112a0565b6040805192835260208301919091528051918290030190f35b610280611652565b6103a061168b565b6103606004803603604081101561050d57600080fd5b506001600160a01b038135169060200135611691565b6103a061169e565b6102766004803603602081101561054157600080fd5b50356001600160a01b03166116a4565b61037c611837565b610276600480360360a081101561056f57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060800135611846565b61037c6119cd565b610276600480360360e08110156105b957600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c001356119dc565b6103a0611c04565b6103a06004803603604081101561061257600080fd5b506001600160a01b0381358116916020013516611c0a565b6102766004803603606081101561064057600080fd5b5080359060208101359060400135611c27565b610276611cda565b600f546001146106b2576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f55841515806106c55750600084115b6107005760405162461bcd60e51b815260040180806020018281038252602581526020018061284f6025913960400191505060405180910390fd5b60008061070b610c06565b5091509150816dffffffffffffffffffffffffffff168710801561073e5750806dffffffffffffffffffffffffffff1686105b6107795760405162461bcd60e51b81526004018080602001828103825260218152602001806128986021913960400191505060405180910390fd5b60065460075460009182916001600160a01b039182169190811690891682148015906107b75750806001600160a01b0316896001600160a01b031614155b610808576040805162461bcd60e51b815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a1561081957610819828a8d611e5a565b891561082a5761082a818a8c611e5a565b86156108dc57886001600160a01b03166310d1e85c338d8d8c8c6040518663ffffffff1660e01b815260040180866001600160a01b03168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b505050505b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561092257600080fd5b505afa158015610936573d6000803e3d6000fd5b505050506040513d602081101561094c57600080fd5b5051604080516370a0823160e01b815230600482015290519195506001600160a01b038316916370a0823191602480820192602092909190829003018186803b15801561099857600080fd5b505afa1580156109ac573d6000803e3d6000fd5b505050506040513d60208110156109c257600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a900383116109ec576000610a02565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610a26576000610a3c565b89856dffffffffffffffffffffffffffff160383035b90506000821180610a4d5750600081115b610a885760405162461bcd60e51b81526004018080602001828103825260248152602001806128746024913960400191505060405180910390fd5b6000610ab4610aa2600c548561202290919063ffffffff16565b610aae876103e8612022565b9061208e565b90506000610ad0610aa2600c548561202290919063ffffffff16565b9050610afc620f4240610af66dffffffffffffffffffffffffffff8b8116908b16612022565b90612022565b610b068383612022565b1015610b59576040805162461bcd60e51b815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610b67848488886120e6565b60408051838152602081018390528082018d9052606081018c905290516001600160a01b038b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600f55505050505050505050565b6040518060400160405280601281526020017f536869626153776170204c5020546f6b656e000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610c68338484612382565b5060015b92915050565b6006546001600160a01b031681565b60005481565b600c5481565b6001600160a01b03831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610d2a576001600160a01b0384166000908152600260209081526040808320338452909152902054610d05908361208e565b6001600160a01b03851660009081526002602090815260408083203384529091529020555b610d358484846123e4565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60095481565b600a5481565b6000600f54600114610dd3576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f81905580610de3610c06565b50600654604080516370a0823160e01b815230600482015290519395509193506000926001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015610e3757600080fd5b505afa158015610e4b573d6000803e3d6000fd5b505050506040513d6020811015610e6157600080fd5b5051600754604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610eb457600080fd5b505afa158015610ec8573d6000803e3d6000fd5b505050506040513d6020811015610ede57600080fd5b505190506000610efe836dffffffffffffffffffffffffffff871661208e565b90506000610f1c836dffffffffffffffffffffffffffff871661208e565b90506000610f2a8787612492565b6000549091508061114757600554604080517f7cd07e4700000000000000000000000000000000000000000000000000000000815290516000926001600160a01b031691637cd07e47916004808301926020929190829003018186803b158015610f9357600080fd5b505afa158015610fa7573d6000803e3d6000fd5b505050506040513d6020811015610fbd57600080fd5b50519050336001600160a01b03821614156110be57806001600160a01b03166340dc0e376040518163ffffffff1660e01b815260040160206040518083038186803b15801561100b57600080fd5b505afa15801561101f573d6000803e3d6000fd5b505050506040513d602081101561103557600080fd5b50519950891580159061106857507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8a14155b6110b9576040805162461bcd60e51b815260206004820152601560248201527f4261642064657369726564206c69717569646974790000000000000000000000604482015290519081900360640190fd5b611141565b6001600160a01b0381161561111a576040805162461bcd60e51b815260206004820152601660248201527f4d757374206e6f742068617665206d69677261746f7200000000000000000000604482015290519081900360640190fd5b6111326103e8610aae61112d8888612022565b61260b565b995061114160006103e861265d565b50611198565b6111956dffffffffffffffffffffffffffff89166111658684612022565b8161116c57fe5b046dffffffffffffffffffffffffffff89166111888685612022565b8161118f57fe5b046126e7565b98505b600089116111d75760405162461bcd60e51b815260040180806020018281038252602881526020018061291b6028913960400191505060405180910390fd5b6111e18a8a61265d565b6111ed86868a8a6120e6565b811561122957600854611225906dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416612022565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600f5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600f546001146112fa576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f8190558061130a610c06565b50600654600754604080516370a0823160e01b815230600482015290519496509294506001600160a01b039182169391169160009184916370a08231916024808301926020929190829003018186803b15801561136657600080fd5b505afa15801561137a573d6000803e3d6000fd5b505050506040513d602081101561139057600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038516916370a08231916024808301926020929190829003018186803b1580156113de57600080fd5b505afa1580156113f2573d6000803e3d6000fd5b505050506040513d602081101561140857600080fd5b5051306000908152600160205260408120549192506114278888612492565b600054909150806114388487612022565b8161143f57fe5b049a508061144d8486612022565b8161145457fe5b04995060008b118015611467575060008a115b6114a25760405162461bcd60e51b81526004018080602001828103825260288152602001806128f36028913960400191505060405180910390fd5b6114ac30846126ff565b6114b7878d8d611e5a565b6114c2868d8c611e5a565b604080516370a0823160e01b815230600482015290516001600160a01b038916916370a08231916024808301926020929190829003018186803b15801561150857600080fd5b505afa15801561151c573d6000803e3d6000fd5b505050506040513d602081101561153257600080fd5b5051604080516370a0823160e01b815230600482015290519196506001600160a01b038816916370a0823191602480820192602092909190829003018186803b15801561157e57600080fd5b505afa158015611592573d6000803e3d6000fd5b505050506040513d60208110156115a857600080fd5b505193506115b885858b8b6120e6565b81156115f4576008546115f0906dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416612022565b600b555b604080518c8152602081018c905281516001600160a01b038f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600f81905550915091565b6040518060400160405280600481526020017f53534c500000000000000000000000000000000000000000000000000000000081525081565b600e5481565b6000610c683384846123e4565b6103e881565b600f546001146116fb576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f55600654600754600854604080516370a0823160e01b815230600482015290516001600160a01b0394851694909316926117ab92859287926117a6926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b15801561177457600080fd5b505afa158015611788573d6000803e3d6000fd5b505050506040513d602081101561179e57600080fd5b50519061208e565b611e5a565b61182d81846117a66008600e9054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff16856001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561177457600080fd5b50506001600f5550565b6005546001600160a01b031681565b6005546001600160a01b031633146118a5576040805162461bcd60e51b815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b600082116118fa576040805162461bcd60e51b815260206004820152601d60248201527f5f616c706861206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b8181116119385760405162461bcd60e51b81526004018080602001828103825260268152602001806129436026913960400191505060405180910390fd5b600083116119775760405162461bcd60e51b815260040180806020018281038252603a8152602001806128b9603a913960400191505060405180910390fd5b600680546001600160a01b039687167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556007805495909616941693909317909355600c55600d91909155600e55565b6007546001600160a01b031681565b42841015611a31576040805162461bcd60e51b815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b6003546001600160a01b0380891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e280820193601f1981019281900390910190855afa158015611b67573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611b9d5750886001600160a01b0316816001600160a01b0316145b611bee576040805162461bcd60e51b815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611bf9898989612382565b505050505050505050565b600d5481565b600260209081526000928352604080842090915290825290205481565b6005546001600160a01b03163314611c86576040805162461bcd60e51b815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b600c839055600d829055600e819055604080518481526020810184905280820183905290517f509d432c4ab40e3eb039ee95fea93be8de6c751efa87aed5e51c7202b0dd8e099181900360600190a1505050565b600f54600114611d31576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f55600654604080516370a0823160e01b81523060048201529051611e53926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611d8257600080fd5b505afa158015611d96573d6000803e3d6000fd5b505050506040513d6020811015611dac57600080fd5b5051600754604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611df957600080fd5b505afa158015611e0d573d6000803e3d6000fd5b505050506040513d6020811015611e2357600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166120e6565b6001600f55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b60208310611f355780518252601f199092019160209182019101611f16565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611f97576040519150601f19603f3d011682016040523d82523d6000602084013e611f9c565b606091505b5091509150818015611fca575080511580611fca5750808060200190516020811015611fc757600080fd5b50515b61201b576040805162461bcd60e51b815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b600081158061203d5750508082028282828161203a57fe5b04145b610c6c576040805162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610c6c576040805162461bcd60e51b815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061211257506dffffffffffffffffffffffffffff8311155b612163576040805162461bcd60e51b815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906121b357506dffffffffffffffffffffffffffff841615155b80156121ce57506dffffffffffffffffffffffffffff831615155b15612278578063ffffffff1661220b856121e786612791565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16906127b5565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff811661224b846121e787612791565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316600090815260016020526040902054612407908261208e565b6001600160a01b03808516600090815260016020526040808220939093559084168152205461243690826127f6565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e357600080fd5b505afa1580156124f7573d6000803e3d6000fd5b505050506040513d602081101561250d57600080fd5b5051600b546001600160a01b0382161580159450919250906125f75780156125f257600061255161112d6dffffffffffffffffffffffffffff888116908816612022565b9050600061255e8361260b565b9050808211156125ef57600d5460009061258890610af661257f868661208e565b60005490612022565b905060006125cb6125a4600d548561202290919063ffffffff16565b6125c56125be600d54600e5461208e90919063ffffffff16565b8790612022565b906127f6565b905060008183816125d857fe5b04905080156125eb576125eb878261265d565b5050505b50505b612603565b8015612603576000600b555b505092915050565b6000600382111561264e575080600160028204015b818110156126485780915060028182858161263757fe5b04018161264057fe5b049050612620565b50612658565b8115612658575060015b919050565b60005461266a90826127f6565b60009081556001600160a01b03831681526001602052604090205461268f90826127f6565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60008183106126f657816126f8565b825b9392505050565b6001600160a01b038216600090815260016020526040902054612722908261208e565b6001600160a01b03831660009081526001602052604081209190915554612749908261208e565b60009081556040805183815290516001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416816127ee57fe5b049392505050565b80820182811015610c6c576040805162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459746f74616c4665652073686f756c64206e6f7420626520302c2077686963682077696c6c20616c6c6f77206672656520666c6173682073776170556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544626574612073686f756c6420616c77617973206265206c61746572207468616e20616c706861a2646970667358221220b562054fd180879e709cb9f95feb3c261a153a823344d5c22c2f0cda0c56df5d64736f6c634300060c0033 | 608060405234801561001057600080fd5b50600436106101e55760003560e01c80637464fc3d1161010f578063c45a0155116100a2578063db1d0fd511610071578063db1d0fd5146105f4578063dd62ed3e146105fc578063fc061a4f1461062a578063fff6cae914610653576101e5565b8063c45a015514610551578063d13f90b414610559578063d21220a71461059b578063d505accf146105a3576101e5565b80639faa3c91116100de5780639faa3c91146104ef578063a9059cbb146104f7578063ba9a7a5614610523578063bc25cf771461052b576101e5565b80637464fc3d1461047a5780637ecebe001461048257806389afcb44146104a857806395d89b41146104e7576101e5565b806323b872dd116101875780635909c0d5116101565780635909c0d51461041e5780635a3d5493146104265780636a6278421461042e57806370a0823114610454576101e5565b806323b872dd146103ba57806330adf81f146103f0578063313ce567146103f85780633644e51514610416576101e5565b8063095ea7b3116101c3578063095ea7b3146103345780630dfe16811461037457806318160ddd146103985780631df4ccfc146103b2576101e5565b8063022c0d9f146101ea57806306fdde03146102785780630902f1ac146102f5575b600080fd5b6102766004803603608081101561020057600080fd5b8135916020810135916001600160a01b03604083013516919081019060808101606082013564010000000081111561023757600080fd5b82018360208201111561024957600080fd5b8035906020019184600183028401116401000000008311171561026b57600080fd5b50909250905061065b565b005b610280610bcd565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102ba5781810151838201526020016102a2565b50505050905090810190601f1680156102e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102fd610c06565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b6103606004803603604081101561034a57600080fd5b506001600160a01b038135169060200135610c5b565b604080519115158252519081900360200190f35b61037c610c72565b604080516001600160a01b039092168252519081900360200190f35b6103a0610c81565b60408051918252519081900360200190f35b6103a0610c87565b610360600480360360608110156103d057600080fd5b506001600160a01b03813581169160208101359091169060400135610c8d565b6103a0610d3f565b610400610d63565b6040805160ff9092168252519081900360200190f35b6103a0610d68565b6103a0610d6e565b6103a0610d74565b6103a06004803603602081101561044457600080fd5b50356001600160a01b0316610d7a565b6103a06004803603602081101561046a57600080fd5b50356001600160a01b0316611276565b6103a0611288565b6103a06004803603602081101561049857600080fd5b50356001600160a01b031661128e565b6104ce600480360360208110156104be57600080fd5b50356001600160a01b03166112a0565b6040805192835260208301919091528051918290030190f35b610280611652565b6103a061168b565b6103606004803603604081101561050d57600080fd5b506001600160a01b038135169060200135611691565b6103a061169e565b6102766004803603602081101561054157600080fd5b50356001600160a01b03166116a4565b61037c611837565b610276600480360360a081101561056f57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060800135611846565b61037c6119cd565b610276600480360360e08110156105b957600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c001356119dc565b6103a0611c04565b6103a06004803603604081101561061257600080fd5b506001600160a01b0381358116916020013516611c0a565b6102766004803603606081101561064057600080fd5b5080359060208101359060400135611c27565b610276611cda565b600f546001146106b2576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f55841515806106c55750600084115b6107005760405162461bcd60e51b815260040180806020018281038252602581526020018061284f6025913960400191505060405180910390fd5b60008061070b610c06565b5091509150816dffffffffffffffffffffffffffff168710801561073e5750806dffffffffffffffffffffffffffff1686105b6107795760405162461bcd60e51b81526004018080602001828103825260218152602001806128986021913960400191505060405180910390fd5b60065460075460009182916001600160a01b039182169190811690891682148015906107b75750806001600160a01b0316896001600160a01b031614155b610808576040805162461bcd60e51b815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a1561081957610819828a8d611e5a565b891561082a5761082a818a8c611e5a565b86156108dc57886001600160a01b03166310d1e85c338d8d8c8c6040518663ffffffff1660e01b815260040180866001600160a01b03168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b505050505b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561092257600080fd5b505afa158015610936573d6000803e3d6000fd5b505050506040513d602081101561094c57600080fd5b5051604080516370a0823160e01b815230600482015290519195506001600160a01b038316916370a0823191602480820192602092909190829003018186803b15801561099857600080fd5b505afa1580156109ac573d6000803e3d6000fd5b505050506040513d60208110156109c257600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a900383116109ec576000610a02565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610a26576000610a3c565b89856dffffffffffffffffffffffffffff160383035b90506000821180610a4d5750600081115b610a885760405162461bcd60e51b81526004018080602001828103825260248152602001806128746024913960400191505060405180910390fd5b6000610ab4610aa2600c548561202290919063ffffffff16565b610aae876103e8612022565b9061208e565b90506000610ad0610aa2600c548561202290919063ffffffff16565b9050610afc620f4240610af66dffffffffffffffffffffffffffff8b8116908b16612022565b90612022565b610b068383612022565b1015610b59576040805162461bcd60e51b815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610b67848488886120e6565b60408051838152602081018390528082018d9052606081018c905290516001600160a01b038b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600f55505050505050505050565b6040518060400160405280601281526020017f536869626153776170204c5020546f6b656e000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610c68338484612382565b5060015b92915050565b6006546001600160a01b031681565b60005481565b600c5481565b6001600160a01b03831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610d2a576001600160a01b0384166000908152600260209081526040808320338452909152902054610d05908361208e565b6001600160a01b03851660009081526002602090815260408083203384529091529020555b610d358484846123e4565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60095481565b600a5481565b6000600f54600114610dd3576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f81905580610de3610c06565b50600654604080516370a0823160e01b815230600482015290519395509193506000926001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015610e3757600080fd5b505afa158015610e4b573d6000803e3d6000fd5b505050506040513d6020811015610e6157600080fd5b5051600754604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610eb457600080fd5b505afa158015610ec8573d6000803e3d6000fd5b505050506040513d6020811015610ede57600080fd5b505190506000610efe836dffffffffffffffffffffffffffff871661208e565b90506000610f1c836dffffffffffffffffffffffffffff871661208e565b90506000610f2a8787612492565b6000549091508061114757600554604080517f7cd07e4700000000000000000000000000000000000000000000000000000000815290516000926001600160a01b031691637cd07e47916004808301926020929190829003018186803b158015610f9357600080fd5b505afa158015610fa7573d6000803e3d6000fd5b505050506040513d6020811015610fbd57600080fd5b50519050336001600160a01b03821614156110be57806001600160a01b03166340dc0e376040518163ffffffff1660e01b815260040160206040518083038186803b15801561100b57600080fd5b505afa15801561101f573d6000803e3d6000fd5b505050506040513d602081101561103557600080fd5b50519950891580159061106857507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8a14155b6110b9576040805162461bcd60e51b815260206004820152601560248201527f4261642064657369726564206c69717569646974790000000000000000000000604482015290519081900360640190fd5b611141565b6001600160a01b0381161561111a576040805162461bcd60e51b815260206004820152601660248201527f4d757374206e6f742068617665206d69677261746f7200000000000000000000604482015290519081900360640190fd5b6111326103e8610aae61112d8888612022565b61260b565b995061114160006103e861265d565b50611198565b6111956dffffffffffffffffffffffffffff89166111658684612022565b8161116c57fe5b046dffffffffffffffffffffffffffff89166111888685612022565b8161118f57fe5b046126e7565b98505b600089116111d75760405162461bcd60e51b815260040180806020018281038252602881526020018061291b6028913960400191505060405180910390fd5b6111e18a8a61265d565b6111ed86868a8a6120e6565b811561122957600854611225906dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416612022565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600f5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600f546001146112fa576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f8190558061130a610c06565b50600654600754604080516370a0823160e01b815230600482015290519496509294506001600160a01b039182169391169160009184916370a08231916024808301926020929190829003018186803b15801561136657600080fd5b505afa15801561137a573d6000803e3d6000fd5b505050506040513d602081101561139057600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038516916370a08231916024808301926020929190829003018186803b1580156113de57600080fd5b505afa1580156113f2573d6000803e3d6000fd5b505050506040513d602081101561140857600080fd5b5051306000908152600160205260408120549192506114278888612492565b600054909150806114388487612022565b8161143f57fe5b049a508061144d8486612022565b8161145457fe5b04995060008b118015611467575060008a115b6114a25760405162461bcd60e51b81526004018080602001828103825260288152602001806128f36028913960400191505060405180910390fd5b6114ac30846126ff565b6114b7878d8d611e5a565b6114c2868d8c611e5a565b604080516370a0823160e01b815230600482015290516001600160a01b038916916370a08231916024808301926020929190829003018186803b15801561150857600080fd5b505afa15801561151c573d6000803e3d6000fd5b505050506040513d602081101561153257600080fd5b5051604080516370a0823160e01b815230600482015290519196506001600160a01b038816916370a0823191602480820192602092909190829003018186803b15801561157e57600080fd5b505afa158015611592573d6000803e3d6000fd5b505050506040513d60208110156115a857600080fd5b505193506115b885858b8b6120e6565b81156115f4576008546115f0906dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416612022565b600b555b604080518c8152602081018c905281516001600160a01b038f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600f81905550915091565b6040518060400160405280600481526020017f53534c500000000000000000000000000000000000000000000000000000000081525081565b600e5481565b6000610c683384846123e4565b6103e881565b600f546001146116fb576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f55600654600754600854604080516370a0823160e01b815230600482015290516001600160a01b0394851694909316926117ab92859287926117a6926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b15801561177457600080fd5b505afa158015611788573d6000803e3d6000fd5b505050506040513d602081101561179e57600080fd5b50519061208e565b611e5a565b61182d81846117a66008600e9054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff16856001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561177457600080fd5b50506001600f5550565b6005546001600160a01b031681565b6005546001600160a01b031633146118a5576040805162461bcd60e51b815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b600082116118fa576040805162461bcd60e51b815260206004820152601d60248201527f5f616c706861206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b8181116119385760405162461bcd60e51b81526004018080602001828103825260268152602001806129436026913960400191505060405180910390fd5b600083116119775760405162461bcd60e51b815260040180806020018281038252603a8152602001806128b9603a913960400191505060405180910390fd5b600680546001600160a01b039687167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556007805495909616941693909317909355600c55600d91909155600e55565b6007546001600160a01b031681565b42841015611a31576040805162461bcd60e51b815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b6003546001600160a01b0380891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e280820193601f1981019281900390910190855afa158015611b67573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611b9d5750886001600160a01b0316816001600160a01b0316145b611bee576040805162461bcd60e51b815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611bf9898989612382565b505050505050505050565b600d5481565b600260209081526000928352604080842090915290825290205481565b6005546001600160a01b03163314611c86576040805162461bcd60e51b815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b600c839055600d829055600e819055604080518481526020810184905280820183905290517f509d432c4ab40e3eb039ee95fea93be8de6c751efa87aed5e51c7202b0dd8e099181900360600190a1505050565b600f54600114611d31576040805162461bcd60e51b815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600f55600654604080516370a0823160e01b81523060048201529051611e53926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611d8257600080fd5b505afa158015611d96573d6000803e3d6000fd5b505050506040513d6020811015611dac57600080fd5b5051600754604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611df957600080fd5b505afa158015611e0d573d6000803e3d6000fd5b505050506040513d6020811015611e2357600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166120e6565b6001600f55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b60208310611f355780518252601f199092019160209182019101611f16565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611f97576040519150601f19603f3d011682016040523d82523d6000602084013e611f9c565b606091505b5091509150818015611fca575080511580611fca5750808060200190516020811015611fc757600080fd5b50515b61201b576040805162461bcd60e51b815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b600081158061203d5750508082028282828161203a57fe5b04145b610c6c576040805162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610c6c576040805162461bcd60e51b815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061211257506dffffffffffffffffffffffffffff8311155b612163576040805162461bcd60e51b815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906121b357506dffffffffffffffffffffffffffff841615155b80156121ce57506dffffffffffffffffffffffffffff831615155b15612278578063ffffffff1661220b856121e786612791565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16906127b5565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff811661224b846121e787612791565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316600090815260016020526040902054612407908261208e565b6001600160a01b03808516600090815260016020526040808220939093559084168152205461243690826127f6565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e357600080fd5b505afa1580156124f7573d6000803e3d6000fd5b505050506040513d602081101561250d57600080fd5b5051600b546001600160a01b0382161580159450919250906125f75780156125f257600061255161112d6dffffffffffffffffffffffffffff888116908816612022565b9050600061255e8361260b565b9050808211156125ef57600d5460009061258890610af661257f868661208e565b60005490612022565b905060006125cb6125a4600d548561202290919063ffffffff16565b6125c56125be600d54600e5461208e90919063ffffffff16565b8790612022565b906127f6565b905060008183816125d857fe5b04905080156125eb576125eb878261265d565b5050505b50505b612603565b8015612603576000600b555b505092915050565b6000600382111561264e575080600160028204015b818110156126485780915060028182858161263757fe5b04018161264057fe5b049050612620565b50612658565b8115612658575060015b919050565b60005461266a90826127f6565b60009081556001600160a01b03831681526001602052604090205461268f90826127f6565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60008183106126f657816126f8565b825b9392505050565b6001600160a01b038216600090815260016020526040902054612722908261208e565b6001600160a01b03831660009081526001602052604081209190915554612749908261208e565b60009081556040805183815290516001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416816127ee57fe5b049392505050565b80820182811015610c6c576040805162461bcd60e51b815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459746f74616c4665652073686f756c64206e6f7420626520302c2077686963682077696c6c20616c6c6f77206672656520666c6173682073776170556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544626574612073686f756c6420616c77617973206265206c61746572207468616e20616c706861a2646970667358221220b562054fd180879e709cb9f95feb3c261a153a823344d5c22c2f0cda0c56df5d64736f6c634300060c0033 | {{
"language": "Solidity",
"sources": {
"contracts/uniswapv2/UniswapV2Pair.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.6.12;\n\nimport './UniswapV2ERC20.sol';\nimport './libraries/Math.sol';\nimport './libraries/UQ112x112.sol';\nimport './interfaces/IERC20.sol';\nimport './interfaces/IUniswapV2Factory.sol';\nimport './interfaces/IUniswapV2Callee.sol';\n\n\ninterface IMigrator {\n // Return the desired amount of liquidity token that the migrator wants.\n function desiredLiquidity() external view returns (uint256);\n}\n\ncontract UniswapV2Pair is UniswapV2ERC20 {\n using SafeMathUniswap for uint;\n using UQ112x112 for uint224;\n\n uint public constant MINIMUM_LIQUIDITY = 10**3;\n bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));\n\n address public factory;\n address public token0;\n address public token1;\n\n uint112 private reserve0; // uses single storage slot, accessible via getReserves\n uint112 private reserve1; // uses single storage slot, accessible via getReserves\n uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves\n\n uint public price0CumulativeLast;\n uint public price1CumulativeLast;\n uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event\n\n uint public totalFee; // total fee (parts per thousand) charged for a swap\n uint public alpha; // numerator for the protocol fee factor\n uint public beta; // denominator for the protocol fee factor\n\n uint private unlocked = 1;\n modifier lock() {\n require(unlocked == 1, 'UniswapV2: LOCKED');\n unlocked = 0;\n _;\n unlocked = 1;\n }\n\n function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {\n _reserve0 = reserve0;\n _reserve1 = reserve1;\n _blockTimestampLast = blockTimestampLast;\n }\n\n function _safeTransfer(address token, address to, uint value) private {\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');\n }\n\n event Mint(address indexed sender, uint amount0, uint amount1);\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint amount0In,\n uint amount1In,\n uint amount0Out,\n uint amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n event FeeUpdated(uint totalFee, uint alpha, uint beta);\n\n constructor() public {\n factory = msg.sender;\n }\n\n // called once by the factory at time of deployment\n function initialize(address _token0, address _token1, uint _totalFee, uint _alpha, uint _beta) external {\n require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check\n require(_alpha > 0,\"_alpha must be greater than 0\");\n require(_beta > _alpha,\"beta should always be later than alpha\");\n require(_totalFee > 0,\"totalFee should not be 0, which will allow free flash swap\");\n token0 = _token0;\n token1 = _token1;\n totalFee = _totalFee;\n alpha = _alpha;\n beta = _beta;\n }\n\n function updateFee(uint _totalFee, uint _alpha, uint _beta) external {\n require(msg.sender == factory, 'UniswapV2: FORBIDDEN');\n totalFee = _totalFee;\n alpha = _alpha;\n beta = _beta;\n\n emit FeeUpdated(_totalFee, _alpha, _beta);\n }\n\n // update reserves and, on the first call per block, price accumulators\n function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {\n require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');\n uint32 blockTimestamp = uint32(block.timestamp % 2**32);\n uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired\n if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {\n // * never overflows, and + overflow is desired\n price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;\n price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;\n }\n reserve0 = uint112(balance0);\n reserve1 = uint112(balance1);\n blockTimestampLast = blockTimestamp;\n emit Sync(reserve0, reserve1);\n }\n\n // if fee is on, mint liquidity equivalent to alpha/beta of the growth in sqrt(k)\n function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {\n address feeTo = IUniswapV2Factory(factory).feeTo();\n feeOn = feeTo != address(0);\n uint _kLast = kLast; // gas savings\n if (feeOn) {\n if (_kLast != 0) {\n uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));\n uint rootKLast = Math.sqrt(_kLast);\n if (rootK > rootKLast) {\n uint numerator = totalSupply.mul(rootK.sub(rootKLast)).mul(alpha);\n uint denominator = rootK.mul(beta.sub(alpha)).add(rootKLast.mul(alpha));\n uint liquidity = numerator / denominator;\n if (liquidity > 0) _mint(feeTo, liquidity);\n }\n }\n } else if (_kLast != 0) {\n kLast = 0;\n }\n }\n\n // this low-level function should be called from a contract which performs important safety checks\n function mint(address to) external lock returns (uint liquidity) {\n (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings\n uint balance0 = IERC20Uniswap(token0).balanceOf(address(this));\n uint balance1 = IERC20Uniswap(token1).balanceOf(address(this));\n uint amount0 = balance0.sub(_reserve0);\n uint amount1 = balance1.sub(_reserve1);\n\n bool feeOn = _mintFee(_reserve0, _reserve1);\n uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee\n if (_totalSupply == 0) {\n address migrator = IUniswapV2Factory(factory).migrator();\n if (msg.sender == migrator) {\n liquidity = IMigrator(migrator).desiredLiquidity();\n require(liquidity > 0 && liquidity != uint256(-1), \"Bad desired liquidity\");\n } else {\n require(migrator == address(0), \"Must not have migrator\");\n liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);\n _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens\n }\n } else {\n liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);\n }\n require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');\n _mint(to, liquidity);\n\n _update(balance0, balance1, _reserve0, _reserve1);\n if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date\n emit Mint(msg.sender, amount0, amount1);\n }\n\n // this low-level function should be called from a contract which performs important safety checks\n function burn(address to) external lock returns (uint amount0, uint amount1) {\n (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings\n address _token0 = token0; // gas savings\n address _token1 = token1; // gas savings\n uint balance0 = IERC20Uniswap(_token0).balanceOf(address(this));\n uint balance1 = IERC20Uniswap(_token1).balanceOf(address(this));\n uint liquidity = balanceOf[address(this)];\n\n bool feeOn = _mintFee(_reserve0, _reserve1);\n uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee\n amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution\n amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution\n require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');\n _burn(address(this), liquidity);\n _safeTransfer(_token0, to, amount0);\n _safeTransfer(_token1, to, amount1);\n balance0 = IERC20Uniswap(_token0).balanceOf(address(this));\n balance1 = IERC20Uniswap(_token1).balanceOf(address(this));\n\n _update(balance0, balance1, _reserve0, _reserve1);\n if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date\n emit Burn(msg.sender, amount0, amount1, to);\n }\n\n // this low-level function should be called from a contract which performs important safety checks\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {\n require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');\n (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings\n require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');\n\n uint balance0;\n uint balance1;\n { // scope for _token{0,1}, avoids stack too deep errors\n address _token0 = token0;\n address _token1 = token1;\n require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');\n if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens\n if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens\n if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);\n balance0 = IERC20Uniswap(_token0).balanceOf(address(this));\n balance1 = IERC20Uniswap(_token1).balanceOf(address(this));\n }\n uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;\n uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;\n require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');\n { // scope for reserve{0,1}Adjusted, avoids stack too deep errors\n uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(totalFee));\n uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(totalFee));\n require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');\n }\n\n _update(balance0, balance1, _reserve0, _reserve1);\n emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);\n }\n\n // force balances to match reserves\n function skim(address to) external lock {\n address _token0 = token0; // gas savings\n address _token1 = token1; // gas savings\n _safeTransfer(_token0, to, IERC20Uniswap(_token0).balanceOf(address(this)).sub(reserve0));\n _safeTransfer(_token1, to, IERC20Uniswap(_token1).balanceOf(address(this)).sub(reserve1));\n }\n\n // force reserves to match balances\n function sync() external lock {\n _update(IERC20Uniswap(token0).balanceOf(address(this)), IERC20Uniswap(token1).balanceOf(address(this)), reserve0, reserve1);\n }\n}\n"
},
"contracts/uniswapv2/UniswapV2ERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.6.12;\n\nimport './libraries/SafeMath.sol';\n\ncontract UniswapV2ERC20 {\n using SafeMathUniswap for uint;\n\n string public constant name = 'ShibaSwap LP Token';\n string public constant symbol = 'SSLP';\n uint8 public constant decimals = 18;\n uint public totalSupply;\n mapping(address => uint) public balanceOf;\n mapping(address => mapping(address => uint)) public allowance;\n\n bytes32 public DOMAIN_SEPARATOR;\n // keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\n mapping(address => uint) public nonces;\n\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n constructor() public {\n uint chainId;\n assembly {\n chainId := chainid()\n }\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),\n keccak256(bytes(name)),\n keccak256(bytes('1')),\n chainId,\n address(this)\n )\n );\n }\n\n function _mint(address to, uint value) internal {\n totalSupply = totalSupply.add(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(address(0), to, value);\n }\n\n function _burn(address from, uint value) internal {\n balanceOf[from] = balanceOf[from].sub(value);\n totalSupply = totalSupply.sub(value);\n emit Transfer(from, address(0), value);\n }\n\n function _approve(address owner, address spender, uint value) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(address from, address to, uint value) private {\n balanceOf[from] = balanceOf[from].sub(value);\n balanceOf[to] = balanceOf[to].add(value);\n emit Transfer(from, to, value);\n }\n\n function approve(address spender, uint value) external returns (bool) {\n _approve(msg.sender, spender, value);\n return true;\n }\n\n function transfer(address to, uint value) external returns (bool) {\n _transfer(msg.sender, to, value);\n return true;\n }\n\n function transferFrom(address from, address to, uint value) external returns (bool) {\n if (allowance[from][msg.sender] != uint(-1)) {\n allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);\n }\n _transfer(from, to, value);\n return true;\n }\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {\n require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');\n bytes32 digest = keccak256(\n abi.encodePacked(\n '\\x19\\x01',\n DOMAIN_SEPARATOR,\n keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))\n )\n );\n address recoveredAddress = ecrecover(digest, v, r, s);\n require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');\n _approve(owner, spender, value);\n }\n}\n"
},
"contracts/uniswapv2/libraries/Math.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.6.12;\n\n// a library for performing various math operations\n\nlibrary Math {\n function min(uint x, uint y) internal pure returns (uint z) {\n z = x < y ? x : y;\n }\n\n // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)\n function sqrt(uint y) internal pure returns (uint z) {\n if (y > 3) {\n z = y;\n uint x = y / 2 + 1;\n while (x < z) {\n z = x;\n x = (y / x + x) / 2;\n }\n } else if (y != 0) {\n z = 1;\n }\n }\n}\n"
},
"contracts/uniswapv2/libraries/UQ112x112.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.6.12;\n\n// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))\n\n// range: [0, 2**112 - 1]\n// resolution: 1 / 2**112\n\nlibrary UQ112x112 {\n uint224 constant Q112 = 2**112;\n\n // encode a uint112 as a UQ112x112\n function encode(uint112 y) internal pure returns (uint224 z) {\n z = uint224(y) * Q112; // never overflows\n }\n\n // divide a UQ112x112 by a uint112, returning a UQ112x112\n function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {\n z = x / uint224(y);\n }\n}\n"
},
"contracts/uniswapv2/interfaces/IERC20.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface IERC20Uniswap {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external view returns (string memory);\n function symbol() external view returns (string memory);\n function decimals() external view returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n}\n"
},
"contracts/uniswapv2/interfaces/IUniswapV2Factory.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\n\n function feeTo() external view returns (address);\n function feeToSetter() external view returns (address);\n function migrator() external view returns (address);\n\n function totalFeeTopCoin() external view returns (uint);\n function alphaTopCoin() external view returns (uint);\n function betaTopCoin() external view returns (uint);\n function totalFeeRegular() external view returns (uint);\n function alphaRegular() external view returns (uint);\n function betaRegular() external view returns (uint);\n\n function topCoins(address token) external view returns (bool isTopCoin);\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n function allPairs(uint) external view returns (address pair);\n function allPairsLength() external view returns (uint);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(address) external;\n function setFeeToSetter(address) external;\n function setMigrator(address) external;\n}\n"
},
"contracts/uniswapv2/interfaces/IUniswapV2Callee.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface IUniswapV2Callee {\n function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;\n}\n"
},
"contracts/uniswapv2/libraries/SafeMath.sol": {
"content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.6.12;\n\n// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)\n\nlibrary SafeMathUniswap {\n function add(uint x, uint y) internal pure returns (uint z) {\n require((z = x + y) >= x, 'ds-math-add-overflow');\n }\n\n function sub(uint x, uint y) internal pure returns (uint z) {\n require((z = x - y) <= x, 'ds-math-sub-underflow');\n }\n\n function mul(uint x, uint y) internal pure returns (uint z) {\n require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 5000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}
}} |
1 | 19,493,149 | 85e81a1aef2c2cf21deae861f89854881653bfa0c44a871dd83dc53a9ce82995 | 7ba0c10d1dc9643638fe95193d8fa2395229dcfddc03358c536a782c6d0e4e25 | 4e565f63257d90f988e5ec9d065bab00f94d2dfd | 9fa5c5733b53814692de4fb31fd592070de5f5f0 | c40c365580d352161460cd20c74fdcc6fab89119 | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 19,493,150 | b234974265da8a898383156b2e8f77985ce36530b9d743cb2fd9cd2bdf993b10 | 2567d0d13f3118604d74f20e21d80bcd4a8d60270b29d0cfd95876e7760ae269 | d2c82f2e5fa236e114a81173e375a73664610998 | ffa397285ce46fb78c588a9e993286aac68c37cd | c7ea67490aea2390af41f36a99426e70d5fa87b4 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,155 | b7f06064d97c5130fad20eb8847032a7439daf88e6559930154e35c50dcabba6 | 8dbd58353ea3eb332526f5b741ea9699bb4584264a7988d619c12f813db9f334 | d2c82f2e5fa236e114a81173e375a73664610998 | ffa397285ce46fb78c588a9e993286aac68c37cd | 3d4a8b19ccc7e86b0d18b6165690db30ff5abc8e | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,156 | ce3493bcec186c4e8f070b0854b9d88f2bd01c01c7b4dca866378c59d0f392e5 | c3ed7c13dba6b38503cbcbdd7e9ede2d7e5c8bbcef688446ddae3c85039d0bee | a7fb5ca286fc3fd67525629048a4de3ba24cba2e | c77ad0a71008d7094a62cfbd250a2eb2afdf2776 | fb21a64b53fc0120745ab6d80b9fbdf8cf85cced | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 19,493,156 | ce3493bcec186c4e8f070b0854b9d88f2bd01c01c7b4dca866378c59d0f392e5 | b6456dbb7db399708a07c6dd24b6767ddee35217ae7c0ef0cea4f1db69f99076 | 791b1689526b5560145f99cb9d3b7f24eca2591a | 5de4839a76cf55d0c90e2061ef4386d962e15ae3 | cd944044cca8125e70763bb050dddd5be53c3093 | 607f3d8160093d39f33d3d33735de4839a76cf55d0c90e2061ef4386d962e15ae314605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b3d356020355560408036111560525736038060403d373d3d355af43d6000803e6052573d6000fd00 | 3d3d33735de4839a76cf55d0c90e2061ef4386d962e15ae314605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b3d356020355560408036111560525736038060403d373d3d355af43d6000803e6052573d6000fd | |
1 | 19,493,159 | 927b961f99453e7cc06174eb91745ba9ad4ea531a9349f9e349a01a59034036d | 138f83ec9a1d6030221ab097f896a908ca3d1bef4996d21a50c81cc88d5517f9 | 0ab04b107793bfc192e15b5c9140ef24f86f219c | 91e677b07f7af907ec9a428aafa9fc14a0d3a338 | 0dc99d660162382618c3d0497f411e4d0ee51be2 | 608060405260405161090e38038061090e83398101604081905261002291610460565b61002e82826000610035565b505061058a565b61003e83610100565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a260008251118061007f5750805b156100fb576100f9836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e99190610520565b836102a360201b6100291760201c565b505b505050565b610113816102cf60201b6100551760201c565b6101725760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6101e6816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d79190610520565b6102cf60201b6100551760201c565b61024b5760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610169565b806102827fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5060001b6102de60201b6100641760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b60606102c883836040518060600160405280602781526020016108e7602791396102e1565b9392505050565b6001600160a01b03163b151590565b90565b6060600080856001600160a01b0316856040516102fe919061053b565b600060405180830381855af49150503d8060008114610339576040519150601f19603f3d011682016040523d82523d6000602084013e61033e565b606091505b5090925090506103508683838761035a565b9695505050505050565b606083156103c65782516103bf576001600160a01b0385163b6103bf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610169565b50816103d0565b6103d083836103d8565b949350505050565b8151156103e85781518083602001fd5b8060405162461bcd60e51b81526004016101699190610557565b80516001600160a01b038116811461041957600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561044f578181015183820152602001610437565b838111156100f95750506000910152565b6000806040838503121561047357600080fd5b61047c83610402565b60208401519092506001600160401b038082111561049957600080fd5b818501915085601f8301126104ad57600080fd5b8151818111156104bf576104bf61041e565b604051601f8201601f19908116603f011681019083821181831017156104e7576104e761041e565b8160405282815288602084870101111561050057600080fd5b610511836020830160208801610434565b80955050505050509250929050565b60006020828403121561053257600080fd5b6102c882610402565b6000825161054d818460208701610434565b9190910192915050565b6020815260008251806020840152610576816040850160208701610434565b601f01601f19169190910160400192915050565b61034e806105996000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610067565b610100565b565b606061004e83836040518060600160405280602781526020016102f260279139610124565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fb9190610249565b905090565b3660008037600080366000845af43d6000803e80801561011f573d6000f35b3d6000fd5b6060600080856001600160a01b03168560405161014191906102a2565b600060405180830381855af49150503d806000811461017c576040519150601f19603f3d011682016040523d82523d6000602084013e610181565b606091505b50915091506101928683838761019c565b9695505050505050565b6060831561020d578251610206576001600160a01b0385163b6102065760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610217565b610217838361021f565b949350505050565b81511561022f5781518083602001fd5b8060405162461bcd60e51b81526004016101fd91906102be565b60006020828403121561025b57600080fd5b81516001600160a01b038116811461004e57600080fd5b60005b8381101561028d578181015183820152602001610275565b8381111561029c576000848401525b50505050565b600082516102b4818460208701610272565b9190910192915050565b60208152600082518060208401526102dd816040850160208701610272565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d51e81d3bc5ed20a26aeb05dce7e825c503b2061aa78628027300c8d65b9d89a64736f6c634300080c0033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65640000000000000000000000005a2a4f2f3c18f09179b6703e63d9edd16590907300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000 | 60806040523661001357610011610017565b005b6100115b610027610022610067565b610100565b565b606061004e83836040518060600160405280602781526020016102f260279139610124565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fb9190610249565b905090565b3660008037600080366000845af43d6000803e80801561011f573d6000f35b3d6000fd5b6060600080856001600160a01b03168560405161014191906102a2565b600060405180830381855af49150503d806000811461017c576040519150601f19603f3d011682016040523d82523d6000602084013e610181565b606091505b50915091506101928683838761019c565b9695505050505050565b6060831561020d578251610206576001600160a01b0385163b6102065760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610217565b610217838361021f565b949350505050565b81511561022f5781518083602001fd5b8060405162461bcd60e51b81526004016101fd91906102be565b60006020828403121561025b57600080fd5b81516001600160a01b038116811461004e57600080fd5b60005b8381101561028d578181015183820152602001610275565b8381111561029c576000848401525b50505050565b600082516102b4818460208701610272565b9190910192915050565b60208152600082518060208401526102dd816040850160208701610272565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d51e81d3bc5ed20a26aeb05dce7e825c503b2061aa78628027300c8d65b9d89a64736f6c634300080c0033 | // SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
// import "../beacon/IBeacon.sol";
// import "../../interfaces/draft-IERC1822.sol";
// import "../../utils/Address.sol";
// import "../../utils/StorageSlot.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*/
abstract contract ERC1967Upgrade {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Emitted when the beacon is upgraded.
*/
event BeaconUpgraded(address indexed beacon);
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
Address.isContract(IBeacon(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
}
}
}
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overridden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overridden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)
pragma solidity ^0.8.0;
// import "./IBeacon.sol";
// import "../Proxy.sol";
// import "../ERC1967/ERC1967Upgrade.sol";
/**
* @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.
*
* The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't
* conflict with the storage layout of the implementation behind the proxy.
*
* _Available since v3.4._
*/
contract BeaconProxy is Proxy, ERC1967Upgrade {
/**
* @dev Initializes the proxy with `beacon`.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
* will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity
* constructor.
*
* Requirements:
*
* - `beacon` must be a contract with the interface {IBeacon}.
*/
constructor(address beacon, bytes memory data) payable {
_upgradeBeaconToAndCall(beacon, data, false);
}
/**
* @dev Returns the current beacon address.
*/
function _beacon() internal view virtual returns (address) {
return _getBeacon();
}
/**
* @dev Returns the current implementation address of the associated beacon.
*/
function _implementation() internal view virtual override returns (address) {
return IBeacon(_getBeacon()).implementation();
}
/**
* @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.
*
* Requirements:
*
* - `beacon` must be a contract.
* - The implementation returned by `beacon` must be a contract.
*/
function _setBeacon(address beacon, bytes memory data) internal virtual {
_upgradeBeaconToAndCall(beacon, data, false);
}
} |
1 | 19,493,161 | 574e56b29b9e42a2dbc18d5915055f84dde86792f864fffef63592ed3ceb1611 | 8997c723d80097ee3cf8ca006c5f894a3983653c37a34ac6a25429d4bfbcb2b1 | 52078caa5aeb3a96b803b2e5b467b8a413c558c7 | 52078caa5aeb3a96b803b2e5b467b8a413c558c7 | 68a64676e65262086bee5b6e870748e5a064244f | 6080604052670de0b6b3a764000060025566470de4df8200006003556000600460006101000a81548160ff0219169083151502179055507ffdc54b1a6f53a21d375d0dea444a27bd72abfff26c6fe5439842b42f4f5a01fc60001b6007557ffdc54b1a6f53a21d375d0dea84608d84c088017f6661b90cbfa86d27732f6d3e60001b6008557ffdc54b1a6f53a21d375d0dea4b719169497dbac884f858c6cc4034ec1a5c51dc60001b6009557ffdc54b1a6f53a21d375d0dea8781250ad761876ba61389a7bce505c58df449ca60001b600a553480156100de57600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006101356007546008546101a860201b60201c565b90508073ffffffffffffffffffffffffffffffffffffffff1663e2d73ccd306040518263ffffffff1660e01b815260040161017091906101ca565b600060405180830381600087803b15801561018a57600080fd5b505af115801561019e573d6000803e3d6000fd5b5050505050610217565b60008160001c8360001c18905092915050565b6101c4816101e5565b82525050565b60006020820190506101df60008301846101bb565b92915050565b60006101f0826101f7565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b61062e806102266000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b61461008e5780639763d29b146100a5578063bedf0f4a146100ce578063eaf67ab9146100e5578063f39d8c65146100ef57610060565b3661006057005b600080fd5b34801561007157600080fd5b5061008c6004803603810190610087919061041e565b61011a565b005b34801561009a57600080fd5b506100a3610124565b005b3480156100b157600080fd5b506100cc60048036038101906100c7919061041e565b6101bc565b005b3480156100da57600080fd5b506100e36101c6565b005b6100ed6101e3565b005b3480156100fb57600080fd5b506101046101ed565b60405161011191906104ed565b60405180910390f35b8060068190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a9906104cd565b60405180910390fd5b6101ba61023e565b565b8060058190555050565b6000600460006101000a81548160ff021916908315150217905550565b6101eb610315565b565b60008060035460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16316102359190610519565b90508091505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906104cd565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610312573d6000803e3d6000fd5b50565b6000610325600954600a546103f6565b905060006103376007546008546103f6565b90508073ffffffffffffffffffffffffffffffffffffffff1663e26d7a7033846000476040518563ffffffff1660e01b81526004016103799493929190610488565b600060405180830381600087803b15801561039357600080fd5b505af11580156103a7573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156103f1573d6000803e3d6000fd5b505050565b60008160001c8360001c18905092915050565b600081359050610418816105e1565b92915050565b60006020828403121561043057600080fd5b600061043e84828501610409565b91505092915050565b6104508161054d565b82525050565b6000610463602083610508565b915061046e826105b8565b602082019050919050565b6104828161057f565b82525050565b600060808201905061049d6000830187610447565b6104aa6020830186610447565b6104b76040830185610447565b6104c46060830184610479565b95945050505050565b600060208201905081810360008301526104e681610456565b9050919050565b60006020820190506105026000830184610479565b92915050565b600082825260208201905092915050565b60006105248261057f565b915061052f8361057f565b92508282101561054257610541610589565b5b828203905092915050565b60006105588261055f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6105ea8161057f565b81146105f557600080fd5b5056fea2646970667358221220dd8be0e86fdd18bb712eb2ac2e62e11653e50388d089ae92cda5beaddd58e5e564736f6c63430008040033 | 6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b61461008e5780639763d29b146100a5578063bedf0f4a146100ce578063eaf67ab9146100e5578063f39d8c65146100ef57610060565b3661006057005b600080fd5b34801561007157600080fd5b5061008c6004803603810190610087919061041e565b61011a565b005b34801561009a57600080fd5b506100a3610124565b005b3480156100b157600080fd5b506100cc60048036038101906100c7919061041e565b6101bc565b005b3480156100da57600080fd5b506100e36101c6565b005b6100ed6101e3565b005b3480156100fb57600080fd5b506101046101ed565b60405161011191906104ed565b60405180910390f35b8060068190555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101a9906104cd565b60405180910390fd5b6101ba61023e565b565b8060058190555050565b6000600460006101000a81548160ff021916908315150217905550565b6101eb610315565b565b60008060035460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16316102359190610519565b90508091505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906104cd565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610312573d6000803e3d6000fd5b50565b6000610325600954600a546103f6565b905060006103376007546008546103f6565b90508073ffffffffffffffffffffffffffffffffffffffff1663e26d7a7033846000476040518563ffffffff1660e01b81526004016103799493929190610488565b600060405180830381600087803b15801561039357600080fd5b505af11580156103a7573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156103f1573d6000803e3d6000fd5b505050565b60008160001c8360001c18905092915050565b600081359050610418816105e1565b92915050565b60006020828403121561043057600080fd5b600061043e84828501610409565b91505092915050565b6104508161054d565b82525050565b6000610463602083610508565b915061046e826105b8565b602082019050919050565b6104828161057f565b82525050565b600060808201905061049d6000830187610447565b6104aa6020830186610447565b6104b76040830185610447565b6104c46060830184610479565b95945050505050565b600060208201905081810360008301526104e681610456565b9050919050565b60006020820190506105026000830184610479565b92915050565b600082825260208201905092915050565b60006105248261057f565b915061052f8361057f565b92508282101561054257610541610589565b5b828203905092915050565b60006105588261055f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6105ea8161057f565b81146105f557600080fd5b5056fea2646970667358221220dd8be0e86fdd18bb712eb2ac2e62e11653e50388d089ae92cda5beaddd58e5e564736f6c63430008040033 | |
1 | 19,493,163 | 69187c879a9422a49232983c95891b1d24e9e0f55b3fc252b871e3241360c5aa | 1ab4948f3152621c808c557515b43266f8dad551590df041ac09c93fe7d1e5e4 | d2c82f2e5fa236e114a81173e375a73664610998 | ffa397285ce46fb78c588a9e993286aac68c37cd | 894d0e53da9ce675d72655db49df01819cd82c1f | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,164 | d1c03196b6399ffb4e28e583640dbf245667ed1bd0805d2c937334356307f116 | 5eab065fcbdb4a4a7ce5e4370a3fb130caf2a8e431afb4313913578d5fbaf2f8 | 5217b2d34ba8f861158a861990db264a49985703 | 5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f | bf2cb7a82c791cce3b3715b91ccd74abd6bfbdba | 60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429 | 608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032 | // File: contracts/interfaces/IUniswapV2Pair.sol
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File: contracts/interfaces/IUniswapV2ERC20.sol
pragma solidity >=0.5.0;
interface IUniswapV2ERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
// File: contracts/libraries/SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
// File: contracts/UniswapV2ERC20.sol
pragma solidity =0.5.16;
contract UniswapV2ERC20 is IUniswapV2ERC20 {
using SafeMath for uint;
string public constant name = 'Uniswap V2';
string public constant symbol = 'UNI-V2';
uint8 public constant decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
uint chainId;
assembly {
chainId := chainid
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
// File: contracts/libraries/Math.sol
pragma solidity =0.5.16;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
// File: contracts/libraries/UQ112x112.sol
pragma solidity =0.5.16;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File: contracts/interfaces/IERC20.sol
pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
// File: contracts/interfaces/IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// File: contracts/interfaces/IUniswapV2Callee.sol
pragma solidity >=0.5.0;
interface IUniswapV2Callee {
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File: contracts/UniswapV2Pair.sol
pragma solidity =0.5.16;
contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'UniswapV2: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
constructor() public {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external {
require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IUniswapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
} |
1 | 19,493,167 | 150f6faaff7bbde9dbe00a11f45b297eea99d93430e88b7be9150dd980865739 | d63f98058a11b971b743f92b8fe2aff34845116841989d20e3a328f8981402c7 | d2c82f2e5fa236e114a81173e375a73664610998 | ffa397285ce46fb78c588a9e993286aac68c37cd | a4f8a2c5d1d5ae84ba73f0de2fd3c52d2d459c77 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,177 | 1a81d762b4379e89156ccca28b16773afd5d08f0ba6eb5d5752aa89159816bae | a508e03320ac2448e983d9575358cab9427350a2fdabd3e6f5b772f1174e315c | 994d5147c315b31f997d8d24b0f8ce7a9557ad31 | 6a8cbed756804b16e05e741edabd5cb544ae21bf | 5378c23f4cf85fc28fddea16153cf9213aefe9be | 615c335150346109c2576020615ddc5f395f516020602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160803950506020615dfc5f395f51600a602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160c03950506020615e9c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156100d857905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b61012001526001018181186100a9575b5050806101005250506020615ebc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f5160208160051b018083615ddc01610220395050506020615edc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561018257905b60208160051b6020860101615ddc015f395f518060081c6109c2578160051b6103600152600101818118610153575b5050806103405250506020615efc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156101f257905b60208160051b6020860101615ddc015f395f518060201b6109c2578160051b61048001526001018181186101c3575b5050806104605250506020615f1c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561026257905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b6105a00152600101818118610233575b5050806105805250506101005160208160051b015f81601f0160051c600981116109c25780156102ae57905b8060051b61010001518160051b6060016153f3015260010181811861028e575b505050506103405160208160051b015f81601f0160051c600981116109c25780156102f657905b8060051b61034001518160051b610180016153f301526001018181186102d5575b505050505f6106a0525f61557351600881116109c257801561033e57905b60028160051b6101a0016153f30151186103335760016106a05261033e565b600101818118610314575b50506106a05161569352610100516106a0526106a0516153f3526106a05180607f1c6109c257615413526102205160208160051b015f81601f0160051c600981116109c25780156103ac57905b8060051b61022001518160051b6102c0016153f3015260010181811861038b575b50505050336154335260646020615e1c5f395f51026106c0526106c051600c556106c051600d556020615e3c5f395f51600a556020615e5c5f395f51600b556020615e7c5f395f51156109c2576020615e7c5f395f5160235561f374602455426040524260605261041e6106e0610981565b6106e0516025555f6106e0525f610800525f610920525f61541351600881116109c257801561070a57905b80610a4052615413516001810380600f0b81186109c2579050610a405112156104ac57601954600781116109c257670de0b6b3a7640000604052670de0b6b3a764000060605261049a610a60610981565b610a605181601a015560018101601955505b61092051600781116109c257610a4051610580518110156109c25760051b6105a00151610a4051610460518110156109c25760051b61048001518060e01c90508060e01b818160e01c186109c2579050178160051b6109400152600181016109205250600154600781116109c2575f81600201556001810160015550601054600781116109c2575f816011015560018101601055506003610a4051610340518110156109c25760051b6103600151186106c0576106e051600781116109c257610a4051610100518110156109c25760051b610120015163313ce567610a60526020610a606004610a7c845afa6105a4573d5f5f3e3d5ffd5b60203d106109c257610a60518060081c6109c257610aa052610aa0905051604d81116109c25780600a0a90508160051b6107000152600181016106e05250610a4051610100518110156109c25760051b61012001516338d52e0f610a80526020610a806004610a9c845afa61061b573d5f5f3e3d5ffd5b60203d106109c257610a80518060a01c6109c257610ac052610ac0905051610a605261080051600781116109c257610a605163313ce567610a80526020610a806004610a9c845afa61066f573d5f5f3e3d5ffd5b60203d106109c257610a80518060081c6109c257610ac052610ac090505180601203601281116109c2579050604d81116109c25780600a0a90508160051b61082001526001810161080052506106ff565b6106e051600781116109c2575f8160051b6107000152600181016106e0525061080051600781116109c2575f8160051b61082001526001810161080052505b600101818118610449575b50506106e05160208160051b015f81601f0160051c600981116109c257801561075057905b8060051b6106e001518160051b610500016153f3015260010181811861072f575b505050506108005160208160051b015f81601f0160051c600981116109c257801561079857905b8060051b61080001518160051b610620016153f30152600101818118610777575b505050506109205160208160051b015f81601f0160051c600981116109c25780156107e057905b8060051b61092001518160051b6103e0016153f301526001018181186107bf575b505050506020608051015f81601f0160051c600281116109c257801561082257905b8060051b608001518160051b610740016153f30152600101818118610802575b505050602060c051015f81601f0160051c600281116109c257801561086357905b8060051b60c001518160051b6107a0016153f30152600101818118610843575b5050506020615b3351015f81601f0160051c600381116109c25780156108a657905b8060051b610740016153f301518160051b610a400152600101818118610885575b505050610a40805160208201209050615bd3526001430340615c135246615bf3527fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac56472610a6052615bd351610a80527f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d610aa05246610ac05230610ae052615c1351610b005260c0610a4052610a40805160208201209050615c3352335f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f610a40526020610a40a36153f36109c661000039615c53610000f35b6fffffffffffffffffffffffffffffffff604051116109c2576fffffffffffffffffffffffffffffffff606051116109c25760605160801b60405117815250565b5f80fd5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5841953f387181e185b184618541846183f1831190860a16576797065728300030a0023000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000003d090000000000000000000000000000000000000000000000000000000004a817c800000000000000000000000000000000000000000000000000000000000000036200000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000000d696e73744554482f737445544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a637276696e73744554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007fa768e035f956c41d6aeaa3bd857e7e5141cad5000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002679aefce0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000343281bb5029c4b698fe736d800115ac64d5de390000000000000000000000000000000000000000000000000000000000000000 | 5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000006a8cbed756804b16e05e741edabd5cb544ae21bf00000000000000000000000000000000000000000000000000000000000000020000000000000000000000007fa768e035f956c41d6aeaa3bd857e7e5141cad5000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002679aefce0000000000000000343281bb5029c4b698fe736d800115ac64d5de390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d696e73744554482f7374455448000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a637276696e737445544800000000000000000000000000000000000000000000e6859c8b7fcb75a8947009b9d7f0cb0aa92ea40442509e1fe84c2c24042698380000000000000000000000000000000000000000000000000000000000000001564d02b74513ddfff820421c741cbef34ce3cf988dce0ddabed077368e17607738cfd42148edd768cf53194fb39733884cf360153dab7d621a9d778c45cd59ee | # pragma version 0.3.10
# pragma optimize codesize
# pragma evm-version shanghai
"""
@title CurveStableSwapNG
@author Curve.Fi
@license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved
@notice Stableswap implementation for up to 8 coins with no rehypothecation,
i.e. the AMM does not deposit tokens into other contracts. The Pool contract also
records exponential moving averages for coins relative to coin 0.
@dev Asset Types:
0. Standard ERC20 token with no additional features.
Note: Users are advised to do careful due-diligence on
ERC20 tokens that they interact with, as this
contract cannot differentiate between harmless and
malicious ERC20 tokens.
1. Oracle - token with rate oracle (e.g. wstETH)
Note: Oracles may be controlled externally by an EOA. Users
are advised to proceed with caution.
2. Rebasing - token with rebase (e.g. stETH).
Note: Users and Integrators are advised to understand how
the AMM contract works with rebasing balances.
3. ERC4626 - token with convertToAssets method (e.g. sDAI).
Note: Some ERC4626 implementations may be susceptible to
Donation/Inflation attacks. Users are advised to
proceed with caution.
NOTE: Pool Cannot support tokens with multiple asset types: e.g. ERC4626
with fees are not supported.
Supports:
1. ERC20 support for return True/revert, return True/False, return None
2. ERC20 tokens can have arbitrary decimals (<=18).
3. ERC20 tokens that rebase (either positive or fee on transfer)
4. ERC20 tokens that have a rate oracle (e.g. wstETH, cbETH, sDAI, etc.)
Note: Oracle precision _must_ be 10**18.
5. ERC4626 tokens with arbitrary precision (<=18) of Vault token and underlying
asset.
Additional features include:
1. Adds price oracles based on AMM State Price (and _not_ last traded price).
2. Adds TVL oracle based on D.
3. `exchange_received`: swaps that expect an ERC20 transfer to have occurred
prior to executing the swap.
Note: a. If pool contains rebasing tokens and one of the `asset_types` is 2 (Rebasing)
then calling `exchange_received` will REVERT.
b. If pool contains rebasing token and `asset_types` does not contain 2 (Rebasing)
then this is an incorrect implementation and rebases can be
stolen.
4. Adds `get_dx`: Similar to `get_dy` which returns an expected output
of coin[j] for given `dx` amount of coin[i], `get_dx` returns expected
input of coin[i] for an output amount of coin[j].
5. Fees are dynamic: AMM will charge a higher fee if pool depegs. This can cause very
slight discrepancies between calculated fees and realised fees.
"""
from vyper.interfaces import ERC20
from vyper.interfaces import ERC20Detailed
from vyper.interfaces import ERC4626
implements: ERC20
# ------------------------------- Interfaces ---------------------------------
interface Factory:
def fee_receiver() -> address: view
def admin() -> address: view
def views_implementation() -> address: view
interface ERC1271:
def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view
interface StableSwapViews:
def get_dx(i: int128, j: int128, dy: uint256, pool: address) -> uint256: view
def get_dy(i: int128, j: int128, dx: uint256, pool: address) -> uint256: view
def dynamic_fee(i: int128, j: int128, pool: address) -> uint256: view
def calc_token_amount(
_amounts: DynArray[uint256, MAX_COINS],
_is_deposit: bool,
_pool: address
) -> uint256: view
# --------------------------------- Events -----------------------------------
event Transfer:
sender: indexed(address)
receiver: indexed(address)
value: uint256
event Approval:
owner: indexed(address)
spender: indexed(address)
value: uint256
event TokenExchange:
buyer: indexed(address)
sold_id: int128
tokens_sold: uint256
bought_id: int128
tokens_bought: uint256
event TokenExchangeUnderlying:
buyer: indexed(address)
sold_id: int128
tokens_sold: uint256
bought_id: int128
tokens_bought: uint256
event AddLiquidity:
provider: indexed(address)
token_amounts: DynArray[uint256, MAX_COINS]
fees: DynArray[uint256, MAX_COINS]
invariant: uint256
token_supply: uint256
event RemoveLiquidity:
provider: indexed(address)
token_amounts: DynArray[uint256, MAX_COINS]
fees: DynArray[uint256, MAX_COINS]
token_supply: uint256
event RemoveLiquidityOne:
provider: indexed(address)
token_id: int128
token_amount: uint256
coin_amount: uint256
token_supply: uint256
event RemoveLiquidityImbalance:
provider: indexed(address)
token_amounts: DynArray[uint256, MAX_COINS]
fees: DynArray[uint256, MAX_COINS]
invariant: uint256
token_supply: uint256
event RampA:
old_A: uint256
new_A: uint256
initial_time: uint256
future_time: uint256
event StopRampA:
A: uint256
t: uint256
event ApplyNewFee:
fee: uint256
offpeg_fee_multiplier: uint256
event SetNewMATime:
ma_exp_time: uint256
D_ma_time: uint256
MAX_COINS: constant(uint256) = 8 # max coins is 8 in the factory
MAX_COINS_128: constant(int128) = 8
# ---------------------------- Pool Variables --------------------------------
N_COINS: public(immutable(uint256))
N_COINS_128: immutable(int128)
PRECISION: constant(uint256) = 10 ** 18
factory: immutable(Factory)
coins: public(immutable(DynArray[address, MAX_COINS]))
asset_types: immutable(DynArray[uint8, MAX_COINS])
pool_contains_rebasing_tokens: immutable(bool)
stored_balances: DynArray[uint256, MAX_COINS]
# Fee specific vars
FEE_DENOMINATOR: constant(uint256) = 10 ** 10
fee: public(uint256) # fee * 1e10
offpeg_fee_multiplier: public(uint256) # * 1e10
admin_fee: public(constant(uint256)) = 5000000000
MAX_FEE: constant(uint256) = 5 * 10 ** 9
# ---------------------- Pool Amplification Parameters -----------------------
A_PRECISION: constant(uint256) = 100
MAX_A: constant(uint256) = 10 ** 6
MAX_A_CHANGE: constant(uint256) = 10
initial_A: public(uint256)
future_A: public(uint256)
initial_A_time: public(uint256)
future_A_time: public(uint256)
# ---------------------------- Admin Variables -------------------------------
MIN_RAMP_TIME: constant(uint256) = 86400
admin_balances: public(DynArray[uint256, MAX_COINS])
# ----------------------- Oracle Specific vars -------------------------------
rate_multipliers: immutable(DynArray[uint256, MAX_COINS])
# [bytes4 method_id][bytes8 <empty>][bytes20 oracle]
rate_oracles: immutable(DynArray[uint256, MAX_COINS])
# For ERC4626 tokens, we need:
call_amount: immutable(DynArray[uint256, MAX_COINS])
scale_factor: immutable(DynArray[uint256, MAX_COINS])
last_prices_packed: DynArray[uint256, MAX_COINS] # packing: last_price, ma_price
last_D_packed: uint256 # packing: last_D, ma_D
ma_exp_time: public(uint256)
D_ma_time: public(uint256)
ma_last_time: public(uint256) # packing: ma_last_time_p, ma_last_time_D
# ma_last_time has a distinction for p and D because p is _not_ updated if
# users remove_liquidity, but D is.
# shift(2**32 - 1, 224)
ORACLE_BIT_MASK: constant(uint256) = (2**32 - 1) * 256**28
# --------------------------- ERC20 Specific Vars ----------------------------
name: public(immutable(String[64]))
symbol: public(immutable(String[32]))
decimals: public(constant(uint8)) = 18
version: public(constant(String[8])) = "v7.0.0"
balanceOf: public(HashMap[address, uint256])
allowance: public(HashMap[address, HashMap[address, uint256]])
total_supply: uint256
nonces: public(HashMap[address, uint256])
# keccak256("isValidSignature(bytes32,bytes)")[:4] << 224
ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000
EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)")
EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")
VERSION_HASH: constant(bytes32) = keccak256(version)
NAME_HASH: immutable(bytes32)
CACHED_CHAIN_ID: immutable(uint256)
salt: public(immutable(bytes32))
CACHED_DOMAIN_SEPARATOR: immutable(bytes32)
# ------------------------------ AMM Setup -----------------------------------
@external
def __init__(
_name: String[32],
_symbol: String[10],
_A: uint256,
_fee: uint256,
_offpeg_fee_multiplier: uint256,
_ma_exp_time: uint256,
_coins: DynArray[address, MAX_COINS],
_rate_multipliers: DynArray[uint256, MAX_COINS],
_asset_types: DynArray[uint8, MAX_COINS],
_method_ids: DynArray[bytes4, MAX_COINS],
_oracles: DynArray[address, MAX_COINS],
):
"""
@notice Initialize the pool contract
@param _name Name of the new plain pool.
@param _symbol Symbol for the new plain pool.
@param _A Amplification co-efficient - a lower value here means
less tolerance for imbalance within the pool's assets.
Suggested values include:
* Uncollateralized algorithmic stablecoins: 5-10
* Non-redeemable, collateralized assets: 100
* Redeemable assets: 200-400
@param _fee Trade fee, given as an integer with 1e10 precision. The
the maximum is 1% (100000000).
50% of the fee is distributed to veCRV holders.
@param _offpeg_fee_multiplier A multiplier that determines how much to increase
Fees by when assets in the AMM depeg. Example value: 20000000000
@param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2)
Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866
@param _coins List of addresses of the coins being used in the pool.
@param _rate_multipliers An array of: [10 ** (36 - _coins[n].decimals()), ... for n in range(N_COINS)]
@param _asset_types Array of uint8 representing tokens in pool
@param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures
of the oracle addresses that gives rate oracles.
Calculated as: keccak(text=event_signature.replace(" ", ""))[:4]
@param _oracles Array of rate oracle addresses.
"""
coins = _coins
asset_types = _asset_types
pool_contains_rebasing_tokens = 2 in asset_types
__n_coins: uint256 = len(_coins)
N_COINS = __n_coins
N_COINS_128 = convert(__n_coins, int128)
rate_multipliers = _rate_multipliers
factory = Factory(msg.sender)
A: uint256 = unsafe_mul(_A, A_PRECISION)
self.initial_A = A
self.future_A = A
self.fee = _fee
self.offpeg_fee_multiplier = _offpeg_fee_multiplier
assert _ma_exp_time != 0
self.ma_exp_time = _ma_exp_time
self.D_ma_time = 62324 # <--------- 12 hours default on contract start.
self.ma_last_time = self.pack_2(block.timestamp, block.timestamp)
# ------------------- initialize storage for DynArrays ------------------
_call_amount: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
_scale_factor: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
_rate_oracles: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
for i in range(N_COINS_128, bound=MAX_COINS_128):
if i < N_COINS_128 - 1:
self.last_prices_packed.append(self.pack_2(10**18, 10**18))
_rate_oracles.append(convert(_method_ids[i], uint256) * 2**224 | convert(_oracles[i], uint256))
self.stored_balances.append(0)
self.admin_balances.append(0)
if _asset_types[i] == 3:
_call_amount.append(10**convert(ERC20Detailed(_coins[i]).decimals(), uint256))
_underlying_asset: address = ERC4626(_coins[i]).asset()
_scale_factor.append(10**(18 - convert(ERC20Detailed(_underlying_asset).decimals(), uint256)))
else:
_call_amount.append(0)
_scale_factor.append(0)
call_amount = _call_amount
scale_factor = _scale_factor
rate_oracles = _rate_oracles
# ----------------------------- ERC20 stuff ------------------------------
name = _name
symbol = _symbol
# EIP712 related params -----------------
NAME_HASH = keccak256(name)
salt = block.prevhash
CACHED_CHAIN_ID = chain.id
CACHED_DOMAIN_SEPARATOR = keccak256(
_abi_encode(
EIP712_TYPEHASH,
NAME_HASH,
VERSION_HASH,
chain.id,
self,
salt,
)
)
# ------------------------ Fire a transfer event -------------------------
log Transfer(empty(address), msg.sender, 0)
# ------------------ Token transfers in and out of the AMM -------------------
@internal
def _transfer_in(
coin_idx: int128,
dx: uint256,
sender: address,
expect_optimistic_transfer: bool,
) -> uint256:
"""
@notice Contains all logic to handle ERC20 token transfers.
@param coin_idx Index of the coin to transfer in.
@param dx amount of `_coin` to transfer into the pool.
@param sender address to transfer `_coin` from.
@param receiver address to transfer `_coin` to.
@param expect_optimistic_transfer True if contract expects an optimistic coin transfer
"""
_dx: uint256 = ERC20(coins[coin_idx]).balanceOf(self)
# ------------------------- Handle Transfers -----------------------------
if expect_optimistic_transfer:
_dx = _dx - self.stored_balances[coin_idx]
assert _dx >= dx
else:
assert dx > 0 # dev : do not transferFrom 0 tokens into the pool
assert ERC20(coins[coin_idx]).transferFrom(
sender, self, dx, default_return_value=True
)
_dx = ERC20(coins[coin_idx]).balanceOf(self) - _dx
# --------------------------- Store transferred in amount ---------------------------
self.stored_balances[coin_idx] += _dx
return _dx
@internal
def _transfer_out(_coin_idx: int128, _amount: uint256, receiver: address):
"""
@notice Transfer a single token from the pool to receiver.
@dev This function is called by `remove_liquidity` and
`remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and
`remove_liquidity_imbalance` methods.
@param _coin_idx Index of the token to transfer out
@param _amount Amount of token to transfer out
@param receiver Address to send the tokens to
"""
assert receiver != empty(address) # dev: do not send tokens to zero_address
if not pool_contains_rebasing_tokens:
# we need not cache balanceOf pool before swap out
self.stored_balances[_coin_idx] -= _amount
assert ERC20(coins[_coin_idx]).transfer(
receiver, _amount, default_return_value=True
)
else:
# cache balances pre and post to account for fee on transfers etc.
coin_balance: uint256 = ERC20(coins[_coin_idx]).balanceOf(self)
assert ERC20(coins[_coin_idx]).transfer(
receiver, _amount, default_return_value=True
)
self.stored_balances[_coin_idx] = coin_balance - _amount
# -------------------------- AMM Special Methods -----------------------------
@view
@internal
def _stored_rates() -> DynArray[uint256, MAX_COINS]:
"""
@notice Gets rate multipliers for each coin.
@dev If the coin has a rate oracle that has been properly initialised,
this method queries that rate by static-calling an external
contract.
"""
rates: DynArray[uint256, MAX_COINS] = rate_multipliers
for i in range(N_COINS_128, bound=MAX_COINS_128):
if asset_types[i] == 1 and not rate_oracles[i] == 0:
# NOTE: fetched_rate is assumed to be 10**18 precision
oracle_response: Bytes[32] = raw_call(
convert(rate_oracles[i] % 2**160, address),
_abi_encode(rate_oracles[i] & ORACLE_BIT_MASK),
max_outsize=32,
is_static_call=True,
)
assert len(oracle_response) == 32
fetched_rate: uint256 = convert(oracle_response, uint256)
rates[i] = unsafe_div(rates[i] * fetched_rate, PRECISION)
elif asset_types[i] == 3: # ERC4626
# fetched_rate: uint256 = ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i]
# here: call_amount has ERC4626 precision, but the returned value is scaled up to 18
# using scale_factor which is (18 - n) if underlying asset has n decimals.
rates[i] = unsafe_div(
rates[i] * ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i],
PRECISION
) # 1e18 precision
return rates
@view
@internal
def _balances() -> DynArray[uint256, MAX_COINS]:
"""
@notice Calculates the pool's balances _excluding_ the admin's balances.
@dev If the pool contains rebasing tokens, this method ensures LPs keep all
rebases and admin only claims swap fees. This also means that, since
admin's balances are stored in an array and not inferred from read balances,
the fees in the rebasing token that the admin collects is immune to
slashing events.
"""
result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
balances_i: uint256 = 0
for i in range(N_COINS_128, bound=MAX_COINS_128):
if pool_contains_rebasing_tokens:
# Read balances by gulping to account for rebases
balances_i = ERC20(coins[i]).balanceOf(self) - self.admin_balances[i]
else:
# Use cached balances
balances_i = self.stored_balances[i] - self.admin_balances[i]
result.append(balances_i)
return result
# -------------------------- AMM Main Functions ------------------------------
@external
@nonreentrant('lock')
def exchange(
i: int128,
j: int128,
_dx: uint256,
_min_dy: uint256,
_receiver: address = msg.sender,
) -> uint256:
"""
@notice Perform an exchange between two coins
@dev Index values can be found via the `coins` public getter method
@param i Index value for the coin to send
@param j Index value of the coin to receive
@param _dx Amount of `i` being exchanged
@param _min_dy Minimum amount of `j` to receive
@param _receiver Address that receives `j`
@return Actual amount of `j` received
"""
return self._exchange(
msg.sender,
i,
j,
_dx,
_min_dy,
_receiver,
False
)
@external
@nonreentrant('lock')
def exchange_received(
i: int128,
j: int128,
_dx: uint256,
_min_dy: uint256,
_receiver: address = msg.sender,
) -> uint256:
"""
@notice Perform an exchange between two coins without transferring token in
@dev The contract swaps tokens based on a change in balance of coin[i]. The
dx = ERC20(coin[i]).balanceOf(self) - self.stored_balances[i]. Users of
this method are dex aggregators, arbitrageurs, or other users who do not
wish to grant approvals to the contract: they would instead send tokens
directly to the contract and call `exchange_received`.
Note: This is disabled if pool contains rebasing tokens.
@param i Index value for the coin to send
@param j Index value of the coin to receive
@param _dx Amount of `i` being exchanged
@param _min_dy Minimum amount of `j` to receive
@param _receiver Address that receives `j`
@return Actual amount of `j` received
"""
assert not pool_contains_rebasing_tokens # dev: exchange_received not supported if pool contains rebasing tokens
return self._exchange(
msg.sender,
i,
j,
_dx,
_min_dy,
_receiver,
True, # <--------------------------------------- swap optimistically.
)
@external
@nonreentrant('lock')
def add_liquidity(
_amounts: DynArray[uint256, MAX_COINS],
_min_mint_amount: uint256,
_receiver: address = msg.sender
) -> uint256:
"""
@notice Deposit coins into the pool
@param _amounts List of amounts of coins to deposit
@param _min_mint_amount Minimum amount of LP tokens to mint from the deposit
@param _receiver Address that owns the minted LP tokens
@return Amount of LP tokens received by depositing
"""
assert _receiver != empty(address) # dev: do not send LP tokens to zero_address
amp: uint256 = self._A()
old_balances: DynArray[uint256, MAX_COINS] = self._balances()
rates: DynArray[uint256, MAX_COINS] = self._stored_rates()
# Initial invariant
D0: uint256 = self.get_D_mem(rates, old_balances, amp)
total_supply: uint256 = self.total_supply
new_balances: DynArray[uint256, MAX_COINS] = old_balances
# -------------------------- Do Transfers In -----------------------------
for i in range(N_COINS_128, bound=MAX_COINS_128):
if _amounts[i] > 0:
new_balances[i] += self._transfer_in(
i,
_amounts[i],
msg.sender,
False, # expect_optimistic_transfer
)
else:
assert total_supply != 0 # dev: initial deposit requires all coins
# ------------------------------------------------------------------------
# Invariant after change
D1: uint256 = self.get_D_mem(rates, new_balances, amp)
assert D1 > D0
# We need to recalculate the invariant accounting for fees
# to calculate fair user's share
fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
mint_amount: uint256 = 0
if total_supply > 0:
ideal_balance: uint256 = 0
difference: uint256 = 0
new_balance: uint256 = 0
ys: uint256 = unsafe_div(D0 + D1, N_COINS)
xs: uint256 = 0
_dynamic_fee_i: uint256 = 0
# Only account for fees if we are not the first to deposit
base_fee: uint256 = unsafe_div(
unsafe_mul(self.fee, N_COINS),
unsafe_mul(4, unsafe_sub(N_COINS, 1))
)
for i in range(N_COINS_128, bound=MAX_COINS_128):
ideal_balance = D1 * old_balances[i] / D0
difference = 0
new_balance = new_balances[i]
if ideal_balance > new_balance:
difference = unsafe_sub(ideal_balance, new_balance)
else:
difference = unsafe_sub(new_balance, ideal_balance)
# fee[i] = _dynamic_fee(i, j) * difference / FEE_DENOMINATOR
xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION)
_dynamic_fee_i = self._dynamic_fee(xs, ys, base_fee)
fees.append(unsafe_div(_dynamic_fee_i * difference, FEE_DENOMINATOR))
self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR)
new_balances[i] -= fees[i]
xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, new_balances)
D1 = self.get_D(xp, amp) # <--------------- Reuse D1 for new D value.
mint_amount = unsafe_div(total_supply * (D1 - D0), D0)
self.upkeep_oracles(xp, amp, D1)
else:
mint_amount = D1 # Take the dust if there was any
# (re)instantiate D oracle if totalSupply is zero.
self.last_D_packed = self.pack_2(D1, D1)
# Update D ma time:
ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time)
if ma_last_time_unpacked[1] < block.timestamp:
ma_last_time_unpacked[1] = block.timestamp
self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1])
assert mint_amount >= _min_mint_amount, "Slippage screwed you"
# Mint pool tokens
total_supply += mint_amount
self.balanceOf[_receiver] += mint_amount
self.total_supply = total_supply
log Transfer(empty(address), _receiver, mint_amount)
log AddLiquidity(msg.sender, _amounts, fees, D1, total_supply)
return mint_amount
@external
@nonreentrant('lock')
def remove_liquidity_one_coin(
_burn_amount: uint256,
i: int128,
_min_received: uint256,
_receiver: address = msg.sender,
) -> uint256:
"""
@notice Withdraw a single coin from the pool
@param _burn_amount Amount of LP tokens to burn in the withdrawal
@param i Index value of the coin to withdraw
@param _min_received Minimum amount of coin to receive
@param _receiver Address that receives the withdrawn coins
@return Amount of coin received
"""
assert _burn_amount > 0 # dev: do not remove 0 LP tokens
dy: uint256 = 0
fee: uint256 = 0
xp: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
amp: uint256 = empty(uint256)
D: uint256 = empty(uint256)
dy, fee, xp, amp, D = self._calc_withdraw_one_coin(_burn_amount, i)
assert dy >= _min_received, "Not enough coins removed"
self.admin_balances[i] += unsafe_div(fee * admin_fee, FEE_DENOMINATOR)
self._burnFrom(msg.sender, _burn_amount)
self._transfer_out(i, dy, _receiver)
log RemoveLiquidityOne(msg.sender, i, _burn_amount, dy, self.total_supply)
self.upkeep_oracles(xp, amp, D)
return dy
@external
@nonreentrant('lock')
def remove_liquidity_imbalance(
_amounts: DynArray[uint256, MAX_COINS],
_max_burn_amount: uint256,
_receiver: address = msg.sender
) -> uint256:
"""
@notice Withdraw coins from the pool in an imbalanced amount
@param _amounts List of amounts of underlying coins to withdraw
@param _max_burn_amount Maximum amount of LP token to burn in the withdrawal
@param _receiver Address that receives the withdrawn coins
@return Actual amount of the LP token burned in the withdrawal
"""
amp: uint256 = self._A()
rates: DynArray[uint256, MAX_COINS] = self._stored_rates()
old_balances: DynArray[uint256, MAX_COINS] = self._balances()
D0: uint256 = self.get_D_mem(rates, old_balances, amp)
new_balances: DynArray[uint256, MAX_COINS] = old_balances
for i in range(N_COINS_128, bound=MAX_COINS_128):
if _amounts[i] != 0:
new_balances[i] -= _amounts[i]
self._transfer_out(i, _amounts[i], _receiver)
D1: uint256 = self.get_D_mem(rates, new_balances, amp)
base_fee: uint256 = unsafe_div(
unsafe_mul(self.fee, N_COINS),
unsafe_mul(4, unsafe_sub(N_COINS, 1))
)
ys: uint256 = unsafe_div((D0 + D1), N_COINS)
fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
dynamic_fee: uint256 = 0
xs: uint256 = 0
ideal_balance: uint256 = 0
difference: uint256 = 0
new_balance: uint256 = 0
for i in range(N_COINS_128, bound=MAX_COINS_128):
ideal_balance = D1 * old_balances[i] / D0
difference = 0
new_balance = new_balances[i]
if ideal_balance > new_balance:
difference = unsafe_sub(ideal_balance, new_balance)
else:
difference = unsafe_sub(new_balance, ideal_balance)
xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION)
dynamic_fee = self._dynamic_fee(xs, ys, base_fee)
fees.append(unsafe_div(dynamic_fee * difference, FEE_DENOMINATOR))
self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR)
new_balances[i] -= fees[i]
D1 = self.get_D_mem(rates, new_balances, amp) # dev: reuse D1 for new D.
self.upkeep_oracles(self._xp_mem(rates, new_balances), amp, D1)
total_supply: uint256 = self.total_supply
burn_amount: uint256 = unsafe_div((D0 - D1) * total_supply, D0) + 1
assert burn_amount > 1 # dev: zero tokens burned
assert burn_amount <= _max_burn_amount, "Slippage screwed you"
self._burnFrom(msg.sender, burn_amount)
log RemoveLiquidityImbalance(
msg.sender,
_amounts,
fees,
D1,
total_supply - burn_amount
)
return burn_amount
@external
@nonreentrant('lock')
def remove_liquidity(
_burn_amount: uint256,
_min_amounts: DynArray[uint256, MAX_COINS],
_receiver: address = msg.sender,
_claim_admin_fees: bool = True,
) -> DynArray[uint256, MAX_COINS]:
"""
@notice Withdraw coins from the pool
@dev Withdrawal amounts are based on current deposit ratios
@param _burn_amount Quantity of LP tokens to burn in the withdrawal
@param _min_amounts Minimum amounts of underlying coins to receive
@param _receiver Address that receives the withdrawn coins
@return List of amounts of coins that were withdrawn
"""
total_supply: uint256 = self.total_supply
assert _burn_amount > 0 # dev: invalid burn amount
assert len(_min_amounts) == N_COINS # dev: invalid array length for _min_amounts
amounts: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
balances: DynArray[uint256, MAX_COINS] = self._balances()
value: uint256 = 0
for i in range(N_COINS_128, bound=MAX_COINS_128):
value = unsafe_div(balances[i] * _burn_amount, total_supply)
assert value >= _min_amounts[i], "Withdrawal resulted in fewer coins than expected"
amounts.append(value)
self._transfer_out(i, value, _receiver)
self._burnFrom(msg.sender, _burn_amount) # <---- Updates self.total_supply
# --------------------------- Upkeep D_oracle ----------------------------
ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time)
last_D_packed_current: uint256 = self.last_D_packed
old_D: uint256 = last_D_packed_current & (2**128 - 1)
self.last_D_packed = self.pack_2(
old_D - unsafe_div(old_D * _burn_amount, total_supply), # new_D = proportionally reduce D.
self._calc_moving_average(
last_D_packed_current,
self.D_ma_time,
ma_last_time_unpacked[1]
)
)
if ma_last_time_unpacked[1] < block.timestamp:
ma_last_time_unpacked[1] = block.timestamp
self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1])
# ------------------------------- Log event ------------------------------
log RemoveLiquidity(
msg.sender,
amounts,
empty(DynArray[uint256, MAX_COINS]),
unsafe_sub(total_supply, _burn_amount)
)
# ------- Withdraw admin fees if _claim_admin_fees is set to True --------
if _claim_admin_fees:
self._withdraw_admin_fees()
return amounts
@external
@nonreentrant('lock')
def withdraw_admin_fees():
"""
@notice Claim admin fees. Callable by anyone.
"""
self._withdraw_admin_fees()
# ------------------------ AMM Internal Functions ----------------------------
@view
@internal
def _dynamic_fee(xpi: uint256, xpj: uint256, _fee: uint256) -> uint256:
_offpeg_fee_multiplier: uint256 = self.offpeg_fee_multiplier
if _offpeg_fee_multiplier <= FEE_DENOMINATOR:
return _fee
xps2: uint256 = (xpi + xpj) ** 2
return unsafe_div(
unsafe_mul(_offpeg_fee_multiplier, _fee),
unsafe_add(
unsafe_sub(_offpeg_fee_multiplier, FEE_DENOMINATOR) * 4 * xpi * xpj / xps2,
FEE_DENOMINATOR
)
)
@internal
def __exchange(
x: uint256,
_xp: DynArray[uint256, MAX_COINS],
rates: DynArray[uint256, MAX_COINS],
i: int128,
j: int128,
) -> uint256:
amp: uint256 = self._A()
D: uint256 = self.get_D(_xp, amp)
y: uint256 = self.get_y(i, j, x, _xp, amp, D)
dy: uint256 = _xp[j] - y - 1 # -1 just in case there were some rounding errors
dy_fee: uint256 = unsafe_div(
dy * self._dynamic_fee(
unsafe_div(_xp[i] + x, 2), unsafe_div(_xp[j] + y, 2), self.fee
),
FEE_DENOMINATOR
)
# Convert all to real units
dy = (dy - dy_fee) * PRECISION / rates[j]
self.admin_balances[j] += unsafe_div(
unsafe_div(dy_fee * admin_fee, FEE_DENOMINATOR) * PRECISION,
rates[j]
)
# Calculate and store state prices:
xp: DynArray[uint256, MAX_COINS] = _xp
xp[i] = x
xp[j] = y
# D is not changed because we did not apply a fee
self.upkeep_oracles(xp, amp, D)
return dy
@internal
def _exchange(
sender: address,
i: int128,
j: int128,
_dx: uint256,
_min_dy: uint256,
receiver: address,
expect_optimistic_transfer: bool
) -> uint256:
assert i != j # dev: coin index out of range
assert _dx > 0 # dev: do not exchange 0 coins
rates: DynArray[uint256, MAX_COINS] = self._stored_rates()
old_balances: DynArray[uint256, MAX_COINS] = self._balances()
xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, old_balances)
# --------------------------- Do Transfer in -----------------------------
# `dx` is whatever the pool received after ERC20 transfer:
dx: uint256 = self._transfer_in(
i,
_dx,
sender,
expect_optimistic_transfer
)
# ------------------------------- Exchange -------------------------------
x: uint256 = xp[i] + unsafe_div(dx * rates[i], PRECISION)
dy: uint256 = self.__exchange(x, xp, rates, i, j)
assert dy >= _min_dy, "Exchange resulted in fewer coins than expected"
# --------------------------- Do Transfer out ----------------------------
self._transfer_out(j, dy, receiver)
# ------------------------------------------------------------------------
log TokenExchange(msg.sender, i, dx, j, dy)
return dy
@internal
def _withdraw_admin_fees():
fee_receiver: address = factory.fee_receiver()
if fee_receiver == empty(address):
return # Do nothing.
admin_balances: DynArray[uint256, MAX_COINS] = self.admin_balances
for i in range(N_COINS_128, bound=MAX_COINS_128):
if admin_balances[i] > 0:
self._transfer_out(i, admin_balances[i], fee_receiver)
admin_balances[i] = 0
self.admin_balances = admin_balances
# --------------------------- AMM Math Functions -----------------------------
@view
@internal
def get_y(
i: int128,
j: int128,
x: uint256,
xp: DynArray[uint256, MAX_COINS],
_amp: uint256,
_D: uint256
) -> uint256:
"""
Calculate x[j] if one makes x[i] = x
Done by solving quadratic equation iteratively.
x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
x_1**2 + b*x_1 = c
x_1 = (x_1**2 + c) / (2*x_1 + b)
"""
# x in the input is converted to the same price/precision
assert i != j # dev: same coin
assert j >= 0 # dev: j below zero
assert j < N_COINS_128 # dev: j above N_COINS
# should be unreachable, but good for safety
assert i >= 0
assert i < N_COINS_128
amp: uint256 = _amp
D: uint256 = _D
S_: uint256 = 0
_x: uint256 = 0
y_prev: uint256 = 0
c: uint256 = D
Ann: uint256 = amp * N_COINS
for _i in range(MAX_COINS_128):
if _i == N_COINS_128:
break
if _i == i:
_x = x
elif _i != j:
_x = xp[_i]
else:
continue
S_ += _x
c = c * D / (_x * N_COINS)
c = c * D * A_PRECISION / (Ann * N_COINS)
b: uint256 = S_ + D * A_PRECISION / Ann # - D
y: uint256 = D
for _i in range(255):
y_prev = y
y = (y*y + c) / (2 * y + b - D)
# Equality with the precision of 1
if y > y_prev:
if y - y_prev <= 1:
return y
else:
if y_prev - y <= 1:
return y
raise
@pure
@internal
def get_D(_xp: DynArray[uint256, MAX_COINS], _amp: uint256) -> uint256:
"""
D invariant calculation in non-overflowing integer operations
iteratively
A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i))
Converging solution:
D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1)
"""
S: uint256 = 0
for x in _xp:
S += x
if S == 0:
return 0
D: uint256 = S
Ann: uint256 = _amp * N_COINS
for i in range(255):
D_P: uint256 = D
for x in _xp:
D_P = D_P * D / x
D_P /= pow_mod256(N_COINS, N_COINS)
Dprev: uint256 = D
# (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P)
D = (
(unsafe_div(Ann * S, A_PRECISION) + D_P * N_COINS) * D
/
(
unsafe_div((Ann - A_PRECISION) * D, A_PRECISION) +
unsafe_add(N_COINS, 1) * D_P
)
)
# Equality with the precision of 1
if D > Dprev:
if D - Dprev <= 1:
return D
else:
if Dprev - D <= 1:
return D
# convergence typically occurs in 4 rounds or less, this should be unreachable!
# if it does happen the pool is borked and LPs can withdraw via `remove_liquidity`
raise
@pure
@internal
def get_y_D(
A: uint256,
i: int128,
xp: DynArray[uint256, MAX_COINS],
D: uint256
) -> uint256:
"""
Calculate x[i] if one reduces D from being calculated for xp to D
Done by solving quadratic equation iteratively.
x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
x_1**2 + b*x_1 = c
x_1 = (x_1**2 + c) / (2*x_1 + b)
"""
# x in the input is converted to the same price/precision
assert i >= 0 # dev: i below zero
assert i < N_COINS_128 # dev: i above N_COINS
S_: uint256 = 0
_x: uint256 = 0
y_prev: uint256 = 0
c: uint256 = D
Ann: uint256 = A * N_COINS
for _i in range(MAX_COINS_128):
if _i == N_COINS_128:
break
if _i != i:
_x = xp[_i]
else:
continue
S_ += _x
c = c * D / (_x * N_COINS)
c = c * D * A_PRECISION / (Ann * N_COINS)
b: uint256 = S_ + D * A_PRECISION / Ann
y: uint256 = D
for _i in range(255):
y_prev = y
y = (y*y + c) / (2 * y + b - D)
# Equality with the precision of 1
if y > y_prev:
if y - y_prev <= 1:
return y
else:
if y_prev - y <= 1:
return y
raise
@view
@internal
def _A() -> uint256:
"""
Handle ramping A up or down
"""
t1: uint256 = self.future_A_time
A1: uint256 = self.future_A
if block.timestamp < t1:
A0: uint256 = self.initial_A
t0: uint256 = self.initial_A_time
# Expressions in uint256 cannot have negative numbers, thus "if"
if A1 > A0:
return A0 + unsafe_sub(A1, A0) * (block.timestamp - t0) / (t1 - t0)
else:
return A0 - unsafe_sub(A0, A1) * (block.timestamp - t0) / (t1 - t0)
else: # when t1 == 0 or block.timestamp >= t1
return A1
@pure
@internal
def _xp_mem(
_rates: DynArray[uint256, MAX_COINS],
_balances: DynArray[uint256, MAX_COINS]
) -> DynArray[uint256, MAX_COINS]:
result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
for i in range(N_COINS_128, bound=MAX_COINS_128):
result.append(unsafe_div(_rates[i] * _balances[i], PRECISION))
return result
@view
@internal
def get_D_mem(
_rates: DynArray[uint256, MAX_COINS],
_balances: DynArray[uint256, MAX_COINS],
_amp: uint256
) -> uint256:
xp: DynArray[uint256, MAX_COINS] = self._xp_mem(_rates, _balances)
return self.get_D(xp, _amp)
@view
@internal
def _calc_withdraw_one_coin(
_burn_amount: uint256,
i: int128
) -> (
uint256,
uint256,
DynArray[uint256, MAX_COINS],
uint256,
uint256
):
# First, need to calculate
# * Get current D
# * Solve Eqn against y_i for D - _token_amount
amp: uint256 = self._A()
rates: DynArray[uint256, MAX_COINS] = self._stored_rates()
xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, self._balances())
D0: uint256 = self.get_D(xp, amp)
total_supply: uint256 = self.total_supply
D1: uint256 = D0 - _burn_amount * D0 / total_supply
new_y: uint256 = self.get_y_D(amp, i, xp, D1)
base_fee: uint256 = unsafe_div(
unsafe_mul(self.fee, N_COINS),
unsafe_mul(4, unsafe_sub(N_COINS, 1))
)
xp_reduced: DynArray[uint256, MAX_COINS] = xp
ys: uint256 = unsafe_div((D0 + D1), unsafe_mul(2, N_COINS))
dx_expected: uint256 = 0
xp_j: uint256 = 0
xavg: uint256 = 0
dynamic_fee: uint256 = 0
for j in range(MAX_COINS_128):
if j == N_COINS_128:
break
dx_expected = 0
xp_j = xp[j]
if j == i:
dx_expected = xp_j * D1 / D0 - new_y
xavg = unsafe_div((xp_j + new_y), 2)
else:
dx_expected = xp_j - xp_j * D1 / D0
xavg = xp_j
dynamic_fee = self._dynamic_fee(xavg, ys, base_fee)
xp_reduced[j] = xp_j - unsafe_div(dynamic_fee * dx_expected, FEE_DENOMINATOR)
dy: uint256 = xp_reduced[i] - self.get_y_D(amp, i, xp_reduced, D1)
dy_0: uint256 = (xp[i] - new_y) * PRECISION / rates[i] # w/o fees
dy = unsafe_div((dy - 1) * PRECISION, rates[i]) # Withdraw less to account for rounding errors
# update xp with new_y for p calculations.
xp[i] = new_y
return dy, dy_0 - dy, xp, amp, D1
# -------------------------- AMM Price Methods -------------------------------
@pure
@internal
def pack_2(p1: uint256, p2: uint256) -> uint256:
assert p1 < 2**128
assert p2 < 2**128
return p1 | (p2 << 128)
@pure
@internal
def unpack_2(packed: uint256) -> uint256[2]:
return [packed & (2**128 - 1), packed >> 128]
@internal
@pure
def _get_p(
xp: DynArray[uint256, MAX_COINS],
amp: uint256,
D: uint256,
) -> DynArray[uint256, MAX_COINS]:
# dx_0 / dx_1 only, however can have any number of coins in pool
ANN: uint256 = unsafe_mul(amp, N_COINS)
Dr: uint256 = unsafe_div(D, pow_mod256(N_COINS, N_COINS))
for i in range(N_COINS_128, bound=MAX_COINS_128):
Dr = Dr * D / xp[i]
p: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
xp0_A: uint256 = unsafe_div(ANN * xp[0], A_PRECISION)
for i in range(1, MAX_COINS):
if i == N_COINS:
break
p.append(10**18 * (xp0_A + unsafe_div(Dr * xp[0], xp[i])) / (xp0_A + Dr))
return p
@internal
def upkeep_oracles(xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256):
"""
@notice Upkeeps price and D oracles.
"""
ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time)
last_prices_packed_current: DynArray[uint256, MAX_COINS] = self.last_prices_packed
last_prices_packed_new: DynArray[uint256, MAX_COINS] = last_prices_packed_current
spot_price: DynArray[uint256, MAX_COINS] = self._get_p(xp, amp, D)
# -------------------------- Upkeep price oracle -------------------------
for i in range(MAX_COINS):
if i == N_COINS - 1:
break
if spot_price[i] != 0:
# Update packed prices -----------------
last_prices_packed_new[i] = self.pack_2(
min(spot_price[i], 2 * 10**18), # <----- Cap spot value by 2.
self._calc_moving_average(
last_prices_packed_current[i],
self.ma_exp_time,
ma_last_time_unpacked[0], # index 0 is ma_last_time for prices
)
)
self.last_prices_packed = last_prices_packed_new
# ---------------------------- Upkeep D oracle ---------------------------
last_D_packed_current: uint256 = self.last_D_packed
self.last_D_packed = self.pack_2(
D,
self._calc_moving_average(
last_D_packed_current,
self.D_ma_time,
ma_last_time_unpacked[1], # index 1 is ma_last_time for D
)
)
# Housekeeping: Update ma_last_time for p and D oracles ------------------
for i in range(2):
if ma_last_time_unpacked[i] < block.timestamp:
ma_last_time_unpacked[i] = block.timestamp
self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1])
@internal
@view
def _calc_moving_average(
packed_value: uint256,
averaging_window: uint256,
ma_last_time: uint256
) -> uint256:
last_spot_value: uint256 = packed_value & (2**128 - 1)
last_ema_value: uint256 = (packed_value >> 128)
if ma_last_time < block.timestamp: # calculate new_ema_value and return that.
alpha: uint256 = self.exp(
-convert(
unsafe_div(unsafe_mul(unsafe_sub(block.timestamp, ma_last_time), 10**18), averaging_window), int256
)
)
return unsafe_div(last_spot_value * (10**18 - alpha) + last_ema_value * alpha, 10**18)
return last_ema_value
@view
@external
def last_price(i: uint256) -> uint256:
return self.last_prices_packed[i] & (2**128 - 1)
@view
@external
def ema_price(i: uint256) -> uint256:
return (self.last_prices_packed[i] >> 128)
@external
@view
def get_p(i: uint256) -> uint256:
"""
@notice Returns the AMM State price of token
@dev if i = 0, it will return the state price of coin[1].
@param i index of state price (0 for coin[1], 1 for coin[2], ...)
@return uint256 The state price quoted by the AMM for coin[i+1]
"""
amp: uint256 = self._A()
xp: DynArray[uint256, MAX_COINS] = self._xp_mem(
self._stored_rates(), self._balances()
)
D: uint256 = self.get_D(xp, amp)
return self._get_p(xp, amp, D)[i]
@external
@view
@nonreentrant('lock')
def price_oracle(i: uint256) -> uint256:
return self._calc_moving_average(
self.last_prices_packed[i],
self.ma_exp_time,
self.ma_last_time & (2**128 - 1)
)
@external
@view
@nonreentrant('lock')
def D_oracle() -> uint256:
return self._calc_moving_average(
self.last_D_packed,
self.D_ma_time,
self.ma_last_time >> 128
)
# ----------------------------- Math Utils -----------------------------------
@internal
@pure
def exp(x: int256) -> uint256:
"""
@dev Calculates the natural exponential function of a signed integer with
a precision of 1e18.
@notice Note that this function consumes about 810 gas units. The implementation
is inspired by Remco Bloemen's implementation under the MIT license here:
https://xn--2-umb.com/22/exp-ln.
@dev This implementation is derived from Snekmate, which is authored
by pcaversaccio (Snekmate), distributed under the AGPL-3.0 license.
https://github.com/pcaversaccio/snekmate
@param x The 32-byte variable.
@return int256 The 32-byte calculation result.
"""
value: int256 = x
# If the result is `< 0.5`, we return zero. This happens when we have the following:
# "x <= floor(log(0.5e18) * 1e18) ~ -42e18".
if (x <= -41446531673892822313):
return empty(uint256)
# When the result is "> (2 ** 255 - 1) / 1e18" we cannot represent it as a signed integer.
# This happens when "x >= floor(log((2 ** 255 - 1) / 1e18) * 1e18) ~ 135".
assert x < 135305999368893231589, "wad_exp overflow"
# `x` is now in the range "(-42, 136) * 1e18". Convert to "(-42, 136) * 2 ** 96" for higher
# intermediate precision and a binary base. This base conversion is a multiplication with
# "1e18 / 2 ** 96 = 5 ** 18 / 2 ** 78".
value = unsafe_div(x << 78, 5 ** 18)
# Reduce the range of `x` to "(-½ ln 2, ½ ln 2) * 2 ** 96" by factoring out powers of two
# so that "exp(x) = exp(x') * 2 ** k", where `k` is a signer integer. Solving this gives
# "k = round(x / log(2))" and "x' = x - k * log(2)". Thus, `k` is in the range "[-61, 195]".
k: int256 = unsafe_add(unsafe_div(value << 96, 54916777467707473351141471128), 2 ** 95) >> 96
value = unsafe_sub(value, unsafe_mul(k, 54916777467707473351141471128))
# Evaluate using a "(6, 7)"-term rational approximation. Since `p` is monic,
# we will multiply by a scaling factor later.
y: int256 = unsafe_add(unsafe_mul(unsafe_add(value, 1346386616545796478920950773328), value) >> 96, 57155421227552351082224309758442)
p: int256 = unsafe_add(unsafe_mul(unsafe_add(unsafe_mul(unsafe_sub(unsafe_add(y, value), 94201549194550492254356042504812), y) >> 96,\
28719021644029726153956944680412240), value), 4385272521454847904659076985693276 << 96)
# We leave `p` in the "2 ** 192" base so that we do not have to scale it up
# again for the division.
q: int256 = unsafe_add(unsafe_mul(unsafe_sub(value, 2855989394907223263936484059900), value) >> 96, 50020603652535783019961831881945)
q = unsafe_sub(unsafe_mul(q, value) >> 96, 533845033583426703283633433725380)
q = unsafe_add(unsafe_mul(q, value) >> 96, 3604857256930695427073651918091429)
q = unsafe_sub(unsafe_mul(q, value) >> 96, 14423608567350463180887372962807573)
q = unsafe_add(unsafe_mul(q, value) >> 96, 26449188498355588339934803723976023)
# The polynomial `q` has no zeros in the range because all its roots are complex.
# No scaling is required, as `p` is already "2 ** 96" too large. Also,
# `r` is in the range "(0.09, 0.25) * 2**96" after the division.
r: int256 = unsafe_div(p, q)
# To finalise the calculation, we have to multiply `r` by:
# - the scale factor "s = ~6.031367120",
# - the factor "2 ** k" from the range reduction, and
# - the factor "1e18 / 2 ** 96" for the base conversion.
# We do this all at once, with an intermediate result in "2**213" base,
# so that the final right shift always gives a positive value.
# Note that to circumvent Vyper's safecast feature for the potentially
# negative parameter value `r`, we first convert `r` to `bytes32` and
# subsequently to `uint256`. Remember that the EVM default behaviour is
# to use two's complement representation to handle signed integers.
return unsafe_mul(convert(convert(r, bytes32), uint256), 3822833074963236453042738258902158003155416615667) >> convert(unsafe_sub(195, k), uint256)
# ---------------------------- ERC20 Utils -----------------------------------
@view
@internal
def _domain_separator() -> bytes32:
if chain.id != CACHED_CHAIN_ID:
return keccak256(
_abi_encode(
EIP712_TYPEHASH,
NAME_HASH,
VERSION_HASH,
chain.id,
self,
salt,
)
)
return CACHED_DOMAIN_SEPARATOR
@internal
def _transfer(_from: address, _to: address, _value: uint256):
# # NOTE: vyper does not allow underflows
# # so the following subtraction would revert on insufficient balance
self.balanceOf[_from] -= _value
self.balanceOf[_to] += _value
log Transfer(_from, _to, _value)
@internal
def _burnFrom(_from: address, _burn_amount: uint256):
self.total_supply -= _burn_amount
self.balanceOf[_from] -= _burn_amount
log Transfer(_from, empty(address), _burn_amount)
@external
def transfer(_to : address, _value : uint256) -> bool:
"""
@dev Transfer token for a specified address
@param _to The address to transfer to.
@param _value The amount to be transferred.
"""
self._transfer(msg.sender, _to, _value)
return True
@external
def transferFrom(_from : address, _to : address, _value : uint256) -> bool:
"""
@dev Transfer tokens from one address to another.
@param _from address The address which you want to send tokens from
@param _to address The address which you want to transfer to
@param _value uint256 the amount of tokens to be transferred
"""
self._transfer(_from, _to, _value)
_allowance: uint256 = self.allowance[_from][msg.sender]
if _allowance != max_value(uint256):
_new_allowance: uint256 = _allowance - _value
self.allowance[_from][msg.sender] = _new_allowance
log Approval(_from, msg.sender, _new_allowance)
return True
@external
def approve(_spender : address, _value : uint256) -> bool:
"""
@notice Approve the passed address to transfer the specified amount of
tokens on behalf of msg.sender
@dev Beware that changing an allowance via this method brings the risk that
someone may use both the old and new allowance by unfortunate transaction
ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
@param _spender The address which will transfer the funds
@param _value The amount of tokens that may be transferred
@return bool success
"""
self.allowance[msg.sender][_spender] = _value
log Approval(msg.sender, _spender, _value)
return True
@external
def permit(
_owner: address,
_spender: address,
_value: uint256,
_deadline: uint256,
_v: uint8,
_r: bytes32,
_s: bytes32
) -> bool:
"""
@notice Approves spender by owner's signature to expend owner's tokens.
See https://eips.ethereum.org/EIPS/eip-2612.
@dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793
@dev Supports smart contract wallets which implement ERC1271
https://eips.ethereum.org/EIPS/eip-1271
@param _owner The address which is a source of funds and has signed the Permit.
@param _spender The address which is allowed to spend the funds.
@param _value The amount of tokens to be spent.
@param _deadline The timestamp after which the Permit is no longer valid.
@param _v The bytes[64] of the valid secp256k1 signature of permit by owner
@param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner
@param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner
@return True, if transaction completes successfully
"""
assert _owner != empty(address)
assert block.timestamp <= _deadline
nonce: uint256 = self.nonces[_owner]
digest: bytes32 = keccak256(
concat(
b"\x19\x01",
self._domain_separator(),
keccak256(_abi_encode(EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline))
)
)
if _owner.is_contract:
sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1))
# reentrancy not a concern since this is a staticcall
assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL
else:
assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner
self.allowance[_owner][_spender] = _value
self.nonces[_owner] = unsafe_add(nonce, 1)
log Approval(_owner, _spender, _value)
return True
@view
@external
def DOMAIN_SEPARATOR() -> bytes32:
"""
@notice EIP712 domain separator.
@return bytes32 Domain Separator set for the current chain.
"""
return self._domain_separator()
# ------------------------- AMM View Functions -------------------------------
@view
@external
def get_dx(i: int128, j: int128, dy: uint256) -> uint256:
"""
@notice Calculate the current input dx given output dy
@dev Index values can be found via the `coins` public getter method
@param i Index value for the coin to send
@param j Index value of the coin to receive
@param dy Amount of `j` being received after exchange
@return Amount of `i` predicted
"""
return StableSwapViews(factory.views_implementation()).get_dx(i, j, dy, self)
@view
@external
def get_dy(i: int128, j: int128, dx: uint256) -> uint256:
"""
@notice Calculate the current output dy given input dx
@dev Index values can be found via the `coins` public getter method
@param i Index value for the coin to send
@param j Index value of the coin to receive
@param dx Amount of `i` being exchanged
@return Amount of `j` predicted
"""
return StableSwapViews(factory.views_implementation()).get_dy(i, j, dx, self)
@view
@external
def calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256:
"""
@notice Calculate the amount received when withdrawing a single coin
@param _burn_amount Amount of LP tokens to burn in the withdrawal
@param i Index value of the coin to withdraw
@return Amount of coin received
"""
return self._calc_withdraw_one_coin(_burn_amount, i)[0]
@view
@external
@nonreentrant('lock')
def totalSupply() -> uint256:
"""
@notice The total supply of pool LP tokens
@return self.total_supply, 18 decimals.
"""
return self.total_supply
@view
@external
@nonreentrant('lock')
def get_virtual_price() -> uint256:
"""
@notice The current virtual price of the pool LP token
@dev Useful for calculating profits.
The method may be vulnerable to donation-style attacks if implementation
contains rebasing tokens. For integrators, caution is advised.
@return LP token virtual price normalized to 1e18
"""
amp: uint256 = self._A()
xp: DynArray[uint256, MAX_COINS] = self._xp_mem(
self._stored_rates(), self._balances()
)
D: uint256 = self.get_D(xp, amp)
# D is in the units similar to DAI (e.g. converted to precision 1e18)
# When balanced, D = n * x_u - total virtual value of the portfolio
return D * PRECISION / self.total_supply
@view
@external
def calc_token_amount(
_amounts: DynArray[uint256, MAX_COINS],
_is_deposit: bool
) -> uint256:
"""
@notice Calculate addition or reduction in token supply from a deposit or withdrawal
@param _amounts Amount of each coin being deposited
@param _is_deposit set True for deposits, False for withdrawals
@return Expected amount of LP tokens received
"""
return StableSwapViews(factory.views_implementation()).calc_token_amount(_amounts, _is_deposit, self)
@view
@external
def A() -> uint256:
return unsafe_div(self._A(), A_PRECISION)
@view
@external
def A_precise() -> uint256:
return self._A()
@view
@external
def balances(i: uint256) -> uint256:
"""
@notice Get the current balance of a coin within the
pool, less the accrued admin fees
@param i Index value for the coin to query balance of
@return Token balance
"""
return self._balances()[i]
@view
@external
def get_balances() -> DynArray[uint256, MAX_COINS]:
return self._balances()
@view
@external
def stored_rates() -> DynArray[uint256, MAX_COINS]:
return self._stored_rates()
@view
@external
def dynamic_fee(i: int128, j: int128) -> uint256:
"""
@notice Return the fee for swapping between `i` and `j`
@param i Index value for the coin to send
@param j Index value of the coin to receive
@return Swap fee expressed as an integer with 1e10 precision
"""
return StableSwapViews(factory.views_implementation()).dynamic_fee(i, j, self)
# --------------------------- AMM Admin Functions ----------------------------
@external
def ramp_A(_future_A: uint256, _future_time: uint256):
assert msg.sender == factory.admin() # dev: only owner
assert block.timestamp >= self.initial_A_time + MIN_RAMP_TIME
assert _future_time >= block.timestamp + MIN_RAMP_TIME # dev: insufficient time
_initial_A: uint256 = self._A()
_future_A_p: uint256 = _future_A * A_PRECISION
assert _future_A > 0 and _future_A < MAX_A
if _future_A_p < _initial_A:
assert _future_A_p * MAX_A_CHANGE >= _initial_A
else:
assert _future_A_p <= _initial_A * MAX_A_CHANGE
self.initial_A = _initial_A
self.future_A = _future_A_p
self.initial_A_time = block.timestamp
self.future_A_time = _future_time
log RampA(_initial_A, _future_A_p, block.timestamp, _future_time)
@external
def stop_ramp_A():
assert msg.sender == factory.admin() # dev: only owner
current_A: uint256 = self._A()
self.initial_A = current_A
self.future_A = current_A
self.initial_A_time = block.timestamp
self.future_A_time = block.timestamp
# now (block.timestamp < t1) is always False, so we return saved A
log StopRampA(current_A, block.timestamp)
@external
def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256):
assert msg.sender == factory.admin()
# set new fee:
assert _new_fee <= MAX_FEE
self.fee = _new_fee
# set new offpeg_fee_multiplier:
assert _new_offpeg_fee_multiplier * _new_fee <= MAX_FEE * FEE_DENOMINATOR # dev: offpeg multiplier exceeds maximum
self.offpeg_fee_multiplier = _new_offpeg_fee_multiplier
log ApplyNewFee(_new_fee, _new_offpeg_fee_multiplier)
@external
def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256):
"""
@notice Set the moving average window of the price oracles.
@param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2).
@param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2).
"""
assert msg.sender == factory.admin() # dev: only owner
assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0 # dev: 0 in input values
self.ma_exp_time = _ma_exp_time
self.D_ma_time = _D_ma_time
log SetNewMATime(_ma_exp_time, _D_ma_time) |
1 | 19,493,180 | d287de7d509c590363d4cc678c9b88241b630d4face464670726392ac7c60da9 | 02b9e2a56a234442673de1b1342d2963efec46f7d9a00b4bd0c5236998fb3625 | 5af239c0d236d96c334d9ca6b845a3ed6861eaf0 | 758ed0650bdf2ac3bf4a48440c3eb2f6d2bb42a5 | e8db35ebb5728aaeb753bc4f1b59b1bdb040f89e | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 19,493,185 | 0afca549ca07d996d473b4bfe69ff795bd2753e500d6f26ddb42c2bd51f6416e | 9be206d741f2db893bb2d59b898a5615d3b583de8a0a6966086cb9aad17b31ba | c384c344accec9dfe3dfc87900cfe35650c36f28 | c384c344accec9dfe3dfc87900cfe35650c36f28 | a09ff201a16eca9f4aeb0b08fed1b9302e920cc6 | 608060405234801561001057600080fd5b5060405161081e38038061081e8339818101604052606081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b90830190602082018581111561006857600080fd5b825164010000000081118282018810171561008257600080fd5b82525081516020918201929091019080838360005b838110156100af578181015183820152602001610097565b50505050905090810190601f1680156100dc5780820380516001836020036101000a031916815260200191505b5060408181526020830151920180519294919391928464010000000082111561010457600080fd5b90830190602082018581111561011957600080fd5b825164010000000081118282018810171561013357600080fd5b82525081516020918201929091019080838360005b83811015610160578181015183820152602001610148565b50505050905090810190601f16801561018d5780820380516001836020036101000a031916815260200191505b50604052505083516101a7915060019060208601906101c9565b50600282905580516101c09060049060208401906101c9565b50505050610264565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061020a57805160ff1916838001178555610237565b82800160010185558215610237579182015b8281111561023757825182559160200191906001019061021c565b50610243929150610247565b5090565b61026191905b80821115610243576000815560010161024d565b90565b6105ab806102736000396000f3fe6080604052600436106100435760003560e01c80633ccfd60b1461004f5780639a861d1c14610059578063be9a65551461004f578063f2bcd022146100e35761004a565b3661004a57005b600080fd5b6100576100f8565b005b34801561006557600080fd5b5061006e61013b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100a8578181015183820152602001610090565b50505050905090810190601f1680156100d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ef57600080fd5b5061006e6101c8565b610100610223565b6001600160a01b03166108fc479081150290604051600060405180830381858888f19350505050158015610138573d6000803e3d6000fd5b50565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101c05780601f10610195576101008083540402835291602001916101c0565b820191906000526020600020905b8154815290600101906020018083116101a357829003601f168201915b505050505081565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101c05780601f10610195576101008083540402835291602001916101c0565b600060606040518060600160405280602a815260200161054c602a91399050610267816000604051806040016040528060018152602001600360fc1b8152506102c6565b5061028d816002604051806040016040528060018152602001603160f81b8152506102c6565b506102b3816001604051806040016040528060018152602001600f60fb1b8152506102c6565b5060006102bf826103b0565b9250505090565b6060808490506060815167ffffffffffffffff811180156102e657600080fd5b506040519080825280601f01601f191660200182016040528015610311576020820181803683370190505b50905060005b82518110156103a65782818151811061032c57fe5b602001015160f81c60f81b82828151811061034357fe5b60200101906001600160f81b031916908160001a9053508581141561039e578460008151811061036f57fe5b602001015160f81c60f81b82828151811061038657fe5b60200101906001600160f81b031916908160001a9053505b600101610317565b5095945050505050565b60008181808060025b602a81101561054057610100840293508481815181106103d557fe5b0160200151855160f89190911c93508590600183019081106103f357fe5b016020015160f81c915060616001600160a01b0384161080159061042157506066836001600160a01b031611155b1561043157605783039250610495565b6041836001600160a01b03161015801561045557506046836001600160a01b031611155b1561046557603783039250610495565b6030836001600160a01b03161015801561048957506039836001600160a01b031611155b15610495576030830392505b6061826001600160a01b0316101580156104b957506066826001600160a01b031611155b156104c95760578203915061052d565b6041826001600160a01b0316101580156104ed57506046826001600160a01b031611155b156104fd5760378203915061052d565b6030826001600160a01b03161015801561052157506039826001600160a01b031611155b1561052d576030820391505b60108302820193909301926002016103b9565b50919594505050505056fe514738423430393945383643373363394233443630656630383739303235633235663862423336453439a2646970667358221220fb58e5a73dd3e173e8ded3b6820b0cb30b530eb4576c35437cd383bde3ac783664736f6c634300060600330000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a30784333383463333434414363656339646645336446433837393030436645333536353043333646323800000000000000000000000000000000000000000000 | 6080604052600436106100435760003560e01c80633ccfd60b1461004f5780639a861d1c14610059578063be9a65551461004f578063f2bcd022146100e35761004a565b3661004a57005b600080fd5b6100576100f8565b005b34801561006557600080fd5b5061006e61013b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100a8578181015183820152602001610090565b50505050905090810190601f1680156100d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100ef57600080fd5b5061006e6101c8565b610100610223565b6001600160a01b03166108fc479081150290604051600060405180830381858888f19350505050158015610138573d6000803e3d6000fd5b50565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101c05780601f10610195576101008083540402835291602001916101c0565b820191906000526020600020905b8154815290600101906020018083116101a357829003601f168201915b505050505081565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101c05780601f10610195576101008083540402835291602001916101c0565b600060606040518060600160405280602a815260200161054c602a91399050610267816000604051806040016040528060018152602001600360fc1b8152506102c6565b5061028d816002604051806040016040528060018152602001603160f81b8152506102c6565b506102b3816001604051806040016040528060018152602001600f60fb1b8152506102c6565b5060006102bf826103b0565b9250505090565b6060808490506060815167ffffffffffffffff811180156102e657600080fd5b506040519080825280601f01601f191660200182016040528015610311576020820181803683370190505b50905060005b82518110156103a65782818151811061032c57fe5b602001015160f81c60f81b82828151811061034357fe5b60200101906001600160f81b031916908160001a9053508581141561039e578460008151811061036f57fe5b602001015160f81c60f81b82828151811061038657fe5b60200101906001600160f81b031916908160001a9053505b600101610317565b5095945050505050565b60008181808060025b602a81101561054057610100840293508481815181106103d557fe5b0160200151855160f89190911c93508590600183019081106103f357fe5b016020015160f81c915060616001600160a01b0384161080159061042157506066836001600160a01b031611155b1561043157605783039250610495565b6041836001600160a01b03161015801561045557506046836001600160a01b031611155b1561046557603783039250610495565b6030836001600160a01b03161015801561048957506039836001600160a01b031611155b15610495576030830392505b6061826001600160a01b0316101580156104b957506066826001600160a01b031611155b156104c95760578203915061052d565b6041826001600160a01b0316101580156104ed57506046826001600160a01b031611155b156104fd5760378203915061052d565b6030826001600160a01b03161015801561052157506039826001600160a01b031611155b1561052d576030820391505b60108302820193909301926002016103b9565b50919594505050505056fe514738423430393945383643373363394233443630656630383739303235633235663862423336453439a2646970667358221220fb58e5a73dd3e173e8ded3b6820b0cb30b530eb4576c35437cd383bde3ac783664736f6c63430006060033 | |
1 | 19,493,185 | 0afca549ca07d996d473b4bfe69ff795bd2753e500d6f26ddb42c2bd51f6416e | fa6756672c83fff1d5ef18a42477343b95cc2e6c1f02b8edf5ea33c67c8ffc46 | ea1ebdcc6b73df5f89e995c182f3a51c77ae5ef0 | a6b71e26c5e0845f74c812102ca7114b6a896ab2 | 33baefaabf690c79449c82ce460482a8a907ebc8 | 608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552 | 608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033 | // SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;
/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain
/// @author Richard Meissner - <richard@gnosis.io>
interface IProxy {
function masterCopy() external view returns (address);
}
/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.
/// @author Stefan George - <stefan@gnosis.io>
/// @author Richard Meissner - <richard@gnosis.io>
contract GnosisSafeProxy {
// singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
// To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
address internal singleton;
/// @dev Constructor function sets address of singleton contract.
/// @param _singleton Singleton address.
constructor(address _singleton) {
require(_singleton != address(0), "Invalid singleton address provided");
singleton = _singleton;
}
/// @dev Fallback function forwards all transactions and returns all received return data.
fallback() external payable {
// solhint-disable-next-line no-inline-assembly
assembly {
let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
// 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s
if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, _singleton)
return(0, 0x20)
}
calldatacopy(0, 0, calldatasize())
let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
if eq(success, 0) {
revert(0, returndatasize())
}
return(0, returndatasize())
}
}
}
/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @author Stefan George - <stefan@gnosis.pm>
contract GnosisSafeProxyFactory {
event ProxyCreation(GnosisSafeProxy proxy, address singleton);
/// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @param singleton Address of singleton contract.
/// @param data Payload for message call sent to new proxy contract.
function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {
proxy = new GnosisSafeProxy(singleton);
if (data.length > 0)
// solhint-disable-next-line no-inline-assembly
assembly {
if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {
revert(0, 0)
}
}
emit ProxyCreation(proxy, singleton);
}
/// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.
function proxyRuntimeCode() public pure returns (bytes memory) {
return type(GnosisSafeProxy).runtimeCode;
}
/// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
function proxyCreationCode() public pure returns (bytes memory) {
return type(GnosisSafeProxy).creationCode;
}
/// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.
/// This method is only meant as an utility to be called from other methods
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function deployProxyWithNonce(
address _singleton,
bytes memory initializer,
uint256 saltNonce
) internal returns (GnosisSafeProxy proxy) {
// If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it
bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));
bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));
// solhint-disable-next-line no-inline-assembly
assembly {
proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)
}
require(address(proxy) != address(0), "Create2 call failed");
}
/// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function createProxyWithNonce(
address _singleton,
bytes memory initializer,
uint256 saltNonce
) public returns (GnosisSafeProxy proxy) {
proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
if (initializer.length > 0)
// solhint-disable-next-line no-inline-assembly
assembly {
if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {
revert(0, 0)
}
}
emit ProxyCreation(proxy, _singleton);
}
/// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
/// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.
function createProxyWithCallback(
address _singleton,
bytes memory initializer,
uint256 saltNonce,
IProxyCreationCallback callback
) public returns (GnosisSafeProxy proxy) {
uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));
proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);
if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);
}
/// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`
/// This method is only meant for address calculation purpose when you use an initializer that would revert,
/// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function calculateCreateProxyWithNonceAddress(
address _singleton,
bytes calldata initializer,
uint256 saltNonce
) external returns (GnosisSafeProxy proxy) {
proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
revert(string(abi.encodePacked(proxy)));
}
}
interface IProxyCreationCallback {
function proxyCreated(
GnosisSafeProxy proxy,
address _singleton,
bytes calldata initializer,
uint256 saltNonce
) external;
} |
1 | 19,493,187 | 1d62e6987e6d74abcc973e40c3a4377b64526a98e87220c840c9fc49e03f596f | 5dbff2fa909c03d1fa9dc365d647d86b0e1e72263fa8bfc90566c94770764cd4 | 27d7f6147a8748454b88be685c2804f96bf69db1 | ffa397285ce46fb78c588a9e993286aac68c37cd | 85bba70676a2cbf93888b0ffa8967cb314eafc0f | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,188 | 66f01cb5af450740aa35e3f3a74d326066155277f7bf63b48b2bc393a8ab110e | cd4658ae43577b76401763bb64db0556a81f2d55f8c855577ea3c2a551a33c48 | caa56880c09e1ebba244cf70e2d7168e09d71559 | ffa397285ce46fb78c588a9e993286aac68c37cd | 4107181c76cfb451287e64591fd5c15170286801 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,189 | a69ce4130ba14b07098ea1f65bc472e7840db4859c0badd586be858e2a7832a9 | 05e79dd40b4d90c0497f8340a8e2b536c0ae068a1edfb179e3b6e261c696ced3 | 83255b06dc6377d097eadd9ada0f69112dd79509 | 7335db10622eecdeffadaee7f2454e37aedf7002 | 1d9db0814e1f2dfea750d9f43664e5946aaee3d6 | 60a03461009757601f6102cd38819003918201601f19168301916001600160401b0383118484101761009c5780849260209460405283398101031261009757516001600160a01b0381169081810361009757608052604051907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e600080a261021a90816100b382396080518181816028015260ef0152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080806040523615610016575b6100146100da565b005b635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156100ce57600091610071575b5061006b9061017d565b3861000c565b6020913d83116100c6575b601f8301601f191682019067ffffffffffffffff8211838310176100b2575060405261006b916100ac910161019e565b90610061565b634e487b7160e01b81526041600452602490fd5b3d925061007c565b6040513d6000823e3d90fd5b604051635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa80156100ce57600090610133575b610131915061017d565b565b6020903d8211610175575b601f8201601f191683019067ffffffffffffffff8211848310176100b2575060405261013191610170918101906101c5565b610127565b3d915061013e565b90506000808092368280378136915af43d82803e1561019a573d90f35b3d90fd5b602090607f1901126101c0576080516001600160a01b03811681036101c05790565b600080fd5b908160209103126101c057516001600160a01b03811681036101c0579056fea2646970667358221220c478b1615b0d76011a7874324ac15b3d7fb464e980c3c09d2d779b62a970e18664736f6c6343000811003300000000000000000000000023b0c2381075df4002bc6d3b9baf52ab0acb1e9b | 6080806040523615610016575b6100146100da565b005b635c60da1b60e01b81526020816004817f00000000000000000000000023b0c2381075df4002bc6d3b9baf52ab0acb1e9b6001600160a01b03165afa9081156100ce57600091610071575b5061006b9061017d565b3861000c565b6020913d83116100c6575b601f8301601f191682019067ffffffffffffffff8211838310176100b2575060405261006b916100ac910161019e565b90610061565b634e487b7160e01b81526041600452602490fd5b3d925061007c565b6040513d6000823e3d90fd5b604051635c60da1b60e01b81526020816004817f00000000000000000000000023b0c2381075df4002bc6d3b9baf52ab0acb1e9b6001600160a01b03165afa80156100ce57600090610133575b610131915061017d565b565b6020903d8211610175575b601f8201601f191683019067ffffffffffffffff8211848310176100b2575060405261013191610170918101906101c5565b610127565b3d915061013e565b90506000808092368280378136915af43d82803e1561019a573d90f35b3d90fd5b602090607f1901126101c0576080516001600160a01b03811681036101c05790565b600080fd5b908160209103126101c057516001600160a01b03811681036101c0579056fea2646970667358221220c478b1615b0d76011a7874324ac15b3d7fb464e980c3c09d2d779b62a970e18664736f6c63430008110033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts/proxy/beacon/IBeacon.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n"
},
"@openzeppelin/contracts/proxy/Proxy.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n"
},
"contracts/utils/BeaconProxy.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\";\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\";\n\n/// @custom:security-contact security@p00ls.com\ncontract BeaconProxy is Proxy {\n IBeacon private immutable _beacon;\n\n event BeaconUpgraded(IBeacon indexed beacon);\n\n constructor(IBeacon beacon)\n {\n _beacon = beacon;\n emit BeaconUpgraded(beacon);\n }\n\n function _implementation()\n internal\n view\n override\n returns (address)\n {\n return _beacon.implementation();\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"debug": {
"revertStrings": "strip"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 19,493,189 | a69ce4130ba14b07098ea1f65bc472e7840db4859c0badd586be858e2a7832a9 | 05e79dd40b4d90c0497f8340a8e2b536c0ae068a1edfb179e3b6e261c696ced3 | 83255b06dc6377d097eadd9ada0f69112dd79509 | 7335db10622eecdeffadaee7f2454e37aedf7002 | 0a5cb919539a6e290c932256aa24a7abaa6b30b3 | 60a03461009757601f6102cd38819003918201601f19168301916001600160401b0383118484101761009c5780849260209460405283398101031261009757516001600160a01b0381169081810361009757608052604051907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e600080a261021a90816100b382396080518181816028015260ef0152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080806040523615610016575b6100146100da565b005b635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa9081156100ce57600091610071575b5061006b9061017d565b3861000c565b6020913d83116100c6575b601f8301601f191682019067ffffffffffffffff8211838310176100b2575060405261006b916100ac910161019e565b90610061565b634e487b7160e01b81526041600452602490fd5b3d925061007c565b6040513d6000823e3d90fd5b604051635c60da1b60e01b81526020816004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa80156100ce57600090610133575b610131915061017d565b565b6020903d8211610175575b601f8201601f191683019067ffffffffffffffff8211848310176100b2575060405261013191610170918101906101c5565b610127565b3d915061013e565b90506000808092368280378136915af43d82803e1561019a573d90f35b3d90fd5b602090607f1901126101c0576080516001600160a01b03811681036101c05790565b600080fd5b908160209103126101c057516001600160a01b03811681036101c0579056fea2646970667358221220c478b1615b0d76011a7874324ac15b3d7fb464e980c3c09d2d779b62a970e18664736f6c63430008110033000000000000000000000000f6fd7647cacc1d570f328fc0f09d9118041ea172 | 6080806040523615610016575b6100146100da565b005b635c60da1b60e01b81526020816004817f000000000000000000000000f6fd7647cacc1d570f328fc0f09d9118041ea1726001600160a01b03165afa9081156100ce57600091610071575b5061006b9061017d565b3861000c565b6020913d83116100c6575b601f8301601f191682019067ffffffffffffffff8211838310176100b2575060405261006b916100ac910161019e565b90610061565b634e487b7160e01b81526041600452602490fd5b3d925061007c565b6040513d6000823e3d90fd5b604051635c60da1b60e01b81526020816004817f000000000000000000000000f6fd7647cacc1d570f328fc0f09d9118041ea1726001600160a01b03165afa80156100ce57600090610133575b610131915061017d565b565b6020903d8211610175575b601f8201601f191683019067ffffffffffffffff8211848310176100b2575060405261013191610170918101906101c5565b610127565b3d915061013e565b90506000808092368280378136915af43d82803e1561019a573d90f35b3d90fd5b602090607f1901126101c0576080516001600160a01b03811681036101c05790565b600080fd5b908160209103126101c057516001600160a01b03811681036101c0579056fea2646970667358221220c478b1615b0d76011a7874324ac15b3d7fb464e980c3c09d2d779b62a970e18664736f6c63430008110033 | {{
"language": "Solidity",
"sources": {
"@openzeppelin/contracts/proxy/beacon/IBeacon.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n"
},
"@openzeppelin/contracts/proxy/Proxy.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n"
},
"contracts/utils/BeaconProxy.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\";\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\";\n\n/// @custom:security-contact security@p00ls.com\ncontract BeaconProxy is Proxy {\n IBeacon private immutable _beacon;\n\n event BeaconUpgraded(IBeacon indexed beacon);\n\n constructor(IBeacon beacon)\n {\n _beacon = beacon;\n emit BeaconUpgraded(beacon);\n }\n\n function _implementation()\n internal\n view\n override\n returns (address)\n {\n return _beacon.implementation();\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"debug": {
"revertStrings": "strip"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}
}} |
1 | 19,493,191 | c11cf1b8dd4dafb2d69f4be273f58e8f1b02bc36361e160ae353ede041614ebe | d7455af40bdcae078bb47fc563447236b55729775988e1bf6c670daa89e44b79 | 8b14b2599b0effd879fc6ff13d1b11382503a642 | a6b71e26c5e0845f74c812102ca7114b6a896ab2 | ee06a48bbb481f9295ba3b905e0f3a374fe37aff | 608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552 | 608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033 | // SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;
/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain
/// @author Richard Meissner - <richard@gnosis.io>
interface IProxy {
function masterCopy() external view returns (address);
}
/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.
/// @author Stefan George - <stefan@gnosis.io>
/// @author Richard Meissner - <richard@gnosis.io>
contract GnosisSafeProxy {
// singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
// To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
address internal singleton;
/// @dev Constructor function sets address of singleton contract.
/// @param _singleton Singleton address.
constructor(address _singleton) {
require(_singleton != address(0), "Invalid singleton address provided");
singleton = _singleton;
}
/// @dev Fallback function forwards all transactions and returns all received return data.
fallback() external payable {
// solhint-disable-next-line no-inline-assembly
assembly {
let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
// 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s
if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
mstore(0, _singleton)
return(0, 0x20)
}
calldatacopy(0, 0, calldatasize())
let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
if eq(success, 0) {
revert(0, returndatasize())
}
return(0, returndatasize())
}
}
}
/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @author Stefan George - <stefan@gnosis.pm>
contract GnosisSafeProxyFactory {
event ProxyCreation(GnosisSafeProxy proxy, address singleton);
/// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @param singleton Address of singleton contract.
/// @param data Payload for message call sent to new proxy contract.
function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {
proxy = new GnosisSafeProxy(singleton);
if (data.length > 0)
// solhint-disable-next-line no-inline-assembly
assembly {
if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {
revert(0, 0)
}
}
emit ProxyCreation(proxy, singleton);
}
/// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.
function proxyRuntimeCode() public pure returns (bytes memory) {
return type(GnosisSafeProxy).runtimeCode;
}
/// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.
function proxyCreationCode() public pure returns (bytes memory) {
return type(GnosisSafeProxy).creationCode;
}
/// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.
/// This method is only meant as an utility to be called from other methods
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function deployProxyWithNonce(
address _singleton,
bytes memory initializer,
uint256 saltNonce
) internal returns (GnosisSafeProxy proxy) {
// If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it
bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));
bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));
// solhint-disable-next-line no-inline-assembly
assembly {
proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)
}
require(address(proxy) != address(0), "Create2 call failed");
}
/// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function createProxyWithNonce(
address _singleton,
bytes memory initializer,
uint256 saltNonce
) public returns (GnosisSafeProxy proxy) {
proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
if (initializer.length > 0)
// solhint-disable-next-line no-inline-assembly
assembly {
if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {
revert(0, 0)
}
}
emit ProxyCreation(proxy, _singleton);
}
/// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
/// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.
function createProxyWithCallback(
address _singleton,
bytes memory initializer,
uint256 saltNonce,
IProxyCreationCallback callback
) public returns (GnosisSafeProxy proxy) {
uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));
proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);
if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);
}
/// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`
/// This method is only meant for address calculation purpose when you use an initializer that would revert,
/// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.
/// @param _singleton Address of singleton contract.
/// @param initializer Payload for message call sent to new proxy contract.
/// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.
function calculateCreateProxyWithNonceAddress(
address _singleton,
bytes calldata initializer,
uint256 saltNonce
) external returns (GnosisSafeProxy proxy) {
proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);
revert(string(abi.encodePacked(proxy)));
}
}
interface IProxyCreationCallback {
function proxyCreated(
GnosisSafeProxy proxy,
address _singleton,
bytes calldata initializer,
uint256 saltNonce
) external;
} |
1 | 19,493,194 | 1481e97926eac838df1ee6ef16e3df59dea6bb40cac211e8264b4460744ed1ca | 4aabc03612b450f05e5a5498dc8b90180433e07d98f76688465dff051ce5501d | a9a0b8a5e1adca0caccc63a168f053cd3be30808 | 01cd62ed13d0b666e2a10d13879a763dfd1dab99 | c4362039c1987625973af0b45b6a3b0aac66bd64 | 3d602d80600a3d3981f3363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3 | |
1 | 19,493,194 | 1481e97926eac838df1ee6ef16e3df59dea6bb40cac211e8264b4460744ed1ca | db666de36434116e5b85ce215308e28bc7636b1ad7f97fead24c286d66bd7682 | 000099b4a4d3ceb370d3a8a6235d24e07a8c0000 | ee2a0343e825b2e5981851299787a679ce08216d | a12058cbc7549015307ae534541113da188a760a | 6080604052348015600f57600080fd5b506040516101bb3803806101bb833981016040819052602c916059565b600080546001600160a01b039092166001600160a01b031992831617905560018054909116331790556087565b600060208284031215606a57600080fd5b81516001600160a01b0381168114608057600080fd5b9392505050565b610125806100966000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c80638da5cb5b14609f578063d4b839921460cd575b6001546001600160a01b03163314604857600080fd5b600080546040516001600160a01b03909116906066908390369060df565b600060405180830381855af49150503d8060008114609d576040519150601f19603f3d011682016040523d82523d6000602084013e005b005b60015460b1906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60005460b1906001600160a01b031681565b818382376000910190815291905056fea2646970667358221220736ccf845e951824707af03941a53c8275c6b25991c8ea8d34f6c24f7bbc22e164736f6c6343000819003300000000000000000000000033c99c0323adc0b7bd4ddd2ac4d4de2c28722fb0 | 6080604052348015600f57600080fd5b506004361060325760003560e01c80638da5cb5b14609f578063d4b839921460cd575b6001546001600160a01b03163314604857600080fd5b600080546040516001600160a01b03909116906066908390369060df565b600060405180830381855af49150503d8060008114609d576040519150601f19603f3d011682016040523d82523d6000602084013e005b005b60015460b1906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b60005460b1906001600160a01b031681565b818382376000910190815291905056fea2646970667358221220736ccf845e951824707af03941a53c8275c6b25991c8ea8d34f6c24f7bbc22e164736f6c63430008190033 | |
1 | 19,493,196 | 017407e1137a82a5976bc56215991bd41d17018119736934c84b9e3633dad3eb | 378e8dc1e8aeae0c8206e81570f8499292d2b4c360f43edaad18024deaa2ac6e | 820fd3a13bacbfc70d0fa974a7f83123830887bc | ffa397285ce46fb78c588a9e993286aac68c37cd | fd26f520f5daaadba968d4ce7f9b06f85e379d02 | 3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | 363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3 | pragma solidity 0.7.5;
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the clone contract data
let clone := mload(0x40)
// The bytecode block below is responsible for contract initialization
// during deployment, it is worth noting the proxied contract constructor will not be called during
// the cloning procedure and that is why an initialization function needs to be called after the
// clone is created
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
// This stores the address location of the implementation contract
// so that the proxy knows where to delegate call logic to
mstore(add(clone, 0x14), targetBytes)
// The bytecode block is the actual code that is deployed for each clone created.
// It forwards all calls to the already deployed implementation via a delegatecall
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// deploy the contract using the CREATE2 opcode
// this deploys the minimal proxy defined above, which will proxy all
// calls to use the logic defined in the implementation contract `target`
result := create2(0, clone, 0x37, salt)
}
}
function isClone(address target, address query)
internal
view
returns (bool result)
{
bytes20 targetBytes = bytes20(target);
assembly {
// load the next free memory slot as a place to store the comparison clone
let clone := mload(0x40)
// The next three lines store the expected bytecode for a miniml proxy
// that targets `target` as its implementation contract
mstore(
clone,
0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000
)
mstore(add(clone, 0xa), targetBytes)
mstore(
add(clone, 0x1e),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
// the next two lines store the bytecode of the contract that we are checking in memory
let other := add(clone, 0x40)
extcodecopy(query, other, 0, 0x2d)
// Check if the expected bytecode equals the actual bytecode and return the result
result := and(
eq(mload(clone), mload(other)),
eq(mload(add(clone, 0xd)), mload(add(other, 0xd)))
)
}
}
}
/**
* Contract that exposes the needed erc20 token functions
*/
abstract contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value)
public
virtual
returns (bool success);
// Get the account balance of another account with address _owner
function balanceOf(address _owner)
public
virtual
view
returns (uint256 balance);
}
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeApprove: approve failed'
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::safeTransfer: transfer failed'
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
'TransferHelper::transferFrom: transferFrom failed'
);
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper::safeTransferETH: ETH transfer failed');
}
}
/**
* Contract that will forward any incoming Ether to the creator of the contract
*
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public parentAddress;
event ForwarderDeposited(address from, uint256 value, bytes data);
/**
* Initialize the contract, and sets the destination address to that of the creator
*/
function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
// NOTE: since we are forwarding on initialization,
// we don't have the context of the original sender.
// We still emit an event about the forwarding but set
// the sender to the forwarder itself
emit ForwarderDeposited(address(this), value, msg.data);
}
/**
* Modifier that will execute internal code block only if the sender is the parent address
*/
modifier onlyParent {
require(msg.sender == parentAddress, 'Only Parent');
_;
}
/**
* Modifier that will execute internal code block only if the contract has not been initialized yet
*/
modifier onlyUninitialized {
require(parentAddress == address(0x0), 'Already initialized');
_;
}
/**
* Default function; Gets called when data is sent but does not match any other function
*/
fallback() external payable {
flush();
}
/**
* Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address
*/
receive() external payable {
flush();
}
/**
* Execute a token transfer of the full balance from the forwarder token to the parent address
* @param tokenContractAddress the address of the erc20 token contract
*/
function flushTokens(address tokenContractAddress) external onlyParent {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
address forwarderAddress = address(this);
uint256 forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
TransferHelper.safeTransfer(
tokenContractAddress,
parentAddress,
forwarderBalance
);
}
/**
* Flush the entire balance of the contract to the parent address.
*/
function flush() public {
uint256 value = address(this).balance;
if (value == 0) {
return;
}
(bool success, ) = parentAddress.call{ value: value }('');
require(success, 'Flush failed');
emit ForwarderDeposited(msg.sender, value, msg.data);
}
}
contract ForwarderFactory is CloneFactory {
address public implementationAddress;
event ForwarderCreated(address newForwarderAddress, address parentAddress);
constructor(address _implementationAddress) {
implementationAddress = _implementationAddress;
}
function createForwarder(address parent, bytes32 salt) external {
// include the signers in the salt so any contract deployed to a given address must have the same signers
bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt));
address payable clone = createClone(implementationAddress, finalSalt);
Forwarder(clone).init(parent);
emit ForwarderCreated(clone, parent);
}
} |
1 | 19,493,205 | bcf1ea1d57cd0274685544875669da82e66a14c8fef40ae527c996ffc614f416 | d677c5785e89b27b186a10d9ef1732c226b6514d45546f2671b264115b493041 | a7fb5ca286fc3fd67525629048a4de3ba24cba2e | c77ad0a71008d7094a62cfbd250a2eb2afdf2776 | db769af4c8aa6a19ea620382fd01d4cc29f72f84 | 608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe | ||
1 | 19,493,210 | 336ac37e7477ec6335255373c74b1259fbd2a81b9cb53e39d81e51bce2b8e2ff | fd78fdb37c87e5e3c61853cd09a542fb7ac879e7ea2e67ffc2590fbe35bc2feb | 8bf0c74d5810c9611e435c21b3eedfb47158f027 | 8bf0c74d5810c9611e435c21b3eedfb47158f027 | 5647e32328b08a5fffb44af4393d7f1bce23343a | 6080604052348015600e575f80fd5b5060015f55611a0b806100205f395ff3fe608060405234801561000f575f80fd5b5060043610610132575f3560e01c806369da1fc6116100b45780639d76ea58116100795780639d76ea58146103025780639ef346b414610335578063a9059cbb14610348578063a9bebf091461035b578063dd62ed3e1461036e578063f9079b37146103a6575f80fd5b806369da1fc61461022357806370a082311461029d578063763072af146102c55780638af104da146102cd57806395d89b41146102e0575f80fd5b806329cb924d116100fa57806329cb924d146101c0578063313ce567146101c65780633ca841b5146101d55780635a7bb69a146101e857806362eb060414610210575f80fd5b806306fdde0314610136578063095ea7b314610170578063130836171461019357806318160ddd146101a557806323b872dd146101ad575b5f80fd5b60408051808201909152600c81526b56657374656420535445414b60a01b60208201525b604051610167919061173d565b60405180910390f35b61018361017e366004611788565b6103b9565b6040519015158152602001610167565b6001545b604051908152602001610167565b600254610197565b6101836101bb3660046117b0565b6103cf565b42610197565b60405160128152602001610167565b6101976101e33660046117e9565b610474565b6101976101f63660046117e9565b6001600160a01b03165f9081526003602052604090205490565b61018361021e366004611809565b610554565b6102366102313660046117e9565b61070b565b60405161016791908151151581526020808301516001600160a01b03169082015260408083015190820152606080830151908201526080808301519082015260a0808301519082015260c0808301519082015260e091820151918101919091526101000190565b6101976102ab3660046117e9565b6001600160a01b03165f9081526005602052604090205490565b6101836107f2565b6101976102db366004611788565b610aea565b60408051808201909152600681526576535445414b60d01b602082015261015a565b61031d73c4c244f1dbca07083fee35220d2169957c275e6881565b6040516001600160a01b039091168152602001610167565b61023661034336600461184f565b610b30565b610183610356366004611788565b610c4a565b610236610369366004611788565b610c57565b61019761037c366004611866565b6001600160a01b039182165f90815260066020908152604080832093909416825291909152205490565b6101976103b436600461184f565b610d75565b5f6103c5338484610dff565b5060015b92915050565b5f816103db853361037c565b10156104405760405162461bcd60e51b815260206004820152602960248201527f546f6b656e56657374696e67535445414b3a20696e73756666696369656e7420604482015268616c6c6f77616e636560b81b60648201526084015b60405180910390fd5b61045f843384610450883361037c565b61045a91906118ab565b610dff565b61046a848484610f3b565b5060019392505050565b6001600160a01b0381165f908152600360205260408120546104946116f5565b5f805b60045f6104a48884610aea565b815260208082019290925260409081015f90812082516101008082018552825460ff811615158352046001600160a01b0316948101949094526001810154928401929092526002820154606084015260038201546080840152600482015460a0840152600582015460c084015260069091015460e083015290935061052884611277565b905061053481846118be565b925081610540816118d1565b925050508381106104975750949350505050565b5f73c4c244f1dbca07083fee35220d2169957c275e686323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018590526064016020604051808303815f875af11580156105c0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105e491906118e9565b6106565760405162461bcd60e51b815260206004820152603960248201527f546f6b656e56657374696e67535445414b3a20746f6b656e20535445414b207460448201527f72616e7366657246726f6d206e6f7420737563636565646564000000000000006064820152608401610437565b61066487878787878761132e565b604080518681526020810188905290810185905260608101849052608081018390526001600160a01b038816907fc63cdf21055cafabb96c87ca41b053fed647aaefbd2cf9ea04a7ae79a9c84ad29060a00160405180910390a26040518281526001600160a01b038816905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35060019695505050505050565b6107136116f5565b6001600160a01b0382165f9081526003602052604090205482906107495760405162461bcd60e51b815260040161043790611908565b6001600160a01b0383165f90815260036020526040812054600491906107779086906102db906001906118ab565b815260208082019290925260409081015f2081516101008082018452825460ff811615158352046001600160a01b0316938101939093526001810154918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e08201529392505050565b5f6107fb6115fe565b335f818152600360205260409020546108265760405162461bcd60e51b815260040161043790611908565b335f818152600360205260408120549080805b60045f6108468784610aea565b815260208082019290925260409081015f90812082516101008082018552825460ff811615158352046001600160a01b0316948101949094526001810154928401929092526002820154606084015260038201546080840152600482015460a0840152600582015460c0840152600682015460e0840152909450906108ca90611277565b905080846006015f8282546108df91906118be565b909155506108ef905081846118be565b9250816108fb816118d1565b92505050838110610839578160025f82825461091791906118ab565b90915550506001600160a01b0385165f90815260056020526040812080548492906109439084906118ab565b909155505060405163a9059cbb60e01b81526001600160a01b03861660048201526024810183905273c4c244f1dbca07083fee35220d2169957c275e689063a9059cbb906044016020604051808303815f875af11580156109a6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109ca91906118e9565b610a515760405162461bcd60e51b815260206004820152604c60248201527f546f6b656e56657374696e67535445414b3a20746f6b656e20535445414b207260448201527f657761726473207472616e7366657220746f2062656e6566696369617279206e60648201526b1bdd081cdd58d8d95959195960a21b608482015260a401610437565b846001600160a01b03167fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df9317983604051610a8c91815260200190565b60405180910390a26040518281525f906001600160a01b038716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a360019650505050505050610ae760015f55565b90565b6040516bffffffffffffffffffffffff19606084901b166020820152603481018290525f9060540160405160208183030381529060405280519060200120905092915050565b610b386116f5565b5f828152600460205260409020805460ff161515600114610be05760405162461bcd60e51b815260206004820152605660248201527f546f6b656e56657374696e67535445414b3a20494e56414c494420566573746960448201527f6e67205363686564756c6520494421206e6f2076657374696e672073636865646064820152751d5b1948195e1a5cdd1cc8199bdc881d1a185d081a5960521b608482015260a401610437565b604080516101008082018352835460ff811615158352046001600160a01b031660208201526001830154918101919091526002820154606082015260038201546080820152600482015460a0820152600582015460c082015260069091015460e082015292915050565b5f3361046a818585610f3b565b610c5f6116f5565b6001600160a01b0383165f908152600360205260409020548390610c955760405162461bcd60e51b815260040161043790611908565b6001600160a01b0384165f908152600360205260409020548310610d605760405162461bcd60e51b815260206004820152607060248201527f546f6b656e56657374696e67535445414b3a20494e56414c494420566573746960448201527f6e67205363686564756c6520496e64657821206e6f2076657374696e6720736360648201527f686564756c6520657869737473206174207468697320696e64657820666f722060848201526f746861742062656e656669636961727960801b60a482015260c401610437565b610d6d6103438585610aea565b949350505050565b5f610d7f60015490565b8210610ddc5760405162461bcd60e51b815260206004820152602660248201527f546f6b656e56657374696e67535445414b3a20696e646578206f7574206f6620604482015265626f756e647360d01b6064820152608401610437565b60018281548110610def57610def61198b565b905f5260205f2001549050919050565b6001600160a01b038316610e6e5760405162461bcd60e51b815260206004820152603060248201527f546f6b656e56657374696e67535445414b3a20617070726f76652066726f6d2060448201526f746865207a65726f206164647265737360801b6064820152608401610437565b6001600160a01b038216610edb5760405162461bcd60e51b815260206004820152602e60248201527f546f6b656e56657374696e67535445414b3a20617070726f766520746f20746860448201526d65207a65726f206164647265737360901b6064820152608401610437565b6001600160a01b038381165f8181526006602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fab5760405162461bcd60e51b815260206004820152603160248201527f546f6b656e56657374696e67535445414b3a207472616e736665722066726f6d60448201527020746865207a65726f206164647265737360781b6064820152608401610437565b6001600160a01b0382166110195760405162461bcd60e51b815260206004820152602f60248201527f546f6b656e56657374696e67535445414b3a207472616e7366657220746f207460448201526e6865207a65726f206164647265737360881b6064820152608401610437565b6001600160a01b0383165f9081526005602052604090205481111561109b5760405162461bcd60e51b815260206004820152603260248201527f546f6b656e56657374696e67535445414b3a207472616e7366657220616d6f756044820152716e7420657863656564732062616c616e636560701b6064820152608401610437565b6001600160a01b0383165f90815260056020526040812080548392906110c29084906118ab565b909155508190505f808080805b6001600160a01b0389165f9081526003602052604090205481101561121f5760045f6110fb8b84610aea565b81526020019081526020015f209150611121826001015483600201548460030154611626565b6006850154600586015493985091965094505f9161113f91906118ab565b90508087116111c357600683015461115790886118be565b836005015f82825461116991906118ab565b90915550505f600684015561117e86866118be565b600184015560028084018690556003840185905580548891905f906111a49084906118ab565b925050819055506111bd8986888787600401548c61132e565b5061121f565b805f036111d05750611217565b5f6005840181905560068401819055600280548392906111f19084906118ab565b90915550611201905081886118ab565b96506112158986888787600401548661132e565b505b6001016110cf565b50866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8860405161126591815260200190565b60405180910390a35050505050505050565b5f816040015142101561128b57505f919050565b8160800151826040015161129f91906118be565b42106112b9578160e001518260c001516103c991906118ab565b5f8260400151426112ca91906118ab565b60a08401519091505f6112dd828461199f565b90505f6112ea83836119be565b90505f8660800151828860c0015161130291906119be565b61130c919061199f565b90508660e001518161131e91906118ab565b979650505050505050565b919050565b5f831161138d5760405162461bcd60e51b815260206004820152602760248201527f546f6b656e56657374696e67535445414b3a206475726174696f6e206d7573746044820152660206265203e20360cc1b6064820152608401610437565b5f81116113ea5760405162461bcd60e51b815260206004820152602560248201527f546f6b656e56657374696e67535445414b3a20616d6f756e74206d7573742062604482015264065203e20360dc1b6064820152608401610437565b60018210156114565760405162461bcd60e51b815260206004820152603260248201527f546f6b656e56657374696e67535445414b3a20736c696365506572696f645365604482015271636f6e6473206d757374206265203e3d203160701b6064820152608401610437565b5f611460876116d2565b90505f61146d86886118be565b9050604051806101000160405280600115158152602001896001600160a01b031681526020018281526020018881526020018681526020018581526020018481526020015f81525060045f8481526020019081526020015f205f820151815f015f6101000a81548160ff0219169083151502179055506020820151815f0160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010155606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e082015181600601559050508260055f8a6001600160a01b03166001600160a01b031681526020019081526020015f205f82825461158091906118be565b925050819055508260025f82825461159891906118be565b9091555050600180548082019091557fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6018290556001600160a01b0388165f9081526003602052604081208054916115ef836118d1565b91905055505050505050505050565b60025f540361162057604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b5f808080808080611637898b6118ab565b90505f808a42101561164e578295508993506116a9565b8b42101561167957611660428d6118ab565b955089935061166f86846118ab565b91505f90506116a9565b5f95508291506116898c426118ab565b9050898110156116a45761169d818b6118ab565b93506116a9565b600193505b806116b4838d6118be565b6116be91906118be565b959c959b5092995093975050505050505050565b6001600160a01b0381165f908152600360205260408120546103c9908390610aea565b6040518061010001604052805f151581526020015f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b0381168114611329575f80fd5b5f8060408385031215611799575f80fd5b6117a283611772565b946020939093013593505050565b5f805f606084860312156117c2575f80fd5b6117cb84611772565b92506117d960208501611772565b9150604084013590509250925092565b5f602082840312156117f9575f80fd5b61180282611772565b9392505050565b5f805f805f8060c0878903121561181e575f80fd5b61182787611772565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b5f6020828403121561185f575f80fd5b5035919050565b5f8060408385031215611877575f80fd5b61188083611772565b915061188e60208401611772565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156103c9576103c9611897565b808201808211156103c9576103c9611897565b5f600182016118e2576118e2611897565b5060010190565b5f602082840312156118f9575f80fd5b81518015158114611802575f80fd5b6020808252605f908201527f546f6b656e56657374696e67535445414b3a20494e56414c49442042656e656660408201527f696369617279204164647265737321206e6f2076657374696e6720736368656460608201527f756c652065786973747320666f7220746861742062656e656669636961727900608082015260a00190565b634e487b7160e01b5f52603260045260245ffd5b5f826119b957634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176103c9576103c961189756fea2646970667358221220743404cc2a9d362b3bda4e8bcd79e3f0f717293b7aa5b81d28490f78dc2098dc64736f6c63430008190033 | 608060405234801561000f575f80fd5b5060043610610132575f3560e01c806369da1fc6116100b45780639d76ea58116100795780639d76ea58146103025780639ef346b414610335578063a9059cbb14610348578063a9bebf091461035b578063dd62ed3e1461036e578063f9079b37146103a6575f80fd5b806369da1fc61461022357806370a082311461029d578063763072af146102c55780638af104da146102cd57806395d89b41146102e0575f80fd5b806329cb924d116100fa57806329cb924d146101c0578063313ce567146101c65780633ca841b5146101d55780635a7bb69a146101e857806362eb060414610210575f80fd5b806306fdde0314610136578063095ea7b314610170578063130836171461019357806318160ddd146101a557806323b872dd146101ad575b5f80fd5b60408051808201909152600c81526b56657374656420535445414b60a01b60208201525b604051610167919061173d565b60405180910390f35b61018361017e366004611788565b6103b9565b6040519015158152602001610167565b6001545b604051908152602001610167565b600254610197565b6101836101bb3660046117b0565b6103cf565b42610197565b60405160128152602001610167565b6101976101e33660046117e9565b610474565b6101976101f63660046117e9565b6001600160a01b03165f9081526003602052604090205490565b61018361021e366004611809565b610554565b6102366102313660046117e9565b61070b565b60405161016791908151151581526020808301516001600160a01b03169082015260408083015190820152606080830151908201526080808301519082015260a0808301519082015260c0808301519082015260e091820151918101919091526101000190565b6101976102ab3660046117e9565b6001600160a01b03165f9081526005602052604090205490565b6101836107f2565b6101976102db366004611788565b610aea565b60408051808201909152600681526576535445414b60d01b602082015261015a565b61031d73c4c244f1dbca07083fee35220d2169957c275e6881565b6040516001600160a01b039091168152602001610167565b61023661034336600461184f565b610b30565b610183610356366004611788565b610c4a565b610236610369366004611788565b610c57565b61019761037c366004611866565b6001600160a01b039182165f90815260066020908152604080832093909416825291909152205490565b6101976103b436600461184f565b610d75565b5f6103c5338484610dff565b5060015b92915050565b5f816103db853361037c565b10156104405760405162461bcd60e51b815260206004820152602960248201527f546f6b656e56657374696e67535445414b3a20696e73756666696369656e7420604482015268616c6c6f77616e636560b81b60648201526084015b60405180910390fd5b61045f843384610450883361037c565b61045a91906118ab565b610dff565b61046a848484610f3b565b5060019392505050565b6001600160a01b0381165f908152600360205260408120546104946116f5565b5f805b60045f6104a48884610aea565b815260208082019290925260409081015f90812082516101008082018552825460ff811615158352046001600160a01b0316948101949094526001810154928401929092526002820154606084015260038201546080840152600482015460a0840152600582015460c084015260069091015460e083015290935061052884611277565b905061053481846118be565b925081610540816118d1565b925050508381106104975750949350505050565b5f73c4c244f1dbca07083fee35220d2169957c275e686323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018590526064016020604051808303815f875af11580156105c0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105e491906118e9565b6106565760405162461bcd60e51b815260206004820152603960248201527f546f6b656e56657374696e67535445414b3a20746f6b656e20535445414b207460448201527f72616e7366657246726f6d206e6f7420737563636565646564000000000000006064820152608401610437565b61066487878787878761132e565b604080518681526020810188905290810185905260608101849052608081018390526001600160a01b038816907fc63cdf21055cafabb96c87ca41b053fed647aaefbd2cf9ea04a7ae79a9c84ad29060a00160405180910390a26040518281526001600160a01b038816905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35060019695505050505050565b6107136116f5565b6001600160a01b0382165f9081526003602052604090205482906107495760405162461bcd60e51b815260040161043790611908565b6001600160a01b0383165f90815260036020526040812054600491906107779086906102db906001906118ab565b815260208082019290925260409081015f2081516101008082018452825460ff811615158352046001600160a01b0316938101939093526001810154918301919091526002810154606083015260038101546080830152600481015460a0830152600581015460c08301526006015460e08201529392505050565b5f6107fb6115fe565b335f818152600360205260409020546108265760405162461bcd60e51b815260040161043790611908565b335f818152600360205260408120549080805b60045f6108468784610aea565b815260208082019290925260409081015f90812082516101008082018552825460ff811615158352046001600160a01b0316948101949094526001810154928401929092526002820154606084015260038201546080840152600482015460a0840152600582015460c0840152600682015460e0840152909450906108ca90611277565b905080846006015f8282546108df91906118be565b909155506108ef905081846118be565b9250816108fb816118d1565b92505050838110610839578160025f82825461091791906118ab565b90915550506001600160a01b0385165f90815260056020526040812080548492906109439084906118ab565b909155505060405163a9059cbb60e01b81526001600160a01b03861660048201526024810183905273c4c244f1dbca07083fee35220d2169957c275e689063a9059cbb906044016020604051808303815f875af11580156109a6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109ca91906118e9565b610a515760405162461bcd60e51b815260206004820152604c60248201527f546f6b656e56657374696e67535445414b3a20746f6b656e20535445414b207260448201527f657761726473207472616e7366657220746f2062656e6566696369617279206e60648201526b1bdd081cdd58d8d95959195960a21b608482015260a401610437565b846001600160a01b03167fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df9317983604051610a8c91815260200190565b60405180910390a26040518281525f906001600160a01b038716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a360019650505050505050610ae760015f55565b90565b6040516bffffffffffffffffffffffff19606084901b166020820152603481018290525f9060540160405160208183030381529060405280519060200120905092915050565b610b386116f5565b5f828152600460205260409020805460ff161515600114610be05760405162461bcd60e51b815260206004820152605660248201527f546f6b656e56657374696e67535445414b3a20494e56414c494420566573746960448201527f6e67205363686564756c6520494421206e6f2076657374696e672073636865646064820152751d5b1948195e1a5cdd1cc8199bdc881d1a185d081a5960521b608482015260a401610437565b604080516101008082018352835460ff811615158352046001600160a01b031660208201526001830154918101919091526002820154606082015260038201546080820152600482015460a0820152600582015460c082015260069091015460e082015292915050565b5f3361046a818585610f3b565b610c5f6116f5565b6001600160a01b0383165f908152600360205260409020548390610c955760405162461bcd60e51b815260040161043790611908565b6001600160a01b0384165f908152600360205260409020548310610d605760405162461bcd60e51b815260206004820152607060248201527f546f6b656e56657374696e67535445414b3a20494e56414c494420566573746960448201527f6e67205363686564756c6520496e64657821206e6f2076657374696e6720736360648201527f686564756c6520657869737473206174207468697320696e64657820666f722060848201526f746861742062656e656669636961727960801b60a482015260c401610437565b610d6d6103438585610aea565b949350505050565b5f610d7f60015490565b8210610ddc5760405162461bcd60e51b815260206004820152602660248201527f546f6b656e56657374696e67535445414b3a20696e646578206f7574206f6620604482015265626f756e647360d01b6064820152608401610437565b60018281548110610def57610def61198b565b905f5260205f2001549050919050565b6001600160a01b038316610e6e5760405162461bcd60e51b815260206004820152603060248201527f546f6b656e56657374696e67535445414b3a20617070726f76652066726f6d2060448201526f746865207a65726f206164647265737360801b6064820152608401610437565b6001600160a01b038216610edb5760405162461bcd60e51b815260206004820152602e60248201527f546f6b656e56657374696e67535445414b3a20617070726f766520746f20746860448201526d65207a65726f206164647265737360901b6064820152608401610437565b6001600160a01b038381165f8181526006602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fab5760405162461bcd60e51b815260206004820152603160248201527f546f6b656e56657374696e67535445414b3a207472616e736665722066726f6d60448201527020746865207a65726f206164647265737360781b6064820152608401610437565b6001600160a01b0382166110195760405162461bcd60e51b815260206004820152602f60248201527f546f6b656e56657374696e67535445414b3a207472616e7366657220746f207460448201526e6865207a65726f206164647265737360881b6064820152608401610437565b6001600160a01b0383165f9081526005602052604090205481111561109b5760405162461bcd60e51b815260206004820152603260248201527f546f6b656e56657374696e67535445414b3a207472616e7366657220616d6f756044820152716e7420657863656564732062616c616e636560701b6064820152608401610437565b6001600160a01b0383165f90815260056020526040812080548392906110c29084906118ab565b909155508190505f808080805b6001600160a01b0389165f9081526003602052604090205481101561121f5760045f6110fb8b84610aea565b81526020019081526020015f209150611121826001015483600201548460030154611626565b6006850154600586015493985091965094505f9161113f91906118ab565b90508087116111c357600683015461115790886118be565b836005015f82825461116991906118ab565b90915550505f600684015561117e86866118be565b600184015560028084018690556003840185905580548891905f906111a49084906118ab565b925050819055506111bd8986888787600401548c61132e565b5061121f565b805f036111d05750611217565b5f6005840181905560068401819055600280548392906111f19084906118ab565b90915550611201905081886118ab565b96506112158986888787600401548661132e565b505b6001016110cf565b50866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8860405161126591815260200190565b60405180910390a35050505050505050565b5f816040015142101561128b57505f919050565b8160800151826040015161129f91906118be565b42106112b9578160e001518260c001516103c991906118ab565b5f8260400151426112ca91906118ab565b60a08401519091505f6112dd828461199f565b90505f6112ea83836119be565b90505f8660800151828860c0015161130291906119be565b61130c919061199f565b90508660e001518161131e91906118ab565b979650505050505050565b919050565b5f831161138d5760405162461bcd60e51b815260206004820152602760248201527f546f6b656e56657374696e67535445414b3a206475726174696f6e206d7573746044820152660206265203e20360cc1b6064820152608401610437565b5f81116113ea5760405162461bcd60e51b815260206004820152602560248201527f546f6b656e56657374696e67535445414b3a20616d6f756e74206d7573742062604482015264065203e20360dc1b6064820152608401610437565b60018210156114565760405162461bcd60e51b815260206004820152603260248201527f546f6b656e56657374696e67535445414b3a20736c696365506572696f645365604482015271636f6e6473206d757374206265203e3d203160701b6064820152608401610437565b5f611460876116d2565b90505f61146d86886118be565b9050604051806101000160405280600115158152602001896001600160a01b031681526020018281526020018881526020018681526020018581526020018481526020015f81525060045f8481526020019081526020015f205f820151815f015f6101000a81548160ff0219169083151502179055506020820151815f0160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010155606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e082015181600601559050508260055f8a6001600160a01b03166001600160a01b031681526020019081526020015f205f82825461158091906118be565b925050819055508260025f82825461159891906118be565b9091555050600180548082019091557fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6018290556001600160a01b0388165f9081526003602052604081208054916115ef836118d1565b91905055505050505050505050565b60025f540361162057604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b5f808080808080611637898b6118ab565b90505f808a42101561164e578295508993506116a9565b8b42101561167957611660428d6118ab565b955089935061166f86846118ab565b91505f90506116a9565b5f95508291506116898c426118ab565b9050898110156116a45761169d818b6118ab565b93506116a9565b600193505b806116b4838d6118be565b6116be91906118be565b959c959b5092995093975050505050505050565b6001600160a01b0381165f908152600360205260408120546103c9908390610aea565b6040518061010001604052805f151581526020015f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b0381168114611329575f80fd5b5f8060408385031215611799575f80fd5b6117a283611772565b946020939093013593505050565b5f805f606084860312156117c2575f80fd5b6117cb84611772565b92506117d960208501611772565b9150604084013590509250925092565b5f602082840312156117f9575f80fd5b61180282611772565b9392505050565b5f805f805f8060c0878903121561181e575f80fd5b61182787611772565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b5f6020828403121561185f575f80fd5b5035919050565b5f8060408385031215611877575f80fd5b61188083611772565b915061188e60208401611772565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156103c9576103c9611897565b808201808211156103c9576103c9611897565b5f600182016118e2576118e2611897565b5060010190565b5f602082840312156118f9575f80fd5b81518015158114611802575f80fd5b6020808252605f908201527f546f6b656e56657374696e67535445414b3a20494e56414c49442042656e656660408201527f696369617279204164647265737321206e6f2076657374696e6720736368656460608201527f756c652065786973747320666f7220746861742062656e656669636961727900608082015260a00190565b634e487b7160e01b5f52603260045260245ffd5b5f826119b957634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176103c9576103c961189756fea2646970667358221220743404cc2a9d362b3bda4e8bcd79e3f0f717293b7aa5b81d28490f78dc2098dc64736f6c63430008190033 | // SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(
address owner,
address spender
) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
}
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
contract TokenVestingSTEAK is IERC20, Context, ReentrancyGuard {
IERC20 public constant tokenAddress =
IERC20(0xC4c244F1dbCA07083feE35220D2169957c275e68);
struct VestingSchedule {
bool initialized;
address beneficiary;
uint256 cliff;
uint256 start;
uint256 duration;
uint256 slicePeriodSeconds;
uint256 amountTotal;
uint256 released;
}
bytes32[] private _vestingSchedulesIds;
uint256 private _totalSupply;
mapping(address => uint256) private _holdersVestingCount;
mapping(bytes32 => VestingSchedule) private _vestingSchedules;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
event TokensReleased(address indexed beneficiary, uint256 amount);
event VestingScheduleCreated(
address indexed beneficiary,
uint256 cliff,
uint256 start,
uint256 duration,
uint256 slicePeriodSeconds,
uint256 amount
);
modifier onlyIfBeneficiaryExists(address beneficiary) {
require(
_holdersVestingCount[beneficiary] > 0,
"TokenVestingSTEAK: INVALID Beneficiary Address! no vesting schedule exists for that beneficiary"
);
_;
}
constructor() {}
function name() external pure returns (string memory) {
return "Vested STEAK";
}
function symbol() external pure returns (string memory) {
return "vSTEAK";
}
function decimals() external pure returns (uint8) {
return 18;
}
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function getCurrentTime() external view returns (uint256) {
return block.timestamp;
}
function approve(address spender, uint256 amount) external returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(
owner != address(0),
"TokenVestingSTEAK: approve from the zero address"
);
require(
spender != address(0),
"TokenVestingSTEAK: approve to the zero address"
);
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function allowance(
address owner,
address spender
) public view returns (uint256) {
return _allowances[owner][spender];
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(
allowance(sender, _msgSender()) >= amount,
"TokenVestingSTEAK: insufficient allowance"
);
_approve(
sender,
_msgSender(),
(allowance(sender, _msgSender()) - amount)
);
_transfer(sender, recipient, amount);
return true;
}
function transfer(address to, uint256 amount) external returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
function _transfer(address from, address to, uint256 amount) private {
require(
from != address(0),
"TokenVestingSTEAK: transfer from the zero address"
);
require(
to != address(0),
"TokenVestingSTEAK: transfer to the zero address"
);
require(
_balances[from] >= amount,
"TokenVestingSTEAK: transfer amount exceeds balance"
);
_balances[from] -= amount;
uint256 transferAmount = amount;
uint256 newCliff;
uint256 newStart;
uint256 newDuration;
VestingSchedule storage vestingSchedule;
for (
uint256 i = 0;
i < getVestingSchedulesCountByBeneficiary(from);
i++
) {
vestingSchedule = _vestingSchedules[
computeVestingScheduleIdForAddressAndIndex(from, i)
];
(newCliff, newStart, newDuration) = _generateCSD(
vestingSchedule.cliff,
vestingSchedule.start,
vestingSchedule.duration
);
uint256 remainingAmount = vestingSchedule.amountTotal -
vestingSchedule.released;
if (transferAmount <= remainingAmount) {
vestingSchedule.amountTotal -= (transferAmount +
vestingSchedule.released);
vestingSchedule.released = 0;
vestingSchedule.cliff = newStart + newCliff;
vestingSchedule.start = newStart;
vestingSchedule.duration = newDuration;
_totalSupply -= transferAmount;
_createVestingSchedule(
to,
newStart,
newCliff,
newDuration,
vestingSchedule.slicePeriodSeconds,
transferAmount
);
break;
} else {
if (remainingAmount == 0) {
continue;
}
vestingSchedule.amountTotal = 0;
vestingSchedule.released = 0;
_totalSupply -= remainingAmount;
transferAmount -= remainingAmount;
_createVestingSchedule(
to,
newStart,
newCliff,
newDuration,
vestingSchedule.slicePeriodSeconds,
remainingAmount
);
}
}
emit Transfer(from, to, amount);
}
function _generateCSD(
uint256 _cliff,
uint256 _start,
uint256 _duration
) private view returns (uint256, uint256, uint256) {
uint256 newCliff;
uint256 newStart;
uint256 newDuration;
uint256 oldCliff = _cliff - _start;
uint256 passedCliff = 0;
uint256 passedDuration = 0;
if (block.timestamp < _start) {
newCliff = oldCliff;
newDuration = _duration;
} else {
if (block.timestamp < _cliff) {
newCliff = _cliff - block.timestamp;
newDuration = _duration;
passedCliff = oldCliff - newCliff;
passedDuration = 0;
} else {
newCliff = 0;
passedCliff = oldCliff;
passedDuration = block.timestamp - _cliff;
if (passedDuration < _duration) {
newDuration = _duration - passedDuration;
} else {
newDuration = 1;
}
}
}
newStart = _start + passedCliff + passedDuration;
return (newCliff, newStart, newDuration);
}
function getVestingIdAtIndex(
uint256 index
) external view returns (bytes32) {
require(
index < getVestingSchedulesCount(),
"TokenVestingSTEAK: index out of bounds"
);
return _vestingSchedulesIds[index];
}
function getVestingSchedulesCountByBeneficiary(
address _beneficiary
) public view returns (uint256) {
return _holdersVestingCount[_beneficiary];
}
function getVestingScheduleByBeneficiaryAndIndex(
address beneficiary,
uint256 index
)
external
view
onlyIfBeneficiaryExists(beneficiary)
returns (VestingSchedule memory)
{
require(
index < _holdersVestingCount[beneficiary],
"TokenVestingSTEAK: INVALID Vesting Schedule Index! no vesting schedule exists at this index for that beneficiary"
);
return
getVestingSchedule(
computeVestingScheduleIdForAddressAndIndex(beneficiary, index)
);
}
function computeVestingScheduleIdForAddressAndIndex(
address holder,
uint256 index
) public pure returns (bytes32) {
return keccak256(abi.encodePacked(holder, index));
}
function getVestingSchedule(
bytes32 vestingScheduleId
) public view returns (VestingSchedule memory) {
VestingSchedule storage vestingSchedule = _vestingSchedules[
vestingScheduleId
];
require(
vestingSchedule.initialized == true,
"TokenVestingSTEAK: INVALID Vesting Schedule ID! no vesting schedule exists for that id"
);
return vestingSchedule;
}
function createVestingSchedule(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
uint256 _slicePeriodSeconds,
uint256 _amount
) external returns (bool) {
require(
tokenAddress.transferFrom(_msgSender(), address(this), _amount),
"TokenVestingSTEAK: token STEAK transferFrom not succeeded"
);
_createVestingSchedule(
_beneficiary,
_start,
_cliff,
_duration,
_slicePeriodSeconds,
_amount
);
emit VestingScheduleCreated(
_beneficiary,
_cliff,
_start,
_duration,
_slicePeriodSeconds,
_amount
);
emit Transfer(address(0), _beneficiary, _amount);
return true;
}
function _createVestingSchedule(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
uint256 _slicePeriodSeconds,
uint256 _amount
) private {
require(_duration > 0, "TokenVestingSTEAK: duration must be > 0");
require(_amount > 0, "TokenVestingSTEAK: amount must be > 0");
require(
_slicePeriodSeconds >= 1,
"TokenVestingSTEAK: slicePeriodSeconds must be >= 1"
);
bytes32 vestingScheduleId = computeNextVestingScheduleIdForHolder(
_beneficiary
);
uint256 cliff = _start + _cliff;
_vestingSchedules[vestingScheduleId] = VestingSchedule(
true,
_beneficiary,
cliff,
_start,
_duration,
_slicePeriodSeconds,
_amount,
0
);
_balances[_beneficiary] += _amount;
_totalSupply += _amount;
_vestingSchedulesIds.push(vestingScheduleId);
_holdersVestingCount[_beneficiary]++;
}
function computeNextVestingScheduleIdForHolder(
address holder
) private view returns (bytes32) {
return
computeVestingScheduleIdForAddressAndIndex(
holder,
_holdersVestingCount[holder]
);
}
function _computeReleasableAmount(
VestingSchedule memory vestingSchedule
) private view returns (uint256) {
if (block.timestamp < vestingSchedule.cliff) {
return 0;
} else if (
block.timestamp >= vestingSchedule.cliff + vestingSchedule.duration
) {
return (vestingSchedule.amountTotal - vestingSchedule.released);
} else {
uint256 timeFromStart = block.timestamp - vestingSchedule.cliff;
uint256 secondsPerSlice = vestingSchedule.slicePeriodSeconds;
uint256 releaseableSlicePeriods = timeFromStart / secondsPerSlice;
uint256 releaseableSeconds = releaseableSlicePeriods *
secondsPerSlice;
uint256 releaseableAmount = (vestingSchedule.amountTotal *
releaseableSeconds) / vestingSchedule.duration;
releaseableAmount -= vestingSchedule.released;
return releaseableAmount;
}
}
function claimFromAllVestings()
external
nonReentrant
onlyIfBeneficiaryExists(_msgSender())
returns (bool)
{
address beneficiary = _msgSender();
uint256 vestingSchedulesCountByBeneficiary = getVestingSchedulesCountByBeneficiary(
beneficiary
);
VestingSchedule storage vestingSchedule;
uint256 totalReleaseableAmount = 0;
uint256 i = 0;
do {
vestingSchedule = _vestingSchedules[
computeVestingScheduleIdForAddressAndIndex(beneficiary, i)
];
uint256 releaseableAmount = _computeReleasableAmount(
vestingSchedule
);
vestingSchedule.released += releaseableAmount;
totalReleaseableAmount += releaseableAmount;
i++;
} while (i < vestingSchedulesCountByBeneficiary);
_totalSupply -= totalReleaseableAmount;
_balances[beneficiary] -= totalReleaseableAmount;
require(
tokenAddress.transfer(beneficiary, totalReleaseableAmount),
"TokenVestingSTEAK: token STEAK rewards transfer to beneficiary not succeeded"
);
emit TokensReleased(beneficiary, totalReleaseableAmount);
emit Transfer(beneficiary, address(0), totalReleaseableAmount);
return true;
}
function getVestingSchedulesCount() public view returns (uint256) {
return _vestingSchedulesIds.length;
}
function getLastVestingScheduleForBeneficiary(
address beneficiary
)
external
view
onlyIfBeneficiaryExists(beneficiary)
returns (VestingSchedule memory)
{
return
_vestingSchedules[
computeVestingScheduleIdForAddressAndIndex(
beneficiary,
_holdersVestingCount[beneficiary] - 1
)
];
}
function computeAllReleasableAmountForBeneficiary(
address beneficiary
) external view returns (uint256) {
uint256 vestingSchedulesCountByBeneficiary = getVestingSchedulesCountByBeneficiary(
beneficiary
);
VestingSchedule memory vestingSchedule;
uint256 totalReleaseableAmount = 0;
uint256 i = 0;
do {
vestingSchedule = _vestingSchedules[
computeVestingScheduleIdForAddressAndIndex(beneficiary, i)
];
uint256 releaseableAmount = _computeReleasableAmount(
vestingSchedule
);
totalReleaseableAmount += releaseableAmount;
i++;
} while (i < vestingSchedulesCountByBeneficiary);
return totalReleaseableAmount;
}
} |