Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xD9BecdB8290077fAf79A2637a5f2FDf5033b2486
Balance 0 ETH
Nonce 1
Code Size 16084 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

16084 bytes
0x608060405234801561001057600080fd5b50600436106101585760003560e01c8063715018a6116100c3578063b56cb4621161007c578063b56cb46214610350578063b67de3ed1461036c578063ce9312ce14610376578063eb37acfc14610392578063f2fde38b146103ae578063ff77351e146103ca57610158565b8063715018a6146102c45780637d454c91146102ce5780638da5cb5b146102ec57806396c82e571461030a578063a2aa9de814610328578063a52042491461034657610158565b80633ae25916116101155780633ae25916146101fb5780633f222b2e146102305780635bf56bc41461023a5780636386c1c7146102565780636b62e0291461028a57806370740aab146102a657610158565b80630ee1e1751461015d578063132c4feb1461017b5780632d2c44f2146101995780632e1a7d4d146101b75780633804bc49146101d35780633ad10ef6146101dd575b600080fd5b6101656103fe565b604051610172919061336c565b60405180910390f35b610183610424565b60405161019091906135c4565b60405180910390f35b6101a161042a565b6040516101ae9190613387565b60405180910390f35b6101d160048036038101906101cc9190612e79565b610450565b005b6101db6107dd565b005b6101e5610bda565b6040516101f29190613276565b60405180910390f35b61021560048036038101906102109190612ddf565b610c00565b604051610227969594939291906136f3565b60405180910390f35b610238610c3c565b005b610254600480360381019061024f9190612ed3565b610d78565b005b610270600480360381019061026b9190612ddf565b6111d8565b6040516102819594939291906136a0565b60405180910390f35b6102a4600480360381019061029f9190612e0c565b611628565b005b6102ae61176d565b6040516102bb9190613351565b60405180910390f35b6102cc611780565b005b6102d6611808565b6040516102e391906135c4565b60405180910390f35b6102f461180e565b6040516103019190613276565b60405180910390f35b610312611837565b60405161031f91906135c4565b60405180910390f35b61033061183d565b60405161033d9190613351565b60405180910390f35b61034e611850565b005b61036a60048036038101906103659190612f13565b611947565b005b610374611acc565b005b610390600480360381019061038b9190612e79565b612008565b005b6103ac60048036038101906103a79190612e79565b6121b5565b005b6103c860048036038101906103c39190612ddf565b612490565b005b6103e460048036038101906103df9190612e79565b612588565b6040516103f595949392919061364d565b60405180910390f35b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414156104d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104cd90613504565b60405180910390fd5b6002600154141561051c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161051390613584565b60405180910390fd5b60026001819055506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016105c49190613276565b60206040518083038186803b1580156105dc57600080fd5b505afa1580156105f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106149190612ea6565b905061061e6125db565b6000600454828460000154610633919061380d565b61063d91906137dc565b9050838360040154826106509190613867565b1015610691576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610688906134a4565b60405180910390fd5b610699612641565b6000818460010154866106ac919061380d565b6106b691906137dc565b9050808460010160008282546106cc9190613867565b9250508190555080600560008282546106e59190613867565b92505081905550600083600454876106fd919061380d565b61070791906137dc565b90508085600001600082825461071d9190613867565b9250508190555080600460008282546107369190613867565b9250508190555061078a3387600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166127d19092919063ffffffff16565b853373ffffffffffffffffffffffffffffffffffffffff167fb244b9a17ad633c6e83b7983ee04320484956a68ddbe96a0b70dfca1cf19d72360405160405180910390a350505050506001808190555050565b600760009054906101000a900460ff161561082d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610824906135a4565b60405180910390fd5b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414156108b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108aa90613504565b60405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016109109190613276565b60206040518083038186803b15801561092857600080fd5b505afa15801561093c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109609190612ea6565b905060008114156109a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099d90613444565b60405180910390fd5b6109ae612641565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060c0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152505090506000600454838360000151610a4d919061380d565b610a5791906137dc565b9050816000015160046000828254610a6f9190613867565b92505081905550816020015160056000828254610a8c9190613867565b925050819055506040518060c0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815250600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050155905050610b913382600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166127d19092919063ffffffff16565b803373ffffffffffffffffffffffffffffffffffffffff167fb244b9a17ad633c6e83b7983ee04320484956a68ddbe96a0b70dfca1cf19d72360405160405180910390a3505050565b600760029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60096020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050154905086565b600760009054906101000a900460ff16610c8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8290613524565b60405180910390fd5b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415610d11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0890613504565b60405180910390fd5b60026001541415610d57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4e90613584565b60405180910390fd5b6002600181905550610d676125db565b610d6f612641565b60018081905550565b60026001541415610dbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db590613584565b60405180910390fd5b60026001819055506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415610e4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4390613504565b60405180910390fd5b60088181548110610e6057610e5f6139bc565b5b906000526020600020906005020160040160009054906101000a900460ff16610ebe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb590613544565b60405180910390fd5b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050610f096125db565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610f669190613276565b60206040518083038186803b158015610f7e57600080fd5b505afa158015610f92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb69190612ea6565b90506000600454828460000154610fcd919061380d565b610fd791906137dc565b905084836004015482610fea9190613867565b101561102b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102290613464565b60405180910390fd5b600083600401541461107e578260030154841461107d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107490613424565b60405180910390fd5b5b60004284600501541015801561109957506000846004015414155b156110b9576110b2846004015487866005015488612857565b90506110ed565b600885815481106110cd576110cc6139bc565b5b906000526020600020906005020160010154426110ea9190613786565b90505b600082856001015488611100919061380d565b61110a91906137dc565b9050600061111887836128d6565b9050611122612641565b8686600301819055508786600401600082825461113f9190613786565b92505081905550828660050181905550808660010160008282546111639190613786565b92505081905550806005600082825461117c9190613786565b92505081905550873373ffffffffffffffffffffffffffffffffffffffff167f8c9e571bc1b7342cfe6c78f8375b579446d31400db4bd1416f26f497c99f1b3360405160405180910390a3505050505050600180819055505050565b600080600080600080600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060c00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481525050905060008160000151111561160b576000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639d44c9b46040518163ffffffff1660e01b815260040160206040518083038186803b1580156112e057600080fd5b505afa1580156112f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113189190612ea6565b600554611325919061380d565b826020015183604001514261133a9190613867565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637c02f6dd306040518263ffffffff1660e01b81526004016113959190613276565b60206040518083038186803b1580156113ad57600080fd5b505afa1580156113c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e59190612ea6565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663628b38dd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561144d57600080fd5b505afa158015611461573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114859190612ea6565b61148f919061380d565b611499919061380d565b6114a3919061380d565b6114ad91906137dc565b90506000600454600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161150f9190613276565b60206040518083038186803b15801561152757600080fd5b505afa15801561153b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155f9190612ea6565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546115ac919061380d565b6115b691906137dc565b9050428360a0015111156115f257428360a001516115d49190613867565b8360800151846060015184849750975097509750975050505061161f565b600080600084849750975097509750975050505061161f565b600080600080600095509550955095509550505b91939590929450565b611630612983565b73ffffffffffffffffffffffffffffffffffffffff1661164e61180e565b73ffffffffffffffffffffffffffffffffffffffff16146116a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169b906134c4565b60405180910390fd5b80600760016101000a81548160ff02191690831515021790555081600760026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fea226c8708c7690f06aa5bf670b5f1a2569de7ce393c874bd66aff5e45400bd6600760029054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760019054906101000a900460ff166040516117619291906132c8565b60405180910390a15050565b600760019054906101000a900460ff1681565b611788612983565b73ffffffffffffffffffffffffffffffffffffffff166117a661180e565b73ffffffffffffffffffffffffffffffffffffffff16146117fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f3906134c4565b60405180910390fd5b611806600061298b565b565b60065481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60055481565b600760009054906101000a900460ff1681565b611858612983565b73ffffffffffffffffffffffffffffffffffffffff1661187661180e565b73ffffffffffffffffffffffffffffffffffffffff16146118cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c3906134c4565b60405180910390fd5b600760009054906101000a900460ff1615600760006101000a81548160ff021916908315150217905550426006819055507f8a11b47e58360bc9a2f4945155f0de108706ee4c0ca25d5423eb5cb518d9f52a30600760009054906101000a900460ff1660405161193d9291906132c8565b60405180910390a1565b61194f612983565b73ffffffffffffffffffffffffffffffffffffffff1661196d61180e565b73ffffffffffffffffffffffffffffffffffffffff16146119c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ba906134c4565b60405180910390fd5b6119cb612d45565b8481600001818152505062015180846119e4919061380d565b8160200181815250508281604001818152505081816060018181525050600181608001901515908115158152505060088190806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff02191690831515021790555050507f5cfb6a22497b0a4188c0c67ea0e3c371f8885f3b83bef02726c27ff19b0ecc9485858585604051611abd9493929190613608565b60405180910390a15050505050565b60026001541415611b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0990613584565b60405180910390fd5b60026001819055506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415611ba0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9790613504565b60405180910390fd5b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060c001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815250509050428160a0015111611c70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6790613404565b60405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611ccd9190613276565b60206040518083038186803b158015611ce557600080fd5b505afa158015611cf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1d9190612ea6565b90506000600454828460000151611d34919061380d565b611d3e91906137dc565b905060006008846060015181548110611d5a57611d596139bc565b5b90600052602060002090600502016040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff16151515158152505090506000816060015182604001518660800151611dd3919061380d565b611ddd91906137dc565b90508083611deb9190613867565b9250846000015160046000828254611e039190613867565b92505081905550846020015160056000828254611e209190613867565b925050819055506040518060c0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815250600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050155905050600760019054906101000a900460ff1615611f6957611f68600760029054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a83611f2091906137dc565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166127d19092919063ffffffff16565b5b611fb63384600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166127d19092919063ffffffff16565b823373ffffffffffffffffffffffffffffffffffffffff167f7d559f0b1f3ca5033a403dcb4e149e04f110489f92d867bb940b7e90391cefaa60405160405180910390a3505050505060018081905550565b612010612983565b73ffffffffffffffffffffffffffffffffffffffff1661202e61180e565b73ffffffffffffffffffffffffffffffffffffffff1614612084576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207b906134c4565b60405180910390fd5b806000108015612098575060088054905081105b6120d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ce906133c4565b60405180910390fd5b600881815481106120eb576120ea6139bc565b5b906000526020600020906005020160040160009054906101000a900460ff16156008828154811061211f5761211e6139bc565b5b906000526020600020906005020160040160006101000a81548160ff0219169083151502179055507fe84b561e1534a08cb9d7d8a90b99e407426f1b33c86024d6ade79a0153d015b1816008838154811061217d5761217c6139bc565b5b906000526020600020906005020160040160009054906101000a900460ff166040516121aa9291906135df565b60405180910390a150565b600760009054906101000a900460ff16612204576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121fb90613524565b60405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016122619190613276565b60206040518083038186803b15801561227957600080fd5b505afa15801561228d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b19190612ea6565b9050612302333084600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612a4f909392919063ffffffff16565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816000015414612366576123596125db565b612361612641565b612370565b4281600201819055505b60045482148061238257506000600454145b156123c0578281600001600082825461239b9190613786565b9250508190555082600460008282546123b49190613786565b92505081905550612413565b600082600454856123d1919061380d565b6123db91906137dc565b9050808260000160008282546123f19190613786565b92505081905550806004600082825461240a9190613786565b92505081905550505b828160010160008282546124279190613786565b9250508190555082600560008282546124409190613786565b92505081905550823373ffffffffffffffffffffffffffffffffffffffff167fdae4417c25a93cfb86ce5fbbb8fc1630945b61afaeab4f29cf301b9a058ba91460405160405180910390a3505050565b612498612983565b73ffffffffffffffffffffffffffffffffffffffff166124b661180e565b73ffffffffffffffffffffffffffffffffffffffff161461250c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612503906134c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561257c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612573906133e4565b60405180910390fd5b6125858161298b565b50565b6008818154811061259857600080fd5b90600052602060002090600502016000915090508060000154908060010154908060020154908060030154908060040160009054906101000a900460ff16905085565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090504281600501541161263e5760008160040181905550600081600301819055505b50565b6000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160020154426126969190613867565b9050600760009054906101000a900460ff166126c15781600201546006546126be9190613867565b90505b6301e133808111156126d5576301e1338090505b60008260010154826126e7919061380d565b9050428360020181905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166329851fd933836005546040518463ffffffff1660e01b81526004016127539392919061331a565b600060405180830381600087803b15801561276d57600080fd5b505af1158015612781573d6000803e3d6000fd5b50505050600115153373ffffffffffffffffffffffffffffffffffffffff167f650639b17ab5dbad2d79a2e4757e3be67a53db225cede5d96cb5ab54837b85ce60405160405180910390a3505050565b6128528363a9059cbb60e01b84846040516024016127f09291906132f1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612ad8565b505050565b600080426008848154811061286f5761286e6139bc565b5b90600052602060002090600502016001015461288b9190613786565b90506000858761289b9190613786565b82876128a7919061380d565b86896128b3919061380d565b6128bd9190613786565b6128c791906137dc565b90508092505050949350505050565b6000600883815481106128ec576128eb6139bc565b5b906000526020600020906005020160040160009054906101000a900460ff16156129785760088381548110612924576129236139bc565b5b906000526020600020906005020160030154826008858154811061294b5761294a6139bc565b5b906000526020600020906005020160000154612967919061380d565b61297191906137dc565b905061297d565b600090505b92915050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612ad2846323b872dd60e01b858585604051602401612a7093929190613291565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612ad8565b50505050565b6000612b3a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612b9f9092919063ffffffff16565b9050600081511115612b9a5780806020019051810190612b5a9190612e4c565b612b99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b9090613564565b60405180910390fd5b5b505050565b6060612bae8484600085612bb7565b90509392505050565b606082471015612bfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bf390613484565b60405180910390fd5b612c0585612ccb565b612c44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c3b906134e4565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612c6d919061325f565b60006040518083038185875af1925050503d8060008114612caa576040519150601f19603f3d011682016040523d82523d6000602084013e612caf565b606091505b5091509150612cbf828286612cde565b92505050949350505050565b600080823b905060008111915050919050565b60608315612cee57829050612d3e565b600083511115612d015782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d3591906133a2565b60405180910390fd5b9392505050565b6040518060a00160405280600081526020016000815260200160008152602001600081526020016000151581525090565b600081359050612d8581613e59565b92915050565b600081359050612d9a81613e70565b92915050565b600081519050612daf81613e70565b92915050565b600081359050612dc481613e87565b92915050565b600081519050612dd981613e87565b92915050565b600060208284031215612df557612df46139eb565b5b6000612e0384828501612d76565b91505092915050565b60008060408385031215612e2357612e226139eb565b5b6000612e3185828601612d76565b9250506020612e4285828601612d8b565b9150509250929050565b600060208284031215612e6257612e616139eb565b5b6000612e7084828501612da0565b91505092915050565b600060208284031215612e8f57612e8e6139eb565b5b6000612e9d84828501612db5565b91505092915050565b600060208284031215612ebc57612ebb6139eb565b5b6000612eca84828501612dca565b91505092915050565b60008060408385031215612eea57612ee96139eb565b5b6000612ef885828601612db5565b9250506020612f0985828601612db5565b9150509250929050565b60008060008060808587031215612f2d57612f2c6139eb565b5b6000612f3b87828801612db5565b9450506020612f4c87828801612db5565b9350506040612f5d87828801612db5565b9250506060612f6e87828801612db5565b91505092959194509250565b612f838161389b565b82525050565b612f92816138ad565b82525050565b6000612fa382613754565b612fad818561376a565b9350612fbd81856020860161392b565b80840191505092915050565b612fd2816138e3565b82525050565b612fe1816138f5565b82525050565b6000612ff28261375f565b612ffc8185613775565b935061300c81856020860161392b565b613015816139f0565b840191505092915050565b600061302d603c83613775565b915061303882613a01565b604082019050919050565b6000613050602683613775565b915061305b82613a50565b604082019050919050565b6000613073601f83613775565b915061307e82613a9f565b602082019050919050565b6000613096603783613775565b91506130a182613ac8565b604082019050919050565b60006130b9602183613775565b91506130c482613b17565b604082019050919050565b60006130dc604183613775565b91506130e782613b66565b606082019050919050565b60006130ff602683613775565b915061310a82613bdb565b604082019050919050565b6000613122604383613775565b915061312d82613c2a565b606082019050919050565b6000613145602083613775565b915061315082613c9f565b602082019050919050565b6000613168601d83613775565b915061317382613cc8565b602082019050919050565b600061318b602183613775565b915061319682613cf1565b604082019050919050565b60006131ae601b83613775565b91506131b982613d40565b602082019050919050565b60006131d1602983613775565b91506131dc82613d69565b604082019050919050565b60006131f4602a83613775565b91506131ff82613db8565b604082019050919050565b6000613217601f83613775565b915061322282613e07565b602082019050919050565b600061323a601f83613775565b915061324582613e30565b602082019050919050565b613259816138d9565b82525050565b600061326b8284612f98565b915081905092915050565b600060208201905061328b6000830184612f7a565b92915050565b60006060820190506132a66000830186612f7a565b6132b36020830185612f7a565b6132c06040830184613250565b949350505050565b60006040820190506132dd6000830185612f7a565b6132ea6020830184612f89565b9392505050565b60006040820190506133066000830185612f7a565b6133136020830184613250565b9392505050565b600060608201905061332f6000830186612f7a565b61333c6020830185613250565b6133496040830184613250565b949350505050565b60006020820190506133666000830184612f89565b92915050565b60006020820190506133816000830184612fc9565b92915050565b600060208201905061339c6000830184612fd8565b92915050565b600060208201905081810360008301526133bc8184612fe7565b905092915050565b600060208201905081810360008301526133dd81613020565b9050919050565b600060208201905081810360008301526133fd81613043565b9050919050565b6000602082019050818103600083015261341d81613066565b9050919050565b6000602082019050818103600083015261343d81613089565b9050919050565b6000602082019050818103600083015261345d816130ac565b9050919050565b6000602082019050818103600083015261347d816130cf565b9050919050565b6000602082019050818103600083015261349d816130f2565b9050919050565b600060208201905081810360008301526134bd81613115565b9050919050565b600060208201905081810360008301526134dd81613138565b9050919050565b600060208201905081810360008301526134fd8161315b565b9050919050565b6000602082019050818103600083015261351d8161317e565b9050919050565b6000602082019050818103600083015261353d816131a1565b9050919050565b6000602082019050818103600083015261355d816131c4565b9050919050565b6000602082019050818103600083015261357d816131e7565b9050919050565b6000602082019050818103600083015261359d8161320a565b9050919050565b600060208201905081810360008301526135bd8161322d565b9050919050565b60006020820190506135d96000830184613250565b92915050565b60006040820190506135f46000830185613250565b6136016020830184612f89565b9392505050565b600060808201905061361d6000830187613250565b61362a6020830186613250565b6136376040830185613250565b6136446060830184613250565b95945050505050565b600060a0820190506136626000830188613250565b61366f6020830187613250565b61367c6040830186613250565b6136896060830185613250565b6136966080830184612f89565b9695505050505050565b600060a0820190506136b56000830188613250565b6136c26020830187613250565b6136cf6040830186613250565b6136dc6060830185613250565b6136e96080830184613250565b9695505050505050565b600060c0820190506137086000830189613250565b6137156020830188613250565b6137226040830187613250565b61372f6060830186613250565b61373c6080830185613250565b61374960a0830184613250565b979650505050505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000613791826138d9565b915061379c836138d9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156137d1576137d061395e565b5b828201905092915050565b60006137e7826138d9565b91506137f2836138d9565b9250826138025761380161398d565b5b828204905092915050565b6000613818826138d9565b9150613823836138d9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561385c5761385b61395e565b5b828202905092915050565b6000613872826138d9565b915061387d836138d9565b9250828210156138905761388f61395e565b5b828203905092915050565b60006138a6826138b9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006138ee82613907565b9050919050565b600061390082613907565b9050919050565b600061391282613919565b9050919050565b6000613924826138b9565b9050919050565b60005b8381101561394957808201518184015260208101905061392e565b83811115613958576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f54656c6c65723a2043757272656e7420696e646578206973206e6f74206c697360008201527f74656420696e2074686520636f6d6d69746d656e742061727261792e00000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f54656c6c65723a204e6f20636f6d6d69746d656e7420746f20627265616b2e00600082015250565b7f54656c6c65723a20436f6d6d69746d656e7420696e646578206973206e6f742060008201527f7468652073616d652061732070726f766964657273272e000000000000000000602082015250565b7f54656c6c65723a20436f6e74726163742062616c616e6365206973207a65726f60008201527f2e00000000000000000000000000000000000000000000000000000000000000602082015250565b7f54656c6c65723a2050726f7669646572206861736e277420676f7420656e6f7560008201527f6768206465706f7369746564204c5020746f6b656e7320746f20636f6d6d697460208201527f2e00000000000000000000000000000000000000000000000000000000000000604082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f54656c6c65723a2050726f7669646572206861736e277420676f7420656e6f7560008201527f6768206465706f7369746564204c5020746f6b656e7320746f2077697468647260208201527f61772e0000000000000000000000000000000000000000000000000000000000604082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f54656c6c65723a2043616c6c6572206973206e6f7420612070726f766964657260008201527f2e00000000000000000000000000000000000000000000000000000000000000602082015250565b7f54656c6c65723a2054656c6c6572206973206e6f74206f70656e2e0000000000600082015250565b7f54656c6c65723a2043757272656e7420636f6d6d69746d656e74206973206e6f60008201527f74206163746976652e0000000000000000000000000000000000000000000000602082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b7f54656c6c65723a2054656c6c6572206973207374696c6c206163746976652e00600082015250565b613e628161389b565b8114613e6d57600080fd5b50565b613e79816138ad565b8114613e8457600080fd5b50565b613e90816138d9565b8114613e9b57600080fd5b5056fea2646970667358221220382807f1ce18bb83002982dedb1d59e94d7d68b94cb8c64a6d1f0d9d003b78ae64736f6c63430008070033

