Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x790FA0e39e4FD673552bed7a355b535D81B20811
Balance 0 ETH
Nonce 1
Code Size 20666 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

20666 bytes
0x6080604052600436106104265760003560e01c80638456cb5911610229578063c8adff011161012e578063eadd94ec116100b6578063f597573f1161007a578063f597573f14610c4b578063f851a44014610c6b578063f885838614610c8b578063fb9a4acd14610cab578063fe575a8714610ccb57600080fd5b8063eadd94ec14610bbf578063edec5f2714610bd5578063f04d688f14610bf5578063f2fde38b14610c0b578063f446374314610c2b57600080fd5b8063dad80e86116100fd578063dad80e8614610b1e578063e19648db14610b3f578063e32204dd14610b5f578063e6da921314610b7f578063e985e36714610b9f57600080fd5b8063c8adff0114610abe578063cad0055614610ad3578063cb1a4fc014610af3578063cff805ab14610b0857600080fd5b8063ae104265116101b1578063ba166a3911610180578063ba166a3914610a11578063bb3d676a14610a3e578063bff1cbec14610a5e578063c23326f314610a7e578063c49cc64514610a9e57600080fd5b8063ae1042651461099e578063ae4e0a18146109be578063b00bba6a146109d1578063b8977d6d146109f157600080fd5b80638da5cb5b116101f85780638da5cb5b146109155780638e15f473146109335780639a89c1fb146109485780639cfa0f7c14610968578063a6d42e4e1461097e57600080fd5b80638456cb59146108a057806389daf799146108b55780638ac08082146108d55780638b3fb182146108f557600080fd5b80633f4ba83a1161032f57806363b20117116102b7578063715018a611610286578063715018a61461080f57806373b2e80e1461082457806378e97925146108545780637ad71f721461086a5780637f6fb2531461088a57600080fd5b806363b20117146107a457806363e40879146107ba578063641046f4146107da578063704b6c02146107ef57600080fd5b8063548db174116102fe578063548db174146107065780635bc34f71146107265780635c975abb1461073c5780635ddc5688146107545780635df4f3531461077457600080fd5b80633f4ba83a146106a557806343568eae146106ba5780634e71d92d146106d057806353d99207146106e557600080fd5b806325312e54116103b25780632dc358e8116103815780632dc358e8146106095780633197cbb61461062957806333f761781461063f57806338646608146106555780633af32abf1461067557600080fd5b806325312e541461057e578063278c278b146105b657806329a5a0b6146105d65780632c65169e146105f657600080fd5b80630dc9c838116103f95780630dc9c838146104dd578063136021d9146104fd5780631ddc60911461051d5780631fa2bc921461053d57806323a8f1c01461055e57600080fd5b806303b9c5ad1461042b57806307f180821461044d5780630a200fc7146104825780630ba36dcd146104a2575b600080fd5b34801561043757600080fd5b5061044b6104463660046147e0565b610cfb565b005b34801561045957600080fd5b5061046d610468366004614822565b610d7a565b60405190151581526020015b60405180910390f35b34801561048e57600080fd5b5061044b61049d366004614849565b610eb6565b3480156104ae57600080fd5b506104cf6104bd36600461487d565b60e06020526000908152604090205481565b604051908152602001610479565b3480156104e957600080fd5b5061044b6104f8366004614898565b610edc565b34801561050957600080fd5b5061046d6105183660046148ba565b6110b8565b34801561052957600080fd5b5061044b610538366004614849565b61159a565b34801561054957600080fd5b5060dd5461046d90600160a01b900460ff1681565b34801561056a57600080fd5b5061044b610579366004614822565b6115c0565b34801561058a57600080fd5b5060e65461059e906001600160a01b031681565b6040516001600160a01b039091168152602001610479565b3480156105c257600080fd5b5061044b6105d1366004614822565b6115cd565b3480156105e257600080fd5b506104cf6105f1366004614822565b611670565b61046d6106043660046148ba565b6116a4565b34801561061557600080fd5b5061044b6106243660046149e9565b611b0e565b34801561063557600080fd5b506104cf60cb5481565b34801561064b57600080fd5b506104cf60ce5481565b34801561066157600080fd5b5060e55461059e906001600160a01b031681565b34801561068157600080fd5b5061046d61069036600461487d565b60e36020526000908152604090205460ff1681565b3480156106b157600080fd5b5061044b611c24565b3480156106c657600080fd5b506104cf60d35481565b3480156106dc57600080fd5b5061046d611c36565b3480156106f157600080fd5b5060dd5461046d90600160a81b900460ff1681565b34801561071257600080fd5b5061044b6107213660046147e0565b611f92565b34801561073257600080fd5b506104cf60d05481565b34801561074857600080fd5b5060975460ff1661046d565b34801561076057600080fd5b5061044b61076f366004614a1e565b61200c565b34801561078057600080fd5b5061046d61078f36600461487d565b60e46020526000908152604090205460ff1681565b3480156107b057600080fd5b506104cf60c95481565b3480156107c657600080fd5b506104cf6107d5366004614822565b612200565b3480156107e657600080fd5b5061044b612222565b3480156107fb57600080fd5b5061044b61080a36600461487d565b6123e7565b34801561081b57600080fd5b5061044b612411565b34801561083057600080fd5b5061046d61083f36600461487d565b60e16020526000908152604090205460ff1681565b34801561086057600080fd5b506104cf60ca5481565b34801561087657600080fd5b5061059e610885366004614822565b612423565b34801561089657600080fd5b506104cf60d45481565b3480156108ac57600080fd5b5061044b61244d565b3480156108c157600080fd5b5061044b6108d03660046147e0565b61245d565b3480156108e157600080fd5b5061046d6108f0366004614ade565b6124d7565b34801561090157600080fd5b5061044b61091036600461487d565b612708565b34801561092157600080fd5b506065546001600160a01b031661059e565b34801561093f57600080fd5b506104cf612732565b34801561095457600080fd5b5061044b610963366004614898565b6127d2565b34801561097457600080fd5b506104cf60cf5481565b34801561098a57600080fd5b5061044b610999366004614b24565b6127e5565b3480156109aa57600080fd5b506104cf6109b9366004614822565b6127fa565b61046d6109cc366004614bbf565b612b2e565b3480156109dd57600080fd5b5061044b6109ec36600461487d565b613028565b3480156109fd57600080fd5b5061044b610a0c366004614849565b61314a565b348015610a1d57600080fd5b50610a31610a2c366004614822565b613170565b6040516104799190614bff565b348015610a4a57600080fd5b5061044b610a593660046147e0565b6131dc565b348015610a6a57600080fd5b5061046d610a793660046148ba565b613256565b348015610a8a57600080fd5b506104cf610a99366004614822565b613728565b348015610aaa57600080fd5b5060df5461059e906001600160a01b031681565b348015610aca57600080fd5b50610a31613749565b348015610adf57600080fd5b5061044b610aee36600461487d565b6137a1565b348015610aff57600080fd5b5061046d61381a565b348015610b1457600080fd5b506104cf60d15481565b348015610b2a57600080fd5b5060dd5461046d90600160b01b900460ff1681565b348015610b4b57600080fd5b506104cf610b5a366004614822565b613a51565b348015610b6b57600080fd5b5060dc5461059e906001600160a01b031681565b348015610b8b57600080fd5b506104cf610b9a366004614898565b613a61565b348015610bab57600080fd5b5060cd5461059e906001600160a01b031681565b348015610bcb57600080fd5b506104cf60d25481565b348015610be157600080fd5b5061044b610bf03660046147e0565b613a95565b348015610c0157600080fd5b506104cf60cc5481565b348015610c1757600080fd5b5061044b610c2636600461487d565b613b0f565b348015610c3757600080fd5b5061044b610c463660046147e0565b613b88565b348015610c5757600080fd5b5060de5461059e906001600160a01b031681565b348015610c7757600080fd5b5060dd5461059e906001600160a01b031681565b348015610c9757600080fd5b506104cf610ca6366004614822565b613c02565b348015610cb757600080fd5b5061044b610cc6366004614c43565b613c12565b348015610cd757600080fd5b5061046d610ce636600461487d565b60e26020526000908152604090205460ff1681565b610d03613d07565b60005b81811015610d7557600160e46000858585818110610d2657610d26614caf565b9050602002016020810190610d3b919061487d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610d6d81614cdb565b915050610d06565b505050565b6000610d84613d07565b600060cc5411610ddb5760405162461bcd60e51b815260206004820152601a60248201527f496e697469616c20636c61696d2064617461206e6f742073657400000000000060448201526064015b60405180910390fd5b60cb548211610e1f5760405162461bcd60e51b815260206004820152601060248201526f53616c6520696e2070726f677265737360801b6044820152606401610dd2565b428211610e645760405162461bcd60e51b815260206004820152601360248201527210db185a5b481cdd185c9d081a5b881c185cdd606a1b6044820152606401610dd2565b60cc8054908390556040805182815260208101859052428183015290517f5f3a900c85949962b4cc192dd3714dae64071dc2e907049ec720b023270905a49181900360600190a160019150505b919050565b610ebe613d07565b60dd8054911515600160a01b0260ff60a01b19909216919091179055565b610ee4613d07565b6000821180610ef35750600081115b610f345760405162461bcd60e51b8152602060048201526012602482015271496e76616c696420706172616d657465727360701b6044820152606401610dd2565b81156110195760ca544210610f825760405162461bcd60e51b815260206004820152601460248201527314d85b1948185b1c9958591e481cdd185c9d195960621b6044820152606401610dd2565b814210610fc55760405162461bcd60e51b815260206004820152601160248201527014d85b19481d1a5b59481a5b881c185cdd607a1b6044820152606401610dd2565b60ca8054908390556040805182815260208101859052428183015290516414d510549560da1b917fddd2ed237e6993c9380182683f2c8bec486aaaa429528852cd74dbdb96cea0b2919081900360600190a2505b80156110b45760ca5481116110625760405162461bcd60e51b815260206004820152600f60248201526e496e76616c696420656e6454696d6560881b6044820152606401610dd2565b60cb8054908290556040805182815260208101849052428183015290516211539160ea1b917fddd2ed237e6993c9380182683f2c8bec486aaaa429528852cd74dbdb96cea0b2919081900360600190a2505b5050565b60008260ca5442101580156110cf575060cb544211155b6110eb5760405162461bcd60e51b8152600401610dd290614cf6565b6000811161110b5760405162461bcd60e51b8152600401610dd290614d2d565b611113613d61565b600061111e856127fa565b90508460c960008282546111329190614d5a565b909155506000905061114964e8d4a5100083614d72565b905060d15460001461116d578560d160008282546111679190614d5a565b90915550505b600060d15460c954116111825760d154611186565b60c9545b905060d560000160d054815481106111a0576111a0614caf565b90600052602060002001548111806111da575060d560020160d054815481106111cb576111cb614caf565b90600052602060002001544210155b156113025760d560020160d054815481106111f7576111f7614caf565b9060005260206000200154421061123a578660d560000160d0548154811061122157611221614caf565b90600052602060002001546112369190614d5a565b60d1555b60dd54600160a01b900460ff161561125457611254613da7565b600060d5810160d0548154811061126d5761126d614caf565b906000526020600020015482116112bc57878260d560000160d0548154811061129857611298614caf565b90600052602060002001546112ad9190614d94565b6112b79190614d94565b6112bf565b60005b60d9805460018181018355600092835260008051602061506583398151915290910183905560d0805493945090929091906112fb908490614d5a565b9091555050505b85156114335760dd54600160b01b900460ff16156113495733600090815260e3602052604090205460ff166113495760405162461bcd60e51b8152600401610dd290614dab565b60e5546001600160a01b03166391c619663360ce54611368908b614de2565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156113ae57600080fd5b505af11580156113c2573d6000803e3d6000fd5b505050508660d460008282546113d89190614d5a565b909155505060de546001600160a01b031687336001600160a01b0316600080516020615025833981519152858742604051611426939291909283526020830191909152604082015260600190565b60405180910390a46114b6565b60ce546114409088614de2565b33600090815260e060205260408120805490919061145f908490614d5a565b909155505060de546001600160a01b031687336001600160a01b03166000805160206150458339815191528587426040516114ad939291909283526020830191909152604082015260600190565b60405180910390a45b8260d260008282546114c89190614d5a565b909155505060de546000906001600160a01b031663dd62ed3e336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260440160206040518083038186803b15801561152757600080fd5b505afa15801561153b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155f9190614e01565b9050808311156115815760405162461bcd60e51b8152600401610dd290614e1a565b61158a83613e17565b60019550505050505b5092915050565b6115a2613d07565b60dd8054911515600160a81b0260ff60a81b19909216919091179055565b6115c8613d07565b60d355565b6115d5613d07565b600081116116255760405162461bcd60e51b815260206004820152601c60248201527f5a65726f206d617820746f6b656e7320746f206275792076616c7565000000006044820152606401610dd2565b60cf8054908290556040805182815260208101849052428183015290517f76f9e5e1f6af6a9f180708b77a5c99210fbf19b91f1f194f3918c262b8edf77c9181900360600190a15050565b60008061167c836127fa565b9050611686612732565b60ce546116939083614de2565b61169d9190614d72565b9392505050565b60008260ca5442101580156116bb575060cb544211155b6116d75760405162461bcd60e51b8152600401610dd290614cf6565b600081116116f75760405162461bcd60e51b8152600401610dd290614d2d565b6116ff613d61565b611707614167565b6000611712856127fa565b9050600061171e612732565b60ce5461172b9084614de2565b6117359190614d72565b9050803410156117765760405162461bcd60e51b815260206004820152600c60248201526b13195cdcc81c185e5b595b9d60a21b6044820152606401610dd2565b60006117828234614d94565b90508660c960008282546117969190614d5a565b909155505060d154156117bb578660d160008282546117b59190614d5a565b90915550505b600060d15460c954116117d05760d1546117d4565b60c9545b905060d560000160d054815481106117ee576117ee614caf565b9060005260206000200154811180611828575060d560020160d0548154811061181957611819614caf565b90600052602060002001544210155b156119505760d560020160d0548154811061184557611845614caf565b90600052602060002001544210611888578760d560000160d0548154811061186f5761186f614caf565b90600052602060002001546118849190614d5a565b60d1555b60dd54600160a01b900460ff16156118a2576118a2613da7565b600060d5810160d054815481106118bb576118bb614caf565b9060005260206000200154821161190a57888260d560000160d054815481106118e6576118e6614caf565b90600052602060002001546118fb9190614d94565b6119059190614d94565b61190d565b60005b60d9805460018181018355600092835260008051602061506583398151915290910183905560d080549394509092909190611949908490614d5a565b9091555050505b8615611a655760dd54600160b01b900460ff16156119975733600090815260e3602052604090205460ff166119975760405162461bcd60e51b8152600401610dd290614dab565b60e5546001600160a01b03166391c619663360ce546119b6908c614de2565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156119fc57600080fd5b505af1158015611a10573d6000803e3d6000fd5b505050508760d46000828254611a269190614d5a565b90915550506040805184815260208101869052428183015290516000918a913391600080516020615025833981519152919081900360600190a4611acc565b60ce54611a729089614de2565b33600090815260e0602052604081208054909190611a91908490614d5a565b90915550506040805184815260208101869052428183015290516000918a913391600080516020615045833981519152919081900360600190a45b8360d26000828254611ade9190614d5a565b90915550611aed9050836141c1565b8115611afd57611afd33836142f5565b600195505050505061159360018055565b60dd546001600160a01b0316331480611b3157506065546001600160a01b031633145b611b795760405162461bcd60e51b815260206004820152601960248201527831b0b63632b9103737ba1030b236b4b71037b91037bbb732b960391b6044820152606401610dd2565b8051611bc75760405162461bcd60e51b815260206004820152601c60248201527f63616e6e6f742075706461746520696e76616c69642076616c756573000000006044820152606401610dd2565b611bd360d960006146ad565b60005b81518110156110b45760d9828281518110611bf357611bf3614caf565b6020908102919091018101518254600181018455600093845291909220015580611c1c81614cdb565b915050611bd6565b611c2c613d07565b611c346143cb565b565b6000611c40613d61565b60cd546001600160a01b0316611c8f5760405162461bcd60e51b815260206004820152601460248201527314d85b19481d1bdad95b881b9bdd08185919195960621b6044820152606401610dd2565b33600090815260e2602052604090205460ff1615611cef5760405162461bcd60e51b815260206004820152601b60248201527f54686973204164647265737320697320426c61636b6c697374656400000000006044820152606401610dd2565b60dd54600160a81b900460ff1615611d605733600090815260e3602052604090205460ff16611d605760405162461bcd60e51b815260206004820152601e60248201527f55736572206e6f742077686974656c697374656420666f7220636c61696d00006044820152606401610dd2565b60cc54421015611db25760405162461bcd60e51b815260206004820152601960248201527f436c61696d20686173206e6f74207374617274656420796574000000000000006044820152606401610dd2565b33600090815260e1602052604090205460ff1615611e045760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610dd2565b33600090815260e160209081526040808320805460ff1916600117905560e090915290205480611e695760405162461bcd60e51b815260206004820152601060248201526f4e6f7468696e6720746f20636c61696d60801b6044820152606401610dd2565b33600081815260e06020908152604080832083905560cd54815163a9059cbb60e01b8152600481019590955260248501869052905192936001600160a01b039091169263a9059cbb9260448084019391929182900301818787803b158015611ed057600080fd5b505af1158015611ee4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f089190614e5b565b905080611f4f5760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610dd2565b6040805183815242602082015233917f9923b4306c6c030f2bdfbf156517d5983b87e15b96176da122cd4f2effa4ba7b910160405180910390a260019250505090565b611f9a613d07565b60005b81811015610d7557600060e36000858585818110611fbd57611fbd614caf565b9050602002016020810190611fd2919061487d565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061200481614cdb565b915050611f9d565b612014613d07565b80518251146120595760405162461bcd60e51b81526020600482015260116024820152704d69736d6174636865642061727261797360781b6044820152606401610dd2565b61206560db60006146ad565b61207160da60006146ad565b6000805b83518110156121af57600083828151811061209257612092614caf565b6020026020010151116120f15760405162461bcd60e51b815260206004820152602160248201527f50657263656e74616765206d7573742062652067726561746572207468616e206044820152600360fc1b6064820152608401610dd2565b82818151811061210357612103614caf565b6020026020010151826121169190614d5a565b915060db84828151811061212c5761212c614caf565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055825160da9084908390811061217e5761217e614caf565b60209081029190910181015182546001810184556000938452919092200155806121a781614cdb565b915050612075565b5080606414610d755760405162461bcd60e51b815260206004820152601f60248201527f546f74616c2070657263656e74616765206d75737420657175616c20313030006044820152606401610dd2565b600061220b826127fa565b905061221c64e8d4a5100082614d72565b92915050565b60dd546001600160a01b031633148061224557506065546001600160a01b031633145b61228d5760405162461bcd60e51b815260206004820152601960248201527831b0b63632b9103737ba1030b236b4b71037b91037bbb732b960391b6044820152606401610dd2565b60d15460d880546001810182556000919091527f5320ad99a619a90804cd2efe3a5cf0ac1ac5c41ad9ff2c61cf699efdad771096015560dd54600160a01b900460ff16156122dd576122dd613da7565b60d560000160d054815481106122f5576122f5614caf565b906000526020600020015460d15410156123d05760d05461235e5760c95460d99060d560000160d0548154811061232e5761232e614caf565b90600052602060002001546123439190614d94565b815460018101835560009283526020909220909101556123a8565b60d15460d99060d560000160d0548154811061237c5761237c614caf565b90600052602060002001546123919190614d94565b815460018101835560009283526020909220909101555b60d560000160d054815481106123c0576123c0614caf565b60009182526020909120015460d1555b60d080549060006123e083614cdb565b9190505550565b6123ef613d07565b60dd80546001600160a01b0319166001600160a01b0392909216919091179055565b612419613d07565b611c34600061441d565b60db818154811061243357600080fd5b6000918252602090912001546001600160a01b0316905081565b612455613d07565b611c3461446f565b612465613d07565b60005b81811015610d7557600060e2600085858581811061248857612488614caf565b905060200201602081019061249d919061487d565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806124cf81614cdb565b915050612468565b60006124e1613d07565b6001600160a01b03831661252c5760405162461bcd60e51b81526020600482015260126024820152715a65726f20746f6b656e206164647265737360701b6044820152606401610dd2565b60cc85905560cd80546001600160a01b038581166001600160a01b0319928316811790935560dd805460ff60a81b1916600160a81b17905560e5805491861691909216811790915560405163095ea7b360e01b81526004810191909152600019602482015263095ea7b390604401602060405180830381600087803b1580156125b457600080fd5b505af11580156125c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125ec9190614e5b565b506040516323b872dd60e01b81526000906001600160a01b038516906323b872dd9061262090339030908a90600401614e78565b602060405180830381600087803b15801561263a57600080fd5b505af115801561264e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126729190614e5b565b9050806126b95760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610dd2565b604080518681524260208201526001600160a01b038616917fdc9670dbabdd488b372eb16ebe49a39b3124a12cdffdcefbc89834a408bf8ff8910160405180910390a250600195945050505050565b612710613d07565b60e680546001600160a01b0319166001600160a01b0392909216919091179055565b60008060df60009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561278357600080fd5b505afa158015612797573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127bb9190614eb6565b505050915050806402540be40061221c9190614f06565b6127da613d07565b60d09190915560d155565b6127ed613d07565b6110b460d58260036146cb565b600080600060d1546000146128115760d154612815565b60c9545b905060cf548411156128695760405162461bcd60e51b815260206004820181905260248201527f416d6f756e742065786365656473206d617820746f6b656e7320746f206275796044820152606401610dd2565b60d560000160d0548154811061288157612881614caf565b906000526020600020015481856128989190614d5a565b11806128c6575060d560020160d054815481106128b7576128b7614caf565b90600052602060002001544210155b15612af85760d5546128da90600190614d94565b60d054106129195760405162461bcd60e51b815260206004820152600c60248201526b57726f6e6720706172616d7360a01b6044820152606401610dd2565b60d560020160d0548154811061293157612931614caf565b90600052602060002001544210612a445760d05460d590612953906001614d5a565b8154811061296357612963614caf565b90600052602060002001548460d560006003811061298357612983614caf565b0160d0548154811061299757612997614caf565b90600052602060002001546129ac9190614d5a565b1115612a065760405162461bcd60e51b815260206004820152602360248201527f43616e74205075726368617365204d6f726520696e20696e646976696475616c604482015262040e8f60eb1b6064820152608401610dd2565b60d05460d690612a17906001614d5a565b81548110612a2757612a27614caf565b906000526020600020015484612a3d9190614de2565b9150611593565b60008160d5820160d05481548110612a5e57612a5e614caf565b9060005260206000200154612a739190614d94565b60d05490915060d690612a87906001614d5a565b81548110612a9757612a97614caf565b90600052602060002001548186612aae9190614d94565b612ab89190614de2565b60d560010160d05481548110612ad057612ad0614caf565b906000526020600020015482612ae69190614de2565b612af09190614d5a565b925050611593565b60d560010160d05481548110612b1057612b10614caf565b906000526020600020015484612b269190614de2565b949350505050565b60008260ca544210158015612b45575060cb544211155b612b615760405162461bcd60e51b8152600401610dd290614cf6565b60008111612b815760405162461bcd60e51b8152600401610dd290614d2d565b612b89613d61565b612b91614167565b33600090815260e4602052604090205460ff16612bf05760405162461bcd60e51b815260206004820181905260248201527f55736572206e6f742077686974656c697374656420666f7220746869732074786044820152606401610dd2565b6000612bfb856127fa565b90506000612c07612732565b60ce54612c149084614de2565b612c1e9190614d72565b905080341015612c5f5760405162461bcd60e51b815260206004820152600c60248201526b13195cdcc81c185e5b595b9d60a21b6044820152606401610dd2565b6000612c6b8234614d94565b90508660c96000828254612c7f9190614d5a565b909155505060d15415612ca4578660d16000828254612c9e9190614d5a565b90915550505b600060d15460c95411612cb95760d154612cbd565b60c9545b905060d560000160d05481548110612cd757612cd7614caf565b9060005260206000200154811180612d11575060d560020160d05481548110612d0257612d02614caf565b90600052602060002001544210155b15612e395760d560020160d05481548110612d2e57612d2e614caf565b90600052602060002001544210612d71578760d560000160d05481548110612d5857612d58614caf565b9060005260206000200154612d6d9190614d5a565b60d1555b60dd54600160a01b900460ff1615612d8b57612d8b613da7565b600060d5810160d05481548110612da457612da4614caf565b90600052602060002001548211612df357888260d560000160d05481548110612dcf57612dcf614caf565b9060005260206000200154612de49190614d94565b612dee9190614d94565b612df6565b60005b60d9805460018181018355600092835260008051602061506583398151915290910183905560d080549394509092909190612e32908490614d5a565b9091555050505b8615612f655760dd54600160b01b900460ff1615612e89576001600160a01b038916600090815260e3602052604090205460ff16612e895760405162461bcd60e51b8152600401610dd290614dab565b60e55460ce546001600160a01b03909116906391c61966908b90612ead908c614de2565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015612ef357600080fd5b505af1158015612f07573d6000803e3d6000fd5b505050508760d46000828254612f1d9190614d5a565b90915550506040805184815260208101869052428183015290516000918a916001600160a01b038d1691600080516020615025833981519152919081900360600190a4612fde565b60ce54612f729089614de2565b6001600160a01b038a16600090815260e0602052604081208054909190612f9a908490614d5a565b90915550506040805184815260208101869052428183015290516000918a916001600160a01b038d1691600080516020615045833981519152919081900360600190a45b8360d26000828254612ff09190614d5a565b90915550612fff9050836141c1565b811561300f5761300f89836142f5565b600195505050505061302060018055565b509392505050565b613030613d07565b6001600160a01b0381166130ac5760405162461bcd60e51b815260206004820152603760248201527f7374616b696e67206d616e616765722063616e6e6f7420626520696e6174696160448201527f6c697a65642077697468207a65726f20616464726573730000000000000000006064820152608401610dd2565b60e580546001600160a01b0319166001600160a01b0383811691821790925560cd5460405163095ea7b360e01b8152600481019290925260001960248301529091169063095ea7b390604401602060405180830381600087803b15801561311257600080fd5b505af1158015613126573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b49190614e5b565b613152613d07565b60dd8054911515600160b01b0260ff60b01b19909216919091179055565b606060d5826003811061318557613185614caf565b018054806020026020016040519081016040528092919081815260200182805480156131d057602002820191906000526020600020905b8154815260200190600101908083116131bc575b50505050509050919050565b6131e4613d07565b60005b81811015610d7557600160e2600085858581811061320757613207614caf565b905060200201602081019061321c919061487d565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061324e81614cdb565b9150506131e7565b60008260ca54421015801561326d575060cb544211155b6132895760405162461bcd60e51b8152600401610dd290614cf6565b600081116132a95760405162461bcd60e51b8152600401610dd290614d2d565b6132b1613d61565b60006132bc856127fa565b90508460c960008282546132d09190614d5a565b90915550600090506132e764e8d4a5100083614d72565b905060d15460001461330b578560d160008282546133059190614d5a565b90915550505b600060d15460c954116133205760d154613324565b60c9545b905060d560000160d0548154811061333e5761333e614caf565b9060005260206000200154811180613378575060d560020160d0548154811061336957613369614caf565b90600052602060002001544210155b156134a05760d560020160d0548154811061339557613395614caf565b906000526020600020015442106133d8578660d560000160d054815481106133bf576133bf614caf565b90600052602060002001546133d49190614d5a565b60d1555b60dd54600160a01b900460ff16156133f2576133f2613da7565b600060d5810160d0548154811061340b5761340b614caf565b9060005260206000200154821161345a57878260d560000160d0548154811061343657613436614caf565b906000526020600020015461344b9190614d94565b6134559190614d94565b61345d565b60005b60d9805460018181018355600092835260008051602061506583398151915290910183905560d080549394509092909190613499908490614d5a565b9091555050505b85156135d15760dd54600160b01b900460ff16156134e75733600090815260e3602052604090205460ff166134e75760405162461bcd60e51b8152600401610dd290614dab565b60e5546001600160a01b03166391c619663360ce54613506908b614de2565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561354c57600080fd5b505af1158015613560573d6000803e3d6000fd5b505050508660d460008282546135769190614d5a565b909155505060e6546001600160a01b031687336001600160a01b03166000805160206150258339815191528587426040516135c4939291909283526020830191909152604082015260600190565b60405180910390a4613654565b60ce546135de9088614de2565b33600090815260e06020526040812080549091906135fd908490614d5a565b909155505060e6546001600160a01b031687336001600160a01b031660008051602061504583398151915285874260405161364b939291909283526020830191909152604082015260600190565b60405180910390a45b8260d260008282546136669190614d5a565b909155505060e6546000906001600160a01b031663dd62ed3e336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260440160206040518083038186803b1580156136c557600080fd5b505afa1580156136d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136fd9190614e01565b90508083111561371f5760405162461bcd60e51b8152600401610dd290614e1a565b61158a836144ac565b60d9818154811061373857600080fd5b600091825260209091200154905081565b606060d980548060200260200160405190810160405280929190818152602001828054801561379757602002820191906000526020600020905b815481526020019060010190808311613783575b5050505050905090565b6137a9613d07565b6001600160a01b0381166137f85760405162461bcd60e51b8152602060048201526016602482015275616464726573732063616e6e6f74206265207a65726f60501b6044820152606401610dd2565b60dc80546001600160a01b0319166001600160a01b0392909216919091179055565b6000613824613d61565b60cd546001600160a01b03166138735760405162461bcd60e51b815260206004820152601460248201527314d85b19481d1bdad95b881b9bdd08185919195960621b6044820152606401610dd2565b33600090815260e2602052604090205460ff16156138d35760405162461bcd60e51b815260206004820152601b60248201527f54686973204164647265737320697320426c61636b6c697374656400000000006044820152606401610dd2565b60dd54600160b01b900460ff16156139145733600090815260e3602052604090205460ff166139145760405162461bcd60e51b8152600401610dd290614dab565b33600090815260e06020526040902054806139645760405162461bcd60e51b815260206004820152601060248201526f4e6f7468696e6720746f207374616b6560801b6044820152606401610dd2565b60e5546001600160a01b03166391c61966336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b1580156139be57600080fd5b505af11580156139d2573d6000803e3d6000fd5b5050505060e060006139e13390565b6001600160a01b031681526020810191909152604001600090812055336001600160a01b03167ffa4ec67f9254455933eb145bae864b26f29dd0a7bbb76eb11e4d6b8b9b184c2b8242604051613a41929190918252602082015260400190565b60405180910390a2600191505090565b60d8818154811061373857600080fd5b60d58260038110613a7157600080fd5b018181548110613a8057600080fd5b90600052602060002001600091509150505481565b613a9d613d07565b60005b81811015610d7557600160e36000858585818110613ac057613ac0614caf565b9050602002016020810190613ad5919061487d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580613b0781614cdb565b915050613aa0565b613b17613d07565b6001600160a01b038116613b7c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610dd2565b613b858161441d565b50565b613b90613d07565b60005b81811015610d7557600060e46000858585818110613bb357613bb3614caf565b9050602002016020810190613bc8919061487d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580613bfa81614cdb565b915050613b93565b60da818154811061373857600080fd5b613c1a613d07565b828114613c5b5760405162461bcd60e51b815260206004820152600f60248201526e098cadccee8d040dad2e6dac2e8c6d608b1b6044820152606401610dd2565b60005b83811015613cf157828282818110613c7857613c78614caf565b9050602002013560e06000878785818110613c9557613c95614caf565b9050602002016020810190613caa919061487d565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254613cd99190614d5a565b90915550819050613ce981614cdb565b915050613c5e565b5050505050565b6001600160a01b03163b151590565b6065546001600160a01b03163314611c345760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610dd2565b60975460ff1615611c345760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610dd2565b60005b60d05460d754613dba9190614d94565b811015613b855760d354613dce9082614de2565b613dd89042614d5a565b60d05460d790613de9908490614d5a565b81548110613df957613df9614caf565b60009182526020909120015580613e0f81614cdb565b915050613daa565b60db54613f0e5760dc546001600160a01b0316613e465760405162461bcd60e51b8152600401610dd290614f8b565b60de546000906001600160a01b0316335b60dc54604051613e7692916001600160a01b0316908690602401614e78565b60408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251613eab9190614fbb565b6000604051808303816000865af19150503d8060008114613ee8576040519150601f19603f3d011682016040523d82523d6000602084013e613eed565b606091505b50509050806110b45760405162461bcd60e51b8152600401610dd290614ff6565b6000805b60db5481101561405a576000606460da8381548110613f3357613f33614caf565b906000526020600020015485613f499190614de2565b613f539190614d72565b60de549091506000906001600160a01b03163360db8581548110613f7957613f79614caf565b600091825260209091200154604051613fa192916001600160a01b0316908690602401614e78565b60408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b17905251613fd69190614fbb565b6000604051808303816000865af19150503d8060008114614013576040519150601f19603f3d011682016040523d82523d6000602084013e614018565b606091505b50509050806140395760405162461bcd60e51b8152600401610dd290614ff6565b6140438285614d5a565b93505050808061405290614cdb565b915050613f12565b5060006140678284614d94565b11156110b45760de546000906001600160a01b0316335b60db805461408e90600190614d94565b8154811061409e5761409e614caf565b6000918252602090912001546001600160a01b03166140bd8587614d94565b6040516024016140cf93929190614e78565b60408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b179052516141049190614fbb565b6000604051808303816000865af19150503d8060008114614141576040519150601f19603f3d011682016040523d82523d6000602084013e614146565b606091505b5050905080610d755760405162461bcd60e51b8152600401610dd290614ff6565b600260015414156141ba5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610dd2565b6002600155565b60db546142065760dc546001600160a01b03166141f05760405162461bcd60e51b8152600401610dd290614f8b565b60dc54613b85906001600160a01b0316826142f5565b6000805b60db5481101561429e576000606460da838154811061422b5761422b614caf565b9060005260206000200154856142419190614de2565b61424b9190614d72565b905061427e60db838154811061426357614263614caf565b6000918252602090912001546001600160a01b0316826142f5565b6142888184614d5a565b925050808061429690614cdb565b91505061420a565b5060006142ab8284614d94565b11156110b45760db80546110b491906142c690600190614d94565b815481106142d6576142d6614caf565b6000918252602090912001546001600160a01b03166142f58385614d94565b804710156143335760405162461bcd60e51b815260206004820152600b60248201526a4c6f772062616c616e636560a81b6044820152606401610dd2565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614380576040519150601f19603f3d011682016040523d82523d6000602084013e614385565b606091505b5050905080610d755760405162461bcd60e51b81526020600482015260126024820152711155120814185e5b595b9d0819985a5b195960721b6044820152606401610dd2565b6143d3614664565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b614477613d61565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586144003390565b60db546144f05760dc546001600160a01b03166144db5760405162461bcd60e51b8152600401610dd290614f8b565b60e6546000906001600160a01b031633613e57565b6000805b60db5481101561463c576000606460da838154811061451557614515614caf565b90600052602060002001548561452b9190614de2565b6145359190614d72565b60e6549091506000906001600160a01b03163360db858154811061455b5761455b614caf565b60009182526020909120015460405161458392916001600160a01b0316908690602401614e78565b60408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b179052516145b89190614fbb565b6000604051808303816000865af19150503d80600081146145f5576040519150601f19603f3d011682016040523d82523d6000602084013e6145fa565b606091505b505090508061461b5760405162461bcd60e51b8152600401610dd290614ff6565b6146258285614d5a565b93505050808061463490614cdb565b9150506144f4565b5060006146498284614d94565b11156110b45760e6546000906001600160a01b03163361407e565b60975460ff16611c345760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610dd2565b5080546000825590600052602060002090810190613b85919061471b565b826003810192821561470b579160200282015b8281111561470b57825180516146fb918491602090910190614730565b50916020019190600101906146de565b50614717929150614777565b5090565b5b80821115614717576000815560010161471c565b82805482825590600052602060002090810192821561476b579160200282015b8281111561476b578251825591602001919060010190614750565b5061471792915061471b565b8082111561471757600061478b82826146ad565b50600101614777565b60008083601f8401126147a657600080fd5b50813567ffffffffffffffff8111156147be57600080fd5b6020830191508360208260051b85010111156147d957600080fd5b9250929050565b600080602083850312156147f357600080fd5b823567ffffffffffffffff81111561480a57600080fd5b61481685828601614794565b90969095509350505050565b60006020828403121561483457600080fd5b5035919050565b8015158114613b8557600080fd5b60006020828403121561485b57600080fd5b813561169d8161483b565b80356001600160a01b0381168114610eb157600080fd5b60006020828403121561488f57600080fd5b61169d82614866565b600080604083850312156148ab57600080fd5b50508035926020909101359150565b600080604083850312156148cd57600080fd5b8235915060208301356148df8161483b565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff81118282101715614923576149236148ea565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614952576149526148ea565b604052919050565b600067ffffffffffffffff821115614974576149746148ea565b5060051b60200190565b600082601f83011261498f57600080fd5b813560206149a461499f8361495a565b614929565b82815260059290921b840181019181810190868411156149c357600080fd5b8286015b848110156149de57803583529183019183016149c7565b509695505050505050565b6000602082840312156149fb57600080fd5b813567ffffffffffffffff811115614a1257600080fd5b612b268482850161497e565b60008060408385031215614a3157600080fd5b823567ffffffffffffffff80821115614a4957600080fd5b818501915085601f830112614a5d57600080fd5b81356020614a6d61499f8361495a565b82815260059290921b84018101918181019089841115614a8c57600080fd5b948201945b83861015614ab157614aa286614866565b82529482019490820190614a91565b96505086013592505080821115614ac757600080fd5b50614ad48582860161497e565b9150509250929050565b60008060008060808587031215614af457600080fd5b8435935060208501359250614b0b60408601614866565b9150614b1960608601614866565b905092959194509250565b60006020808385031215614b3757600080fd5b823567ffffffffffffffff80821115614b4f57600080fd5b818501915085601f830112614b6357600080fd5b614b6b614900565b806060840188811115614b7d57600080fd5b845b81811015614bb157803585811115614b975760008081fd5b614ba38b82890161497e565b855250928601928601614b7f565b509098975050505050505050565b600080600060608486031215614bd457600080fd5b614bdd84614866565b9250602084013591506040840135614bf48161483b565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b81811015614c3757835183529284019291840191600101614c1b565b50909695505050505050565b60008060008060408587031215614c5957600080fd5b843567ffffffffffffffff80821115614c7157600080fd5b614c7d88838901614794565b90965094506020870135915080821115614c9657600080fd5b50614ca387828801614794565b95989497509550505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415614cef57614cef614cc5565b5060010190565b60208082526017908201527f496e76616c69642074696d6520666f7220627579696e67000000000000000000604082015260600190565b602080825260139082015272125b9d985b1a59081cd85b1948185b5bdd5b9d606a1b604082015260600190565b60008219821115614d6d57614d6d614cc5565b500190565b600082614d8f57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015614da657614da6614cc5565b500390565b6020808252601e908201527f55736572206e6f742077686974656c697374656420666f72207374616b650000604082015260600190565b6000816000190483118215151615614dfc57614dfc614cc5565b500290565b600060208284031215614e1357600080fd5b5051919050565b60208082526021908201527f4d616b65207375726520746f2061646420656e6f75676820616c6c6f77616e636040820152606560f81b606082015260800190565b600060208284031215614e6d57600080fd5b815161169d8161483b565b6001600160a01b039384168152919092166020820152604081019190915260600190565b805169ffffffffffffffffffff81168114610eb157600080fd5b600080600080600060a08688031215614ece57600080fd5b614ed786614e9c565b9450602086015193506040860151925060608601519150614efa60808701614e9c565b90509295509295909350565b60006001600160ff1b0381841382841380821686840486111615614f2c57614f2c614cc5565b600160ff1b6000871282811687830589121615614f4b57614f4b614cc5565b60008712925087820587128484161615614f6757614f67614cc5565b87850587128184161615614f7d57614f7d614cc5565b505050929093029392505050565b60208082526016908201527514185e5b595b9d081dd85b1b195d081b9bdd081cd95d60521b604082015260600190565b6000825160005b81811015614fdc5760208186018101518583015201614fc2565b81811115614feb576000828501525b509190910192915050565b602080825260149082015273151bdad95b881c185e5b595b9d0819985a5b195960621b60408201526060019056fe6f225532a9c33b023b8e48247ad8df9d98f132ae17c769b97ff22d2b278fa73a4d8aead3491b7eba4b5c7a65fc17e493b9e63f9e433522fc5f6a85a168fc9d36cc6782fd46dd71c5f512301ab049782450b4eaf79fdac5443d93d274d3916786a2646970667358221220c382732876dc486aea2b971d3136b9ef5db129903154ea612addee2e1818543364736f6c63430008090033

