Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xeb2bF89F55E97B330291b9dd54798b82eDA7A4b3
Balance 0.002000 ETH
Nonce 1
Code Size 14519 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

14519 bytes
0x60806040526004361061020f5760003560e01c80638474e28311610118578063c19d93fb116100a0578063f0da0df31161006f578063f0da0df3146106fc578063f44ea0ee1461073a578063f85f91b414610765578063fc4aaa7914610790578063fd20b69f146107bb5761020f565b8063c19d93fb14610650578063c480c90c1461067b578063c67eda99146106a6578063ca11048b146106d15761020f565b8063b53f0487116100e7578063b53f04871461059c578063b6b55f25146105c7578063b88a802f146105e3578063b9419a1b146105fa578063be07ae77146106255761020f565b80638474e283146105045780638712400b1461052f5780638fe262661461055a57806394b5798a146105715761020f565b80633bb3bba41161019b578063482853c91161016a578063482853c91461042d578063525bffe9146104585780636597a1301461048357806379a9e85e146104ae57806380500913146104d95761020f565b80633bb3bba4146103815780633d20217a146103ac5780633e357e43146103d757806345c0a77d146104025761020f565b80631d558966116101e25780631d558966146102aa5780632af7a3f8146102d5578063383640fd1461030057806339b0e5ea1461032b5780633a213b66146103565761020f565b80630104db1b146102145780630780bdb91461023f5780630e15561a146102685780631c8418c214610293575b600080fd5b34801561022057600080fd5b506102296107ec565b604051610236919061282e565b60405180910390f35b34801561024b57600080fd5b506102666004803603810190610261919061287a565b6107f1565b005b34801561027457600080fd5b5061027d610925565b60405161028a919061282e565b60405180910390f35b34801561029f57600080fd5b506102a861092b565b005b3480156102b657600080fd5b506102bf610c29565b6040516102cc91906128e8565b60405180910390f35b3480156102e157600080fd5b506102ea610c4d565b6040516102f7919061282e565b60405180910390f35b34801561030c57600080fd5b50610315610c53565b604051610322919061282e565b60405180910390f35b34801561033757600080fd5b50610340610c5c565b60405161034d919061282e565b60405180910390f35b34801561036257600080fd5b5061036b610c62565b604051610378919061282e565b60405180910390f35b34801561038d57600080fd5b50610396610c67565b6040516103a3919061282e565b60405180910390f35b3480156103b857600080fd5b506103c1610c72565b6040516103ce919061282e565b60405180910390f35b3480156103e357600080fd5b506103ec610c77565b6040516103f9919061282e565b60405180910390f35b34801561040e57600080fd5b50610417610c83565b604051610424919061282e565b60405180910390f35b34801561043957600080fd5b50610442610c88565b60405161044f91906128e8565b60405180910390f35b34801561046457600080fd5b5061046d610cac565b60405161047a919061282e565b60405180910390f35b34801561048f57600080fd5b50610498610cb6565b6040516104a5919061282e565b60405180910390f35b3480156104ba57600080fd5b506104c3610cbc565b6040516104d0919061282e565b60405180910390f35b3480156104e557600080fd5b506104ee610cc2565b6040516104fb919061282e565b60405180910390f35b34801561051057600080fd5b50610519610cc7565b60405161052691906128e8565b60405180910390f35b34801561053b57600080fd5b50610544610ceb565b604051610551919061282e565b60405180910390f35b34801561056657600080fd5b5061056f610cf0565b005b34801561057d57600080fd5b5061058661136e565b604051610593919061282e565b60405180910390f35b3480156105a857600080fd5b506105b1611374565b6040516105be919061282e565b60405180910390f35b6105e160048036038101906105dc919061287a565b61137a565b005b3480156105ef57600080fd5b506105f861180c565b005b34801561060657600080fd5b5061060f611d50565b60405161061c91906128e8565b60405180910390f35b34801561063157600080fd5b5061063a611d74565b60405161064791906128e8565b60405180910390f35b34801561065c57600080fd5b50610665611d98565b604051610672919061297a565b60405180910390f35b34801561068757600080fd5b50610690611dab565b60405161069d919061282e565b60405180910390f35b3480156106b257600080fd5b506106bb611db0565b6040516106c8919061282e565b60405180910390f35b3480156106dd57600080fd5b506106e6611db6565b6040516106f3919061282e565b60405180910390f35b34801561070857600080fd5b50610723600480360381019061071e91906129c1565b611dbc565b6040516107319291906129ee565b60405180910390f35b34801561074657600080fd5b5061074f611de0565b60405161075c919061282e565b60405180910390f35b34801561077157600080fd5b5061077a611de5565b604051610787919061282e565b60405180910390f35b34801561079c57600080fd5b506107a5611deb565b6040516107b291906128e8565b60405180910390f35b3480156107c757600080fd5b506107d0611e0f565b6040516107e39796959493929190612a93565b60405180910390f35b603c81565b6107f9611ece565b806007600082825461080b9190612b31565b9250508190555061085f3330837f000000000000000000000000488db574c77dd27a07f9c97bac673bc8e9fc6bf373ffffffffffffffffffffffffffffffffffffffff16611f1d909392919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f06948d3cd1c38e7c818750f08f659abdf83d339abe934f7c30920783f7323b6282426040516108a79291906129ee565b60405180910390a267051ef38b821e8000600754101580156108fc5750600060018111156108d8576108d7612903565b5b600160009054906101000a900460ff1660018111156108fa576108f9612903565b5b145b1561091a57610909611fa6565b61091161235f565b60006007819055505b6109226124f1565b50565b600a5481565b60018081111561093e5761093d612903565b5b600160009054906101000a900460ff1660018111156109605761095f612903565b5b036109a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099790612bc2565b60405180910390fd5b60085442116109e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109db90612c2e565b60405180910390fd5b6001600b5403610a3a57655af3107a40006004541015610a39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3090612c9a565b60405180910390fd5b5b60007f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610a9591906128e8565b602060405180830381865afa158015610ab2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad69190612ccf565b90508060098190555060018060006101000a81548160ff02191690836001811115610b0457610b03612903565b5b0217905550600b6000815480929190610b1c90612cfc565b91905055506000600c8190555060045460038190555060006004819055507f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166352a438b882603c6040518363ffffffff1660e01b8152600401610b969291906129ee565b600060405180830381600087803b158015610bb057600080fd5b505af1158015610bc4573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167f27e3bb6257f12da083c070c18a86a30e2533be3eb22c31b2d4aaedb826ca26676001600b54610c0f9190612d44565b42604051610c1e9291906129ee565b60405180910390a250565b7f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3981565b60045481565b6402540be40081565b60055481565b600981565b66071afd498d000081565b600a81565b67051ef38b821e800081565b600a81565b7f00000000000000000000000002eb294af5e1fe16eb701f164bf8cf396e0cd8aa81565b655af3107a400081565b600b5481565b60075481565b601e81565b7f00000000000000000000000004e3faa5758a2768ddafd34d91e7d04eef8feae281565b601e81565b610cf8611ece565b600060058190555060007f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff16635c9302c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190612ccf565b9050600080610d9e611e0f565b90919293945090919293509091509050508092508193505050603c8161ffff1684610dc99190612d44565b1015610e0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0190612dc4565b60405180910390fd5b60006001811115610e1e57610e1d612903565b5b600160009054906101000a900460ff166001811115610e4057610e3f612903565b5b03610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790612e30565b60405180910390fd5b6000600160006101000a81548160ff02191690836001811115610ea657610ea5612903565b5b02179055507f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff1663343009a26000846040518363ffffffff1660e01b8152600401610f07929190612e95565b600060405180830381600087803b158015610f2157600080fd5b505af1158015610f35573d6000803e3d6000fd5b5050505060007f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610f9491906128e8565b602060405180830381865afa158015610fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd59190612ccf565b905060095481610fe59190612d44565b600a8190555060006064600a8054610ffd9190612ebe565b6110079190612f2f565b905060006064600a805461101b9190612ebe565b6110259190612f2f565b905060006064600a80546110399190612ebe565b6110439190612f2f565b90508082846110529190612b31565b61105c9190612b31565b600a600082825461106d9190612d44565b92505081905550600a54600c819055507f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f00000000000000000000000002eb294af5e1fe16eb701f164bf8cf396e0cd8aa856040518363ffffffff1660e01b81526004016110f8929190612f60565b6020604051808303816000875af1158015611117573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113b9190612fb5565b507f00000000000000000000000002eb294af5e1fe16eb701f164bf8cf396e0cd8aa73ffffffffffffffffffffffffffffffffffffffff16632664f06d846040518263ffffffff1660e01b8152600401611195919061282e565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b505050506112327f000000000000000000000000d55fe0a9b00bb8c2691fc5b30a99496b7a7c3665837f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166124fb9092919063ffffffff16565b61129d7f000000000000000000000000eb9014610d4dac128f9da00c397ce9119ee777f5827f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166124fb9092919063ffffffff16565b6201518060096112ad9190612ebe565b426112b89190612b31565b60088190555060004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611309573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167ffb30e27e0c0cfd01dcd576c7409088227abc2239ee0ab801f41b1a5506c7cf97600b54426040516113549291906129ee565b60405180910390a2505050505050505061136c6124f1565b565b60095481565b60085481565b611382611ece565b6001600560008282546113959190612b31565b925050819055506001600660008282546113af9190612b31565b925050819055506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414801561144c5750600b54600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015414155b1561149b57600b54600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b66071afd498d000034146114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613054565b60405180910390fd5b6402540be40081101561152c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611523906130e6565b60405180910390fd5b600060018111156115405761153f612903565b5b600160009054906101000a900460ff16600181111561156257611561612903565b5b146115a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159990613152565b60405180910390fd5b600b54600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015414611628576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161f906131e4565b60405180910390fd5b80600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825461167a9190612b31565b9250508190555080600460008282546116939190612b31565b925050819055506116e73330837f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff16611f1d909392919063ffffffff16565b600b543373ffffffffffffffffffffffffffffffffffffffff167f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1583604051611730919061282e565b60405180910390a36001600b5414801561177d57506000600181111561175957611758612903565b5b600160009054906101000a900460ff16600181111561177b5761177a612903565b5b145b156117ae576008544211801561179b5750655af3107a400060045410155b156117a9576117a861092b565b5b611801565b600854421180156117f25750600060018111156117ce576117cd612903565b5b600160009054906101000a900460ff1660018111156117f0576117ef612903565b5b145b15611800576117ff61092b565b5b5b6118096124f1565b50565b611814611ece565b6000600181111561182857611827612903565b5b600160009054906101000a900460ff16600181111561184a57611849612903565b5b1461188a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188190613276565b60405180910390fd5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541161190f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611906906132e2565b60405180910390fd5b6001600b5461191e9190612d44565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015403611b1f576000600354600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600a546119bb9190612ebe565b6119c59190612f2f565b905080600c60008282546119d99190612d44565b925050819055506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600b54600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550611abc33827f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166124fb9092919063ffffffff16565b6001600b54611acb9190612d44565b3373ffffffffffffffffffffffffffffffffffffffff167f5a2ecdb14b94278f5a76efb2b0742090477e505b7d67ad574053b77dc045d48f83604051611b11919061282e565b60405180910390a350611c7d565b600b54600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015403611ba5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9c90613374565b60405180910390fd5b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600b54600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600b543373ffffffffffffffffffffffffffffffffffffffff167f4cdebe0d16716e79c78fd92a7feb868dad400f77e1e397cb11ab5fc433fe802460405160405180910390a35b6001600b54148015611cc2575060006001811115611c9e57611c9d612903565b5b600160009054906101000a900460ff166001811115611cc057611cbf612903565b5b145b15611cf35760085442118015611ce05750655af3107a400060045410155b15611cee57611ced61092b565b5b611d46565b60085442118015611d37575060006001811115611d1357611d12612903565b5b600160009054906101000a900460ff166001811115611d3557611d34612903565b5b145b15611d4557611d4461092b565b5b5b611d4e6124f1565b565b7f000000000000000000000000488db574c77dd27a07f9c97bac673bc8e9fc6bf381565b7f000000000000000000000000d55fe0a9b00bb8c2691fc5b30a99496b7a7c366581565b600160009054906101000a900460ff1681565b602881565b60065481565b60035481565b60026020528060005260406000206000915090508060000154908060010154905082565b600a81565b600c5481565b7f000000000000000000000000eb9014610d4dac128f9da00c397ce9119ee777f581565b60008060008060008060007f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff16632607443b3060006040518363ffffffff1660e01b8152600401611e76929190613394565b60e060405180830381865afa158015611e93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb79190613441565b965096509650965096509650965090919293949596565b600260005403611f13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f0a9061352f565b60405180910390fd5b6002600081905550565b611fa0846323b872dd60e01b858585604051602401611f3e9392919061354f565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612581565b50505050565b67051ef38b821e80006007541015611ff3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fea906135d2565b60405180910390fd5b6000600c546004546120059190612b31565b7f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161205e91906128e8565b602060405180830381865afa15801561207b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209f9190612ccf565b6120a99190612d44565b905060006064601e836120bc9190612ebe565b6120c69190612f2f565b905060006064601e846120d99190612ebe565b6120e39190612f2f565b9050600081836120f39190612b31565b846120fe9190612d44565b90507f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f00000000000000000000000002eb294af5e1fe16eb701f164bf8cf396e0cd8aa856040518363ffffffff1660e01b815260040161217b929190612f60565b6020604051808303816000875af115801561219a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121be9190612fb5565b507f00000000000000000000000002eb294af5e1fe16eb701f164bf8cf396e0cd8aa73ffffffffffffffffffffffffffffffffffffffff16632664f06d846040518263ffffffff1660e01b8152600401612218919061282e565b600060405180830381600087803b15801561223257600080fd5b505af1158015612246573d6000803e3d6000fd5b505050506122b57f000000000000000000000000d55fe0a9b00bb8c2691fc5b30a99496b7a7c3665837f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166124fb9092919063ffffffff16565b6123207f000000000000000000000000eb9014610d4dac128f9da00c397ce9119ee777f5827f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3973ffffffffffffffffffffffffffffffffffffffff166124fb9092919063ffffffff16565b7faeb870fde8cec404e4275d67f6bb82326894fa4abb802019a339ea1018678bd184426040516123519291906129ee565b60405180910390a150505050565b67051ef38b821e800060075410156123ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a3906135d2565b60405180910390fd5b60007f000000000000000000000000488db574c77dd27a07f9c97bac673bc8e9fc6bf373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161240791906128e8565b602060405180830381865afa158015612424573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124489190612ccf565b90506124b57f00000000000000000000000004e3faa5758a2768ddafd34d91e7d04eef8feae2827f000000000000000000000000488db574c77dd27a07f9c97bac673bc8e9fc6bf373ffffffffffffffffffffffffffffffffffffffff166124fb9092919063ffffffff16565b7f479f77ede19fc41d3b27cb7bc1c4dba83bcfa4f53030487d340534e4fa44ea4281426040516124e69291906129ee565b60405180910390a150565b6001600081905550565b61257c8363a9059cbb60e01b848460405160240161251a929190612f60565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612581565b505050565b60006125e3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166126489092919063ffffffff16565b905060008151111561264357808060200190518101906126039190612fb5565b612642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161263990613664565b60405180910390fd5b5b505050565b60606126578484600085612660565b90509392505050565b6060824710156126a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161269c906136f6565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516126ce9190613787565b60006040518083038185875af1925050503d806000811461270b576040519150601f19603f3d011682016040523d82523d6000602084013e612710565b606091505b50915091506127218783838761272d565b92505050949350505050565b6060831561278f57600083510361278757612747856127a2565b612786576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161277d906137ea565b60405180910390fd5b5b82905061279a565b61279983836127c5565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000825111156127d85781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280c919061385f565b60405180910390fd5b6000819050919050565b61282881612815565b82525050565b6000602082019050612843600083018461281f565b92915050565b600080fd5b61285781612815565b811461286257600080fd5b50565b6000813590506128748161284e565b92915050565b6000602082840312156128905761288f612849565b5b600061289e84828501612865565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006128d2826128a7565b9050919050565b6128e2816128c7565b82525050565b60006020820190506128fd60008301846128d9565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002811061294357612942612903565b5b50565b600081905061295482612932565b919050565b600061296482612946565b9050919050565b61297481612959565b82525050565b600060208201905061298f600083018461296b565b92915050565b61299e816128c7565b81146129a957600080fd5b50565b6000813590506129bb81612995565b92915050565b6000602082840312156129d7576129d6612849565b5b60006129e5848285016129ac565b91505092915050565b6000604082019050612a03600083018561281f565b612a10602083018461281f565b9392505050565b600064ffffffffff82169050919050565b612a3181612a17565b82525050565b600068ffffffffffffffffff82169050919050565b612a5581612a37565b82525050565b600061ffff82169050919050565b612a7281612a5b565b82525050565b60008115159050919050565b612a8d81612a78565b82525050565b600060e082019050612aa8600083018a612a28565b612ab56020830189612a4c565b612ac26040830188612a4c565b612acf6060830187612a69565b612adc6080830186612a69565b612ae960a0830185612a69565b612af660c0830184612a84565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612b3c82612815565b9150612b4783612815565b9250828201905080821115612b5f57612b5e612b02565b5b92915050565b600082825260208201905092915050565b7f5374616b696e672073657373696f6e20616c7265616479207374617274656400600082015250565b6000612bac601f83612b65565b9150612bb782612b76565b602082019050919050565b60006020820190508181036000830152612bdb81612b9f565b9050919050565b7f52656c6f616420706572696f64206e6f7420656e646564207965740000000000600082015250565b6000612c18601b83612b65565b9150612c2382612be2565b602082019050919050565b60006020820190508181036000830152612c4781612c0b565b9050919050565b7f53746172746f666620616d6f756e74206e6f7420726561636865640000000000600082015250565b6000612c84601b83612b65565b9150612c8f82612c4e565b602082019050919050565b60006020820190508181036000830152612cb381612c77565b9050919050565b600081519050612cc98161284e565b92915050565b600060208284031215612ce557612ce4612849565b5b6000612cf384828501612cba565b91505092915050565b6000612d0782612815565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612d3957612d38612b02565b5b600182019050919050565b6000612d4f82612815565b9150612d5a83612815565b9250828203905081811115612d7257612d71612b02565b5b92915050565b7f5374616b696e672073657373696f6e206e6f7420656e64656420796574000000600082015250565b6000612dae601d83612b65565b9150612db982612d78565b602082019050919050565b60006020820190508181036000830152612ddd81612da1565b9050919050565b7f416c726561647920696e2072656c6f616420706572696f640000000000000000600082015250565b6000612e1a601883612b65565b9150612e2582612de4565b602082019050919050565b60006020820190508181036000830152612e4981612e0d565b9050919050565b6000819050919050565b6000819050919050565b6000612e7f612e7a612e7584612e50565b612e5a565b612815565b9050919050565b612e8f81612e64565b82525050565b6000604082019050612eaa6000830185612e86565b612eb76020830184612a28565b9392505050565b6000612ec982612815565b9150612ed483612815565b9250828202612ee281612815565b91508282048414831517612ef957612ef8612b02565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612f3a82612815565b9150612f4583612815565b925082612f5557612f54612f00565b5b828204905092915050565b6000604082019050612f7560008301856128d9565b612f82602083018461281f565b9392505050565b612f9281612a78565b8114612f9d57600080fd5b50565b600081519050612faf81612f89565b92915050565b600060208284031215612fcb57612fca612849565b5b6000612fd984828501612fa0565b91505092915050565b7f76616c75652073656e7420646f6573206e6f74206d617463682077697468206560008201527f7468206665650000000000000000000000000000000000000000000000000000602082015250565b600061303e602683612b65565b915061304982612fe2565b604082019050919050565b6000602082019050818103600083015261306d81613031565b9050919050565b7f4174206c65617374206d696e696d756d20484558206465706f7369742072657160008201527f7569726564000000000000000000000000000000000000000000000000000000602082015250565b60006130d0602583612b65565b91506130db82613074565b604082019050919050565b600060208201905081810360008301526130ff816130c3565b9050919050565b7f4e6f7420696e2072656c6f616420706572696f64000000000000000000000000600082015250565b600061313c601483612b65565b915061314782613106565b602082019050919050565b6000602082019050818103600083015261316b8161312f565b9050919050565b7f506c6561736520636c61696d207265776172647320666f72207468652070726560008201527f76696f75732073657373696f6e00000000000000000000000000000000000000602082015250565b60006131ce602d83612b65565b91506131d982613172565b604082019050919050565b600060208201905081810360008301526131fd816131c1565b9050919050565b7f43616e277420636c61696d20647572696e67207374616b696e6720736573736960008201527f6f6e000000000000000000000000000000000000000000000000000000000000602082015250565b6000613260602283612b65565b915061326b82613204565b604082019050919050565b6000602082019050818103600083015261328f81613253565b9050919050565b7f4e6f206465706f73697473000000000000000000000000000000000000000000600082015250565b60006132cc600b83612b65565b91506132d782613296565b602082019050919050565b600060208201905081810360008301526132fb816132bf565b9050919050565b7f5374616b696e6720666f7220746869732073657373696f6e206973206e6f742060008201527f66696e6973686564207965740000000000000000000000000000000000000000602082015250565b600061335e602c83612b65565b915061336982613302565b604082019050919050565b6000602082019050818103600083015261338d81613351565b9050919050565b60006040820190506133a960008301856128d9565b6133b66020830184612e86565b9392505050565b6133c681612a17565b81146133d157600080fd5b50565b6000815190506133e3816133bd565b92915050565b6133f281612a37565b81146133fd57600080fd5b50565b60008151905061340f816133e9565b92915050565b61341e81612a5b565b811461342957600080fd5b50565b60008151905061343b81613415565b92915050565b600080600080600080600060e0888a0312156134605761345f612849565b5b600061346e8a828b016133d4565b975050602061347f8a828b01613400565b96505060406134908a828b01613400565b95505060606134a18a828b0161342c565b94505060806134b28a828b0161342c565b93505060a06134c38a828b0161342c565b92505060c06134d48a828b01612fa0565b91505092959891949750929550565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000613519601f83612b65565b9150613524826134e3565b602082019050919050565b600060208201905081810360008301526135488161350c565b9050919050565b600060608201905061356460008301866128d9565b61357160208301856128d9565b61357e604083018461281f565b949350505050565b7f546172676574206e6f7420726561636865642079657400000000000000000000600082015250565b60006135bc601683612b65565b91506135c782613586565b602082019050919050565b600060208201905081810360008301526135eb816135af565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b600061364e602a83612b65565b9150613659826135f2565b604082019050919050565b6000602082019050818103600083015261367d81613641565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b60006136e0602683612b65565b91506136eb82613684565b604082019050919050565b6000602082019050818103600083015261370f816136d3565b9050919050565b600081519050919050565b600081905092915050565b60005b8381101561374a57808201518184015260208101905061372f565b60008484015250505050565b600061376182613716565b61376b8185613721565b935061377b81856020860161372c565b80840191505092915050565b60006137938284613756565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b60006137d4601d83612b65565b91506137df8261379e565b602082019050919050565b60006020820190508181036000830152613803816137c7565b9050919050565b600081519050919050565b6000601f19601f8301169050919050565b60006138318261380a565b61383b8185612b65565b935061384b81856020860161372c565b61385481613815565b840191505092915050565b600060208201905081810360008301526138798184613826565b90509291505056fea2646970667358221220a9836246554db186c09f6c9b52a64305185ddc38c4743868a8420df4a280bd3f64736f6c63430008110033

