Address Contract Partially Verified
Address
0xE26A601Dec9FCd2d1079ACdeDC5ECcaBBcC89df8
Balance
0 ETH
Nonce
1
Code Size
15291 bytes
Creator
0x72B5e6B5...a2E4 at tx 0x863284b1...681788
Indexed Transactions
0
Contract Bytecode
15291 bytes
0x608060405234801561001057600080fd5b506004361061027f5760003560e01c80639ebc1a8e1161015c578063da3a5f72116100ce578063f2fde38b11610087578063f2fde38b146106cd578063f40f0f52146106e9578063f69e20461461071a578063f7c618c114610724578063f83ac39c14610742578063fa967e43146107605761027f565b8063da3a5f7214610632578063db2e21bc1461064e578063e2bbb15814610658578063eb0477f414610674578063f2494f3b14610692578063f2e0c915146106b15761027f565b8063bace709911610120578063bace709914610592578063c885bc58146105b0578063cac9e1eb146105ba578063ccd34cd5146105d8578063d843f352146105f6578063d89135cd146106145761027f565b80639ebc1a8e146104fc5780639f8c9b2e1461051a5780639fc3749514610538578063a9f8d18114610556578063aae282e1146105745761027f565b80635b7f415c116101f55780638aa99af1116101b95780638aa99af11461045c5780638ae39cac146104665780638da5cb5b146104845780638f662915146104a2578063909de8df146104c057806392e8990e146104de5761027f565b80635b7f415c146103dc5780636a00dc3c146103fa578063715018a6146104185780637f7499ca14610422578063897af754146104405761027f565b8063392e53cd11610247578063392e53cd1461032c5780633ccfd60b1461034a5780633da72bf4146103545780633f138d4b1461037257806348cd4cb11461038e5780634960d6d9146103ac5761027f565b806301f8a9761461028457806310859a70146102a05780631959a002146102bc57806323efc307146102f05780632eebe78e1461030e575b600080fd5b61029e60048036038101906102999190612c29565b61077e565b005b6102ba60048036038101906102b59190612c29565b61080a565b005b6102d660048036038101906102d19190612cb4565b6108ec565b6040516102e7959493929190612cf0565b60405180910390f35b6102f8610922565b6040516103059190612d43565b60405180910390f35b610316610929565b6040516103239190612d79565b60405180910390f35b61033461093c565b6040516103419190612d79565b60405180910390f35b61035261094f565b005b61035c610ba0565b6040516103699190612d43565b60405180910390f35b61038c60048036038101906103879190612d94565b610ba6565b005b610396610d0f565b6040516103a39190612d43565b60405180910390f35b6103c660048036038101906103c19190612c29565b610d15565b6040516103d39190612d43565b60405180910390f35b6103e4610d2d565b6040516103f19190612d43565b60405180910390f35b610402610d51565b60405161040f9190612d43565b60405180910390f35b610420610d75565b005b61042a610d89565b6040516104379190612d43565b60405180910390f35b61045a60048036038101906104559190612e00565b610d8e565b005b610464610e23565b005b61046e6111a8565b60405161047b9190612d43565b60405180910390f35b61048c6111ae565b6040516104999190612e62565b60405180910390f35b6104aa6111d7565b6040516104b79190612d43565b60405180910390f35b6104c86111dd565b6040516104d59190612d43565b60405180910390f35b6104e661128d565b6040516104f39190612d79565b60405180910390f35b6105046112a0565b6040516105119190612d79565b60405180910390f35b6105226112b3565b60405161052f9190612d43565b60405180910390f35b6105406112b9565b60405161054d9190612d43565b60405180910390f35b61055e6112bf565b60405161056b9190612d43565b60405180910390f35b61057c6112c5565b6040516105899190612e62565b60405180910390f35b61059a6112eb565b6040516105a79190612d43565b60405180910390f35b6105b86112f0565b005b6105c2611654565b6040516105cf9190612d43565b60405180910390f35b6105e061165a565b6040516105ed9190612d43565b60405180910390f35b6105fe61167e565b60405161060b9190612d43565b60405180910390f35b61061c611684565b6040516106299190612d43565b60405180910390f35b61064c60048036038101906106479190612c29565b61168a565b005b610656611780565b005b610672600480360381019061066d9190612e7d565b6119f4565b005b61067c611f42565b6040516106899190612d43565b60405180910390f35b61069a611f47565b6040516106a8929190612ebd565b60405180910390f35b6106cb60048036038101906106c69190612c29565b611fe3565b005b6106e760048036038101906106e29190612cb4565b61202c565b005b61070360048036038101906106fe9190612cb4565b6120af565b604051610711929190612ebd565b60405180910390f35b610722612355565b005b61072c612851565b6040516107399190612f45565b60405180910390f35b61074a612877565b6040516107579190612d43565b60405180910390f35b61076861287c565b6040516107759190612d79565b60405180910390f35b61078661288d565b600081116107c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c090612fe3565b60405180910390fd5b806008819055507f36ea59653b93d089d49c74d420b7884cd51117c3ff1ed62ed8b98cf43835d888816040516107ff9190612d43565b60405180910390a150565b61081261288d565b600260019054906101000a900460ff1615610862576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108599061304f565b60405180910390fd5b6001600260016101000a81548160ff021916908315150217905550806008819055504360068190555060016002806101000a81548160ff0219169083151502179055506006546007819055507faf9b8c1676656a817bb6b978900dea30f7d87dd4af846ff666096a49ebdd1e35600654826040516108e1929190612ebd565b60405180910390a150565b600e6020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154905085565b6212750081565b600260039054906101000a900460ff1681565b600260019054906101000a900460ff1681565b61095761290b565b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600081600401549050600081036109e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109dd906130bb565b60405180910390fd5b426212750083600201546109fa919061310a565b1115610a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a329061318a565b60405180910390fd5b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008082016000905560018201600090556002820160009055600382016000905560048201600090555050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610b029291906131aa565b6020604051808303816000875af1158015610b21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4591906131e8565b503373ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436482604051610b8c9190612d43565b60405180910390a25050610b9e61295a565b565b60035481565b610bae61288d565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610c3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3590613287565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610c799291906131aa565b6020604051808303816000875af1158015610c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbc91906131e8565b508173ffffffffffffffffffffffffffffffffffffffff167f4590b594be6fdef6bd5e18792a2494ddf2156b618c7bbe48d13a92831208af0582604051610d039190612d43565b60405180910390a25050565b60065481565b600f6020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000001281565b7f00000000000000000000000000000000000000000001a784379d99db4200000081565b610d7d61288d565b610d876000612963565b565b604b81565b610d9661288d565b826002806101000a81548160ff02191690831515021790555081600260036101000a81548160ff02191690831515021790555080600260046101000a81548160ff0219169083151502179055507f28de186b226935b24684e28dd7acff5cdcd95dddcbde84e6451b70ac240acb66838383604051610e16939291906132a7565b60405180910390a1505050565b610e2b61290b565b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000154905060008103610eba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb19061332a565b60405180910390fd5b6000826004015414610f01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef890613396565b60405180910390fd5b610f09612a27565b600080610f1d836005548660010154612ac8565b9050600081146110ad5780600b6000828254610f39919061310a565b925050819055508060046000828254610f5291906133b6565b925050819055506064600f6000866003015481526020019081526020016000205482610f7e91906133ea565b610f88919061345b565b91508160096000828254610f9c919061310a565b925050819055508181610faf91906133b6565b83610fba919061310a565b8460040181905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632b8b3475836040518263ffffffff1660e01b815260040161101d9190612d43565b600060405180830381600087803b15801561103757600080fd5b505af115801561104b573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167fba8de60c3403ec381d1d484652ea1980e3c3e56359195c92525bff4ce47ad98e838361109391906133b6565b6040516110a09190612d43565b60405180910390a26110b7565b8284600401819055505b6001600360008282546110ca91906133b6565b9250508190555082600a60008282546110e391906133b6565b925050819055504284600201819055507f000000000000000000000000000000000000000000000000000000e8d4a510006005548461112291906133ea565b61112c919061345b565b84600101819055503373ffffffffffffffffffffffffffffffffffffffff167ff908b12fe0d8dc1ff4fda115e5bace3a7ad1aad889daca8e638ca0b29f806577838361117891906133b6565b85611183919061310a565b84604051611192929190612ebd565b60405180910390a2505050506111a661295a565b565b60085481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60055481565b6000600a54600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161123d9190612e62565b602060405180830381865afa15801561125a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127e91906134a1565b61128891906133b6565b905090565b600260009054906101000a900460ff1681565b600260049054906101000a900460ff1681565b600c5481565b600a5481565b60075481565b600260059054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a81565b6112f861290b565b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816004015414611382576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137990613540565b60405180910390fd5b600081600001549050600081036113ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c5906135ac565b60405180910390fd5b6113d6612a27565b60006113e9826005548560010154612ac8565b905060008111156116065780600b6000828254611406919061310a565b92505081905550806004600082825461141f91906133b6565b9250508190555060006064600f600086600301548152602001908152602001600020548361144d91906133ea565b611457919061345b565b9050806009600082825461146b919061310a565b92505081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632b8b3475826040518263ffffffff1660e01b81526004016114cd9190612d43565b600060405180830381600087803b1580156114e757600080fd5b505af11580156114fb573d6000803e3d6000fd5b50505050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33838561154a91906133b6565b6040518363ffffffff1660e01b81526004016115679291906131aa565b6020604051808303816000875af1158015611586573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115aa91906131e8565b503373ffffffffffffffffffffffffffffffffffffffff167fba8de60c3403ec381d1d484652ea1980e3c3e56359195c92525bff4ce47ad98e82846115ef91906133b6565b6040516115fc9190612d43565b60405180910390a2505b7f000000000000000000000000000000000000000000000000000000e8d4a510006005548361163591906133ea565b61163f919061345b565b836001018190555050505061165261295a565b565b600b5481565b7f000000000000000000000000000000000000000000000000000000e8d4a5100081565b60045481565b60095481565b806004600082825461169c919061310a565b92505081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401611702939291906135cc565b6020604051808303816000875af1158015611721573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174591906131e8565b507fd20389ec208fde395624b8221fa1cae9211e46a6ba77134c8e0b1af8c9603398816040516117759190612d43565b60405180910390a150565b61178861290b565b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000154905060008103611817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180e906130bb565b60405180910390fd5b80600a600082825461182991906133b6565b9250508190555060006064600a8361184191906133ea565b61184b919061345b565b9050808261185991906133b6565b9150806004600082825461186d919061310a565b9250508190555060016003600082825461188791906133b6565b92505081905550600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008082016000905560018201600090556002820160009055600382016000905560048201600090555050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b81526004016119559291906131aa565b6020604051808303816000875af1158015611974573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199891906131e8565b503373ffffffffffffffffffffffffffffffffffffffff167f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695836040516119df9190612d43565b60405180910390a25050506119f261295a565b565b600060028054906101000a900460ff1680611a415750611a126111ae565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611a80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7790613675565b60405180910390fd5b60008160ff1603611b1c57600260039054906101000a900460ff1680611ad85750611aa96111ae565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611b17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0e906136e1565b60405180910390fd5b611bb5565b60018160ff1603611bb457600260049054906101000a900460ff1680611b745750611b456111ae565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611baa9061374d565b60405180910390fd5b5b5b611bbd61290b565b6001821480611bcc5750600282145b80611bd75750600382145b611c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0d906137b9565b60405180910390fd5b42600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015410611c9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9190613825565b60405180910390fd5b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816000015490507f00000000000000000000000000000000000000000001a784379d99db420000008186611d13919061310a565b1115611d54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4b90613891565b60405180910390fd5b60008514611e31578481611d68919061310a565b826000018190555084600a6000828254611d82919061310a565b92505081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330886040518463ffffffff1660e01b8152600401611de8939291906135cc565b6020604051808303816000875af1158015611e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2b91906131e8565b50611e6c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e63906138fd565b60405180910390fd5b60008103611e9857600160036000828254611e87919061310a565b925050819055508382600301819055505b611ea0612a27565b7f000000000000000000000000000000000000000000000000000000e8d4a510006005548360000154611ed391906133ea565b611edd919061345b565b82600101819055503373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c86604051611f2b9190612d43565b60405180910390a25050611f3d61295a565b505050565b601981565b6000806000622819a090506000600a541480611f6557506000600454145b15611f77576000925060009150611fde565b600a5481600854611f8891906133ea565b611f92919061345b565b925060006064600c54600854611fa891906133ea565b611fb2919061345b565b600854611fbf919061310a565b9050600a548282611fd091906133ea565b611fda919061345b565b9250505b509091565b611feb61288d565b80600c819055507f32e63aeca1f896ac57d5b36c3f3b57df9a47fe6ff073e58366ff3d0cf6e55fa5816040516120219190612d43565b60405180910390a150565b61203461288d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036120a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161209a9061398f565b60405180910390fd5b6120ac81612963565b50565b6000806000600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600081600401541461211157600092508060040154915061234f565b6007544311801561212557506000600a5414155b156121ec5760006007544361213a91906133b6565b905060006008548261214c91906133ea565b90506000600a547f000000000000000000000000000000000000000000000000000000e8d4a510008361217f91906133ea565b612189919061345b565b600554612196919061310a565b905083600101547f000000000000000000000000000000000000000000000000000000e8d4a510008286600001546121ce91906133ea565b6121d8919061345b565b6121e291906133b6565b955050505061223b565b80600101547f000000000000000000000000000000000000000000000000000000e8d4a51000600554836000015461222491906133ea565b61222e919061345b565b61223891906133b6565b92505b6000600260059054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b81526004016122989190612e62565b602060405180830381865afa1580156122b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d991906134a1565b90506000811461230b576064600c54856122f391906133ea565b6122fd919061345b565b84612308919061310a565b93505b60006064600f600085600301548152602001908152602001600020548661233291906133ea565b61233c919061345b565b9050808561234a91906133b6565b935050505b50915091565b600160028054906101000a900460ff16806123a257506123736111ae565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6123e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d890613675565b60405180910390fd5b60008160ff160361247d57600260039054906101000a900460ff1680612439575061240a6111ae565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b612478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246f906136e1565b60405180910390fd5b612516565b60018160ff160361251557600260049054906101000a900460ff16806124d557506124a66111ae565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b612514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250b9061374d565b60405180910390fd5b5b5b61251e61290b565b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600081600001549050600081036125ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125a49061332a565b60405180910390fd5b60008260040154146125f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125eb90613a21565b60405180910390fd5b6000811461280957612604612a27565b6000612617826005548560010154612ac8565b9050600081146128035780600b6000828254612633919061310a565b92505081905550806004600082825461264c91906133b6565b9250508190555060006064600f600086600301548152602001908152602001600020548361267a91906133ea565b612684919061345b565b90506000818361269491906133b6565b905081600960008282546126a8919061310a565b9250508190555080600a60008282546126c1919061310a565b925050819055508085600001546126d8919061310a565b85600001819055507f000000000000000000000000000000000000000000000000000000e8d4a51000600554866000015461271391906133ea565b61271d919061345b565b8560010181905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632b8b3475836040518263ffffffff1660e01b81526004016127809190612d43565b600060405180830381600087803b15801561279a57600080fd5b505af11580156127ae573d6000803e3d6000fd5b505050503373ffffffffffffffffffffffffffffffffffffffff167f169f1815ebdea059aac3bb00ec9a9594c7a5ffcb64a17e8392b5d84909a14556826040516127f89190612d43565b60405180910390a250505b50612844565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161283b90613a8d565b60405180910390fd5b505061284e61295a565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b603281565b60028054906101000a900460ff1681565b612895612be6565b73ffffffffffffffffffffffffffffffffffffffff166128b36111ae565b73ffffffffffffffffffffffffffffffffffffffff1614612909576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161290090613af9565b60405180910390fd5b565b600260015403612950576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294790613b65565b60405180910390fd5b6002600181905550565b60018081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600754431115612ac6576000600a54905060008103612a4d574360078190555050612ac6565b600060075443612a5d91906133b6565b9050600060085482612a6f91906133ea565b9050827f000000000000000000000000000000000000000000000000000000e8d4a5100082612a9e91906133ea565b612aa8919061345b565b600554612ab5919061310a565b600581905550436007819055505050505b565b6000817f000000000000000000000000000000000000000000000000000000e8d4a510008486612af891906133ea565b612b02919061345b565b612b0c91906133b6565b90506000600260059054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401612b6b9190612e62565b602060405180830381865afa158015612b88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bac91906134a1565b905060008114612bde576064600c5483612bc691906133ea565b612bd0919061345b565b82612bdb919061310a565b91505b509392505050565b600033905090565b600080fd5b6000819050919050565b612c0681612bf3565b8114612c1157600080fd5b50565b600081359050612c2381612bfd565b92915050565b600060208284031215612c3f57612c3e612bee565b5b6000612c4d84828501612c14565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612c8182612c56565b9050919050565b612c9181612c76565b8114612c9c57600080fd5b50565b600081359050612cae81612c88565b92915050565b600060208284031215612cca57612cc9612bee565b5b6000612cd884828501612c9f565b91505092915050565b612cea81612bf3565b82525050565b600060a082019050612d056000830188612ce1565b612d126020830187612ce1565b612d1f6040830186612ce1565b612d2c6060830185612ce1565b612d396080830184612ce1565b9695505050505050565b6000602082019050612d586000830184612ce1565b92915050565b60008115159050919050565b612d7381612d5e565b82525050565b6000602082019050612d8e6000830184612d6a565b92915050565b60008060408385031215612dab57612daa612bee565b5b6000612db985828601612c9f565b9250506020612dca85828601612c14565b9150509250929050565b612ddd81612d5e565b8114612de857600080fd5b50565b600081359050612dfa81612dd4565b92915050565b600080600060608486031215612e1957612e18612bee565b5b6000612e2786828701612deb565b9350506020612e3886828701612deb565b9250506040612e4986828701612deb565b9150509250925092565b612e5c81612c76565b82525050565b6000602082019050612e776000830184612e53565b92915050565b60008060408385031215612e9457612e93612bee565b5b6000612ea285828601612c14565b9250506020612eb385828601612c14565b9150509250929050565b6000604082019050612ed26000830185612ce1565b612edf6020830184612ce1565b9392505050565b6000819050919050565b6000612f0b612f06612f0184612c56565b612ee6565b612c56565b9050919050565b6000612f1d82612ef0565b9050919050565b6000612f2f82612f12565b9050919050565b612f3f81612f24565b82525050565b6000602082019050612f5a6000830184612f36565b92915050565b600082825260208201905092915050565b7f5265776172642070657220626c6f636b2073686f756c6420626520677265617460008201527f6572207468616e20300000000000000000000000000000000000000000000000602082015250565b6000612fcd602983612f60565b9150612fd882612f71565b604082019050919050565b60006020820190508181036000830152612ffc81612fc0565b9050919050565b7f416c726561647920696e697469616c697a656400000000000000000000000000600082015250565b6000613039601383612f60565b915061304482613003565b602082019050919050565b600060208201905081810360008301526130688161302c565b9050919050565b7f4e6f20616d6f756e7420746f2077697468647261770000000000000000000000600082015250565b60006130a5601583612f60565b91506130b08261306f565b602082019050919050565b600060208201905081810360008301526130d481613098565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061311582612bf3565b915061312083612bf3565b9250828201905080821115613138576131376130db565b5b92915050565b7f4d696e696d756d206c6f636b2074696d65206e6f742072656163686564000000600082015250565b6000613174601d83612f60565b915061317f8261313e565b602082019050919050565b600060208201905081810360008301526131a381613167565b9050919050565b60006040820190506131bf6000830185612e53565b6131cc6020830184612ce1565b9392505050565b6000815190506131e281612dd4565b92915050565b6000602082840312156131fe576131fd612bee565b5b600061320c848285016131d3565b91505092915050565b7f43616e6e6f74206265207374616b6564206f722072657761726420746f6b656e60008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b6000613271602183612f60565b915061327c82613215565b604082019050919050565b600060208201905081810360008301526132a081613264565b9050919050565b60006060820190506132bc6000830186612d6a565b6132c96020830185612d6a565b6132d66040830184612d6a565b949350505050565b7f4e6f20616d6f756e7420737461636b6564000000000000000000000000000000600082015250565b6000613314601183612f60565b915061331f826132de565b602082019050919050565b6000602082019050818103600083015261334381613307565b9050919050565b7f576974686472617720616c726561647920696e69746961746564000000000000600082015250565b6000613380601a83612f60565b915061338b8261334a565b602082019050919050565b600060208201905081810360008301526133af81613373565b9050919050565b60006133c182612bf3565b91506133cc83612bf3565b92508282039050818111156133e4576133e36130db565b5b92915050565b60006133f582612bf3565b915061340083612bf3565b925082820261340e81612bf3565b91508282048414831517613425576134246130db565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061346682612bf3565b915061347183612bf3565b9250826134815761348061342c565b5b828204905092915050565b60008151905061349b81612bfd565b92915050565b6000602082840312156134b7576134b6612bee565b5b60006134c58482850161348c565b91505092915050565b7f43616e742068617665207265776172647320696620776974686472617720696e60008201527f6974696174656400000000000000000000000000000000000000000000000000602082015250565b600061352a602783612f60565b9150613535826134ce565b604082019050919050565b600060208201905081810360008301526135598161351d565b9050919050565b7f3020737461636b65640000000000000000000000000000000000000000000000600082015250565b6000613596600983612f60565b91506135a182613560565b602082019050919050565b600060208201905081810360008301526135c581613589565b9050919050565b60006060820190506135e16000830186612e53565b6135ee6020830185612e53565b6135fb6040830184612ce1565b949350505050565b7f7374616b696e6720706c6174666f726d206e6f7420617661696c61626c65206e60008201527f6f772e0000000000000000000000000000000000000000000000000000000000602082015250565b600061365f602383612f60565b915061366a82613603565b604082019050919050565b6000602082019050818103600083015261368e81613652565b9050919050565b7f6465706f73697473206e6f7420617661696c61626c65206e6f772e0000000000600082015250565b60006136cb601b83612f60565b91506136d682613695565b602082019050919050565b600060208201905081810360008301526136fa816136be565b9050919050565b7f636f6d706f756e6473206e6f7420617661696c61626c65206e6f772e00000000600082015250565b6000613737601c83612f60565b915061374282613701565b602082019050919050565b600060208201905081810360008301526137668161372a565b9050919050565b7f696e76616c6964206275726e206f7074696f6e00000000000000000000000000600082015250565b60006137a3601383612f60565b91506137ae8261376d565b602082019050919050565b600060208201905081810360008301526137d281613796565b9050919050565b7f636f6f6c646f776e206e6f742070617373656400000000000000000000000000600082015250565b600061380f601383612f60565b915061381a826137d9565b602082019050919050565b6000602082019050818103600083015261383e81613802565b9050919050565b7f5573657220616d6f756e742061626f7665206c696d6974000000000000000000600082015250565b600061387b601783612f60565b915061388682613845565b602082019050919050565b600060208201905081810360008301526138aa8161386e565b9050919050565b7f63616e2774206465706f736974203020746f6b656e7300000000000000000000600082015250565b60006138e7601683612f60565b91506138f2826138b1565b602082019050919050565b60006020820190508181036000830152613916816138da565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613979602683612f60565b91506139848261391d565b604082019050919050565b600060208201905081810360008301526139a88161396c565b9050919050565b7f43616e7420636f6d706f756e6420696620776974686472617720696e6974696160008201527f7465640000000000000000000000000000000000000000000000000000000000602082015250565b6000613a0b602383612f60565b9150613a16826139af565b604082019050919050565b60006020820190508181036000830152613a3a816139fe565b9050919050565b7f6e6f7468696e6720746f20636f6d706f756e6400000000000000000000000000600082015250565b6000613a77601383612f60565b9150613a8282613a41565b602082019050919050565b60006020820190508181036000830152613aa681613a6a565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613ae3602083612f60565b9150613aee82613aad565b602082019050919050565b60006020820190508181036000830152613b1281613ad6565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000613b4f601f83612f60565b9150613b5a82613b19565b602082019050919050565b60006020820190508181036000830152613b7e81613b42565b905091905056fea2646970667358221220741ce9fc56b66a15dd7ab369005d4961fb742b3da5b4a41221cf140431c91cab64736f6c63430008130033
Verified Source Code Partial Match
Compiler: v0.8.19+commit.7dd6d404
EVM: paris
Optimization: No
Staking.sol 683 lines
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts (last updated v4.9.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;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.9.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);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (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;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable 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 Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: contracts/elmo_staking_v2.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
interface IBurn {
function publicBurn(uint256 amount) external;
}
interface IBalanceOf721 {
function balanceOf(address owner) external view returns (uint256 balance);
}
contract Staking is Ownable, ReentrancyGuard {
//constant
uint256 public constant BURN_OPTION_ONE = 25;
uint256 public constant BURN_OPTION_TWO = 50;
uint256 public constant BURN_OPTION_THREE = 75;
uint256 public constant DELAY_WITHDRAW = 14 days;
uint256 public constant EMERGENCY_FEE = 10;
uint256 public immutable MAX_DEPOSIT_LIMIT;
uint256 public immutable PRECISION_FACTOR;
uint256 public immutable TOKEN_DECIMALS;
// bool
bool public hasUserLimit;
bool public isInitialized;
bool public poolIsOnline;
bool public depositEnabled = true;
bool public compoundEnabled = true;
//address
address public nftContractAddress;
// uint
uint256 public totalUsersInStaking;
uint256 public poolTotalReward;
uint256 public accTokenPerShare;
uint256 public startBlock;
uint256 public lastRewardBlock;
uint256 public rewardPerBlock;
uint256 public totalBurned;
uint256 public totalUsersStake;
uint256 public totalUsersRewards;
uint256 public nftBoostPercentage;
// staking tokens
IERC20Metadata public rewardToken;
// mapping
mapping(address => UserInfo) public userInfo;
mapping(uint => uint) public optionToBurn; //0=None 1=25% 2=50% 3=75%
// struct
struct UserInfo {
uint256 amount; // How many staked tokens the user has provided
uint256 rewardDebt; // Reward debt
uint256 withdrawInitTime; // // init the cooldown timer to withdraw, save block.timestamp
uint256 burnChosen; // burn option
uint256 amountToWithdraw; // amount to withdraw
}
// event
event Deposit(address indexed user, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event PoolFunded(uint256 amount);
event Compound(address indexed user, uint256 amount);
event ClaimReward(address indexed user, uint256 amount);
event UserCompoundUpdated(address indexed user, bool onDeposit, bool onWithdraw);
event WithdrawInitiated(address indexed user, uint256 amount, uint256 burnedAmount);
event PoolStateUpdated(bool poolIsOnline, bool depositEnabled, bool compoundEnabled);
event NftBoostUpdated(uint256 percentage);
event TokenRecovered(address indexed tokenAddress, uint256 tokenAmount);
event BlockRewardUpdated(uint256 rewardPerBlock);
event PoolStarted(uint256 startBlock, uint256 rewardPerBlock);
//constructor
/// @notice Contract constructor that initializes the Smart Contract.
/// @param _rewardToken The address of the ERC20 token used as a reward.
/// @param _nftContractAddress The address of the NFT contract used as reward boost.
constructor(IERC20Metadata _rewardToken, address _nftContractAddress) {
rewardToken = _rewardToken;
TOKEN_DECIMALS = uint256(rewardToken.decimals());
require(TOKEN_DECIMALS < 30, "Must be inferior to 30");
MAX_DEPOSIT_LIMIT= 2000000*10**TOKEN_DECIMALS;
PRECISION_FACTOR = uint256(10**(uint256(30) - TOKEN_DECIMALS));
optionToBurn[1] = BURN_OPTION_ONE;
optionToBurn[2] = BURN_OPTION_TWO;
optionToBurn[3] = BURN_OPTION_THREE;
nftContractAddress = _nftContractAddress;
}
//owner function
/// @notice Allows the contract owner to set the state of the pool.
/// @param _poolIsOnline Enable or disable the pool.
/// @param _depositEnabled Enable or disable user deposits.
/// @param _compoundEnabled Enable or disable user compound functionality.
function setPoolState(bool _poolIsOnline, bool _depositEnabled, bool _compoundEnabled) external onlyOwner {
poolIsOnline = _poolIsOnline;
depositEnabled = _depositEnabled;
compoundEnabled = _compoundEnabled;
emit PoolStateUpdated(_poolIsOnline, _depositEnabled, _compoundEnabled);
}
/// @notice Allows the contract owner to set the NFT boost percentage.
/// @param _percentage The new NFT boost percentage to be set.
function setNftBoostPercentage(uint256 _percentage) external onlyOwner {
nftBoostPercentage = _percentage;
emit NftBoostUpdated(_percentage);
}
/// @notice Allows the contract owner to recover wrongly sent tokens to the contract.
/// @param _tokenAddress The address of the token to be recovered.
/// @param _tokenAmount The amount of tokens to be recovered.
function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner { //@msg NOT Withdraw any tokens from the contract
require(_tokenAddress != address(rewardToken), "Cannot be staked or reward tokens");
IERC20Metadata(_tokenAddress).transfer(address(msg.sender), _tokenAmount);
emit TokenRecovered(_tokenAddress, _tokenAmount);
}
/// @notice Allows the contract owner to update the reward rate per block.
/// @param _rewardPerBlock The new token amount per block to be set.
function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner { //@msg Update APY
require(_rewardPerBlock > 0, "Reward per block should be greater than 0");
rewardPerBlock = _rewardPerBlock;
emit BlockRewardUpdated(_rewardPerBlock);
}
/// @notice Initializes the staking pool with the provided reward rate per block.
/// @param _rewardPerBlock The reward rate per block to be set for the staking pool.
function istart(uint256 _rewardPerBlock) external onlyOwner {
require(!isInitialized, "Already initialized");
isInitialized = true;
rewardPerBlock = _rewardPerBlock;
startBlock = block.number;
poolIsOnline = true;
lastRewardBlock = startBlock;
emit PoolStarted(startBlock, _rewardPerBlock);
}
//modifier
/// @notice Modifier to check if the staking pool is online and available for certain actions.
/// @param actionType The type of action: 0 for deposit, 1 for compound.
modifier isPoolOnline(uint8 actionType) {
require(poolIsOnline || msg.sender == owner(),"staking platform not available now.");
if (actionType == 0) {
require(depositEnabled || msg.sender == owner(),"deposits not available now.");
}
else if (actionType == 1) {
require(compoundEnabled || msg.sender == owner(),"compounds not available now.");
}
_;
}
// user functions
/// @notice Allows users to top up the staking pool with additional reward tokens.
/// @param amount The amount of reward tokens to be added to the pool.
function fundPool(uint256 amount) external {
poolTotalReward += amount;
rewardToken.transferFrom(address(msg.sender), address(this), amount);
emit PoolFunded(amount);
}
/// @notice Allows users to deposit tokens into the staking pool.
/// @param _amount The amount of reward tokens to be deposited into the staking pool.
/// @param _burnOption The chosen burn option (1-25%, 2-50%, 3-75%) for the user's rewards.
function deposit(uint256 _amount, uint256 _burnOption) external isPoolOnline(0) nonReentrant {
require(_burnOption == 1 || _burnOption == 2 || _burnOption == 3, "invalid burn option");
require(userInfo[msg.sender].withdrawInitTime < block.timestamp, "cooldown not passed");
UserInfo storage user = userInfo[msg.sender];
uint userAmountBefore = user.amount;
require(_amount + userAmountBefore <= MAX_DEPOSIT_LIMIT, "User amount above limit");
if (_amount != 0) {
user.amount = userAmountBefore + _amount;
totalUsersStake += _amount;
rewardToken.transferFrom(address(msg.sender), address(this), _amount);
}else{
revert("can't deposit 0 tokens");
}
if (userAmountBefore == 0) {
totalUsersInStaking += 1;
user.burnChosen = _burnOption;
}
_updatePool();
user.rewardDebt = user.amount * accTokenPerShare / PRECISION_FACTOR;
emit Deposit(msg.sender, _amount);
}
/// @notice Initiates the withdrawal process for the staked reward tokens.
function initWithdraw() external nonReentrant {// unstack init
UserInfo storage user = userInfo[msg.sender];
uint userAmnt = user.amount;
require(userAmnt != 0, "No amount stacked");
require(user.amountToWithdraw == 0, "Withdraw already initiated");
_updatePool();
uint burnAmnout;
uint256 pending =_internalPendingCalc(userAmnt, accTokenPerShare, user.rewardDebt);
if (pending != 0) {
totalUsersRewards += pending;
poolTotalReward -= pending;
burnAmnout = pending * optionToBurn[user.burnChosen] / 100;
totalBurned += burnAmnout;
user.amountToWithdraw = userAmnt + (pending - burnAmnout);
IBurn(address(rewardToken)).publicBurn(burnAmnout);
emit ClaimReward(msg.sender,pending - burnAmnout);
}else{
user.amountToWithdraw = userAmnt;
}
totalUsersInStaking -= 1;
totalUsersStake -= userAmnt;
user.withdrawInitTime = block.timestamp;
user.rewardDebt = userAmnt * accTokenPerShare / PRECISION_FACTOR;
emit WithdrawInitiated(msg.sender, userAmnt + (pending - burnAmnout), burnAmnout);
}
/// @notice Allows users to withdraw their pending rewards from the staking pool.
function withdrawReward() external nonReentrant{
UserInfo storage user = userInfo[msg.sender];
require(user.amountToWithdraw == 0, "Cant have rewards if withdraw initiated");
uint userAmnt = user.amount;
require(userAmnt != 0, "0 stacked");
_updatePool();
uint256 pending = _internalPendingCalc(userAmnt, accTokenPerShare, user.rewardDebt);
if (pending > 0) {
totalUsersRewards += pending;
poolTotalReward -= pending;
uint burnAmnout = pending * optionToBurn[user.burnChosen] / 100;
totalBurned += burnAmnout;
IBurn(address(rewardToken)).publicBurn(burnAmnout);
rewardToken.transfer(address(msg.sender), pending-burnAmnout);
emit ClaimReward(msg.sender,pending - burnAmnout);
}
user.rewardDebt = userAmnt * accTokenPerShare / PRECISION_FACTOR;
}
/// @notice Allows users to withdraw their staked reward tokens after the lock time has passed.
function withdraw() external nonReentrant {// unstack
UserInfo storage user = userInfo[msg.sender];
uint256 amountToWithdraw = user.amountToWithdraw;
require(amountToWithdraw != 0, "No amount to withdraw");
require(user.withdrawInitTime + DELAY_WITHDRAW <= block.timestamp, "Minimum lock time not reached");
delete userInfo[msg.sender];
rewardToken.transfer(address(msg.sender), amountToWithdraw);
emit Withdraw(msg.sender, amountToWithdraw);
}
/// @notice Allows users to compound their pending rewards by adding them to their staked amount.
function compound() external isPoolOnline(1) nonReentrant {
UserInfo storage user = userInfo[msg.sender];
uint userAmnt = user.amount;
require(userAmnt != 0, "No amount stacked");
require(user.amountToWithdraw == 0, "Cant compound if withdraw initiated");
if(userAmnt != 0) {
_updatePool();
uint pending = _internalPendingCalc(userAmnt, accTokenPerShare, user.rewardDebt);
if(pending != 0) {
totalUsersRewards += pending;
poolTotalReward -= pending;
uint burnAmnout = pending * optionToBurn[user.burnChosen] / 100;
uint effectivePending = pending - burnAmnout;
totalBurned += burnAmnout;
totalUsersStake += effectivePending;
user.amount = user.amount + effectivePending;
user.rewardDebt = user.amount * accTokenPerShare / PRECISION_FACTOR;
IBurn(address(rewardToken)).publicBurn(burnAmnout);
emit Compound(msg.sender, effectivePending);
}
} else {
revert("nothing to compound");
}
}
// @notice Allows users to perform an emergency withdrawal from the staking pool.
function emergencyWithdraw() external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
uint256 amountToWithdraw = user.amount;
require(amountToWithdraw != 0, "No amount to withdraw");
totalUsersStake -= amountToWithdraw;
uint256 feePart = (amountToWithdraw * EMERGENCY_FEE / 100);
amountToWithdraw = amountToWithdraw - feePart; //fee back to pool
poolTotalReward += feePart;
totalUsersInStaking -= 1;
delete userInfo[msg.sender];
rewardToken.transfer(address(msg.sender), amountToWithdraw);
emit EmergencyWithdraw(msg.sender, amountToWithdraw);
}
/// @notice Calculates the pending rewards for a user's staked amount, considering the NFT boost.
/// @param amnt The user's staked amount for which the pending rewards are calculated.
/// @param accTokenShare The accumulated token share in the staking pool at the time of calculation.
/// @param debt The user's reward debt at the time of calculation.
/// @return pending The calculated pending rewards for the user's staked amount, considering the NFT boost.
function _internalPendingCalc(uint amnt, uint accTokenShare, uint debt) internal view returns(uint256 pending) {
pending = amnt * accTokenShare / PRECISION_FACTOR - debt;
uint hasNft = IBalanceOf721(nftContractAddress).balanceOf(msg.sender);
if(hasNft != 0) {
pending = pending+(pending * nftBoostPercentage / 100);
}
return pending;
}
/// @notice Calculates the pending and effective pending rewards for a specific user, considering the NFT boost(if applicable).
/// @param _user The address of the user for whom the rewards are to be calculated.
/// @return pending The total pending rewards for the user's staked amount, including the NFT boost if applicable.
/// @return effectivePending The effective pending rewards after considering the burn option (if any) and NFT boost (if applicable).
function pendingReward(address _user) external view returns (uint256 pending, uint256 effectivePending) {
UserInfo storage user = userInfo[_user];
if(user.amountToWithdraw != 0){
pending = 0;
effectivePending = user.amountToWithdraw;
} else {
if (block.number > lastRewardBlock && totalUsersStake != 0) {
uint256 multiplier = block.number - lastRewardBlock;
uint256 cakeReward = multiplier * rewardPerBlock;
uint256 adjustedTokenPerShare = accTokenPerShare + (cakeReward * PRECISION_FACTOR / totalUsersStake);
pending = user.amount * adjustedTokenPerShare / PRECISION_FACTOR - user.rewardDebt;
} else {
pending = user.amount * accTokenPerShare / PRECISION_FACTOR - user.rewardDebt;
}
uint hasNft = IBalanceOf721(nftContractAddress).balanceOf(_user);
if(hasNft != 0) {
pending = pending + (pending * nftBoostPercentage / 100);
}
uint burnAmnout = pending * optionToBurn[user.burnChosen] / 100;
effectivePending = pending - burnAmnout;
}
}
/// @notice Updates the staking pool by calculating and accumulating the reward tokens (cakeReward) per share of staked tokens.
function _updatePool() internal {
if (block.number <= lastRewardBlock) {
return;
}
uint256 stakedTokenSupply = totalUsersStake;
if (stakedTokenSupply == 0) {
lastRewardBlock = block.number;
return;
}
uint256 multiplier = block.number - lastRewardBlock;
uint256 cakeReward = multiplier * rewardPerBlock;
accTokenPerShare = accTokenPerShare + (cakeReward * PRECISION_FACTOR / stakedTokenSupply);
lastRewardBlock = block.number;
}
/// @notice Get the available balance of the staking pool.
/// @return calc The available balance of the staking pool (total reward tokens available for distribution).
function getPoolEffectiveBalance() external view returns(uint256 calc){
calc = rewardToken.balanceOf(address(this)) - totalUsersStake;
return calc;
}
/// @notice Calculate the Annual Percentage Yield (APY) for the staking pool.
/// @return calculatedApr The calculated Annual Percentage Yield (APY) for the staking pool.
function calculateAPR() external view returns (uint256 calculatedApr, uint256 aprWithNft) {
uint blockPerYear = (86400/12)*365;
if (totalUsersStake == 0 || poolTotalReward == 0) {
calculatedApr = 0;
aprWithNft = 0;
}else{
calculatedApr = (rewardPerBlock * blockPerYear) / totalUsersStake;
uint blockBoosted = rewardPerBlock + (rewardPerBlock * nftBoostPercentage / 100);
aprWithNft = (blockBoosted * blockPerYear) / totalUsersStake;
}
}
}
Read Contract
BURN_OPTION_ONE 0xeb0477f4 → uint256
BURN_OPTION_THREE 0x7f7499ca → uint256
BURN_OPTION_TWO 0xf83ac39c → uint256
DELAY_WITHDRAW 0x23efc307 → uint256
EMERGENCY_FEE 0xbace7099 → uint256
MAX_DEPOSIT_LIMIT 0x6a00dc3c → uint256
PRECISION_FACTOR 0xccd34cd5 → uint256
TOKEN_DECIMALS 0x5b7f415c → uint256
accTokenPerShare 0x8f662915 → uint256
calculateAPR 0xf2494f3b → uint256, uint256
compoundEnabled 0x9ebc1a8e → bool
depositEnabled 0x2eebe78e → bool
getPoolEffectiveBalance 0x909de8df → uint256
hasUserLimit 0x92e8990e → bool
isInitialized 0x392e53cd → bool
lastRewardBlock 0xa9f8d181 → uint256
nftBoostPercentage 0x9f8c9b2e → uint256
nftContractAddress 0xaae282e1 → address
optionToBurn 0x4960d6d9 → uint256
owner 0x8da5cb5b → address
pendingReward 0xf40f0f52 → uint256, uint256
poolIsOnline 0xfa967e43 → bool
poolTotalReward 0xd843f352 → uint256
rewardPerBlock 0x8ae39cac → uint256
rewardToken 0xf7c618c1 → address
startBlock 0x48cd4cb1 → uint256
totalBurned 0xd89135cd → uint256
totalUsersInStaking 0x3da72bf4 → uint256
totalUsersRewards 0xcac9e1eb → uint256
totalUsersStake 0x9fc37495 → uint256
userInfo 0x1959a002 → uint256, uint256, uint256, uint256, uint256
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
compound 0xf69e2046
No parameters
deposit 0xe2bbb158
uint256 _amount
uint256 _burnOption
emergencyWithdraw 0xdb2e21bc
No parameters
fundPool 0xda3a5f72
uint256 amount
initWithdraw 0x8aa99af1
No parameters
istart 0x10859a70
uint256 _rewardPerBlock
recoverWrongTokens 0x3f138d4b
address _tokenAddress
uint256 _tokenAmount
renounceOwnership 0x715018a6
No parameters
setNftBoostPercentage 0xf2e0c915
uint256 _percentage
setPoolState 0x897af754
bool _poolIsOnline
bool _depositEnabled
bool _compoundEnabled
transferOwnership 0xf2fde38b
address newOwner
updateRewardPerBlock 0x01f8a976
uint256 _rewardPerBlock
withdraw 0x3ccfd60b
No parameters
withdrawReward 0xc885bc58
No parameters
Recent Transactions
No transactions found for this address