Verified Source Code Full Match

Compiler: v0.8.9+commit.e5eed63a EVM: london Optimization: Yes (200 runs)
OwnableUpgradeable.sol 95 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions 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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
Initializable.sol 165 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}
PausableUpgradeable.sol 117 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
ReentrancyGuardUpgradeable.sol 81 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

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

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

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
IERC20Upgradeable.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}
AddressUpgradeable.sol 219 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}
PresaleV3.sol 1023 lines
//SPDX-License-Identifier: MIT
//               _    _____                                        _
// __      _____| |__|___ / _ __   __ _ _   _ _ __ ___   ___ _ __ | |_ ___
// \ \ /\ / / _ \ '_ \ |_ \| '_ \ / _` | | | | '_ ` _ \ / _ \ '_ \| __/ __|
//  \ V  V /  __/ |_) |__) | |_) | (_| | |_| | | | | | |  __/ | | | |_\__ \
//   \_/\_/ \___|_.__/____/| .__/ \__,_|\__, |_| |_| |_|\___|_| |_|\__|___/
//                         |_|          |___/
//
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

interface Aggregator {
    function latestRoundData()
        external
        view
        returns (
            uint80 roundId,
            int256 answer,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );
}

interface StakingManager {
    function depositByPresale(address _user, uint256 _amount) external;
}