Verified Source Code Full Match

Compiler: v0.8.17+commit.8df45f5f EVM: london Optimization: No
HexCommunityStaker.sol 384 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.16;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

interface IHexToken {
    function stakeStart(
        uint256 newStakedHearts,
        uint256 newStakedDays
    ) external;

    function stakeGoodAccounting(
        address stakerAddr,
        uint256 stakeIndex,
        uint40 stakeIdParam
    ) external;

    function stakeEnd(uint256 stakeIndex, uint40 stakeIdParam) external;

    function stakeLists(
        address,
        uint256
    )
    external
    view
    returns (uint40, uint72, uint72, uint16, uint16, uint16, bool);

    function currentDay() external view returns (uint256);
}

interface IPLSDStaker {
    function depositHEX(uint256 _amount) external;
}

contract HEXCommunityStaker is ReentrancyGuard {
    using SafeERC20 for IERC20;

    uint256 public constant MIN_HEX_DEPOSIT = 100 * 1e8;
    uint256 public constant ETH_FEE = 0.002 ether;
    uint256 public constant STAKING_PERIOD = 60; // 60 days
    uint256 public constant RELOAD_PERIOD = 9; // 9 days
    uint256 public constant TRAPPED_POOL_TARGET = 369000 * 1e12; // 369K CARN
    uint256 public constant STARTOFF_AMOUNT = 1000000 * 1e8; // 1M HEX

    uint256 public constant HEXTOPLSDSTAKER_PERCENTAGE = 10;
    uint256 public constant HEXTOWAATCA_PERCENTAGE = 10;
    uint256 public constant HEXTOTHIRDPOOL_PERCENTAGE = 10;

    uint256 public constant TRAPPED_HEXTOPLSDSTAKER_PERCENTAGE = 30;
    uint256 public constant TRAPPED_HEXTOWAATCA_PERCENTAGE = 30;
    uint256 public constant TRAPPED_HEXTOTHIRDPOOL_PERCENTAGE = 40;

    // Token Addresses
    address public immutable CARN;
    address public immutable HEX;

    address public immutable waatcaPool;
    address public immutable buyAndBurnContract;
    address public immutable plsdStakingContract;
    address public immutable thirdPoolAddress;

    enum State {
        RELOAD,
        STAKING
    }

    State public state; // keeps track of the current state of the contract

    struct HexDeposit {
        uint256 amount;
        uint256 sessionId;
    }

    // Variables
    mapping(address => HexDeposit) public hexDeposits; // keeps track of user's HEX deposits for the session

    uint256 public totalHexDepositForThePreviousSession; // total HEX deposited for the previous sessionId
    uint256 public totalHexDepositForTheCurrentSession; // total HEX deposited for the current sessionId
    uint256 public numParticipantsForThisSession; // total depositors for each session
    uint256 public numTotalDepositsForAllSessions; // total sum of all depositors from all sessions
    uint256 public trappedHexReleasePool; // keeps track of carn deposited by the community

    uint256 public nextStakingStartTime; // start of next staking session as timestamp

    uint256 public balanceBefore;

    uint256 public totalRewards; // total rewards for the staking session
    uint256 public currentSessionId; // keeps track of current staking session Id
    uint256 public unclaimedRewards; // keeps track of unclaimed amount from reward pool

    // Events
    event Deposit(
        address indexed depositor,
        uint256 indexed sessionId,
        uint256 hexAmount
    );

    event StakingSessionStart(
        address indexed caller,
        uint256 id,
        uint256 startTime
    );

    event RewardClaim(
        address indexed withdrawer,
        uint256 indexed sessionId,
        uint256 hexAmount
    );

    event RewardReset(address indexed staker, uint256 indexed sessionId);

    event ReloadPeriodStart(
        address indexed caller,
        uint256 id,
        uint256 reloadTime
    );

    event CARNDepositToTrappedPool(
        address indexed depositor,
        uint256 amount,
        uint256 time
    );

    event HEXReleased(uint256 amount, uint256 time);
    event CARNReleased(uint256 amount, uint256 time);

    constructor(
        address _waatcaPoolAddress,
        address _buyAndBurnContractAddress,
        address _plsdStakingContractAddress,
        address _thirdPoolAddress,
        address _CARN,
        address _HEX
    ) {
        waatcaPool = _waatcaPoolAddress;
        buyAndBurnContract = _buyAndBurnContractAddress;
        plsdStakingContract = _plsdStakingContractAddress;
        thirdPoolAddress = _thirdPoolAddress;
        CARN = _CARN;
        HEX = _HEX;

        nextStakingStartTime = block.timestamp + 30 days;
        currentSessionId = 1;
    }

    // Functions
    // Deposit function
    function deposit(uint256 _hexAmount) public payable nonReentrant {
        numParticipantsForThisSession += 1;
        numTotalDepositsForAllSessions += 1;
        if (
            hexDeposits[msg.sender].amount == 0 &&
            hexDeposits[msg.sender].sessionId != currentSessionId
        ) {
            // new staker/staker don't have any pending claims, update sessionId
            hexDeposits[msg.sender].sessionId = currentSessionId;
        }

        require(msg.value == ETH_FEE, "value sent does not match with eth fee");

        require(
            _hexAmount >= MIN_HEX_DEPOSIT,
            "At least minimum HEX deposit required"
        );

        require(state == State.RELOAD, "Not in reload period");

        require(
            hexDeposits[msg.sender].sessionId == currentSessionId,
            "Please claim rewards for the previous session"
        );

        hexDeposits[msg.sender].amount += _hexAmount;
        totalHexDepositForTheCurrentSession += _hexAmount;

        // Transfer the HEX to contract
        IERC20(HEX).safeTransferFrom(msg.sender, address(this), _hexAmount);

//        // Transfer the CARN to contract
//        if (currentSessionId == 1 && _hexAmount > 10000 * 1e8){
//            IERC20(CARN).safeTransferFrom(msg.sender, address(this), 100 * 1e12);
//        }

        emit Deposit(msg.sender, currentSessionId, _hexAmount);

        // Start staking session if it has not already started
        if (currentSessionId == 1 && state == State.RELOAD) {
            if (
                block.timestamp > nextStakingStartTime &&
                totalHexDepositForTheCurrentSession >= STARTOFF_AMOUNT
            ) {
                startStakingSession();
            }
        } else {
            if (
                block.timestamp > nextStakingStartTime && state == State.RELOAD
            ) {
                startStakingSession();
            }
        }
    }

    // function to trigger the staking session
    function startStakingSession() public {
        require(state != State.STAKING, "Staking session already started");
        require(
            block.timestamp > nextStakingStartTime,
            "Reload period not ended yet"
        );

        if (currentSessionId == 1)
            require(
                totalHexDepositForTheCurrentSession >= STARTOFF_AMOUNT,
                "Startoff amount not reached"
            );

        uint256 _hexBalance = IERC20(HEX).balanceOf(address(this));
        balanceBefore = _hexBalance;

        state = State.STAKING;
        currentSessionId++;
        unclaimedRewards = 0;

        totalHexDepositForThePreviousSession = totalHexDepositForTheCurrentSession;
        totalHexDepositForTheCurrentSession = 0;

        IHexToken(HEX).stakeStart(_hexBalance, STAKING_PERIOD);

        emit StakingSessionStart(
            msg.sender,
            currentSessionId - 1,
            block.timestamp
        );
    }

    function getStakeStore()
    public
    view
    returns (uint40, uint72, uint72, uint16, uint16, uint16, bool)
    {
        return IHexToken(HEX).stakeLists(address(this), 0);
    }

    // function to trigger the reload period
    // This function needs to be called manually to end the stake and get rewards
    function startReloadPeriod() public nonReentrant {
        numParticipantsForThisSession = 0;
        uint256 _currentDay = IHexToken(HEX).currentDay();
        uint40 _stakeId;
        uint16 _lockedDay;
        (_stakeId, , , _lockedDay, , , ) = getStakeStore();

        require(
            _currentDay - _lockedDay >= STAKING_PERIOD,
            "Staking session not ended yet"
        );
        require(state != State.RELOAD, "Already in reload period");

        state = State.RELOAD;

        IHexToken(HEX).stakeEnd(0, _stakeId);

        uint256 _balanceAfter = IERC20(HEX).balanceOf(address(this));
        totalRewards = _balanceAfter - balanceBefore;

        uint256 _hexToPLSDStaker = (totalRewards * HEXTOPLSDSTAKER_PERCENTAGE) /
        100;
        uint256 _hexToWaatca = (totalRewards * HEXTOWAATCA_PERCENTAGE) / 100;
        uint256 _hexToThirdPool = (totalRewards * HEXTOTHIRDPOOL_PERCENTAGE) /
        100;

        totalRewards -= (_hexToPLSDStaker + _hexToWaatca + _hexToThirdPool);
        unclaimedRewards = totalRewards;

        IERC20(HEX).approve(plsdStakingContract, _hexToPLSDStaker);
        IPLSDStaker(plsdStakingContract).depositHEX(_hexToPLSDStaker);

        IERC20(HEX).safeTransfer(waatcaPool, _hexToWaatca);
        IERC20(HEX).safeTransfer(thirdPoolAddress, _hexToThirdPool);

        nextStakingStartTime = block.timestamp + RELOAD_PERIOD * 86400;


        // Reward caller with ethBalance to compensate gas cost
        uint256 ethBalance = address(this).balance;
        payable(msg.sender).transfer(ethBalance);

        emit ReloadPeriodStart(msg.sender, currentSessionId, block.timestamp);
    }

    // function to claim rewards once staking ends
    function claimReward() external nonReentrant {
        require(state == State.RELOAD, "Can't claim during staking session");
        require(hexDeposits[msg.sender].amount > 0, "No deposits");

        if (hexDeposits[msg.sender].sessionId == currentSessionId - 1) {
            // normal case - user can claim their rewards
            uint256 _reward = (totalRewards * hexDeposits[msg.sender].amount) /
            totalHexDepositForThePreviousSession;

            unclaimedRewards -= _reward;

            hexDeposits[msg.sender].amount = 0;
            hexDeposits[msg.sender].sessionId = currentSessionId;
            IERC20(HEX).safeTransfer(msg.sender, _reward);
            emit RewardClaim(msg.sender, currentSessionId - 1, _reward);
        } else if (hexDeposits[msg.sender].sessionId == currentSessionId) {
            revert("Staking for this session is not finished yet");
        } else {
            // Invalid sessionId - reset user's amount and sessionId
            hexDeposits[msg.sender].amount = 0;
            hexDeposits[msg.sender].sessionId = currentSessionId;

            emit RewardReset(msg.sender, currentSessionId);
        }

        // Start staking session if it has not already started
        if (currentSessionId == 1 && state == State.RELOAD) {
            if (
                block.timestamp > nextStakingStartTime &&
                totalHexDepositForTheCurrentSession >= STARTOFF_AMOUNT
            ) {
                startStakingSession();
            }
        } else {
            if (
                block.timestamp > nextStakingStartTime && state == State.RELOAD
            ) {
                startStakingSession();
            }
        }
    }

    // function to deposit CARN tokens to the trapped HEX release pool
    function depositCARNToTrappedPool(
        uint256 _carnAmount
    ) external nonReentrant {
        trappedHexReleasePool += _carnAmount;
        IERC20(CARN).safeTransferFrom(msg.sender, address(this), _carnAmount);
        emit CARNDepositToTrappedPool(msg.sender, _carnAmount, block.timestamp);

        if (
            trappedHexReleasePool >= TRAPPED_POOL_TARGET &&
            state == State.RELOAD
        ) {
            releaseHEX();
            releaseCARN();
            trappedHexReleasePool = 0;
        }
    }

    function releaseHEX() internal {
        require(
            trappedHexReleasePool >= TRAPPED_POOL_TARGET,
            "Target not reached yet"
        );

        uint256 _hexBalance = IERC20(HEX).balanceOf(address(this)) - (totalHexDepositForTheCurrentSession + unclaimedRewards);
        uint256 _hexToPlsdStaker = (_hexBalance * TRAPPED_HEXTOPLSDSTAKER_PERCENTAGE) / 100;
        uint256 _hexToWaatca = (_hexBalance * TRAPPED_HEXTOWAATCA_PERCENTAGE) / 100;
        uint256 _hexToThirdPool = _hexBalance - (_hexToPlsdStaker + _hexToWaatca);

        IERC20(HEX).approve(plsdStakingContract, _hexToPlsdStaker);
        IPLSDStaker(plsdStakingContract).depositHEX(_hexToPlsdStaker);

        IERC20(HEX).safeTransfer(waatcaPool, _hexToWaatca);
        IERC20(HEX).safeTransfer(thirdPoolAddress, _hexToThirdPool);

        emit HEXReleased(_hexBalance, block.timestamp);
    }

    function releaseCARN() internal {
        require(
            trappedHexReleasePool >= TRAPPED_POOL_TARGET,
            "Target not reached yet"
        );

        uint256 _carnBalance = IERC20(CARN).balanceOf(address(this));
        IERC20(CARN).safeTransfer(buyAndBurnContract, _carnBalance);
        emit CARNReleased(_carnBalance, block.timestamp);
    }
}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// 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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}
ReentrancyGuard.sol 69 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // 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;
    }
}
SafeERC20.sol 116 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.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));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-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");
        }
    }
}
draft-IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