Verified Source Code Full Match

Compiler: v0.8.7+commit.e28d00a7 EVM: london Optimization: No
Teller.sol 496 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.6;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IVault.sol";

/**
 * @title Teller Contract
 */
contract Teller is Ownable, ReentrancyGuard {
    using Address for address;
    using SafeERC20 for IERC20;

    /// @notice Event emitted on construction.
    event TellerDeployed();

    /// @notice Event emitted when teller status is toggled.
    event TellerToggled(address teller, bool status);

    /// @notice Event emitted when new commitment is added.
    event NewCommitmentAdded(
        uint256 bonus,
        uint256 time,
        uint256 penalty,
        uint256 deciAdjustment
    );

    /// @notice Event emitted when commitment status is toggled.
    event CommitmentToggled(uint256 index, bool status);

    /// @notice Event emitted when owner sets the dev address to get the break commitment fees.
    event PurposeSet(address devAddress, bool purposeStatus);

    /// @notice Event emitted when a provider deposits lp tokens.
    event LpDeposited(address indexed provider, uint256 indexed amount);

    /// @notice Event emitted when a provider withdraws lp tokens.
    event Withdrew(address indexed provider, uint256 indexed amount);

    /// @notice Event emitted when a provider commits lp tokens.
    event Commited(address indexed provider, uint256 indexed commitedAmount);

    /// @notice Event emitted when a provider breaks the commitment.
    event CommitmentBroke(address indexed provider, uint256 indexed tokenSentAmount);

    /// @notice Event emitted when provider claimed rewards.
    event Claimed(address indexed provider, bool indexed success);

    struct Provider {
        uint256 LPDepositedRatio;
        uint256 userWeight;
        uint256 lastClaimedTime;
        uint256 commitmentIndex;
        uint256 committedAmount;
        uint256 commitmentEndTime;
    }

    struct Commitment {
        uint256 bonus;
        uint256 duration;
        uint256 penalty;
        uint256 deciAdjustment;
        bool isActive;
    }

    IVault public Vault;
    IERC20 public LpToken;

    uint256 public totalLP;
    uint256 public totalWeight;
    uint256 public tellerClosedTime;

    bool public tellerOpen;
    bool public purpose;

    address public devAddress;

    Commitment[] public commitmentInfo;

    mapping(address => Provider) public providerInfo;

    modifier isTellerOpen() {
        require(tellerOpen, "Teller: Teller is not open.");
        _;
    }

    modifier isProvider() {
        require(
            providerInfo[msg.sender].LPDepositedRatio != 0,
            "Teller: Caller is not a provider."
        );
        _;
    }

    modifier isTellerClosed() {
        require(!tellerOpen, "Teller: Teller is still active.");
        _;
    }

    /**
     * @dev Constructor function
     * @param _LpToken Interface of LP token
     * @param _Vault Interface of Vault
     */
    constructor(IERC20 _LpToken, IVault _Vault) {
        LpToken = _LpToken;
        Vault = _Vault;
        commitmentInfo.push();

        emit TellerDeployed();
    }

    /**
     * @dev External function to toggle the teller. This function can be called only by the owner.
     */
    function toggleTeller() external onlyOwner {
        tellerOpen = !tellerOpen;
        tellerClosedTime = block.timestamp;
        emit TellerToggled(address(this), tellerOpen);
    }

    /**
     * @dev External function to add a commitment option. This function can be called only by the owner.
     * @param _bonus Amount of bonus
     * @param _days Commitment duration in days
     * @param _penalty The penalty
     * @param _deciAdjustment Decimal percentage
     */
    function addCommitment(
        uint256 _bonus,
        uint256 _days,
        uint256 _penalty,
        uint256 _deciAdjustment
    ) external onlyOwner {
        Commitment memory holder;

        holder.bonus = _bonus;
        holder.duration = _days * 1 days;
        holder.penalty = _penalty;
        holder.deciAdjustment = _deciAdjustment;
        holder.isActive = true;

        commitmentInfo.push(holder);

        emit NewCommitmentAdded(_bonus, _days, _penalty, _deciAdjustment);
    }

    /**
     * @dev External function to toggle the commitment. This function can be called only by the owner.
     * @param _index Commitment index
     */
    function toggleCommitment(uint256 _index) external onlyOwner {
        require(
            0 < _index && _index < commitmentInfo.length,
            "Teller: Current index is not listed in the commitment array."
        );
        commitmentInfo[_index].isActive = !commitmentInfo[_index].isActive;

        emit CommitmentToggled(_index, commitmentInfo[_index].isActive);
    }

    /**
     * @dev External function to set the dev address to give that address the break commitment fees. This function can be called only by the owner.
     * @param _address Dev address
     * @param _status If purpose is active or not
     */
    function setPurpose(address _address, bool _status) external onlyOwner {
        purpose = _status;
        devAddress = _address;

        emit PurposeSet(devAddress, purpose);
    }

    /**
     * @dev External function for providers to deposit lp tokens. Teller must be open.
     * @param _amount LP token amount
     */
    function depositLP(uint256 _amount) external isTellerOpen {
        uint256 contractBalance = LpToken.balanceOf(address(this));
        LpToken.safeTransferFrom(msg.sender, address(this), _amount);

        Provider storage user = providerInfo[msg.sender];
        if (user.LPDepositedRatio != 0) {
            commitmentFinished();
            claim();
        } else {
            user.lastClaimedTime = block.timestamp;
        }
        if (contractBalance == totalLP || totalLP == 0) {
            user.LPDepositedRatio += _amount;
            totalLP += _amount;
        } else {
            uint256 _adjustedAmount = (_amount * totalLP) / contractBalance;
            user.LPDepositedRatio += _adjustedAmount;
            totalLP += _adjustedAmount;
        }

        user.userWeight += _amount;
        totalWeight += _amount;

        emit LpDeposited(msg.sender, _amount);
    }

    /**
     * @dev External function to withdraw lp token from the teller. This function can be called only by a provider.
     * @param _amount LP token amount
     */
    function withdraw(uint256 _amount) external isProvider nonReentrant {
        Provider storage user = providerInfo[msg.sender];
        uint256 contractBalance = LpToken.balanceOf(address(this));
        commitmentFinished();
        uint256 userTokens = (user.LPDepositedRatio * contractBalance) /
            totalLP;
        require(
            userTokens - user.committedAmount >= _amount,
            "Teller: Provider hasn't got enough deposited LP tokens to withdraw."
        );

        claim();

        uint256 _weightChange = (_amount * user.userWeight) / userTokens;
        user.userWeight -= _weightChange;
        totalWeight -= _weightChange;

        uint256 ratioChange = _amount * totalLP/contractBalance;
        user.LPDepositedRatio -= ratioChange;
        totalLP -= ratioChange;


        LpToken.safeTransfer(msg.sender, _amount);

        emit Withdrew(msg.sender, _amount);
    }

    /**
     * @dev External function to withdraw lp token when teller is closed. This function can be called only by a provider.
     */
    function tellerClosedWithdraw() external isTellerClosed isProvider {
        uint256 contractBalance = LpToken.balanceOf(address(this));
        require(contractBalance != 0, "Teller: Contract balance is zero.");

        claim();

        Provider memory user = providerInfo[msg.sender];

        uint256 userTokens = (user.LPDepositedRatio * contractBalance) /
            totalLP;
        totalLP -= user.LPDepositedRatio;
        totalWeight -= user.userWeight;

        providerInfo[msg.sender] = Provider(0, 0, 0, 0, 0, 0);

        LpToken.safeTransfer(msg.sender, userTokens);

        emit Withdrew(msg.sender, userTokens);
    }

    /**
     * @dev External function to commit lp token to gain a minor advantage for a selected period of time. This function can be called only by a provider.
     * @param _amount LP token amount
     * @param _commitmentIndex Index of commitment array
     */
    function commit(uint256 _amount, uint256 _commitmentIndex)
        external
        nonReentrant
        isProvider
    {
        require(
            commitmentInfo[_commitmentIndex].isActive,
            "Teller: Current commitment is not active."
        );

        Provider storage user = providerInfo[msg.sender];
        commitmentFinished();
        uint256 contractBalance = LpToken.balanceOf(address(this));
        uint256 userTokens = (user.LPDepositedRatio * contractBalance) /
            totalLP;

        require(
            userTokens - user.committedAmount >= _amount,
            "Teller: Provider hasn't got enough deposited LP tokens to commit."
        );

        if (user.committedAmount != 0) {
            require(
                _commitmentIndex == user.commitmentIndex,
                "Teller: Commitment index is not the same as providers'."
            );
        }

        uint256 newEndTime;

        if (
            user.commitmentEndTime >= block.timestamp &&
            user.committedAmount != 0
        ) {
            newEndTime = calculateNewEndTime(
                user.committedAmount,
                _amount,
                user.commitmentEndTime,
                _commitmentIndex
            );
        } else {
            newEndTime =
                block.timestamp +
                commitmentInfo[_commitmentIndex].duration;
        }

        uint256 weightToGain = (_amount * user.userWeight) / userTokens;
        uint256 bonusCredit = commitBonus(_commitmentIndex, weightToGain);

        claim();

        user.commitmentIndex = _commitmentIndex;
        user.committedAmount += _amount;
        user.commitmentEndTime = newEndTime;
        user.userWeight += bonusCredit;
        totalWeight += bonusCredit;

        emit Commited(msg.sender, _amount);
    }

    /**
     * @dev External function to break the commitment. This function can be called only by a provider.
     */
    function breakCommitment() external nonReentrant isProvider {
        Provider memory user = providerInfo[msg.sender];

        require(
            user.commitmentEndTime > block.timestamp,
            "Teller: No commitment to break."
        );

        uint256 contractBalance = LpToken.balanceOf(address(this));

        uint256 tokenToReceive = (user.LPDepositedRatio * contractBalance) /
            totalLP;

        Commitment memory currentCommit = commitmentInfo[user.commitmentIndex];
        
        //fee for breaking the commitment
        uint256 fee = (user.committedAmount * currentCommit.penalty) /
            currentCommit.deciAdjustment;
            
        //fee reduced from provider and left in teller
        tokenToReceive -= fee;

        totalLP -= user.LPDepositedRatio;

        totalWeight -= user.userWeight;

        providerInfo[msg.sender] = Provider(0, 0, 0, 0, 0, 0);
        
        //if a devloper purpose is set then transfer to address
        if (purpose) {
            LpToken.safeTransfer(devAddress, fee / 10);
        }
        
        //Fee is not lost it is dispersed to remaining providers. 
        LpToken.safeTransfer(msg.sender, tokenToReceive);

        emit CommitmentBroke(msg.sender, tokenToReceive);
    }

    /**
     * @dev Internal function to claim rewards.
     */
    function claim() internal {
        Provider storage user = providerInfo[msg.sender];
        uint256 timeGap = block.timestamp - user.lastClaimedTime;

        if (!tellerOpen) {
            timeGap = tellerClosedTime - user.lastClaimedTime;
        }

        if (timeGap > 365 * 1 days) {
            timeGap = 365 * 1 days;
        }

        uint256 timeWeight = timeGap * user.userWeight;

        user.lastClaimedTime = block.timestamp;

        Vault.payProvider(msg.sender, timeWeight, totalWeight);

        emit Claimed(msg.sender, true);
    }

    /**
     * @dev Internal function to return commit bonus.
     * @param _commitmentIndex Index of commitment array
     * @param _amount Commitment token amount
     */
    function commitBonus(uint256 _commitmentIndex, uint256 _amount)
        internal
        view
        returns (uint256)
    {
        if (commitmentInfo[_commitmentIndex].isActive) {
            return
                (commitmentInfo[_commitmentIndex].bonus * _amount) /
                commitmentInfo[_commitmentIndex].deciAdjustment;
        }
        return 0;
    }

    /**
     * @dev Internal function to calculate the new ending time when the current end time is overflown.
     * @param _oldAmount Commitment lp token amount which provider has
     * @param _extraAmount Lp token amount which user wants to commit
     * @param _oldEndTime Previous commitment ending time
     * @param _commitmentIndex Index of commitment array
     */
    function calculateNewEndTime(
        uint256 _oldAmount,
        uint256 _extraAmount,
        uint256 _oldEndTime,
        uint256 _commitmentIndex
    ) internal view returns (uint256) {
        uint256 extraEndTIme = commitmentInfo[_commitmentIndex].duration +
            block.timestamp;
        uint256 newEndTime = ((_oldAmount * _oldEndTime) +
            (_extraAmount * extraEndTIme)) / (_oldAmount + _extraAmount);

        return newEndTime;
    }

    /**
     * @dev Internal function to finish a commitment when it has ended.
     */
    function commitmentFinished() internal {
        Provider storage user = providerInfo[msg.sender];
        if (user.commitmentEndTime <= block.timestamp) {
            user.committedAmount = 0;
            user.commitmentIndex = 0;
        }
    }

    /**
     * @dev External function to claim the reward token. This function can be called only by a provider and teller must be open.
     */
    function claimExternal() external isTellerOpen isProvider nonReentrant {
        commitmentFinished();
        claim();
    }

    /**
     * @dev External function to get User info. This function can be called from a msg.sender with active deposits.
     * @return Time of rest committed time
     * @return Committed amount
     * @return Committed Index
     * @return Amount to Claim
     * @return Total LP deposited
     */
    function getUserInfo(address _user)
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            uint256,
            uint256
        )
    {
        Provider memory user = providerInfo[_user];

        if (user.LPDepositedRatio > 0) {
            uint256 claimAmount = (Vault.vidyaRate() *
                Vault.tellerPriority(address(this)) *
                (block.timestamp - user.lastClaimedTime) *
                user.userWeight) / (totalWeight * Vault.totalPriority());

            uint256 totalLPDeposited = (providerInfo[msg.sender]
                .LPDepositedRatio * LpToken.balanceOf(address(this))) / totalLP;

            if (user.commitmentEndTime > block.timestamp) {
                return (
                    user.commitmentEndTime - block.timestamp,
                    user.committedAmount,
                    user.commitmentIndex,
                    claimAmount,
                    totalLPDeposited
                );
            } else {
                return (0, 0, 0, claimAmount, totalLPDeposited);
            }
        } else {
            return (0, 0, 0, 0, 0);
        }
    }
}
IVault.sol 54 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.6;