contract PresaleV3 is
    Initializable,
    ReentrancyGuardUpgradeable,
    OwnableUpgradeable,
    PausableUpgradeable
{
    uint256 public totalTokensSold;
    uint256 public startTime;
    uint256 public endTime;
    uint256 public claimStart;
    address public saleToken;
    uint256 public baseDecimals;
    uint256 public maxTokensToBuy;
    uint256 public currentStep;
    uint256 public checkPoint;
    uint256 public usdRaised;
    uint256 public timeConstant;
    uint256 public totalBoughtAndStaked;
    uint256[][3] public rounds;
    uint256[] public prevCheckpoints;
    uint256[] public remainingTokensTracker;
    uint256[] public percentages;
    address[] public wallets;
    address public paymentWallet;
    address public admin;
    bool public dynamicTimeFlag;
    bool public whitelistClaimOnly;
    bool public stakeingWhitelistStatus;

    IERC20Upgradeable public USDTInterface;
    Aggregator public aggregatorInterface;
    mapping(address => uint256) public userDeposits;
    mapping(address => bool) public hasClaimed;
    mapping(address => bool) public isBlacklisted;
    mapping(address => bool) public isWhitelisted;
    mapping(address => bool) public wertWhitelisted;

    StakingManager public stakingManagerInterface;

    IERC20Upgradeable public USDCInterface;

    event SaleTimeSet(uint256 _start, uint256 _end, uint256 timestamp);
    event SaleTimeUpdated(
        bytes32 indexed key,
        uint256 prevValue,
        uint256 newValue,
        uint256 timestamp
    );
    event TokensBought(
        address indexed user,
        uint256 indexed tokensBought,
        address indexed purchaseToken,
        uint256 amountPaid,
        uint256 usdEq,
        uint256 timestamp
    );
    event TokensAdded(
        address indexed token,
        uint256 noOfTokens,
        uint256 timestamp
    );
    event TokensClaimed(
        address indexed user,
        uint256 amount,
        uint256 timestamp
    );
    event ClaimStartUpdated(
        uint256 prevValue,
        uint256 newValue,
        uint256 timestamp
    );
    event MaxTokensUpdated(
        uint256 prevValue,
        uint256 newValue,
        uint256 timestamp
    );
    event TokensBoughtAndStaked(
        address indexed user,
        uint256 indexed tokensBought,
        address indexed purchaseToken,
        uint256 amountPaid,
        uint256 usdEq,
        uint256 timestamp
    );
    event TokensClaimedAndStaked(
        address indexed user,
        uint256 amount,
        uint256 timestamp
    );

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {}

    /**
     * @dev To pause the presale
     */
    function pause() external onlyOwner {
        _pause();
    }

    /**
     * @dev To unpause the presale
     */
    function unpause() external onlyOwner {
        _unpause();
    }

    /**
     * @dev To calculate the price in USD for given amount of tokens.
     * @param _amount No of tokens
     */
    function calculatePrice(uint256 _amount) public view returns (uint256) {
        uint256 USDTAmount;
        uint256 total = checkPoint == 0 ? totalTokensSold : checkPoint;
        require(_amount <= maxTokensToBuy, "Amount exceeds max tokens to buy");
        if (
            _amount + total > rounds[0][currentStep] ||
            block.timestamp >= rounds[2][currentStep]
        ) {
            require(currentStep < (rounds[0].length - 1), "Wrong params");
            if (block.timestamp >= rounds[2][currentStep]) {
                require(
                    rounds[0][currentStep] + _amount <=
                        rounds[0][currentStep + 1],
                    "Cant Purchase More in individual tx"
                );
                USDTAmount = _amount * rounds[1][currentStep + 1];
            } else {
                uint256 tokenAmountForCurrentPrice = rounds[0][currentStep] -
                    total;
                USDTAmount =
                    tokenAmountForCurrentPrice *
                    rounds[1][currentStep] +
                    (_amount - tokenAmountForCurrentPrice) *
                    rounds[1][currentStep + 1];
            }
        } else USDTAmount = _amount * rounds[1][currentStep];
        return USDTAmount;
    }

    /**
     * @dev To update the sale times
     * @param _startTime New start time
     * @param _endTime New end time
     */
    function changeSaleTimes(
        uint256 _startTime,
        uint256 _endTime
    ) external onlyOwner {
        require(_startTime > 0 || _endTime > 0, "Invalid parameters");
        if (_startTime > 0) {
            require(block.timestamp < startTime, "Sale already started");
            require(block.timestamp < _startTime, "Sale time in past");
            uint256 prevValue = startTime;
            startTime = _startTime;
            emit SaleTimeUpdated(
                bytes32("START"),
                prevValue,
                _startTime,
                block.timestamp
            );
        }
        if (_endTime > 0) {
            require(_endTime > startTime, "Invalid endTime");
            uint256 prevValue = endTime;
            endTime = _endTime;
            emit SaleTimeUpdated(
                bytes32("END"),
                prevValue,
                _endTime,
                block.timestamp
            );
        }
    }

    /**
     * @dev To get latest ETH price in 10**18 format
     */
    function getLatestPrice() public view returns (uint256) {
        (, int256 price, , , ) = aggregatorInterface.latestRoundData();
        price = (price * (10 ** 10));
        return uint256(price);
    }

    function setSplits(
        address[] memory _wallets,
        uint256[] memory _percentages
    ) public onlyOwner {
        require(_wallets.length == _percentages.length, "Mismatched arrays");
        delete wallets;
        delete percentages;
        uint256 totalPercentage = 0;

        for (uint256 i = 0; i < _wallets.length; i++) {
            require(_percentages[i] > 0, "Percentage must be greater than 0");
            totalPercentage += _percentages[i];
            wallets.push(_wallets[i]);
            percentages.push(_percentages[i]);
        }

        require(totalPercentage == 100, "Total percentage must equal 100");
    }

    modifier checkSaleState(uint256 amount) {
        require(
            block.timestamp >= startTime && block.timestamp <= endTime,
            "Invalid time for buying"
        );
        require(amount > 0, "Invalid sale amount");
        _;
    }

    /**
     * @dev To buy into a presale using USDT
     * @param amount No of tokens to buy
     * @param stake boolean flag for token staking
     */
    function buyWithUSDT(
        uint256 amount,
        bool stake
    ) external checkSaleState(amount) whenNotPaused returns (bool) {
        uint256 usdPrice = calculatePrice(amount);
        totalTokensSold += amount;
        uint256 price = usdPrice / (10 ** 12);
        if (checkPoint != 0) checkPoint += amount;
        uint256 total = totalTokensSold > checkPoint
            ? totalTokensSold
            : checkPoint;
        if (
            total > rounds[0][currentStep] ||
            block.timestamp >= rounds[2][currentStep]
        ) {
            if (block.timestamp >= rounds[2][currentStep]) {
                checkPoint = rounds[0][currentStep] + amount;
            }
            if (dynamicTimeFlag) {
                manageTimeDiff();
            }
            uint256 unsoldTokens = total > rounds[0][currentStep]
                ? 0
                : rounds[0][currentStep] - total - amount;
            remainingTokensTracker.push(unsoldTokens);
            currentStep += 1;
        }
        if (stake) {
            if (stakeingWhitelistStatus) {
                require(
                    isWhitelisted[_msgSender()],
                    "User not whitelisted for stake"
                );
            }
            stakingManagerInterface.depositByPresale(
                _msgSender(),
                amount * baseDecimals
            );
            totalBoughtAndStaked += amount;
            emit TokensBoughtAndStaked(
                _msgSender(),
                amount,
                address(USDTInterface),
                price,
                usdPrice,
                block.timestamp
            );
        } else {
            userDeposits[_msgSender()] += (amount * baseDecimals);
            emit TokensBought(
                _msgSender(),
                amount,
                address(USDTInterface),
                price,
                usdPrice,
                block.timestamp
            );
        }
        usdRaised += usdPrice;
        uint256 ourAllowance = USDTInterface.allowance(
            _msgSender(),
            address(this)
        );
        require(price <= ourAllowance, "Make sure to add enough allowance");
        splitUSDTValue(price);

        return true;
    }

    /**
     * @dev To buy into a presale using USDC
     * @param amount No of tokens to buy
     * @param stake boolean flag for token staking
     */
    function buyWithUSDC(
        uint256 amount,
        bool stake
    ) external checkSaleState(amount) whenNotPaused returns (bool) {
        uint256 usdPrice = calculatePrice(amount);
        totalTokensSold += amount;
        uint256 price = usdPrice / (10 ** 12);
        if (checkPoint != 0) checkPoint += amount;
        uint256 total = totalTokensSold > checkPoint
            ? totalTokensSold
            : checkPoint;
        if (
            total > rounds[0][currentStep] ||
            block.timestamp >= rounds[2][currentStep]
        ) {
            if (block.timestamp >= rounds[2][currentStep]) {
                checkPoint = rounds[0][currentStep] + amount;
            }
            if (dynamicTimeFlag) {
                manageTimeDiff();
            }
            uint256 unsoldTokens = total > rounds[0][currentStep]
                ? 0
                : rounds[0][currentStep] - total - amount;
            remainingTokensTracker.push(unsoldTokens);
            currentStep += 1;
        }
        if (stake) {
            if (stakeingWhitelistStatus) {
                require(
                    isWhitelisted[_msgSender()],
                    "User not whitelisted for stake"
                );
            }
            stakingManagerInterface.depositByPresale(
                _msgSender(),
                amount * baseDecimals
            );
            totalBoughtAndStaked += amount;
            emit TokensBoughtAndStaked(
                _msgSender(),
                amount,
                address(USDCInterface),
                price,
                usdPrice,
                block.timestamp
            );
        } else {
            userDeposits[_msgSender()] += (amount * baseDecimals);
            emit TokensBought(
                _msgSender(),
                amount,
                address(USDCInterface),
                price,
                usdPrice,
                block.timestamp
            );
        }
        usdRaised += usdPrice;
        uint256 ourAllowance = USDCInterface.allowance(
            _msgSender(),
            address(this)
        );
        require(price <= ourAllowance, "Make sure to add enough allowance");
        splitUSDCValue(price);

        return true;
    }

    /**
     * @dev To buy into a presale using ETH
     * @param amount No of tokens to buy
     * @param stake boolean flag for token staking
     */
    function buyWithEth(
        uint256 amount,
        bool stake
    )
        external
        payable
        checkSaleState(amount)
        whenNotPaused
        nonReentrant
        returns (bool)
    {
        uint256 usdPrice = calculatePrice(amount);
        uint256 ethAmount = (usdPrice * baseDecimals) / getLatestPrice();
        require(msg.value >= ethAmount, "Less payment");
        uint256 excess = msg.value - ethAmount;
        totalTokensSold += amount;
        if (checkPoint != 0) checkPoint += amount;
        uint256 total = totalTokensSold > checkPoint
            ? totalTokensSold
            : checkPoint;
        if (
            total > rounds[0][currentStep] ||
            block.timestamp >= rounds[2][currentStep]
        ) {
            if (block.timestamp >= rounds[2][currentStep]) {
                checkPoint = rounds[0][currentStep] + amount;
            }
            if (dynamicTimeFlag) {
                manageTimeDiff();
            }
            uint256 unsoldTokens = total > rounds[0][currentStep]
                ? 0
                : rounds[0][currentStep] - total - amount;
            remainingTokensTracker.push(unsoldTokens);
            currentStep += 1;
        }
        if (stake) {
            if (stakeingWhitelistStatus) {
                require(
                    isWhitelisted[_msgSender()],
                    "User not whitelisted for stake"
                );
            }
            stakingManagerInterface.depositByPresale(
                _msgSender(),
                amount * baseDecimals
            );
            totalBoughtAndStaked += amount;
            emit TokensBoughtAndStaked(
                _msgSender(),
                amount,
                address(0),
                ethAmount,
                usdPrice,
                block.timestamp
            );
        } else {
            userDeposits[_msgSender()] += (amount * baseDecimals);
            emit TokensBought(
                _msgSender(),
                amount,
                address(0),
                ethAmount,
                usdPrice,
                block.timestamp
            );
        }
        usdRaised += usdPrice;
        splitETHValue(ethAmount);
        if (excess > 0) sendValue(payable(_msgSender()), excess);
        return true;
    }

    /**
     * @dev To buy ETH directly from wert .*wert contract address should be whitelisted if wertBuyRestrictionStatus is set true
     * @param _user address of the user
     * @param _amount No of ETH to buy
     * @param stake boolean flag for token staking
     */
    function buyWithETHWert(
        address _user,
        uint256 _amount,
        bool stake
    )
        external
        payable
        checkSaleState(_amount)
        whenNotPaused
        nonReentrant
        returns (bool)
    {
        require(
            wertWhitelisted[_msgSender()],
            "User not whitelisted for this tx"
        );
        uint256 usdPrice = calculatePrice(_amount);
        uint256 ethAmount = (usdPrice * baseDecimals) / getLatestPrice();
        require(msg.value >= ethAmount, "Less payment");
        uint256 excess = msg.value - ethAmount;
        totalTokensSold += _amount;
        if (checkPoint != 0) checkPoint += _amount;
        uint256 total = totalTokensSold > checkPoint
            ? totalTokensSold
            : checkPoint;
        if (
            total > rounds[0][currentStep] ||
            block.timestamp >= rounds[2][currentStep]
        ) {
            if (block.timestamp >= rounds[2][currentStep]) {
                checkPoint = rounds[0][currentStep] + _amount;
            }
            if (dynamicTimeFlag) {
                manageTimeDiff();
            }
            uint256 unsoldTokens = total > rounds[0][currentStep]
                ? 0
                : rounds[0][currentStep] - total - _amount;
            remainingTokensTracker.push(unsoldTokens);
            currentStep += 1;
        }
        if (stake) {
            if (stakeingWhitelistStatus) {
                require(isWhitelisted[_user], "User not whitelisted for stake");
            }
            stakingManagerInterface.depositByPresale(
                _user,
                _amount * baseDecimals
            );
            totalBoughtAndStaked += _amount;
            emit TokensBoughtAndStaked(
                _user,
                _amount,
                address(0),
                ethAmount,
                usdPrice,
                block.timestamp
            );
        } else {
            userDeposits[_user] += (_amount * baseDecimals);
            emit TokensBought(
                _user,
                _amount,
                address(0),
                ethAmount,
                usdPrice,
                block.timestamp
            );
        }
        usdRaised += usdPrice;
        splitETHValue(ethAmount);
        if (excess > 0) sendValue(payable(_user), excess);
        return true;
    }

    /**
     * @dev Helper funtion to get ETH price for given amount
     * @param amount No of tokens to buy
     */
    function ethBuyHelper(
        uint256 amount
    ) external view returns (uint256 ethAmount) {
        uint256 usdPrice = calculatePrice(amount);
        ethAmount = (usdPrice * baseDecimals) / getLatestPrice();
    }

    /**
     * @dev Helper funtion to get USDT price for given amount
     * @param amount No of tokens to buy
     */
    function usdtBuyHelper(
        uint256 amount
    ) external view returns (uint256 usdPrice) {
        usdPrice = calculatePrice(amount);
        usdPrice = usdPrice / (10 ** 12);
    }

    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Low balance");
        (bool success, ) = recipient.call{value: amount}("");
        require(success, "ETH Payment failed");
    }

    function splitETHValue(uint256 _amount) internal {
        if (wallets.length == 0) {
            require(paymentWallet != address(0), "Payment wallet not set");
            sendValue(payable(paymentWallet), _amount);
        } else {
            uint256 tempCalc;
            for (uint256 i = 0; i < wallets.length; i++) {
                uint256 amountToTransfer = (_amount * percentages[i]) / 100;
                sendValue(payable(wallets[i]), amountToTransfer);
                tempCalc += amountToTransfer;
            }
            if ((_amount - tempCalc) > 0) {
                sendValue(
                    payable(wallets[wallets.length - 1]),
                    _amount - tempCalc
                );
            }
        }
    }

    function splitUSDTValue(uint256 _amount) internal {
        if (wallets.length == 0) {
            require(paymentWallet != address(0), "Payment wallet not set");
            (bool success, ) = address(USDTInterface).call(
                abi.encodeWithSignature(
                    "transferFrom(address,address,uint256)",
                    _msgSender(),
                    paymentWallet,
                    _amount
                )
            );
            require(success, "Token payment failed");
        } else {
            uint256 tempCalc;
            for (uint256 i = 0; i < wallets.length; i++) {
                uint256 amountToTransfer = (_amount * percentages[i]) / 100;
                (bool success, ) = address(USDTInterface).call(
                    abi.encodeWithSignature(
                        "transferFrom(address,address,uint256)",
                        _msgSender(),
                        wallets[i],
                        amountToTransfer
                    )
                );
                require(success, "Token payment failed");
                tempCalc += amountToTransfer;
            }
            if ((_amount - tempCalc) > 0) {
                (bool success, ) = address(USDTInterface).call(
                    abi.encodeWithSignature(
                        "transferFrom(address,address,uint256)",
                        _msgSender(),
                        wallets[wallets.length - 1],
                        _amount - tempCalc
                    )
                );
                require(success, "Token payment failed");
            }
        }
    }

    function splitUSDCValue(uint256 _amount) internal {
        if (wallets.length == 0) {
            require(paymentWallet != address(0), "Payment wallet not set");
            (bool success, ) = address(USDCInterface).call(
                abi.encodeWithSignature(
                    "transferFrom(address,address,uint256)",
                    _msgSender(),
                    paymentWallet,
                    _amount
                )
            );
            require(success, "Token payment failed");
        } else {
            uint256 tempCalc;
            for (uint256 i = 0; i < wallets.length; i++) {
                uint256 amountToTransfer = (_amount * percentages[i]) / 100;
                (bool success, ) = address(USDCInterface).call(
                    abi.encodeWithSignature(
                        "transferFrom(address,address,uint256)",
                        _msgSender(),
                        wallets[i],
                        amountToTransfer
                    )
                );
                require(success, "Token payment failed");
                tempCalc += amountToTransfer;
            }
            if ((_amount - tempCalc) > 0) {
                (bool success, ) = address(USDCInterface).call(
                    abi.encodeWithSignature(
                        "transferFrom(address,address,uint256)",
                        _msgSender(),
                        wallets[wallets.length - 1],
                        _amount - tempCalc
                    )
                );
                require(success, "Token payment failed");
            }
        }
    }

    /**
     * @dev to initialize staking manager with new addredd
     * @param _stakingManagerAddress address of the staking smartcontract
     */
    function setStakingManager(
        address _stakingManagerAddress
    ) external onlyOwner {
        require(
            _stakingManagerAddress != address(0),
            "staking manager cannot be inatialized with zero address"
        );
        stakingManagerInterface = StakingManager(_stakingManagerAddress);
        IERC20Upgradeable(saleToken).approve(
            _stakingManagerAddress,
            type(uint256).max
        );
    }

    /**
     * @dev To set the claim start time and sale token address by the owner
     * @param _claimStart claim start time
     * @param noOfTokens no of tokens to add to the contract
     * @param _saleToken sale toke address
     */
    function startClaim(
        uint256 _claimStart,
        uint256 noOfTokens,
        address _saleToken,
        address _stakingManagerAddress
    ) external onlyOwner returns (bool) {
        require(_saleToken != address(0), "Zero token address");
        // require(claimStart == 0, "Claim already set");
        claimStart = _claimStart;
        saleToken = _saleToken;
        whitelistClaimOnly = true;
        stakingManagerInterface = StakingManager(_stakingManagerAddress);
        IERC20Upgradeable(_saleToken).approve(
            _stakingManagerAddress,
            type(uint256).max
        );
        bool success = IERC20Upgradeable(_saleToken).transferFrom(
            _msgSender(),
            address(this),
            noOfTokens
        );
        require(success, "Token transfer failed");
        emit TokensAdded(_saleToken, noOfTokens, block.timestamp);
        return true;
    }

    /**
     * @dev To set status for claim whitelisting
     * @param _status bool value
     */
    function setStakeingWhitelistStatus(bool _status) external onlyOwner {
        stakeingWhitelistStatus = _status;
    }

    function setUSDCInterface(address _usdc) external onlyOwner {
        USDCInterface = IERC20Upgradeable(_usdc);
    }

    /**
     * @dev To change the claim start time by the owner
     * @param _claimStart new claim start time
     */
    function changeClaimStart(
        uint256 _claimStart
    ) external onlyOwner returns (bool) {
        require(claimStart > 0, "Initial claim data not set");
        require(_claimStart > endTime, "Sale in progress");
        require(_claimStart > block.timestamp, "Claim start in past");
        uint256 prevValue = claimStart;
        claimStart = _claimStart;
        emit ClaimStartUpdated(prevValue, _claimStart, block.timestamp);
        return true;
    }

    /**
     * @dev To claim tokens after claiming starts
     */
    function claim() external whenNotPaused returns (bool) {
        require(saleToken != address(0), "Sale token not added");
        require(!isBlacklisted[_msgSender()], "This Address is Blacklisted");
        if (whitelistClaimOnly) {
            require(
                isWhitelisted[_msgSender()],
                "User not whitelisted for claim"
            );
        }
        require(block.timestamp >= claimStart, "Claim has not started yet");
        require(!hasClaimed[_msgSender()], "Already claimed");
        hasClaimed[_msgSender()] = true;
        uint256 amount = userDeposits[_msgSender()];
        require(amount > 0, "Nothing to claim");
        delete userDeposits[_msgSender()];
        bool success = IERC20Upgradeable(saleToken).transfer(
            _msgSender(),
            amount
        );
        require(success, "Token transfer failed");
        emit TokensClaimed(_msgSender(), amount, block.timestamp);
        return true;
    }

    function claimAndStake() external whenNotPaused returns (bool) {
        require(saleToken != address(0), "Sale token not added");
        require(!isBlacklisted[_msgSender()], "This Address is Blacklisted");
        if (stakeingWhitelistStatus) {
            require(
                isWhitelisted[_msgSender()],
                "User not whitelisted for stake"
            );
        }
        uint256 amount = userDeposits[_msgSender()];
        require(amount > 0, "Nothing to stake");
        stakingManagerInterface.depositByPresale(_msgSender(), amount);
        delete userDeposits[_msgSender()];
        emit TokensClaimedAndStaked(_msgSender(), amount, block.timestamp);
        return true;
    }

    /**
     * @dev To add wert contract addresses to whitelist
     * @param _addressesToWhitelist addresses of the contract
     */
    function whitelistUsersForWERT(
        address[] calldata _addressesToWhitelist
    ) external onlyOwner {
        for (uint256 i = 0; i < _addressesToWhitelist.length; i++) {
            wertWhitelisted[_addressesToWhitelist[i]] = true;
        }
    }

    /**
     * @dev To remove wert contract addresses to whitelist
     * @param _addressesToRemoveFromWhitelist addresses of the contracts
     */
    function removeFromWhitelistForWERT(
        address[] calldata _addressesToRemoveFromWhitelist
    ) external onlyOwner {
        for (uint256 i = 0; i < _addressesToRemoveFromWhitelist.length; i++) {
            wertWhitelisted[_addressesToRemoveFromWhitelist[i]] = false;
        }
    }

    function changeMaxTokensToBuy(uint256 _maxTokensToBuy) external onlyOwner {
        require(_maxTokensToBuy > 0, "Zero max tokens to buy value");
        uint256 prevValue = maxTokensToBuy;
        maxTokensToBuy = _maxTokensToBuy;
        emit MaxTokensUpdated(prevValue, _maxTokensToBuy, block.timestamp);
    }

    function changeRoundsData(uint256[][3] memory _rounds) external onlyOwner {
        rounds = _rounds;
    }

    /**
     * @dev To add users to blacklist which restricts blacklisted users from claiming
     * @param _usersToBlacklist addresses of the users
     */
    function blacklistUsers(
        address[] calldata _usersToBlacklist
    ) external onlyOwner {
        for (uint256 i = 0; i < _usersToBlacklist.length; i++) {
            isBlacklisted[_usersToBlacklist[i]] = true;
        }
    }

    /**
     * @dev To remove users from blacklist which restricts blacklisted users from claiming
     * @param _userToRemoveFromBlacklist addresses of the users
     */
    function removeFromBlacklist(
        address[] calldata _userToRemoveFromBlacklist
    ) external onlyOwner {
        for (uint256 i = 0; i < _userToRemoveFromBlacklist.length; i++) {
            isBlacklisted[_userToRemoveFromBlacklist[i]] = false;
        }
    }

    /**
     * @dev To add users to whitelist which restricts users from claiming if claimWhitelistStatus is true
     * @param _usersToWhitelist addresses of the users
     */
    function whitelistUsers(
        address[] calldata _usersToWhitelist
    ) external onlyOwner {
        for (uint256 i = 0; i < _usersToWhitelist.length; i++) {
            isWhitelisted[_usersToWhitelist[i]] = true;
        }
    }

    /**
     * @dev To remove users from whitelist which restricts users from claiming if claimWhitelistStatus is true
     * @param _userToRemoveFromWhitelist addresses of the users
     */
    function removeFromWhitelist(
        address[] calldata _userToRemoveFromWhitelist
    ) external onlyOwner {
        for (uint256 i = 0; i < _userToRemoveFromWhitelist.length; i++) {
            isWhitelisted[_userToRemoveFromWhitelist[i]] = false;
        }
    }

    /**
     * @dev To set status for claim whitelisting
     * @param _status bool value
     */
    function setClaimWhitelistStatus(bool _status) external onlyOwner {
        whitelistClaimOnly = _status;
    }

    /**
     * @dev To set payment wallet address
     * @param _newPaymentWallet new payment wallet address
     */
    function changePaymentWallet(address _newPaymentWallet) external onlyOwner {
        require(_newPaymentWallet != address(0), "address cannot be zero");
        paymentWallet = _newPaymentWallet;
    }

    /**
     * @dev To manage time gap between two rounds
     */
    function manageTimeDiff() internal {
        for (uint256 i; i < rounds[2].length - currentStep; i++) {
            rounds[2][currentStep + i] = block.timestamp + i * timeConstant;
        }
    }

    /**
     * @dev To set time constant for manageTimeDiff()
     * @param _timeConstant time in <days>*24*60*60 format
     */
    function setTimeConstant(uint256 _timeConstant) external onlyOwner {
        timeConstant = _timeConstant;
    }

    /**
     * @dev To get array of round details at once
     * @param _no array index
     */
    function roundDetails(
        uint256 _no
    ) external view returns (uint256[] memory) {
        return rounds[_no];
    }

    /**
     * @dev to update userDeposits for purchases made on BSC
     * @param _users array of users
     * @param _userDeposits array of userDeposits associated with users
     */
    function updateFromBSC(
        address[] calldata _users,
        uint256[] calldata _userDeposits
    ) external onlyOwner {
        require(_users.length == _userDeposits.length, "Length mismatch");
        for (uint256 i = 0; i < _users.length; i++) {
            userDeposits[_users[i]] += _userDeposits[i];
        }
    }

    /**
     * @dev To increment the rounds from backend
     */
    function incrementCurrentStep() external {
        require(
            msg.sender == admin || msg.sender == owner(),
            "caller not admin or owner"
        );
        prevCheckpoints.push(checkPoint);
        if (dynamicTimeFlag) {
            manageTimeDiff();
        }
        if (checkPoint < rounds[0][currentStep]) {
            if (currentStep == 0) {
                remainingTokensTracker.push(
                    rounds[0][currentStep] - totalTokensSold
                );
            } else {
                remainingTokensTracker.push(
                    rounds[0][currentStep] - checkPoint
                );
            }
            checkPoint = rounds[0][currentStep];
        }
        currentStep++;
    }

    /**
     * @dev To set admin
     * @param _admin new admin wallet address
     */
    function setAdmin(address _admin) external onlyOwner {
        admin = _admin;
    }

    /**
     * @dev To change details of the round
     * @param _step round for which you want to change the details
     * @param _checkpoint token tracker amount
     */
    function setCurrentStep(
        uint256 _step,
        uint256 _checkpoint
    ) external onlyOwner {
        currentStep = _step;
        checkPoint = _checkpoint;
    }

    /**
     * @dev To set time shift functionality on/off
     * @param _dynamicTimeFlag bool value
     */
    function setDynamicTimeFlag(bool _dynamicTimeFlag) external onlyOwner {
        dynamicTimeFlag = _dynamicTimeFlag;
    }

    /**
     * @dev     Function to return remainingTokenTracker Array
     */
    function trackRemainingTokens() external view returns (uint256[] memory) {
        return remainingTokensTracker;
    }

    /**
     * @dev     To update remainingTokensTracker Array
     * @param   _unsoldTokens  input parameters in uint256 array format
     */
    function setRemainingTokensArray(uint256[] memory _unsoldTokens) public {
        require(
            msg.sender == admin || msg.sender == owner(),
            "caller not admin or owner"
        );
        require(_unsoldTokens.length != 0, "cannot update invalid values");
        delete remainingTokensTracker;
        for (uint256 i; i < _unsoldTokens.length; i++) {
            remainingTokensTracker.push(_unsoldTokens[i]);
        }
    }
}