Read Contract

CARN 0xb9419a1b → address
ETH_FEE 0x3bb3bba4 → uint256
HEX 0x1d558966 → address
HEXTOPLSDSTAKER_PERCENTAGE 0xf44ea0ee → uint256
HEXTOTHIRDPOOL_PERCENTAGE 0x3d20217a → uint256
HEXTOWAATCA_PERCENTAGE 0x45c0a77d → uint256
MIN_HEX_DEPOSIT 0x383640fd → uint256
RELOAD_PERIOD 0x3a213b66 → uint256
STAKING_PERIOD 0x0104db1b → uint256
STARTOFF_AMOUNT 0x525bffe9 → uint256
TRAPPED_HEXTOPLSDSTAKER_PERCENTAGE 0x80500913 → uint256
TRAPPED_HEXTOTHIRDPOOL_PERCENTAGE 0xc480c90c → uint256
TRAPPED_HEXTOWAATCA_PERCENTAGE 0x8712400b → uint256
TRAPPED_POOL_TARGET 0x3e357e43 → uint256
balanceBefore 0x94b5798a → uint256
buyAndBurnContract 0x8474e283 → address
currentSessionId 0x6597a130 → uint256
getStakeStore 0xfd20b69f → uint40, uint72, uint72, uint16, uint16, uint16, bool
hexDeposits 0xf0da0df3 → uint256, uint256
nextStakingStartTime 0xb53f0487 → uint256
numParticipantsForThisSession 0x39b0e5ea → uint256
numTotalDepositsForAllSessions 0xc67eda99 → uint256
plsdStakingContract 0x482853c9 → address
state 0xc19d93fb → uint8
thirdPoolAddress 0xfc4aaa79 → address
totalHexDepositForTheCurrentSession 0x2af7a3f8 → uint256
totalHexDepositForThePreviousSession 0xca11048b → uint256
totalRewards 0x0e15561a → uint256
trappedHexReleasePool 0x79a9e85e → uint256
unclaimedRewards 0xf85f91b4 → uint256
waatcaPool 0xbe07ae77 → address

Write Contract 5 functions

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

claimReward 0xb88a802f
No parameters
deposit 0xb6b55f25
uint256 _hexAmount
depositCARNToTrappedPool 0x0780bdb9
uint256 _carnAmount
startReloadPeriod 0x8fe26266
No parameters
startStakingSession 0x1c8418c2
No parameters

Recent Transactions

No transactions found for this address