Address Contract Verified
Address
0x572Cfd21ccC1a5EDe4f83161E36CF1D62deb13AA
Balance
0 ETH
Nonce
1
Code Size
12668 bytes
Creator
0x56ddc9f4...550d at tx 0x41c2fbb8...0fd4af
Indexed Transactions
0
Contract Bytecode
12668 bytes
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c8063c31c00181161010f578063db81213a116100a2578063f53014b411610071578063f53014b4146105c7578063f7329f6a146105ee578063f8c3a5db14610615578063fdb36d541461062857600080fd5b8063db81213a1461054c578063e5ca9f2414610566578063f01f20df1461058d578063f2fde38b146105b457600080fd5b8063d1dfb8dc116100de578063d1dfb8dc146104e3578063d5dd6677146104f8578063d713c3041461050b578063da40ea1d1461052557600080fd5b8063c31c00181461046f578063c415b95c14610482578063c736e1ff146104a9578063c8796572146104b157600080fd5b806388a6094611610187578063a2e6204511610156578063a2e620451461039d578063b28e20c0146103a5578063ba93f699146103ad578063bf39a89c146103c057600080fd5b806388a609461461033b5780638da5cb5b1461034e57806392767a19146103735780639b442e3f1461038657600080fd5b8063464a59c7116101c3578063464a59c7146102c1578063715018a6146102de57806378e97925146102e8578063798c87ce1461032857600080fd5b806301185285146101ea5780631c78302c1461021a5780632a8b279a14610256575b600080fd5b6009546101fd906001600160781b031681565b6040516001600160781b0390911681526020015b60405180910390f35b6102417f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610211565b610297610264366004612cb5565b60026020526000908152604090205461ffff8082169162010000810490911690600160201b90046001600160781b031683565b6040805161ffff94851681529390921660208401526001600160781b031690820152606001610211565b6007546102ce9060ff1681565b6040519015158152602001610211565b6102e661063b565b005b61030f7f000000000000000000000000000000000000000000000000000000006385f44081565b60405167ffffffffffffffff9091168152602001610211565b610241610336366004612e09565b61067a565b6102e6610349366004612cdc565b6106b4565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610211565b6102e6610381366004612d1c565b610a6f565b6004545b60405161ffff9091168152602001610211565b6102e661110f565b61038a611186565b6102416103bb366004612e09565b6112bc565b6104226103ce366004612cb5565b6003602052600090815260409020805460018201546002909201546001600160781b0380831693600160781b808504831694600160f01b900461ffff16938383169392829004831692808216929091041687565b604080516001600160781b039889168152968816602088015261ffff90951694860194909452918516606085015284166080840152831660a08301529190911660c082015260e001610211565b6101fd61047d366004612cb5565b6112cc565b61035b7f0000000000000000000000009bb4b952d576dcc7f58797c909b0f4e8c14ae51d81565b6101fd6116b3565b6104b96116c3565b604080516001600160781b0394851681529284166020840152921691810191909152606001610211565b60085461038a90600160781b900461ffff1681565b6008546101fd906001600160781b031681565b6008546101fd90600160881b90046001600160781b031681565b6102417f000000000000000000000000000000000000000000000000000000000000000081565b6007546101fd90630100000090046001600160781b031681565b6102417f00000000000000000000000000000000000000000000000000000000000f424081565b6102417f000000000000000000000000000000000000000000000000000000000000000081565b6102e66105c2366004612cb5565b611b23565b61035b7f000000000000000000000000fc1c93a2507975e98b9d0e9260ded61a00152bf181565b61035b7f000000000000000000000000b956f28f02ace969a3e77667e3f5ee3089b2b06f81565b6101fd610623366004612e09565b611bbb565b6104b9610636366004612de2565b611bf8565b6000546001600160a01b0316331461066e5760405162461bcd60e51b815260040161066590612f4f565b60405180910390fd5b610678600061205f565b565b6004818154811061068a57600080fd5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b6000546001600160a01b031633146106de5760405162461bcd60e51b815260040161066590612f4f565b6106e661110f565b600754610100900461ffff1661070e5760405162461bcd60e51b815260040161066590612f1f565b60075460009061072990600190610100900461ffff1661306a565b60055490915061073b90600190613085565b8161ffff16106107995760405162461bcd60e51b815260206004820152602360248201527f53484f3a20656c696d696e6174696e6720696e20746865206c61737420756e6c6044820152626f636b60e81b6064820152608401610665565b60005b82811015610a695760008484838181106107c657634e487b7160e01b600052603260045260246000fd5b90506020020160208101906107db9190612cb5565b6001600160a01b0381166000908152600260209081526040918290208251606081018452905461ffff80821683526201000082041692820192909252600160201b9091046001600160781b031691810182905291925061087d5760405162461bcd60e51b815260206004820152601b60248201527f53484f3a20736f6d652075736572206e6f74206f7074696f6e203100000000006044820152606401610665565b602081015161ffff16156108dd5760405162461bcd60e51b815260206004820152602160248201527f53484f3a20736f6d65207573657220616c726561647920656c696d696e6174656044820152601960fa1b6064820152608401610665565b60006108ee826040015160016120af565b905060006109468260048861ffff168154811061091b57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1661211f565b905081600860118282829054906101000a90046001600160781b031661096c9190612fbb565b92506101000a8154816001600160781b0302191690836001600160781b0316021790555080600960008282829054906101000a90046001600160781b03166109b49190612fbb565b92506101000a8154816001600160781b0302191690836001600160781b031602179055508560016109e59190612fe6565b6001600160a01b038516600081815260026020908152604091829020805463ffff000019166201000061ffff968716021790558151928352928916928201929092527f2e534232be2bba1dbb7d9f42a931f682e70335382d04258ae54c1e4f7f3fbbea910160405180910390a1505050508080610a6190613107565b91505061079c565b50505050565b6000546001600160a01b03163314610a995760405162461bcd60e51b815260040161066590612f4f565b60075460ff16610af95760405162461bcd60e51b815260206004820152602560248201527f53484f3a2077686974656c697374696e67206e6f7420616c6c6f77656420616e604482015264796d6f726560d81b6064820152608401610665565b85610b3f5760405162461bcd60e51b815260206004820152601660248201527553484f3a207a65726f206c656e67746820617272617960501b6044820152606401610665565b858414610b8e5760405162461bcd60e51b815260206004820152601c60248201527f53484f3a20646966666572656e74206172726179206c656e67746873000000006044820152606401610665565b858214610bdd5760405162461bcd60e51b815260206004820152601c60248201527f53484f3a20646966666572656e74206172726179206c656e67746873000000006044820152606401610665565b60008060005b888110156110625760008a8a83818110610c0d57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610c229190612cb5565b9050868683818110610c4457634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610c599190612e39565b60ff1660011480610ca15750868683818110610c8557634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610c9a9190612e39565b60ff166002145b610ced5760405162461bcd60e51b815260206004820152601860248201527f53484f3a20696e76616c69642075736572206f7074696f6e00000000000000006044820152606401610665565b6001600160a01b038116600090815260026020526040902054600160201b90046001600160781b031615610d335760405162461bcd60e51b815260040161066590612ea9565b6001600160a01b0381166000908152600360205260409020546001600160781b031615610d725760405162461bcd60e51b815260040161066590612ea9565b868683818110610d9257634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610da79190612e39565b60ff1660011415610e6f57888883818110610dd257634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610de79190612de2565b6001600160a01b038216600090815260026020526040902080546001600160781b0392909216600160201b02640100000000600160981b0319909216919091179055888883818110610e4957634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610e5e9190612de2565b610e689085612fbb565b9350610f5c565b868683818110610e8f57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610ea49190612e39565b60ff1660021415610f5c57888883818110610ecf57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610ee49190612de2565b6001600160a01b038216600090815260036020526040902080546001600160781b0319166001600160781b0392909216919091179055888883818110610f3a57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610f4f9190612de2565b610f599084612fbb565b92505b7fd21b390558b71e411ac9142c73cd39dfc4df6e49de8292e4d44f1b432f5591a98b8b84818110610f9d57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610fb29190612cb5565b8a8a85818110610fd257634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610fe79190612de2565b89898681811061100757634e487b7160e01b600052603260045260246000fd5b905060200201602081019061101c9190612e39565b604080516001600160a01b0390941684526001600160781b03909216602084015260ff169082015260600160405180910390a1508061105a81613107565b915050610be3565b5081600760038282829054906101000a90046001600160781b03166110879190612fbb565b92506101000a8154816001600160781b0302191690836001600160781b0316021790555080600860008282829054906101000a90046001600160781b03166110cf9190612fbb565b92506101000a8154816001600160781b0302191690836001600160781b031602179055508215611104576007805460ff191690555b505050505050505050565b6000611119611186565b60075490915061ffff61010090910481169082161115611183576007805462ffff00191661010061ffff8416908102919091179091556040519081527f51d949e894d194a06df7af6fb215f324ab4717f75f3b9efcb57210c3a68087259060200160405180910390a15b50565b60007f000000000000000000000000000000000000000000000000000000006385f44067ffffffffffffffff164210156111fa5760405162461bcd60e51b815260206004820152601560248201527453484f3a206265666f726520737461727454696d6560581b6044820152606401610665565b600061123067ffffffffffffffff7f000000000000000000000000000000000000000000000000000000006385f4401642613085565b600554600754610100900461ffff1693509091505b808361ffff161080156112a0575060058361ffff168154811061127857634e487b7160e01b600052603260045260246000fd5b6000918252602090912060088204015460079091166004026101000a900463ffffffff168210155b156112b757826112af816130e5565b935050611245565b505090565b6005818154811061068a57600080fd5b6001600160a01b0381166000908152600260205260408120548290600160201b90046001600160781b031661137c5760405162461bcd60e51b815260206004820152604a60248201527f53484f3a207061737365642061646472657373206973206e6f7420776869746560448201527f6c6973746564206f7220646f6573206e6f7420686176652074686520636f727260648201526932b1ba1037b83a34b7b760b11b608482015260a401610665565b6002600154141561139f5760405162461bcd60e51b815260040161066590612f84565b60026001556113ac61110f565b6001600160a01b0383166000908152600260209081526040918290208251606081018452905461ffff8082168352620100008204811693830193909352600160201b90046001600160781b0316928101929092526007546101009004166114255760405162461bcd60e51b815260040161066590612f1f565b600754815161ffff61010090920482169116106114545760405162461bcd60e51b815260040161066590612ef0565b60075460009061146f90600190610100900461ffff1661306a565b602083015190915061ffff16156114c357816020015161ffff16826000015161ffff16106114af5760405162461bcd60e51b815260040161066590612ef0565b600182602001516114c0919061306a565b90505b815160009061ffff166114d7576000611531565b82516004906114e89060019061306a565b61ffff168154811061150a57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff165b905061159683604001518260048561ffff168154811061156157634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16611591919061309c565b61211f565b94506115a38560016120af565b94506115b0826001612fe6565b61ffff90811684526001600160a01b0387811660009081526002602090815260409182902087518154928901519389015190861663ffffffff199093169290921762010000939095169290920293909317640100000000600160981b031916600160201b6001600160781b0394851602179055611655917f000000000000000000000000fc1c93a2507975e98b9d0e9260ded61a00152bf19091169088908816612148565b6040805161ffff841681526001600160781b03871660208201526001600160a01b038816917fb533cd5ff9fe6578a985cd9f6134baf83ea6aaf0236d28533fd9cf8313846f42910160405180910390a2505060018055509092915050565b60006116be336112cc565b905090565b6000806000600260015414156116eb5760405162461bcd60e51b815260040161066590612f84565b60026001556116f861110f565b60075460085461010090910461ffff908116600160781b90920416106117605760405162461bcd60e51b815260206004820152601760248201527f53484f3a206e6f206665657320746f20636f6c6c6563740000000000000000006044820152606401610665565b60075460009061177b90600190610100900461ffff1661306a565b600854909150600090600160781b900461ffff1661179a576000611800565b6008546004906117b790600190600160781b900461ffff1661306a565b61ffff16815481106117d957634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff165b90506000611843600760039054906101000a90046001600160781b03168360048661ffff168154811061156157634e487b7160e01b600052603260045260246000fd5b60085460048054929350600092611882926001600160781b031691869161ffff891690811061156157634e487b7160e01b600052603260045260246000fd5b90506118ae827f000000000000000000000000000000000000000000000000000000000000000061211f565b96506118da817f000000000000000000000000000000000000000000000000000000000000000061211f565b6118e49088612fbb565b6008549097506000906001600160781b03161561198857600854600160781b900461ffff165b8561ffff168161ffff16116119865760068161ffff168154811061193e57634e487b7160e01b600052603260045260246000fd5b9060005260206000209060029182820401919006600f029054906101000a90046001600160781b0316826119729190612fbb565b91508061197e816130e5565b91505061190a565b505b60006119c8600860119054906101000a90046001600160781b031660048861ffff168154811061091b57634e487b7160e01b600052603260045260246000fd5b6009549091506000906119e4906001600160781b031683613042565b600980546001600160781b0319166001600160781b0385161790559050611a0b8382612fbb565b98506000611a198a8c612fbb565b9050611a248a61219f565b9850611a31886001612fe6565b6008805461ffff92909216600160781b0261ffff60781b19909216919091179055611aba7f0000000000000000000000009bb4b952d576dcc7f58797c909b0f4e8c14ae51d611a808b84613042565b6001600160a01b037f000000000000000000000000fc1c93a2507975e98b9d0e9260ded61a00152bf11691906001600160781b0316612148565b6040805161ffff8a1681526001600160781b0383811660208301528c8116828401528b16606082015290517f0954e17da6a76fc598fe15749138bad5134a004f429f0875f8d17a052dfd16589181900360800190a1505050505050505060018081905550909192565b6000546001600160a01b03163314611b4d5760405162461bcd60e51b815260040161066590612f4f565b6001600160a01b038116611bb25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610665565b6111838161205f565b60068181548110611bcb57600080fd5b9060005260206000209060029182820401919006600f02915054906101000a90046001600160781b031681565b600080600060026001541415611c205760405162461bcd60e51b815260040161066590612f84565b6002600155336000908152600360205260409020546001600160781b0316611cbb5760405162461bcd60e51b815260206004820152604260248201527f53484f3a2063616c6c6572206973206e6f742077686974656c6973746564206f60448201527f7220646f6573206e6f7420686176652074686520636f7272656374206f70746960648201526137b760f11b608482015260a401610665565b611cc361110f565b33600090815260036020908152604091829020825160e08101845281546001600160781b038082168352600160781b808304821695840195909552600160f01b90910461ffff90811695830195909552600183015480821660608401528490048116608083015260029092015480831660a0830152929092041660c0820152600754909161010090910416611d6a5760405162461bcd60e51b815260040161066590612f1f565b600754600090611d8590600190610100900461ffff1661306a565b600754604084015191925061ffff610100909104811691161015611dea57611dad8282612442565b9450611db982826126e4565b9350611dc58486612fbb565b94508382608001818151611dd99190612fbb565b6001600160781b0316905250611e13565b6000866001600160781b031611611e135760405162461bcd60e51b815260040161066590612ef0565b606082015192506001600160781b03861615611edd5781608001518260600151611e3d9190613042565b6001600160781b0316866001600160781b03161115611ea85760405162461bcd60e51b815260206004820152602160248201527f53484f3a2070617373656420657874726120616d6f756e7420746f6f206869676044820152600d60fb1b6064820152608401610665565b611eb28686612fbb565b94508582608001818151611ec69190612fbb565b6001600160781b0316905250611edd82878361273f565b6000856001600160781b031611611f065760405162461bcd60e51b815260040161066590612ef0565b848260c001818151611f189190612fbb565b6001600160781b03908116909152336000818152600360209081526040918290208751815492890151938901519086166001600160f01b031993841617600160781b9487168502176001600160f01b0316600160f01b61ffff90921691909102178155606088015160018201805460808b015192881690851617918716850291909117905560a08801516002909101805460c08a0151928716931692909217908516909202919091179055611ffa92506001600160a01b037f000000000000000000000000fc1c93a2507975e98b9d0e9260ded61a00152bf116918816612148565b6040805161ffff831681526001600160781b0387811660208301528681168284015288166060820152905133917f0de75c8104646a057ba354669d75c0407de8220eee9021025b6595f98d3919bc919081900360800190a25050600180559193909250565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061210c838360ff166001146120e6577f000000000000000000000000000000000000000000000000000000000000000061211f565b7f000000000000000000000000000000000000000000000000000000000000000061211f565b6121169084613042565b90505b92915050565b6000620f424061213e63ffffffff84166001600160781b038616613023565b6121169190613003565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261219a9084906128ee565b505050565b60006121cb827f000000000000000000000000000000000000000000000000000000000000000061211f565b90506001600160781b0381166121e357506000919050565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000fc1c93a2507975e98b9d0e9260ded61a00152bf16001600160a01b0316906370a082319060240160206040518083038186803b15801561224557600080fd5b505afa158015612259573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227d9190612e21565b6040516001600160781b03841660248201529091506001600160a01b037f000000000000000000000000fc1c93a2507975e98b9d0e9260ded61a00152bf1169060440160408051601f198184030181529181526020820180516001600160e01b0316630852cd8d60e31b179052516122f59190612e5a565b6000604051808303816000865af19150503d8060008114612332576040519150601f19603f3d011682016040523d82523d6000602084013e612337565b606091505b50506040516370a0823160e01b8152306004820152600091507f000000000000000000000000fc1c93a2507975e98b9d0e9260ded61a00152bf16001600160a01b0316906370a082319060240160206040518083038186803b15801561239c57600080fd5b505afa1580156123b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d49190612e21565b90508082141561243b5761243b6001600160a01b037f000000000000000000000000fc1c93a2507975e98b9d0e9260ded61a00152bf1167f000000000000000000000000b956f28f02ace969a3e77667e3f5ee3089b2b06f6001600160781b038616612148565b5050919050565b600061244e83836129c0565b90506000836080015184606001516124669190613042565b6124709083613042565b90506000808461ffff16116124cf5760048461ffff16815481106124a457634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16612579565b60046124dc60018661306a565b61ffff16815481106124fe57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1660048561ffff168154811061254957634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16612579919061309c565b9050600061258b86600001518361211f565b90506125988160026120af565b90506125a48184612fbb565b925085602001516001600160781b0316836001600160781b0316106125d95760208601516125d29084613042565b92506125de565b600092505b85602001516001600160781b0316846001600160781b03161061261857602086015161260a9085613042565b60006020880152935061263b565b838660200181815161262a9190613042565b6001600160781b0316905250600093505b85602001516001600160781b0316816001600160781b0316106126755760208601516126679082613042565b600060208801529050612698565b80866020018181516126879190613042565b6001600160781b0316905250600090505b828660a0018181516126aa9190612fbb565b6001600160781b0390811690915291909116606087015250506000608085015250600754610100900461ffff166040909301929092525090565b6005546000906126f690600190613085565b8261ffff1610156127365761272f83606001517f00000000000000000000000000000000000000000000000000000000000f424061211f565b9050612119565b50506060015190565b81836020018181516127519190612fbb565b6001600160781b03169052505b6000826001600160781b0316118015612788575060055461278190600190613085565b8161ffff16105b1561219a57600061279a826001612fe6565b90506000612816856000015160048561ffff16815481106127cb57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff1660048561ffff168154811061156157634e487b7160e01b600052603260045260246000fd5b90506128238160026120af565b90506000816001600160781b0316856001600160781b031611156128475781612849565b845b90508060068461ffff168154811061287157634e487b7160e01b600052603260045260246000fd5b9060005260206000209060029182820401919006600f028282829054906101000a90046001600160781b03166128a79190612fbb565b92506101000a8154816001600160781b0302191690836001600160781b0316021790555080856128d79190613042565b9450836128e3816130e5565b94505050505061275e565b6000612943826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612af19092919063ffffffff16565b80519091501561219a57808060200190518101906129619190612dc6565b61219a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610665565b6000806000846040015161ffff16116129da576000612a36565b6004600185604001516129ed919061306a565b61ffff1681548110612a0f57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff165b90506000808461ffff1611612a4c576000612aa2565b6004612a5960018661306a565b61ffff1681548110612a7b57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600891828204019190066004029054906101000a900463ffffffff165b8551909150600090612ab890611591858561309c565b9050612ac58160026120af565b905085608001518660600151612adb9190613042565b9350612ae78185612fbb565b9695505050505050565b6060612b008484600085612b0a565b90505b9392505050565b606082471015612b6b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610665565b843b612bb95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610665565b600080866001600160a01b03168587604051612bd59190612e5a565b60006040518083038185875af1925050503d8060008114612c12576040519150601f19603f3d011682016040523d82523d6000602084013e612c17565b606091505b5091509150612c27828286612c32565b979650505050505050565b60608315612c41575081612b03565b825115612c515782518084602001fd5b8160405162461bcd60e51b81526004016106659190612e76565b60008083601f840112612c7c578182fd5b50813567ffffffffffffffff811115612c93578182fd5b6020830191508360208260051b8501011115612cae57600080fd5b9250929050565b600060208284031215612cc6578081fd5b81356001600160a01b0381168114612b03578182fd5b60008060208385031215612cee578081fd5b823567ffffffffffffffff811115612d04578182fd5b612d1085828601612c6b565b90969095509350505050565b60008060008060008060006080888a031215612d36578283fd5b873567ffffffffffffffff80821115612d4d578485fd5b612d598b838c01612c6b565b909950975060208a0135915080821115612d71578485fd5b612d7d8b838c01612c6b565b909750955060408a0135915080821115612d95578485fd5b50612da28a828b01612c6b565b9094509250506060880135612db681613138565b8091505092959891949750929550565b600060208284031215612dd7578081fd5b8151612b0381613138565b600060208284031215612df3578081fd5b81356001600160781b0381168114612b03578182fd5b600060208284031215612e1a578081fd5b5035919050565b600060208284031215612e32578081fd5b5051919050565b600060208284031215612e4a578081fd5b813560ff81168114612b03578182fd5b60008251612e6c8184602087016130b9565b9190910192915050565b6020815260008251806020840152612e958160408501602087016130b9565b601f01601f19169190910160400192915050565b60208082526027908201527f53484f3a20736f6d652075736572732061726520616c72656164792077686974604082015266195b1a5cdd195960ca1b606082015260800190565b60208082526015908201527453484f3a206e6f7468696e6720746f20636c61696d60581b604082015260600190565b60208082526016908201527514d213ce881b9bc81d5b9b1bd8dadcc81c185cdcd95960521b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006001600160781b03808316818516808303821115612fdd57612fdd613122565b01949350505050565b600061ffff808316818516808303821115612fdd57612fdd613122565b60008261301e57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561303d5761303d613122565b500290565b60006001600160781b038381169083168181101561306257613062613122565b039392505050565b600061ffff8381169083168181101561306257613062613122565b60008282101561309757613097613122565b500390565b600063ffffffff8381169083168181101561306257613062613122565b60005b838110156130d45781810151838201526020016130bc565b83811115610a695750506000910152565b600061ffff808316818114156130fd576130fd613122565b6001019392505050565b600060001982141561311b5761311b613122565b5060010190565b634e487b7160e01b600052601160045260246000fd5b801515811461118357600080fdfea2646970667358221220292f52a7a5c0485f3ccafbbe2b9cbe56775ce00f0baf7e5c5d7e4268f69953ee64736f6c63430008040033
Verified Source Code Full Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: Yes (200 runs)
SHO.sol 497 lines
//SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract SHO is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
uint32 constant HUNDRED_PERCENT = 1e6;
struct User1 {
uint16 claimedUnlocksCount;
uint16 eliminatedAfterUnlock;
uint120 allocation;
}
struct User2 {
uint120 allocation;
uint120 debt;
uint16 claimedUnlocksCount;
uint120 currentUnlocked;
uint120 currentClaimed;
uint120 totalUnlocked;
uint120 totalClaimed;
}
mapping(address => User1) public users1;
mapping(address => User2) public users2;
IERC20 public immutable shoToken;
uint64 public immutable startTime;
address public immutable feeCollector;
uint32 public immutable baseFeePercentage1;
uint32 public immutable baseFeePercentage2;
uint32 public immutable freeClaimablePercentage;
address public immutable burnValley;
uint32 public immutable burnPercentage;
uint32[] public unlockPercentages;
uint32[] public unlockPeriods;
uint120[] public extraFees2;
bool public whitelistingAllowed = true;
uint16 passedUnlocksCount;
uint120 public globalTotalAllocation1;
uint120 public globalTotalAllocation2;
uint16 public collectedFeesUnlocksCount;
uint120 public extraFees1Allocation;
uint120 public extraFees1AllocationUncollectable;
event Whitelist (
address user,
uint120 allocation,
uint8 option
);
event Claim1 (
address indexed user,
uint16 currentUnlock,
uint120 claimedTokens
);
event Claim2 (
address indexed user,
uint16 currentUnlock,
uint120 claimedTokens,
uint120 baseClaimed,
uint120 chargedfee
);
event FeeCollection (
uint16 currentUnlock,
uint120 totalFee,
uint120 extraFee,
uint120 burned
);
event UserElimination (
address user,
uint16 currentUnlock
);
event Update (
uint16 passedUnlocksCount
);
modifier onlyWhitelistedUser1(address userAddress) {
require(users1[userAddress].allocation > 0, "SHO: passed address is not whitelisted or does not have the correct option");
_;
}
modifier onlyWhitelistedUser2() {
require(users2[msg.sender].allocation > 0, "SHO: caller is not whitelisted or does not have the correct option");
_;
}
/**
@param _shoToken token that whitelisted users claim
@param _unlockPercentagesDiff array of unlock percentages as differentials
(how much of total user's whitelisted allocation can a user claim per unlock)
@param _unlockPeriodsDiff array of unlock periods as differentials
(when unlocks happen from startTime)
@param _baseFeePercentage1 base fee in percentage for option 1 users
@param _baseFeePercentage2 base fee in percentage for option 2 users
@param _feeCollector EOA that receives fees
@param _startTime when users can start claiming
@param _burnValley burned tokens are sent to this address if the SHO token is not burnable
@param _burnPercentage burn percentage of extra fees
@param _freeClaimablePercentage how much can users of type 2 claim in the current unlock without a fee
*/
constructor(
IERC20 _shoToken,
uint32[] memory _unlockPercentagesDiff,
uint32[] memory _unlockPeriodsDiff,
uint32 _baseFeePercentage1,
uint32 _baseFeePercentage2,
address _feeCollector,
uint64 _startTime,
address _burnValley,
uint32 _burnPercentage,
uint32 _freeClaimablePercentage
) {
require(address(_shoToken) != address(0), "SHO: sho token zero address");
require(_unlockPercentagesDiff.length > 0, "SHO: 0 unlock percentages");
require(_unlockPercentagesDiff.length <= 800, "SHO: too many unlock percentages");
require(_unlockPeriodsDiff.length == _unlockPercentagesDiff.length, "SHO: different array lengths");
require(_baseFeePercentage1 <= HUNDRED_PERCENT, "SHO: base fee percentage 1 higher than 100%");
require(_baseFeePercentage2 <= HUNDRED_PERCENT, "SHO: base fee percentage 2 higher than 100%");
require(_feeCollector != address(0), "SHO: fee collector zero address");
require(_startTime > block.timestamp, "SHO: start time must be in future");
require(_burnValley != address(0), "SHO: burn valley zero address");
require(_burnPercentage <= HUNDRED_PERCENT, "SHO: burn percentage higher than 100%");
require(_freeClaimablePercentage <= HUNDRED_PERCENT, "SHO: free claimable percentage higher than 100%");
// build arrays of sums for easier calculations
uint32[] memory _unlockPercentages = _buildArraySum(_unlockPercentagesDiff);
uint32[] memory _unlockPeriods = _buildArraySum(_unlockPeriodsDiff);
require(_unlockPercentages[_unlockPercentages.length - 1] == HUNDRED_PERCENT, "SHO: invalid unlock percentages");
shoToken = _shoToken;
unlockPercentages = _unlockPercentages;
unlockPeriods = _unlockPeriods;
baseFeePercentage1 = _baseFeePercentage1;
baseFeePercentage2 = _baseFeePercentage2;
feeCollector = _feeCollector;
startTime = _startTime;
burnValley = _burnValley;
burnPercentage = _burnPercentage;
freeClaimablePercentage = _freeClaimablePercentage;
extraFees2 = new uint120[](_unlockPercentagesDiff.length);
}
/**
@param userAddresses addresses to whitelist
@param allocations users total allocation
@param options user types
*/
function whitelistUsers(
address[] calldata userAddresses,
uint120[] calldata allocations,
uint8[] calldata options,
bool last
) external onlyOwner {
require(whitelistingAllowed, "SHO: whitelisting not allowed anymore");
require(userAddresses.length != 0, "SHO: zero length array");
require(userAddresses.length == allocations.length, "SHO: different array lengths");
require(userAddresses.length == options.length, "SHO: different array lengths");
uint120 _globalTotalAllocation1;
uint120 _globalTotalAllocation2;
for (uint256 i = 0; i < userAddresses.length; i++) {
address userAddress = userAddresses[i];
require(options[i] == 1 || options[i] == 2, "SHO: invalid user option");
require(users1[userAddress].allocation == 0, "SHO: some users are already whitelisted");
require(users2[userAddress].allocation == 0, "SHO: some users are already whitelisted");
if (options[i] == 1) {
users1[userAddress].allocation = allocations[i];
_globalTotalAllocation1 += allocations[i];
} else if (options[i] == 2) {
users2[userAddress].allocation = allocations[i];
_globalTotalAllocation2 += allocations[i];
}
emit Whitelist(
userAddresses[i],
allocations[i],
options[i]
);
}
globalTotalAllocation1 += _globalTotalAllocation1;
globalTotalAllocation2 += _globalTotalAllocation2;
if (last) {
whitelistingAllowed = false;
}
}
function claimUser1() external returns (uint120 amountToClaim) {
return claimUser1(msg.sender);
}
/**
Users type 1 claims all the available amount without increasing the fee.
(there's still the baseFee deducted from their allocation).
*/
function claimUser1(address userAddress) onlyWhitelistedUser1(userAddress) public nonReentrant returns (uint120 amountToClaim) {
update();
User1 memory user = users1[userAddress];
require(passedUnlocksCount > 0, "SHO: no unlocks passed");
require(user.claimedUnlocksCount < passedUnlocksCount, "SHO: nothing to claim");
uint16 currentUnlock = passedUnlocksCount - 1;
if (user.eliminatedAfterUnlock > 0) {
require(user.claimedUnlocksCount < user.eliminatedAfterUnlock, "SHO: nothing to claim");
currentUnlock = user.eliminatedAfterUnlock - 1;
}
uint32 lastUnlockPercentage = user.claimedUnlocksCount > 0 ? unlockPercentages[user.claimedUnlocksCount - 1] : 0;
amountToClaim = _applyPercentage(user.allocation, unlockPercentages[currentUnlock] - lastUnlockPercentage);
amountToClaim = _applyBaseFee(amountToClaim, 1);
user.claimedUnlocksCount = currentUnlock + 1;
users1[userAddress] = user;
shoToken.safeTransfer(userAddress, amountToClaim);
emit Claim1(
userAddress,
currentUnlock,
amountToClaim
);
}
/**
Removes all the future allocation of passed user type 1 addresses.
They can still claim the unlock they were eliminated in.
@param userAddresses whitelisted user addresses to eliminate
*/
function eliminateUsers1(address[] calldata userAddresses) external onlyOwner {
update();
require(passedUnlocksCount > 0, "SHO: no unlocks passed");
uint16 currentUnlock = passedUnlocksCount - 1;
require(currentUnlock < unlockPeriods.length - 1, "SHO: eliminating in the last unlock");
for (uint256 i = 0; i < userAddresses.length; i++) {
address userAddress = userAddresses[i];
User1 memory user = users1[userAddress];
require(user.allocation > 0, "SHO: some user not option 1");
require(user.eliminatedAfterUnlock == 0, "SHO: some user already eliminated");
uint120 userAllocation = _applyBaseFee(user.allocation, 1);
uint120 uncollectable = _applyPercentage(userAllocation, unlockPercentages[currentUnlock]);
extraFees1Allocation += userAllocation;
extraFees1AllocationUncollectable += uncollectable;
users1[userAddress].eliminatedAfterUnlock = currentUnlock + 1;
emit UserElimination(
userAddress,
currentUnlock
);
}
}
/**
User type 2 claims all the remaining amount of previous unlocks and can claim up to baseFeePercentage of the current unlock tokens without causing a fee.
@param extraAmountToClaim the extra amount is also equal to the charged fee (user claims 100 more the first unlock, can claim 200 less the second unlock)
*/
function claimUser2(
uint120 extraAmountToClaim
) external nonReentrant onlyWhitelistedUser2 returns (
uint120 amountToClaim,
uint120 baseClaimAmount,
uint120 currentUnlocked
) {
update();
User2 memory user = users2[msg.sender];
require(passedUnlocksCount > 0, "SHO: no unlocks passed");
uint16 currentUnlock = passedUnlocksCount - 1;
if (user.claimedUnlocksCount < passedUnlocksCount) {
amountToClaim = _updateUserCurrent(user, currentUnlock);
baseClaimAmount = _getCurrentBaseClaimAmount(user, currentUnlock);
amountToClaim += baseClaimAmount;
user.currentClaimed += baseClaimAmount;
} else {
require(extraAmountToClaim > 0, "SHO: nothing to claim");
}
currentUnlocked = user.currentUnlocked;
if (extraAmountToClaim > 0) {
require(extraAmountToClaim <= user.currentUnlocked - user.currentClaimed, "SHO: passed extra amount too high");
amountToClaim += extraAmountToClaim;
user.currentClaimed += extraAmountToClaim;
_chargeFee(user, extraAmountToClaim, currentUnlock);
}
require(amountToClaim > 0, "SHO: nothing to claim");
user.totalClaimed += amountToClaim;
users2[msg.sender] = user;
shoToken.safeTransfer(msg.sender, amountToClaim);
emit Claim2(
msg.sender,
currentUnlock,
amountToClaim,
baseClaimAmount,
extraAmountToClaim
);
}
/**
It's important that the fees are collectable not depedning on if users are claiming.
Anybody can call this but the fees go to the fee collector.
*/
function collectFees() external nonReentrant returns (uint120 baseFee, uint120 extraFee, uint120 burned) {
update();
require(collectedFeesUnlocksCount < passedUnlocksCount, "SHO: no fees to collect");
uint16 currentUnlock = passedUnlocksCount - 1;
// base fee from users type 1 and 2
uint32 lastUnlockPercentage = collectedFeesUnlocksCount > 0 ? unlockPercentages[collectedFeesUnlocksCount - 1] : 0;
uint120 globalAllocation1 = _applyPercentage(globalTotalAllocation1, unlockPercentages[currentUnlock] - lastUnlockPercentage);
uint120 globalAllocation2 = _applyPercentage(globalTotalAllocation2, unlockPercentages[currentUnlock] - lastUnlockPercentage);
baseFee = _applyPercentage(globalAllocation1, baseFeePercentage1);
baseFee += _applyPercentage(globalAllocation2, baseFeePercentage2);
// extra fees from users type 2
uint120 extraFee2;
if (globalTotalAllocation2 > 0) {
for (uint16 i = collectedFeesUnlocksCount; i <= currentUnlock; i++) {
extraFee2 += extraFees2[i];
}
}
// extra fees from users type 1
uint120 extraFees1AllocationTillNow = _applyPercentage(extraFees1Allocation, unlockPercentages[currentUnlock]);
uint120 extraFee1 = extraFees1AllocationTillNow - extraFees1AllocationUncollectable;
extraFees1AllocationUncollectable = extraFees1AllocationTillNow;
extraFee = extraFee1 + extraFee2;
uint120 totalFee = baseFee + extraFee;
burned = _burn(extraFee);
collectedFeesUnlocksCount = currentUnlock + 1;
shoToken.safeTransfer(feeCollector, totalFee - burned);
emit FeeCollection(
currentUnlock,
totalFee,
extraFee,
burned
);
}
/**
Updates passedUnlocksCount.
*/
function update() public {
uint16 _passedUnlocksCount = getPassedUnlocksCount();
if (_passedUnlocksCount > passedUnlocksCount) {
passedUnlocksCount = _passedUnlocksCount;
emit Update(_passedUnlocksCount);
}
}
// PUBLIC VIEW FUNCTIONS
function getPassedUnlocksCount() public view returns (uint16 _passedUnlocksCount) {
require(block.timestamp >= startTime, "SHO: before startTime");
uint256 timeSinceStart = block.timestamp - startTime;
uint256 maxReleases = unlockPeriods.length;
_passedUnlocksCount = passedUnlocksCount;
while (_passedUnlocksCount < maxReleases && timeSinceStart >= unlockPeriods[_passedUnlocksCount]) {
_passedUnlocksCount++;
}
}
function getTotalUnlocksCount() public view returns (uint16 totalUnlocksCount) {
return uint16(unlockPercentages.length);
}
// PRIVATE FUNCTIONS
function _burn(uint120 amount) private returns (uint120 burned) {
burned = _applyPercentage(amount, burnPercentage);
if (burned == 0) return 0;
uint256 balanceBefore = shoToken.balanceOf(address(this));
address(shoToken).call(abi.encodeWithSignature("burn(uint256)", burned));
uint256 balanceAfter = shoToken.balanceOf(address(this));
if (balanceBefore == balanceAfter) {
shoToken.safeTransfer(burnValley, burned);
}
}
function _updateUserCurrent(User2 memory user, uint16 currentUnlock) private view returns (uint120 claimableFromPreviousUnlocks) {
claimableFromPreviousUnlocks = _getClaimableFromPreviousUnlocks(user, currentUnlock);
uint120 newUnlocked = claimableFromPreviousUnlocks - (user.currentUnlocked - user.currentClaimed);
uint32 unlockPercentageDiffCurrent = currentUnlock > 0 ?
unlockPercentages[currentUnlock] - unlockPercentages[currentUnlock - 1] : unlockPercentages[currentUnlock];
uint120 currentUnlocked = _applyPercentage(user.allocation, unlockPercentageDiffCurrent);
currentUnlocked = _applyBaseFee(currentUnlocked, 2);
newUnlocked += currentUnlocked;
if (newUnlocked >= user.debt) {
newUnlocked -= user.debt;
} else {
newUnlocked = 0;
}
if (claimableFromPreviousUnlocks >= user.debt) {
claimableFromPreviousUnlocks -= user.debt;
user.debt = 0;
} else {
user.debt -= claimableFromPreviousUnlocks;
claimableFromPreviousUnlocks = 0;
}
if (currentUnlocked >= user.debt) {
currentUnlocked -= user.debt;
user.debt = 0;
} else {
user.debt -= currentUnlocked;
currentUnlocked = 0;
}
user.totalUnlocked += newUnlocked;
user.currentUnlocked = currentUnlocked;
user.currentClaimed = 0;
user.claimedUnlocksCount = passedUnlocksCount;
}
function _getClaimableFromPreviousUnlocks(User2 memory user, uint16 currentUnlock) private view returns (uint120 claimableFromPreviousUnlocks) {
uint32 lastUnlockPercentage = user.claimedUnlocksCount > 0 ? unlockPercentages[user.claimedUnlocksCount - 1] : 0;
uint32 previousUnlockPercentage = currentUnlock > 0 ? unlockPercentages[currentUnlock - 1] : 0;
uint120 claimableFromMissedUnlocks = _applyPercentage(user.allocation, previousUnlockPercentage - lastUnlockPercentage);
claimableFromMissedUnlocks = _applyBaseFee(claimableFromMissedUnlocks, 2);
claimableFromPreviousUnlocks = user.currentUnlocked - user.currentClaimed;
claimableFromPreviousUnlocks += claimableFromMissedUnlocks;
}
function _getCurrentBaseClaimAmount(User2 memory user, uint16 currentUnlock) private view returns (uint120 baseClaimAmount) {
if (currentUnlock < unlockPeriods.length - 1) {
baseClaimAmount =_applyPercentage(user.currentUnlocked, freeClaimablePercentage);
} else {
baseClaimAmount = user.currentUnlocked;
}
}
function _chargeFee(User2 memory user, uint120 fee, uint16 currentUnlock) private {
user.debt += fee;
while (fee > 0 && currentUnlock < unlockPeriods.length - 1) {
uint16 nextUnlock = currentUnlock + 1;
uint120 nextUserAvailable = _applyPercentage(user.allocation, unlockPercentages[nextUnlock] - unlockPercentages[currentUnlock]);
nextUserAvailable = _applyBaseFee(nextUserAvailable, 2);
uint120 currentUnlockFee = fee <= nextUserAvailable ? fee : nextUserAvailable;
extraFees2[nextUnlock] += currentUnlockFee;
fee -= currentUnlockFee;
currentUnlock++;
}
}
function _applyPercentage(uint120 value, uint32 percentage) private pure returns (uint120) {
return uint120(uint256(value) * percentage / HUNDRED_PERCENT);
}
function _applyBaseFee(uint120 value, uint8 option) private view returns (uint120) {
return value - _applyPercentage(value, option == 1 ? baseFeePercentage1 : baseFeePercentage2);
}
function _buildArraySum(uint32[] memory diffArray) internal pure returns (uint32[] memory) {
uint256 len = diffArray.length;
uint32[] memory sumArray = new uint32[](len);
uint32 lastSum = 0;
for (uint256 i = 0; i < len; i++) {
if (i > 0) {
lastSum = sumArray[i - 1];
}
sumArray[i] = lastSum + diffArray[i];
}
return sumArray;
}
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @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
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "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");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(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) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(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) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason 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 {
// 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
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
Read Contract
baseFeePercentage1 0xda40ea1d → uint32
baseFeePercentage2 0x1c78302c → uint32
burnPercentage 0xf01f20df → uint32
burnValley 0xf7329f6a → address
collectedFeesUnlocksCount 0xd1dfb8dc → uint16
extraFees1Allocation 0xd713c304 → uint120
extraFees1AllocationUncollectable 0x01185285 → uint120
extraFees2 0xf8c3a5db → uint120
feeCollector 0xc415b95c → address
freeClaimablePercentage 0xe5ca9f24 → uint32
getPassedUnlocksCount 0xb28e20c0 → uint16
getTotalUnlocksCount 0x9b442e3f → uint16
globalTotalAllocation1 0xdb81213a → uint120
globalTotalAllocation2 0xd5dd6677 → uint120
owner 0x8da5cb5b → address
shoToken 0xf53014b4 → address
startTime 0x78e97925 → uint64
unlockPercentages 0x798c87ce → uint32
unlockPeriods 0xba93f699 → uint32
users1 0x2a8b279a → uint16, uint16, uint120
users2 0xbf39a89c → uint120, uint120, uint16, uint120, uint120, uint120, uint120
whitelistingAllowed 0x464a59c7 → bool
Write Contract 9 functions
These functions modify contract state and require a wallet transaction to execute.
claimUser1 0xc31c0018
address userAddress
returns: uint120
claimUser1 0xc736e1ff
No parameters
returns: uint120
claimUser2 0xfdb36d54
uint120 extraAmountToClaim
returns: uint120, uint120, uint120
collectFees 0xc8796572
No parameters
returns: uint120, uint120, uint120
eliminateUsers1 0x88a60946
address[] userAddresses
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
update 0xa2e62045
No parameters
whitelistUsers 0x92767a19
address[] userAddresses
uint120[] allocations
uint8[] options
bool last
Recent Transactions
No transactions found for this address