Read Contract

USDCInterface 0x25312e54 → address
USDTInterface 0xf597573f → address
admin 0xf851a440 → address
aggregatorInterface 0xc49cc645 → address
baseDecimals 0x33f76178 → uint256
calculatePrice 0xae104265 → uint256
checkPoint 0xcff805ab → uint256
claimStart 0xf04d688f → uint256
currentStep 0x5bc34f71 → uint256
dynamicTimeFlag 0x1fa2bc92 → bool
endTime 0x3197cbb6 → uint256
ethBuyHelper 0x29a5a0b6 → uint256
getLatestPrice 0x8e15f473 → uint256
hasClaimed 0x73b2e80e → bool
isBlacklisted 0xfe575a87 → bool
isWhitelisted 0x3af32abf → bool
maxTokensToBuy 0x9cfa0f7c → uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
paymentWallet 0xe32204dd → address
percentages 0xf8858386 → uint256
prevCheckpoints 0xe19648db → uint256
remainingTokensTracker 0xc23326f3 → uint256
roundDetails 0xba166a39 → uint256[]
rounds 0xe6da9213 → uint256
saleToken 0xe985e367 → address
stakeingWhitelistStatus 0xdad80e86 → bool
stakingManagerInterface 0x38646608 → address
startTime 0x78e97925 → uint256
timeConstant 0x43568eae → uint256
totalBoughtAndStaked 0x7f6fb253 → uint256
totalTokensSold 0x63b20117 → uint256
trackRemainingTokens 0xc8adff01 → uint256[]
usdRaised 0xeadd94ec → uint256
usdtBuyHelper 0x63e40879 → uint256
userDeposits 0x0ba36dcd → uint256
wallets 0x7ad71f72 → address
wertWhitelisted 0x5df4f353 → bool
whitelistClaimOnly 0x53d99207 → bool