/**
 * @title Vault Interface
 */
interface IVault {
    /**
     * @dev External function to get vidya rate.
     */
    function vidyaRate() external view returns (uint256);

    /**
     * @dev External function to get total priority.
     */
    function totalPriority() external view returns (uint256);

    /**
     * @dev External function to get teller priority.
     * @param tellerId Teller Id
     */
    function tellerPriority(address tellerId) external view returns (uint256);

    /**
     * @dev External function to add the teller. This function can be called by only owner.
     * @param teller Address of teller
     * @param priority Priority of teller
     */
    function addTeller(address teller, uint256 priority) external;

    /**
     * @dev External function to change the priority of teller. This function can be called by only owner.
     * @param teller Address of teller
     * @param newPriority New priority of teller
     */
    function changePriority(address teller, uint256 newPriority) external;

    /**
     * @dev External function to pay the Vidya token to investors. This function can be called by only teller.
     * @param provider Address of provider
     * @param providerTimeWeight Weight time of provider
     * @param totalWeight Sum of provider weight
     */
    function payProvider(
        address provider,
        uint256 providerTimeWeight,
        uint256 totalWeight
    ) external;

    /**
     * @dev External function to calculate the Vidya Rate.
     */
    function calculateRateExternal() external;
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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;
    }
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

