Address Contract Verified
Address
0xcAFb07CCB524C957c835Be287f75c6F92db79CA3
Balance
0 ETH
Nonce
1
Code Size
13231 bytes
Creator
0xeED8A32c...4605 at tx 0x25f87b24...dd00fe
Indexed Transactions
0
Contract Bytecode
13231 bytes
0x608060405234801561001057600080fd5b50600436106102955760003560e01c80637b0a47ee11610167578063bc25973a116100ce578063e281dfef11610087578063e281dfef14610599578063e5f49cf8146105ac578063eda7c599146105bf578063f39c38a0146105d2578063f525cb68146105da578063f58c251c146105e257610295565b8063bc25973a14610518578063bedb86fb14610538578063bff7bcb51461054b578063c487622f1461056b578063ca3b76b71461057e578063d64b84b51461059157610295565b80638dc9144a116101205780638dc9144a146104b15780638e73c93a146104c45780639e447fc6146104d7578063acfc5b6d146104ea578063b50224b5146104fd578063b775f1001461050557610295565b80637b0a47ee146104555780637f8661a11461045d5780637fd115d7146104705780638456cb5914610483578063895a9e091461048b5780638dbdbe6d1461049e57610295565b806339664a311161020b5780635aa6e675116101c45780635aa6e675146103f95780635ac2f301146104015780636ce13743146104145780636e5105c21461042757806374f0314f1461043a578063772336f01461044257610295565b806339664a311461037a578063401760191461038d578063411208ad146103ad578063441a3e70146103c0578063488766a2146103d3578063532c5912146103e657610295565b8063238efcbc1161025d578063238efcbc146103065780632e0a8b951461030e5780632fd8a62b14610321578063359cd45e1461034157806337578cb314610354578063379607f51461036757610295565b80630361ca5a1461029a57806305287533146102af57806309dac061146102d85780630abb6035146102eb578063228cb733146102fe575b600080fd5b6102ad6102a83660046129a0565b6105ea565b005b6102c26102bd366004612b07565b61074e565b6040516102cf9190612b7c565b60405180910390f35b6102ad6102e6366004612959565b610774565b6102ad6102f9366004612959565b61081a565b6102c26108b5565b6102ad6108c4565b6102ad61031c366004612a89565b61093f565b61033461032f366004612a89565b6109fd565b6040516102cf9190613313565b61033461034f366004612aa1565b610a0f565b610334610362366004612a44565b610afd565b6102ad610375366004612a89565b610c5f565b610334610388366004612959565b610cec565b6103a061039b366004612975565b610cfe565b6040516102cf9190612ca4565b6103a06103bb366004612a89565b610d1e565b6102ad6103ce366004612b07565b610d44565b6103346103e1366004612a89565b610ec8565b6102ad6103f4366004612b07565b610ee7565b6102c2610f89565b61033461040f366004612a89565b610f98565b6102ad610422366004612a89565b610fb7565b610334610435366004612a89565b611073565b610334611092565b6102c2610450366004612975565b611099565b6103346110bf565b6102ad61046b366004612a89565b6110c5565b61033461047e366004612975565b61122b565b6103a0611279565b610334610499366004612a89565b611282565b6102ad6104ac366004612b28565b6112b0565b6103346104bf366004612975565b611639565b6102ad6104d2366004612959565b61167f565b6102ad6104e5366004612a89565b611716565b6103346104f8366004612975565b61177d565b6102c26117a8565b6102c2610513366004612ad0565b6117b7565b61052b610526366004612aa1565b6117f9565b6040516102cf9190612c55565b6102ad610546366004612a0c565b61188f565b61055e610559366004612aa1565b61190c565b6040516102cf9190612c08565b6102ad610579366004612b07565b61198a565b61033461058c366004612a89565b611a1e565b610334611a3d565b6103346105a7366004612a89565b611a43565b6102c26105ba366004612b07565b611a62565b6102c26105cd366004612a89565b611a88565b6102c2611aad565b610334611abc565b6102c2611acd565b6003546001600160a01b0316331461061d5760405162461bcd60e51b815260040161061490612f7d565b60405180910390fd5b6106276009611adc565b81146106455760405162461bcd60e51b815260040161061490613297565b61064d611ae0565b60085460005b61065d6009611adc565b81101561074657600061067760098363ffffffff611b2616565b600281015490915085858481811061068b57fe5b905060200201358114156106a057505061073e565b6106d58686858181106106af57fe5b905060200201356106c98387611b4d90919063ffffffff16565b9063ffffffff611b7516565b93508585848181106106e357fe5b6020029190910135600284015550827f4ca01fb9384991e6b301fe0ac5263aa1e34e2ea1a96dc91393e5bf3e3c34c66487878381811061071f57fe5b905060200201356040516107339190613313565b60405180910390a250505b600101610653565b506008555050565b600e6020908152600092835260408084209091529082529020546001600160a01b031681565b6003546001600160a01b0316331461079e5760405162461bcd60e51b815260040161061490612f7d565b6001600160a01b0381166107c45760405162461bcd60e51b81526004016106149061309c565b600580546001600160a01b0319166001600160a01b0383161790556040517fdc117600f93282860144d2cd2745f8e2e15c3ca2a32b4290c30f7cd1ae7ffcb99061080f908390612b7c565b60405180910390a150565b6003546001600160a01b031633146108445760405162461bcd60e51b815260040161061490612f7d565b6001600160a01b03811661086a5760405162461bcd60e51b815260040161061490612ce2565b600480546001600160a01b0319166001600160a01b0383161790556040517fc9e2377236eab4280090ce8f2317332649736d92f00dcf20a8dd6684ec5e78399061080f908390612b7c565b6001546001600160a01b031681565b6004546001600160a01b031633146108ee5760405162461bcd60e51b815260040161061490613146565b600454600380546001600160a01b0319166001600160a01b0390921691821790556040517f9d3e522e1e47a2f6009739342b9cc7b252a1888154e843ab55ee1c81745795ab9061080f908390612b7c565b6003546001600160a01b031633148061096257506005546001600160a01b031633145b61097e5760405162461bcd60e51b81526004016106149061302c565b600061099160098363ffffffff611b2616565b8054909150600160a81b900460ff16156109bd5760405162461bcd60e51b815260040161061490613260565b805460ff60a81b1916600160a81b17815560405182907fc6e55ae524304d0eb19f97102b6c23c1eae90bb0821dcd2bbe6e8ac8ccd8323290600090a25050565b600f6020526000908152604090205481565b600080610a2360098563ffffffff611b2616565b6001600160a01b0384166000908152600a602090815260408083208884529091528120919250805b825463ffffffff82161015610af1576000610ab385600801546106c962015180610aa762015180896000018863ffffffff1681548110610a8757fe5b906000526020600020906002020160010154611b9a90919063ffffffff16565b9063ffffffff611bcc16565b9050804210610ae857836000018263ffffffff1681548110610ad157fe5b906000526020600020906002020160000154830192505b50600101610a4b565b50925050505b92915050565b6003546000906001600160a01b03163314610b2a5760405162461bcd60e51b815260040161061490612f7d565b6001600160a01b03851660009081526006602052604090205415610b605760405162461bcd60e51b8152600401610614906131d0565b6000610b6c6009611adc565b9050610bfc604051806101600160405280886001600160a01b031681526020018715158152602001600015158152602001600081526020016000815260200160405180602001604052806000815250815260200143815260200186815260200160008152602001604051806020016040528060008152508152602001858152506009611c0690919063ffffffff16565b6001600160a01b038616600081815260066020526040908190206001840190555182907f154511729012ef776b8a51ae96d7429fa768546e62bec65af546cb3a5ff8f8ac90610c4e908890889061331c565b60405180910390a395945050505050565b60026000541415610c825760405162461bcd60e51b8152600401610614906132dc565b60026000908155610c9a60098363ffffffff611b2616565b9050610cad81600763ffffffff611ccd16565b336000908152600a602090815260408083208584529091529020610cd98183600763ffffffff611d1516565b610ce283611d49565b5050600160005550565b60066020526000908152604090205481565b600d60209081526000928352604080842090915290825290205460ff1681565b600080610d3260098463ffffffff611b2616565b54600160a81b900460ff169392505050565b60026000541415610d675760405162461bcd60e51b8152600401610614906132dc565b600260005580610d895760405162461bcd60e51b815260040161061490613072565b6000610d958333610a0f565b905081811015610db75760405162461bcd60e51b815260040161061490612fb4565b6000610dca60098563ffffffff611b2616565b9050610ddd81600763ffffffff611ccd16565b336000908152600a602090815260408083208784529091529020610e098183600763ffffffff611d1516565b8154600090600160a81b900460ff16610e23576000610e48565b336000908152600c602090815260408083208984529091529020546001600160a01b03165b8354909150600160a81b900460ff168015610e6b57506001600160a01b03811615155b15610ea7576001600160a01b0381166000908152600b602090815260408083208984529091529020610ea58185600763ffffffff611f1516565b505b610eb086611d49565b610ebb868683611f49565b5050600160005550505050565b600080610edc60098463ffffffff611b2616565b600601549392505050565b6003546001600160a01b0316331480610f0a57506005546001600160a01b031633145b610f265760405162461bcd60e51b815260040161061490612ed2565b6000610f3960098463ffffffff611b2616565b600881018054908490556040519192509084907ff7c740042c960435d73145d82054ffab47ed34b6f0253a38e60355f1976486d490610f7b908490879061331c565b60405180910390a250505050565b6003546001600160a01b031681565b600080610fac60098463ffffffff611b2616565b600201549392505050565b6003546001600160a01b0316331480610fda57506005546001600160a01b031633145b610ff65760405162461bcd60e51b815260040161061490612f37565b600061100960098363ffffffff611b2616565b8054909150600160a81b900460ff1615156001146110395760405162461bcd60e51b815260040161061490612f07565b805460ff60a81b1916815560405182907f87546fb57c5b318e0c2162aed2c505ceb5bb53507ac10aee73df15d182d36d0490600090a25050565b60008061108760098463ffffffff611b2616565b600101549392505050565b6201518081565b600c6020908152600092835260408084209091529082529020546001600160a01b031681565b60075490565b600260005414156110e85760405162461bcd60e51b8152600401610614906132dc565b600260009081556110f98233610a0f565b90506000811161111b5760405162461bcd60e51b815260040161061490612e64565b600061112e60098463ffffffff611b2616565b905061114181600763ffffffff611ccd16565b336000908152600a60209081526040808320868452909152902061116d8183600763ffffffff611d1516565b8154600090600160a81b900460ff166111875760006111ac565b336000908152600c602090815260408083208884529091529020546001600160a01b03165b8354909150600160a81b900460ff1680156111cf57506001600160a01b03811615155b1561120b576001600160a01b0381166000908152600b6020908152604080832088845290915290206112098185600763ffffffff611f1516565b505b61121485611d49565b61121f858583611f49565b50506001600055505050565b6001600160a01b0382166000908152600a60209081526040808320848452909152812061127161126260098563ffffffff611b2616565b8290600763ffffffff61212516565b949350505050565b60115460ff1681565b60008061129660098463ffffffff611b2616565b90506112a981600763ffffffff6121d116565b9392505050565b600260005414156112d35760405162461bcd60e51b8152600401610614906132dc565b60026000908155839082906112ef60098463ffffffff611b2616565b8054909150600160a81b900460ff16801561131257506001600160a01b03821615155b1561148c576001600160a01b0382166000908152600d6020908152604080832086845290915290205460ff166113e5576000838152600e60209081526040808320600f8084528285208054865291845282852080546001600160a01b0319166001600160a01b0389169081179091558552600d8452828520888652845293829020805460ff191660019081179091559390925281549092019055517fbfad7feb722a5c152032ec8cc078f5ac575c3c79d10b1f395d775f7db1c1e453906113dc9084903390612bb1565b60405180910390a15b60008381526010602090815260408083206001600160a01b038616845290915281206001913391905b815481101561145557826001600160a01b031682828154811061142d57fe5b6000918252602090912001546001600160a01b0316141561144d57600093505b60010161140e565b5082156114885780546001810182556000828152602090200180546001600160a01b0319166001600160a01b0384161790555b5050505b600085116114ac5760405162461bcd60e51b8152600401610614906130e9565b60006114bf60098863ffffffff611b2616565b90506114d281600763ffffffff611ccd16565b336000908152600a602090815260408083208a845290915290206114fe8183600763ffffffff611d1516565b336000908152600c602090815260408083208b845290915290205482546001600160a01b0390911690600160a81b900460ff161561161e576001600160a01b038716156115bc576001600160a01b038116158061156c5750866001600160a01b0316816001600160a01b0316145b6115885760405162461bcd60e51b815260040161061490612da6565b336000908152600c602090815260408083208c8452909152902080546001600160a01b0319166001600160a01b0389161790555b50336000908152600c602090815260408083208b84529091529020546001600160a01b0316801561161e576001600160a01b0381166000908152600b602090815260408083208c8452909152902061161c8185600763ffffffff611f1516565b505b611629898983612202565b5050600160005550505050505050565b6001600160a01b0382166000908152600b60209081526040808320848452909152812061127161167060098563ffffffff611b2616565b8290600763ffffffff6123a116565b60115460ff1680156116af57506003546001600160a01b03163314806116af57506005546001600160a01b031633145b6116cb5760405162461bcd60e51b815260040161061490612dd0565b600280546001600160a01b0319166001600160a01b0383161790556040517fcd409fc2a693558f338316d2cd6cb79806b6ca7b834d35e3c44eb9f5a5f6bafb9061080f908390612b7c565b6003546001600160a01b031633146117405760405162461bcd60e51b815260040161061490612f7d565b611748611ae0565b60078190556040517f41d466ebd06fb97e7786086ac8b69b7eb7da798592036251291d34e9791cde019061080f908390613313565b6001600160a01b03919091166000908152600a60209081526040808320938352929052206001015490565b6002546001600160a01b031681565b601060205282600052604060002060205281600052604060002081815481106117dc57fe5b6000918252602090912001546001600160a01b0316925083915050565b6001600160a01b0381166000908152600a6020908152604080832085845282528083208054825181850281018501909352808352606094919385939285929184015b828210156118815783829060005260206000209060020201604051806040016040529081600082015481526020016001820154815250508152602001906001019061183b565b509298975050505050505050565b6003546001600160a01b03163314806118b257506005546001600160a01b031633145b6118ce5760405162461bcd60e51b815260040161061490612ed2565b6011805460ff19168215151790556040517f77860e247ab9186dbe64e5bd0e0b93273cc4273e01818420e788f500078886f59061080f908390612ca4565b60008281526010602090815260408083206001600160a01b038516845282529182902080548351818402810184019094528084526060939283018282801561197d57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161195f575b5050505050905092915050565b6003546001600160a01b03163314806119ad57506005546001600160a01b031633145b6119c95760405162461bcd60e51b815260040161061490612ed2565b60006119dc60098463ffffffff611b2616565b600581018054908490556040519192509084907fa6845d2944a9fc6f60ad09a201890006d456bd5790e21942b68b1a92da99d9bb90610f7b908490879061331c565b600080611a3260098463ffffffff611b2616565b600501549392505050565b60085490565b600080611a5760098463ffffffff611b2616565b600801549392505050565b6000918252600e602090815260408084209284529190529020546001600160a01b031690565b600080611a9c60098463ffffffff611b2616565b546001600160a01b03169392505050565b6004546001600160a01b031681565b6000611ac86009611adc565b905090565b6005546001600160a01b031681565b5490565b60005b611aed6009611adc565b811015611b23576000611b0760098363ffffffff611b2616565b9050611b1a81600763ffffffff611ccd16565b50600101611ae3565b50565b6000826000018281548110611b3757fe5b9060005260206000209060090201905092915050565b600082821115611b6f5760405162461bcd60e51b815260040161061490612e2d565b50900390565b6000828201838110156112a95760405162461bcd60e51b815260040161061490612d6f565b6000808211611bbb5760405162461bcd60e51b815260040161061490612e9b565b818381611bc457fe5b049392505050565b600082611bdb57506000610af7565b82820282848281611be857fe5b04146112a95760405162461bcd60e51b815260040161061490612feb565b8154600181810184556000938452602093849020835160099093020180549484015160408501511515600160a81b0260ff60a81b19911515600160a01b0260ff60a01b196001600160a01b039096166001600160a01b0319909816979097179490941695909517949094169190911783556060820151908301556080810151600283015560a081015151600383015560c0810151600483015560e0810151600583015561010081015160068301556101208101515160078301556101400151600890910155565b611cdd828263ffffffff61242e16565b5160038301558154600160a81b900460ff1615611d0b57611d04828263ffffffff61252416565b5160078301555b5043600490910155565b611d2683838363ffffffff61212516565b6002840155611d3b828263ffffffff61242e16565b516003909301929092555050565b60115460ff1615611d6c5760405162461bcd60e51b81526004016106149061318b565b6000611d7f60098363ffffffff611b2616565b336000908152600a602090815260408083208684529091528120600281018054929055825492935091600160a01b900460ff1615611eb05760015460025460405163095ea7b360e01b81526001600160a01b039283169263095ea7b392611def9291169060001990600401612bef565b602060405180830381600087803b158015611e0957600080fd5b505af1158015611e1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e419190612a28565b50600254600584015460405163f52743b160e01b81526001600160a01b039092169163f52743b191611e799133918691600401612b90565b600060405180830381600087803b158015611e9357600080fd5b505af1158015611ea7573d6000803e3d6000fd5b50505050611ecd565b600154611ecd906001600160a01b0316338363ffffffff61260e16565b83336001600160a01b03167f9923b4306c6c030f2bdfbf156517d5983b87e15b96176da122cd4f2effa4ba7b83604051611f079190613313565b60405180910390a350505050565b611f2683838363ffffffff6123a116565b6001840155611f3b828263ffffffff61252416565b516002909301929092555050565b6000611f5c60098563ffffffff611b2616565b336000908152600a602090815260408083208884529091529020600182015491925090611f8f908563ffffffff611b4d16565b600180840191909155810154611fab908563ffffffff611b4d16565b60018201558360005b82548110156120475781611fc757612047565b6000836000018281548110611fd857fe5b600091825260208220600290910201549150838211611ff75781611ff9565b835b905061200b828263ffffffff611b4d16565b85600001848154811061201a57fe5b600091825260209091206002909102015561203b848263ffffffff611b4d16565b93505050600101611fb4565b508254600160a81b900460ff16801561206857506001600160a01b03841615155b156120bf576001600160a01b0384166000908152600b60209081526040808320898452909152902060068401546120a5908763ffffffff611b4d16565b600685015580546120bc908763ffffffff611b4d16565b90555b82546120db906001600160a01b0316338763ffffffff61260e16565b85336001600160a01b03167fffe903c0abe6b2dbb2f3474ef43d7a3c1fca49e5a774453423ca8e1952aabffa876040516121159190613313565b60405180910390a3505050505050565b600061212f61292c565b61213f848463ffffffff61242e16565b905061214961292c565b5060408051602081019091526003860154815261216c828263ffffffff61266916565b61217d5750505060028301546112a9565b60006121ae6121a9886001015461219d858761269a90919063ffffffff16565b9063ffffffff6126ca16565b6126f8565b60028801549091506121c6908263ffffffff611b7516565b979650505050505050565b60006112a982600101546121f685600201548560000154611bcc90919063ffffffff16565b9063ffffffff611b9a16565b600061221560098563ffffffff611b2616565b336000908152600a602090815260408083208884529091529020600182015491925090612248908563ffffffff611b7516565b600183015561225561293f565b506040805180820190915284815242602080830191825283546001818101865560008681529290922084516002909202019081559151918101919091558201546122a5908663ffffffff611b7516565b60018301558254600160a81b900460ff1680156122ca57506001600160a01b03841615155b1561234a57336001600160a01b03851614156122f85760405162461bcd60e51b815260040161061490612d38565b6001600160a01b0384166000908152600b6020908152604080832089845290915290206006840154612330908763ffffffff611b7516565b60068501558054612347908763ffffffff611b7516565b90555b8254612367906001600160a01b031633308863ffffffff61270716565b85336001600160a01b03167ffdfdcf596161b0e81e3161597d46888dcc88bd83b22dcfb341c76377ca3bbc9e876040516121159190613313565b60006123ab61292c565b6123bb848463ffffffff61252416565b90506123c561292c565b506040805160208101909152600286015481526123e8828263ffffffff61266916565b6123f95750505060018301546112a9565b8554600090612416906121a99061219d868663ffffffff61269a16565b60018801549091506121c6908263ffffffff611b7516565b61243661292c565b60018301546124575750604080516020810190915260038301548152610af7565b6000612470846004015443611b4d90919063ffffffff16565b905080612490575050604080516020810190915260038301548152610af7565b60006124a2858563ffffffff6121d116565b905060006124b6828463ffffffff611bcc16565b9050806124da5750506040805160208101909152600385015481529150610af79050565b6124e261292c565b6124ff87600101546124f38461272e565b9063ffffffff61277016565b6040805160208101909152600389015481529091506121c6908263ffffffff6127a416565b61252c61292c565b600683015461254d5750604080516020810190915260078301548152610af7565b6000612566846004015443611b4d90919063ffffffff16565b905080612586575050604080516020810190915260078301548152610af7565b6000612598858563ffffffff6121d116565b905060006125ac828463ffffffff611bcc16565b9050806125d05750506040805160208101909152600785015481529150610af79050565b6125d861292c565b6125e987600601546124f38461272e565b6040805160208101909152600789015481529091506121c6908263ffffffff6127a416565b6126648363a9059cbb60e01b848460405160240161262d929190612bef565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127bf565b505050565b80518251600091111561267f5750600019610af7565b81518351111561269157506001610af7565b50600092915050565b6126a261292c565b825182518103908111156126b557600080fd5b60408051602081019091529081529392505050565b6126d261292c565b60008215806126ef5750508251828102908382816126ec57fe5b04145b6126b557600080fd5b51670de0b6b3a7640000900490565b612728846323b872dd60e01b85858560405160240161262d93929190612bcb565b50505050565b61273661292c565b6000821580612753575050670de0b6b3a764000082810290810483145b61275c57600080fd5b604080516020810190915290815292915050565b61277861292c565b8161278257600080fd5b60405180602001604052808385600001518161279a57fe5b0490529392505050565b6127ac61292c565b825182518101908110156126b557600080fd5b6060612814826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661284e9092919063ffffffff16565b80519091501561266457808060200190518101906128329190612a28565b6126645760405162461bcd60e51b815260040161061490613216565b6060611271848460008585612862856128ed565b61287e5760405162461bcd60e51b81526004016106149061310f565b60006060866001600160a01b0316858760405161289b9190612b60565b60006040518083038185875af1925050503d80600081146128d8576040519150601f19603f3d011682016040523d82523d6000602084013e6128dd565b606091505b50915091506121c68282866128f3565b3b151590565b606083156129025750816112a9565b8251156129125782518084602001fd5b8160405162461bcd60e51b81526004016106149190612caf565b6040518060200160405280600081525090565b604051806040016040528060008152602001600081525090565b60006020828403121561296a578081fd5b81356112a981613356565b60008060408385031215612987578081fd5b823561299281613356565b946020939093013593505050565b600080602083850312156129b2578182fd5b823567ffffffffffffffff808211156129c9578384fd5b81850186601f8201126129da578485fd5b80359250818311156129ea578485fd5b86602080850283010111156129fd578485fd5b60200196919550909350505050565b600060208284031215612a1d578081fd5b81356112a98161336b565b600060208284031215612a39578081fd5b81516112a98161336b565b60008060008060808587031215612a59578182fd5b8435612a6481613356565b93506020850135612a748161336b565b93969395505050506040820135916060013590565b600060208284031215612a9a578081fd5b5035919050565b60008060408385031215612ab3578182fd5b823591506020830135612ac581613356565b809150509250929050565b600080600060608486031215612ae4578283fd5b833592506020840135612af681613356565b929592945050506040919091013590565b60008060408385031215612b19578182fd5b50508035926020909101359150565b600080600060608486031215612b3c578283fd5b83359250602084013591506040840135612b5581613356565b809150509250925092565b60008251612b7281846020870161332a565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015612c495783516001600160a01b031683529284019291840191600101612c24565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612c9757815180518552860151868501529284019290850190600101612c72565b5091979650505050505050565b901515815260200190565b6000602082528251806020840152612cce81604085016020870161332a565b601f01601f19169190910160400192915050565b60208082526036908201527f5374616b696e67506f6f6c733a2070656e64696e6720676f7665726e616e6365604082015275020616464726573732063616e6e6f74206265203078360541b606082015260800190565b60208082526019908201527f43616e206e6f7420726566657272616c20796f757273656c6600000000000000604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526010908201526f726566657272656420616c726561647960801b604082015260600190565b60208082526037908201527f5374616b696e67506f6f6c733a206e6f74207061757365642c206f72206e6f7460408201527f20676f7665726e616e6365206f722073656e74696e656c000000000000000000606082015260800190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f616c6c206465706f7369746564207374696c6c206c6f636b6564000000000000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252818101527f5374616b696e67506f6f6c733a202128676f76207c7c2073656e74696e656c29604082015260600190565b6020808252601690820152753932b332b93930b6103737ba103a3ab93732b21037b760511b604082015260600190565b60208082526026908201527f73746f7074526566657272616c426f6e75733a202128676f76207c7c2073656e60408201526574696e656c2960d01b606082015260800190565b6020808252601d908201527f5374616b696e67506f6f6c733a206f6e6c7920676f7665726e616e6365000000604082015260600190565b6020808252601b908201527f616d6f756e74206578636565647320776974686472617741626c650000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60208082526026908201527f7374617274526566657272616c426f6e75733a202128676f76207c7c2073656e60408201526574696e656c2960d01b606082015260800190565b60208082526010908201526f746f207769746864726177207a65726f60801b604082015260600190565b6020808252602d908201527f5374616b696e67506f6f6c733a2073656e74696e656c2061646472657373206360408201526c30b73737ba10313290183c181760991b606082015260800190565b6020808252600c908201526b1e995c9bc819195c1bdcda5d60a21b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526025908201527f5374616b696e67506f6f6c733a206f6e6c792070656e64696e6720676f7665726040820152646e616e636560d81b606082015260800190565b60208082526025908201527f5374616b696e67506f6f6c733a20656d657267656e637920706175736520656e60408201526418589b195960da1b606082015260800190565b60208082526026908201527f5374616b696e67506f6f6c733a20746f6b656e20616c7265616479206861732060408201526518481c1bdbdb60d21b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526019908201527f726566657272616c20626f6e757320616c7265616479206f6e00000000000000604082015260600190565b60208082526025908201527f5374616b696e67506f6f6c733a2077656967687473206c656e677468206d69736040820152640dac2e8c6d60db1b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b90815260200190565b918252602082015260400190565b60005b8381101561334557818101518382015260200161332d565b838111156127285750506000910152565b6001600160a01b0381168114611b2357600080fd5b8015158114611b2357600080fdfea2646970667358221220de0d07ab4a86fd9db5bd4cf48ac4c9ac43f837f8c3affd291a1534a4aff6f1e964736f6c634300060a0033
Verified Source Code Full Match
Compiler: v0.6.10+commit.00c0fcaf
EVM: istanbul
Optimization: Yes (200 runs)
StakingWithLockUp.sol 2005 lines
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[email protected] // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File @openzeppelin/contracts/utils/[email protected] pragma solidity >=0.6.0 <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 GSN 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 payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File @openzeppelin/contracts/access/[email protected] pragma solidity >=0.6.0 <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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = 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"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File @openzeppelin/contracts/utils/[email protected] pragma solidity >=0.6.0 <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 () internal { _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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File @openzeppelin/contracts/math/[email protected] pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // File @openzeppelin/contracts/utils/[email protected] pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File @openzeppelin/contracts/token/ERC20/[email protected] pragma solidity >=0.6.0 <0.8.0; /** * @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 SafeMath for uint256; 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' // solhint-disable-next-line max-line-length 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).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File contracts/lib/FixedPointMath.sol /* Copyright 2021 Cook Finance. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.6.2; library FixedPointMath { uint256 public constant DECIMALS = 18; uint256 public constant SCALAR = 10**DECIMALS; struct uq192x64 { uint256 x; } function fromU256(uint256 value) internal pure returns (uq192x64 memory) { uint256 x; require(value == 0 || (x = value * SCALAR) / SCALAR == value); return uq192x64(x); } function maximumValue() internal pure returns (uq192x64 memory) { return uq192x64(uint256(-1)); } function add(uq192x64 memory self, uq192x64 memory value) internal pure returns (uq192x64 memory) { uint256 x; require((x = self.x + value.x) >= self.x); return uq192x64(x); } function add(uq192x64 memory self, uint256 value) internal pure returns (uq192x64 memory) { return add(self, fromU256(value)); } function sub(uq192x64 memory self, uq192x64 memory value) internal pure returns (uq192x64 memory) { uint256 x; require((x = self.x - value.x) <= self.x); return uq192x64(x); } function sub(uq192x64 memory self, uint256 value) internal pure returns (uq192x64 memory) { return sub(self, fromU256(value)); } function mul(uq192x64 memory self, uint256 value) internal pure returns (uq192x64 memory) { uint256 x; require(value == 0 || (x = self.x * value) / value == self.x); return uq192x64(x); } function div(uq192x64 memory self, uint256 value) internal pure returns (uq192x64 memory) { require(value != 0); return uq192x64(self.x / value); } function cmp(uq192x64 memory self, uq192x64 memory value) internal pure returns (int256) { if (self.x < value.x) { return -1; } if (self.x > value.x) { return 1; } return 0; } function decode(uq192x64 memory self) internal pure returns (uint256) { return self.x / SCALAR; } } // File contracts/interfaces/IDetailedERC20.sol /* Copyright 2021 Cook Finance. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.6.2; interface IDetailedERC20 is IERC20 { function name() external returns (string memory); function symbol() external returns (string memory); function decimals() external returns (uint8); } // File contracts/interfaces/IMintableERC20.sol /* Copyright 2021 Cook Finance. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.6.2; interface IMintableERC20 is IDetailedERC20{ function mint(address _recipient, uint256 _amount) external; function burnFrom(address account, uint256 amount) external; function lowerHasMinted(uint256 amount) external; function lowerHasMintedIfNeeded(uint256 amount) external; } // File contracts/interfaces/IRewardVesting.sol /* Copyright 2021 Cook Finance. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.6.2; interface IRewardVesting { function addEarning(address user, uint256 amount, uint256 durationInSecs) external; function userBalances(address user) external view returns (uint256 bal); } // File @openzeppelin/contracts/math/[email protected] pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File contracts/farm/Pool.sol /* Copyright 2021 Cook Finance. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.6.2; pragma experimental ABIEncoderV2; /// @title Pool /// /// @dev A library which provides the Pool data struct and associated functions. library Pool { using FixedPointMath for FixedPointMath.uq192x64; using Pool for Pool.Data; using Pool for Pool.List; using SafeMath for uint256; struct Context { uint256 rewardRate; uint256 totalRewardWeight; } struct Data { IERC20 token; bool needVesting; bool onReferralBonus; uint256 totalDeposited; uint256 rewardWeight; FixedPointMath.uq192x64 accumulatedRewardWeight; // for vesting uint256 lastUpdatedBlock; // for referral power calculation uint256 vestingDurationInSecs; uint256 totalReferralAmount; // deposited through referral FixedPointMath.uq192x64 accumulatedReferralWeight; uint256 lockUpPeriodInSecs; } struct List { Data[] elements; } /// @dev Updates the pool. /// /// @param _ctx the pool context. function update(Data storage _data, Context storage _ctx) internal { _data.accumulatedRewardWeight = _data.getUpdatedAccumulatedRewardWeight(_ctx); if (_data.onReferralBonus) { _data.accumulatedReferralWeight = _data.getUpdatedAccumulatedReferralWeight(_ctx); } _data.lastUpdatedBlock = block.number; } /// @dev Gets the rate at which the pool will distribute rewards to stakers. /// /// @param _ctx the pool context. /// /// @return the reward rate of the pool in tokens per block. function getRewardRate(Data storage _data, Context storage _ctx) internal view returns (uint256) { return _ctx.rewardRate.mul(_data.rewardWeight).div(_ctx.totalRewardWeight); } /// @dev Gets the accumulated reward weight of a pool. /// /// @param _ctx the pool context. /// /// @return the accumulated reward weight. function getUpdatedAccumulatedRewardWeight(Data storage _data, Context storage _ctx) internal view returns (FixedPointMath.uq192x64 memory) { if (_data.totalDeposited == 0) { return _data.accumulatedRewardWeight; } uint256 _elapsedTime = block.number.sub(_data.lastUpdatedBlock); if (_elapsedTime == 0) { return _data.accumulatedRewardWeight; } uint256 _rewardRate = _data.getRewardRate(_ctx); uint256 _distributeAmount = _rewardRate.mul(_elapsedTime); if (_distributeAmount == 0) { return _data.accumulatedRewardWeight; } FixedPointMath.uq192x64 memory _rewardWeight = FixedPointMath.fromU256(_distributeAmount).div(_data.totalDeposited); return _data.accumulatedRewardWeight.add(_rewardWeight); } /// @dev Gets the accumulated referral weight of a pool. /// /// @param _ctx the pool context. /// /// @return the accumulated reward weight. function getUpdatedAccumulatedReferralWeight(Data storage _data, Context storage _ctx) internal view returns (FixedPointMath.uq192x64 memory) { if (_data.totalReferralAmount == 0) { return _data.accumulatedReferralWeight; } uint256 _elapsedTime = block.number.sub(_data.lastUpdatedBlock); if (_elapsedTime == 0) { return _data.accumulatedReferralWeight; } uint256 _rewardRate = _data.getRewardRate(_ctx); uint256 _distributeAmount = _rewardRate.mul(_elapsedTime); if (_distributeAmount == 0) { return _data.accumulatedReferralWeight; } FixedPointMath.uq192x64 memory _rewardWeight = FixedPointMath.fromU256(_distributeAmount).div(_data.totalReferralAmount); return _data.accumulatedReferralWeight.add(_rewardWeight); } /// @dev Adds an element to the list. /// /// @param _element the element to add. function push(List storage _self, Data memory _element) internal { _self.elements.push(_element); } /// @dev Gets an element from the list. /// /// @param _index the index in the list. /// /// @return the element at the specified index. function get(List storage _self, uint256 _index) internal view returns (Data storage) { return _self.elements[_index]; } /// @dev Gets the last element in the list. /// /// This function will revert if there are no elements in the list. ///ck /// @return the last element in the list. function last(List storage _self) internal view returns (Data storage) { return _self.elements[_self.lastIndex()]; } /// @dev Gets the index of the last element in the list. /// /// This function will revert if there are no elements in the list. /// /// @return the index of the last element. function lastIndex(List storage _self) internal view returns (uint256) { uint256 _length = _self.length(); return _length.sub(1, "Pool.List: list is empty"); } /// @dev Gets the number of elements in the list. /// /// @return the number of elements. function length(List storage _self) internal view returns (uint256) { return _self.elements.length; } } // File contracts/farm/Stake.sol /* Copyright 2021 Cook Finance. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.6.2; /// @title Stake /// /// @dev A library which provides the Stake data struct and associated functions. library Stake { using FixedPointMath for FixedPointMath.uq192x64; using Pool for Pool.Data; using SafeMath for uint256; using Stake for Stake.Data; struct Data { Deposit[] deposits; uint256 totalDeposited; uint256 totalUnclaimed; FixedPointMath.uq192x64 lastAccumulatedWeight; } function update(Data storage _self, Pool.Data storage _pool, Pool.Context storage _ctx) internal { _self.totalUnclaimed = _self.getUpdatedTotalUnclaimed(_pool, _ctx); _self.lastAccumulatedWeight = _pool.getUpdatedAccumulatedRewardWeight(_ctx); } function getUpdatedTotalUnclaimed(Data storage _self, Pool.Data storage _pool, Pool.Context storage _ctx) internal view returns (uint256) { FixedPointMath.uq192x64 memory _currentAccumulatedWeight = _pool.getUpdatedAccumulatedRewardWeight(_ctx); FixedPointMath.uq192x64 memory _lastAccumulatedWeight = _self.lastAccumulatedWeight; if (_currentAccumulatedWeight.cmp(_lastAccumulatedWeight) == 0) { return _self.totalUnclaimed; } uint256 _distributedAmount = _currentAccumulatedWeight .sub(_lastAccumulatedWeight) .mul(_self.totalDeposited) .decode(); return _self.totalUnclaimed.add(_distributedAmount); } } struct Deposit { uint256 amount; uint256 timestamp; } // File contracts/farm/ReferralPower.sol /* Copyright 2021 Cook Finance. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.6.2; /// @title ReferralPower /// /// @dev A library which provides the ReferralPower data struct and associated functions. library ReferralPower { using FixedPointMath for FixedPointMath.uq192x64; using Pool for Pool.Data; using SafeMath for uint256; using ReferralPower for ReferralPower.Data; struct Data { uint256 totalDeposited; uint256 totalReferralPower; FixedPointMath.uq192x64 lastAccumulatedReferralPower; } function update(Data storage _self, Pool.Data storage _pool, Pool.Context storage _ctx) internal { _self.totalReferralPower = _self.getUpdatedTotalReferralPower(_pool, _ctx); _self.lastAccumulatedReferralPower = _pool.getUpdatedAccumulatedReferralWeight(_ctx); } function getUpdatedTotalReferralPower(Data storage _self, Pool.Data storage _pool, Pool.Context storage _ctx) internal view returns (uint256) { FixedPointMath.uq192x64 memory _currentAccumulatedReferralPower = _pool.getUpdatedAccumulatedReferralWeight(_ctx); FixedPointMath.uq192x64 memory lastAccumulatedReferralPower = _self.lastAccumulatedReferralPower; if (_currentAccumulatedReferralPower.cmp(lastAccumulatedReferralPower) == 0) { return _self.totalReferralPower; } uint256 _distributedAmount = _currentAccumulatedReferralPower .sub(lastAccumulatedReferralPower) .mul(_self.totalDeposited) .decode(); return _self.totalReferralPower.add(_distributedAmount); } } // File contracts/farm/StakingPool.sol /* Copyright 2021 Cook Finance. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ pragma solidity ^0.6.2; // import "hardhat/console.sol"; /// @dev A contract which allows users to stake to farm tokens. /// /// This contract was inspired by Chef Nomi's 'MasterChef' contract which can be found in this /// repository: https://github.com/sushiswap/sushiswap. contract StakingPools is ReentrancyGuard { using FixedPointMath for FixedPointMath.uq192x64; using Pool for Pool.Data; using Pool for Pool.List; using SafeERC20 for IERC20; using SafeMath for uint256; using Stake for Stake.Data; using ReferralPower for ReferralPower.Data; event PendingGovernanceUpdated( address pendingGovernance ); event GovernanceUpdated( address governance ); event RewardRateUpdated( uint256 rewardRate ); event PoolRewardWeightUpdated( uint256 indexed poolId, uint256 rewardWeight ); event PoolCreated( uint256 indexed poolId, IERC20 indexed token, uint256 vestingDurationInSecs, uint256 depositLockPeriodInSecs ); event TokensDeposited( address indexed user, uint256 indexed poolId, uint256 amount ); event TokensWithdrawn( address indexed user, uint256 indexed poolId, uint256 amount ); event TokensClaimed( address indexed user, uint256 indexed poolId, uint256 amount ); event PauseUpdated( bool status ); event SentinelUpdated( address sentinel ); event RewardVestingUpdated( IRewardVesting rewardVesting ); event NewReferralAdded( address referral, address referee ); event StartPoolReferralCompetition( uint256 indexed poolId ); event StopPoolReferralCompetition( uint256 indexed poolId ); event LockUpPeriodInSecsUpdated ( uint256 indexed poolId, uint256 oldLockPeriodInSecs, uint256 newLockPeriodInSecs ); event VestingDurationInSecsUpdated ( uint256 indexed poolId, uint256 oldDurationInSecs, uint256 newDurationInSecs ); /// @dev The token which will be minted as a reward for staking. IERC20 public reward; /// @dev The address of reward vesting. IRewardVesting public rewardVesting; /// @dev The address of the account which currently has administrative capabilities over this contract. address public governance; address public pendingGovernance; /// @dev The address of the account which can perform emergency activities address public sentinel; /// @dev Tokens are mapped to their pool identifier plus one. Tokens that do not have an associated pool /// will return an identifier of zero. mapping(IERC20 => uint256) public tokenPoolIds; /// @dev The context shared between the pools. Pool.Context private _ctx; /// @dev A list of all of the pools. Pool.List private _pools; uint256 constant public SECONDS_PER_DAY = 86400; /// @dev A mapping of all of the user stakes mapped first by pool and then by address. mapping(address => mapping(uint256 => Stake.Data)) private _stakes; /// @dev A mapping of all of the referral power mapped first by pool and then by address. mapping(address => mapping(uint256 => ReferralPower.Data)) private _referralPowers; /// @dev A mapping of all of the referee staker power mapped first by referee and then by pool id to get referral address. mapping(address => mapping(uint256 => address)) public myReferral; /// @dev A mapping of known referrals mapped first by pool and then by address. mapping(address => mapping(uint256 => bool)) public referralIsKnown; /// @dev A mapping of referral Address mapped first by pool and then by nextReferral. mapping(uint256 => mapping(uint256 => address)) public referralList; /// @dev index record next user index mapped by pool mapping(uint256 => uint256) public nextReferral; // @dev A mapping of all of the referee staker referred by me. Mapping as by pool id and then by my address then referee array mapping(uint256 => mapping(address => address[])) public myreferees; /// @dev A flag indicating if claim should be halted bool public pause; constructor( IMintableERC20 _reward, address _governance, address _sentinel, IRewardVesting _rewardVesting ) public { require(_governance != address(0), "StakingPools: governance address cannot be 0x0"); require(_sentinel != address(0), "StakingPools: sentinel address cannot be 0x0"); reward = _reward; governance = _governance; sentinel = _sentinel; rewardVesting = _rewardVesting; } /// @dev A modifier which reverts when the caller is not the governance. modifier onlyGovernance() { require(msg.sender == governance, "StakingPools: only governance"); _; } ///@dev modifier add referral to referrallist. Users are indexed in order to keep track of modifier checkIfNewReferral(uint256 pid, address referral) { Pool.Data storage _pool = _pools.get(pid); if (_pool.onReferralBonus && referral != address(0)) { if (!referralIsKnown[referral][pid]) { referralList[pid][nextReferral[pid]] = referral; referralIsKnown[referral][pid] = true; nextReferral[pid]++; emit NewReferralAdded(referral, msg.sender); } // add referee to referral's myreferee array bool toAdd = true; address refereeAddr = msg.sender; address[] storage referees = myreferees[pid][referral]; for (uint256 i = 0; i < referees.length; i++) { if (referees[i] == refereeAddr) { toAdd = false; } } if (toAdd) { referees.push(refereeAddr); } } _; } /// @dev Sets the governance. /// /// This function can only called by the current governance. /// /// @param _pendingGovernance the new pending governance. function setPendingGovernance(address _pendingGovernance) external onlyGovernance { require(_pendingGovernance != address(0), "StakingPools: pending governance address cannot be 0x0"); pendingGovernance = _pendingGovernance; emit PendingGovernanceUpdated(_pendingGovernance); } function acceptGovernance() external { require(msg.sender == pendingGovernance, "StakingPools: only pending governance"); addr... // [truncated — 70107 bytes total]
Read Contract
SECONDS_PER_DAY 0x74f0314f → uint256
getAccumulatedReferralPower 0x8dc9144a → uint256
getPoolLockPeriodInSecs 0xe281dfef → uint256
getPoolReferral 0xe5f49cf8 → address
getPoolRewardRate 0x895a9e09 → uint256
getPoolRewardWeight 0x5ac2f301 → uint256
getPoolToken 0xeda7c599 → address
getPoolTotalDeposited 0x6e5105c2 → uint256
getPoolTotalReferralAmount 0x488766a2 → uint256
getPoolVestingDurationInSecs 0xca3b76b7 → uint256
getPoolreferee 0xbff7bcb5 → address[]
getStakeTotalDeposited 0xacfc5b6d → uint256
getStakeTotalUnclaimed 0x7fd115d7 → uint256
getUserDeposits 0xbc25973a → tuple[]
getWithdrawableAmount 0x359cd45e → uint256
governance 0x5aa6e675 → address
isPoolReferralProgramOn 0x411208ad → bool
myReferral 0x772336f0 → address
myreferees 0xb775f100 → address
nextReferral 0x2fd8a62b → uint256
pause 0x8456cb59 → bool
pendingGovernance 0xf39c38a0 → address
poolCount 0xf525cb68 → uint256
referralIsKnown 0x40176019 → bool
referralList 0x05287533 → address
reward 0x228cb733 → address
rewardRate 0x7b0a47ee → uint256
rewardVesting 0xb50224b5 → address
sentinel 0xf58c251c → address
tokenPoolIds 0x39664a31 → uint256
totalRewardWeight 0xd64b84b5 → uint256
Write Contract 16 functions
These functions modify contract state and require a wallet transaction to execute.
acceptGovernance 0x238efcbc
No parameters
claim 0x379607f5
uint256 _poolId
createPool 0x37578cb3
address _token
bool _needVesting
uint256 _vestingDurationInSecs
uint256 _depositLockPeriodInSecs
returns: uint256
deposit 0x8dbdbe6d
uint256 _poolId
uint256 _depositAmount
address referral
exit 0x7f8661a1
uint256 _poolId
setPause 0xbedb86fb
bool _pause
setPendingGovernance 0x0abb6035
address _pendingGovernance
setPoolLockUpPeriodInSecs 0x532c5912
uint256 _poolId
uint256 _newLockUpPeriodInSecs
setPoolVestingDurationInSecs 0xc487622f
uint256 _poolId
uint256 _newVestingDurationInSecs
setRewardRate 0x9e447fc6
uint256 _rewardRate
setRewardVesting 0x8e73c93a
address _rewardVesting
setRewardWeights 0x0361ca5a
uint256[] _rewardWeights
setSentinel 0x09dac061
address _sentinel
startReferralBonus 0x2e0a8b95
uint256 _poolId
stoptReferralBonus 0x6ce13743
uint256 _poolId
withdraw 0x441a3e70
uint256 _poolId
uint256 _withdrawAmount
Recent Transactions
No transactions found for this address