Write Contract 34 functions

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

blacklistUsers 0xbb3d676a
address[] _usersToBlacklist
buyWithETHWert 0xae4e0a18
address _user
uint256 _amount
bool stake
returns: bool
buyWithEth 0x2c65169e
uint256 amount
bool stake
returns: bool
buyWithUSDC 0xbff1cbec
uint256 amount
bool stake
returns: bool
buyWithUSDT 0x136021d9
uint256 amount
bool stake
returns: bool
changeClaimStart 0x07f18082
uint256 _claimStart
returns: bool
changeMaxTokensToBuy 0x278c278b
uint256 _maxTokensToBuy
changePaymentWallet 0xcad00556
address _newPaymentWallet
changeRoundsData 0xa6d42e4e
uint256[][3] _rounds
changeSaleTimes 0x0dc9c838
uint256 _startTime
uint256 _endTime
claim 0x4e71d92d
No parameters
returns: bool
claimAndStake 0xcb1a4fc0
No parameters
returns: bool
incrementCurrentStep 0x641046f4
No parameters
pause 0x8456cb59
No parameters
removeFromBlacklist 0x89daf799
address[] _userToRemoveFromBlacklist
removeFromWhitelist 0x548db174
address[] _userToRemoveFromWhitelist
removeFromWhitelistForWERT 0xf4463743
address[] _addressesToRemoveFromWhitelist
renounceOwnership 0x715018a6
No parameters
setAdmin 0x704b6c02
address _admin
setClaimWhitelistStatus 0x1ddc6091
bool _status
setCurrentStep 0x9a89c1fb
uint256 _step
uint256 _checkpoint
setDynamicTimeFlag 0x0a200fc7
bool _dynamicTimeFlag
setRemainingTokensArray 0x2dc358e8
uint256[] _unsoldTokens
setSplits 0x5ddc5688
address[] _wallets
uint256[] _percentages
setStakeingWhitelistStatus 0xb8977d6d
bool _status
setStakingManager 0xb00bba6a
address _stakingManagerAddress
setTimeConstant 0x23a8f1c0
uint256 _timeConstant
setUSDCInterface 0x8b3fb182
address _usdc
startClaim 0x8ac08082
uint256 _claimStart
uint256 noOfTokens
address _saleToken
address _stakingManagerAddress
returns: bool
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateFromBSC 0xfb9a4acd
address[] _users
uint256[] _userDeposits
whitelistUsers 0xedec5f27
address[] _usersToWhitelist
whitelistUsersForWERT 0x03b9c5ad
address[] _addressesToWhitelist

Recent Transactions

No transactions found for this address