Read Contract

LpToken 0x0ee1e175 → address
Vault 0x2d2c44f2 → address
commitmentInfo 0xff77351e → uint256, uint256, uint256, uint256, bool
devAddress 0x3ad10ef6 → address
getUserInfo 0x6386c1c7 → uint256, uint256, uint256, uint256, uint256
owner 0x8da5cb5b → address
providerInfo 0x3ae25916 → uint256, uint256, uint256, uint256, uint256, uint256
purpose 0x70740aab → bool
tellerClosedTime 0x7d454c91 → uint256
tellerOpen 0xa2aa9de8 → bool
totalLP 0x132c4feb → uint256
totalWeight 0x96c82e57 → uint256

Write Contract 12 functions

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

addCommitment 0xb56cb462
uint256 _bonus
uint256 _days
uint256 _penalty
uint256 _deciAdjustment
breakCommitment 0xb67de3ed
No parameters
claimExternal 0x3f222b2e
No parameters
commit 0x5bf56bc4
uint256 _amount
uint256 _commitmentIndex
depositLP 0xeb37acfc
uint256 _amount
renounceOwnership 0x715018a6
No parameters
setPurpose 0x6b62e029
address _address
bool _status
tellerClosedWithdraw 0x3804bc49
No parameters
toggleCommitment 0xce9312ce
uint256 _index
toggleTeller 0xa5204249
No parameters
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x2e1a7d4d
uint256 _amount

Recent Transactions

No transactions found for this address