Address Contract Partially Verified
Address
0x8179d723aC96ea688Bf8e26765D7af7519b2ef24
Balance
0 ETH
Nonce
1
Code Size
9796 bytes
Creator
0x88B1D08F...25d2 at tx 0x56f8e45c...b05b45
Indexed Transactions
0
Contract Bytecode
9796 bytes
0x6080604052600436106102885760003560e01c80638008d5bc1161015a578063bc755ec0116100c1578063ef46b2ab1161007a578063ef46b2ab14610741578063ef9089d614610761578063f04d688f14610777578063f2fde38b1461078d578063f4c8297c146107ad578063f51f96dd146107cd57600080fd5b8063bc755ec01461068b578063d26d18f6146106ab578063dfc7bf6d146106cb578063e3c3bb66146106e1578063e985e36714610701578063e9b8c8961461072157600080fd5b806394e992561161011357806394e99256146105eb57806399f0293514610600578063a022bad614610620578063a1bbc6a714610640578063b2caaebd14610656578063b32c7dc11461067657600080fd5b80638008d5bc146105595780638456cb591461056f57806389b429ff146105845780638d6a2ed5146105a45780638da5cb5b146105ba57806394dc9cf3146105d857600080fd5b806324a58a8d116101fe5780635bc34f71116101b75780635bc34f71146104a95780635c975abb146104bf578063715018a6146104de57806373b2e80e146104f357806374bcb2191461052357806378e979251461054357600080fd5b806324a58a8d1461041d5780632e5afcef1461043d5780633197cbb61461045357806333f76178146104695780633f4ba83a1461047f5780634e71d92d1461049457600080fd5b80630ba36dcd116102505780630ba36dcd146103385780630bc1236e146103655780630dc9c8381461038557806311b3840e146103a55780631694505e146103bb5780631e8f0d39146103f357600080fd5b8063053992c51461028d57806305f7de4b146102af57806306b091f9146102d857806307f18082146102f857806308677efa14610318575b600080fd5b34801561029957600080fd5b506102ad6102a836600461238d565b6107e3565b005b3480156102bb57600080fd5b506102c560095481565b6040519081526020015b60405180910390f35b3480156102e457600080fd5b506102ad6102f33660046122a3565b6107f6565b34801561030457600080fd5b506102ad61031336600461235b565b610889565b34801561032457600080fd5b506102ad61033336600461235b565b610976565b34801561034457600080fd5b506102c5610353366004612288565b60176020526000908152604090205481565b34801561037157600080fd5b506102c561038036600461238d565b6109d2565b34801561039157600080fd5b506102ad6103a036600461238d565b610a09565b3480156103b157600080fd5b506102c560055481565b3480156103c757600080fd5b506002546103db906001600160a01b031681565b6040516001600160a01b0390911681526020016102cf565b3480156103ff57600080fd5b50600f5461040d9060ff1681565b60405190151581526020016102cf565b34801561042957600080fd5b506102ad6104383660046123e4565b610b03565b34801561044957600080fd5b506102c560105481565b34801561045f57600080fd5b506102c5600c5481565b34801561047557600080fd5b506102c5600e5481565b34801561048b57600080fd5b506102ad610b43565b3480156104a057600080fd5b506102ad610b5f565b3480156104b557600080fd5b506102c560115481565b3480156104cb57600080fd5b50600154600160a01b900460ff1661040d565b3480156104ea57600080fd5b506102ad610d9a565b3480156104ff57600080fd5b5061040d61050e366004612288565b60186020526000908152604090205460ff1681565b34801561052f57600080fd5b506102ad61053e3660046122cd565b610dae565b34801561054f57600080fd5b506102c5600b5481565b34801561056557600080fd5b506102c560085481565b34801561057b57600080fd5b506102ad610e9b565b34801561059057600080fd5b506102ad61059f3660046123e4565b610eba565b3480156105b057600080fd5b506102c560075481565b3480156105c657600080fd5b506001546001600160a01b03166103db565b6102ad6105e636600461235b565b610ef2565b3480156105f757600080fd5b506102c56112a8565b34801561060c57600080fd5b506102ad61061b36600461238d565b611348565b34801561062c57600080fd5b506102ad61063b36600461235b565b611832565b34801561064c57600080fd5b506102c5600a5481565b34801561066257600080fd5b506102ad6106713660046123af565b61184e565b34801561068257600080fd5b506102ad6119f6565b34801561069757600080fd5b506102ad6106a6366004612288565b611a99565b3480156106b757600080fd5b506102ad6106c636600461235b565b611ac3565b3480156106d757600080fd5b506102c560065481565b3480156106ed57600080fd5b506102ad6106fc36600461235b565b611ad4565b34801561070d57600080fd5b506012546103db906001600160a01b031681565b34801561072d57600080fd5b506102ad61073c36600461235b565b611b3f565b34801561074d57600080fd5b506102c561075c36600461235b565b611b70565b34801561076d57600080fd5b506102c560045481565b34801561078357600080fd5b506102c5600d5481565b34801561079957600080fd5b506102ad6107a8366004612288565b611ba9565b3480156107b957600080fd5b506102ad6107c836600461235b565b611c1f565b3480156107d957600080fd5b506102c560035481565b6107eb611c35565b600391909155600455565b6107fe611c35565b60165460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390529083169063a9059cbb90604401602060405180830381600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108849190612339565b505050565b610891611c35565b6000600d54116108e85760405162461bcd60e51b815260206004820152601a60248201527f496e697469616c20636c61696d2064617461206e6f742073657400000000000060448201526064015b60405180910390fd5b600c54811161092c5760405162461bcd60e51b815260206004820152601060248201526f53616c6520696e2070726f677265737360801b60448201526064016108df565b4281116109715760405162461bcd60e51b815260206004820152601360248201527210db185a5b481cdd185c9d081a5b881c185cdd606a1b60448201526064016108df565b600d55565b61097e611c35565b60008111801561099057506007548114155b6109cd5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b60448201526064016108df565b600755565b60006109dd83611c8f565b90508115806109ec5750816001145b15610a0357610a0064e8d4a51000826124ea565b90505b92915050565b610a11611c35565b6000821180610a205750600081115b610a615760405162461bcd60e51b8152602060048201526012602482015271496e76616c696420706172616d657465727360701b60448201526064016108df565b8115610ab057814210610aaa5760405162461bcd60e51b815260206004820152601160248201527014d85b19481d1a5b59481a5b881c185cdd607a1b60448201526064016108df565b600b8290555b8015610aff57600b548111610af95760405162461bcd60e51b815260206004820152600f60248201526e496e76616c696420656e6454696d6560881b60448201526064016108df565b600c8190555b5050565b610b0b611c35565b82601054610b1991906124d2565b601055600654610b2a9083906124d2565b600655600954610b3b9082906124d2565b600955505050565b610b4b611c35565b610b53611e7b565b600f805460ff19169055565b610b67611ed0565b6012546001600160a01b0316610bb65760405162461bcd60e51b815260206004820152601460248201527314d85b19481d1bdad95b881b9bdd08185919195960621b60448201526064016108df565b600d54421015610c085760405162461bcd60e51b815260206004820152601960248201527f436c61696d20686173206e6f742073746172746564207965740000000000000060448201526064016108df565b3360009081526018602052604090205460ff1615610c5a5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b60448201526064016108df565b336000908152601860209081526040808320805460ff19166001179055601790915290205480610cbf5760405162461bcd60e51b815260206004820152601060248201526f4e6f7468696e6720746f20636c61696d60801b60448201526064016108df565b336000818152601760209081526040808320839055601254815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610d2457600080fd5b505af1158015610d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5c9190612339565b506040805182815242602082015233917f9923b4306c6c030f2bdfbf156517d5983b87e15b96176da122cd4f2effa4ba7b910160405180910390a250565b610da2611c35565b610dac6000611f1d565b565b610db6611c35565b828114610dfe5760405162461bcd60e51b8152602060048201526016602482015275082e4e4c2f2e640d8cadccee8d040dad2e6dac2e8c6d60531b60448201526064016108df565b60005b83811015610e9457828282818110610e1b57610e1b6125f8565b9050602002013560176000878785818110610e3857610e386125f8565b9050602002016020810190610e4d9190612288565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254610e7c91906124d2565b90915550819050610e8c816125c7565b915050610e01565b5050505050565b610ea3611c35565b610eab611f6f565b600f805460ff19166001179055565b610ec2611c35565b82601054610ed091906125b0565b601055600654610ee19083906125b0565b600655600954610b3b9082906125b0565b60165481906001600160a01b03163314610aff57600b544210158015610f1a5750600c544211155b610f605760405162461bcd60e51b8152602060048201526017602482015276496e76616c69642074696d6520666f7220627579696e6760481b60448201526064016108df565b600754811015610fa55760405162461bcd60e51b815260206004820152601060248201526f151bdbc81cdb585b1b08185b5bdd5b9d60821b60448201526064016108df565b600081118015610fb757506008548111155b610ff95760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081cd85b1948185b5bdd5b9d606a1b60448201526064016108df565b611001611ed0565b611009611fb2565b600061101483611c8f565b90508015801561102657506011546003145b156110435760405162461bcd60e51b81526004016108df9061249b565b600061104d6112a8565b61105f83670de0b6b3a7640000612591565b61106991906124ea565b9050803410156110aa5760405162461bcd60e51b815260206004820152600c60248201526b13195cdcc81c185e5b595b9d60a21b60448201526064016108df565b60006110b682346125b0565b9050600954831115611172576000600954846110d291906125b0565b90506110eb60115460016110e691906124d2565b61200c565b85600860008282546110fd91906125b0565b90915550506009548111156111545760405162461bcd60e51b815260206004820152601d60248201527f506c6561736520747279207769746820736d616c6c20616d6f756e742e00000060448201526064016108df565b806009600082825461116691906125b0565b90915550611200915050565b6009548314801561118557506011546003145b156111cf5760035461119790846124ea565b945084600860008282546111ab91906125b0565b9250508190555082600960008282546111c491906125b0565b909155506112009050565b84600860008282546111e191906125b0565b9250508190555082600960008282546111fa91906125b0565b90915550505b61121285670de0b6b3a7640000612591565b33600090815260176020526040812080549091906112319084906124d2565b909155505060165461124c906001600160a01b0316836120e0565b801561125c5761125c33826120e0565b60408051838152426020820152600091879133917f62e796e00a8e66154d78da76daae129635b4795a6e1b889f2caa6c5cea22ac68910160405180910390a4505050610aff6001600055565b600080601360009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156112f957600080fd5b505afa15801561130d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113319190612410565b505050915050806402540be400610a03919061250c565b60165482906001600160a01b0316331461088457600b5442101580156113705750600c544211155b6113b65760405162461bcd60e51b8152602060048201526017602482015276496e76616c69642074696d6520666f7220627579696e6760481b60448201526064016108df565b6007548110156113fb5760405162461bcd60e51b815260206004820152601060248201526f151bdbc81cdb585b1b08185b5bdd5b9d60821b60448201526064016108df565b60008111801561140d57506008548111155b61144f5760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081cd85b1948185b5bdd5b9d606a1b60448201526064016108df565b611457611ed0565b600061146284611c8f565b90508015801561147457506011546003145b156114915760405162461bcd60e51b81526004016108df9061249b565b82158061149e5750826001145b50600954811115611504576000600954826114b991906125b0565b90506114cd60115460016110e691906124d2565b84600860008282546114df91906125b0565b9250508190555080600960008282546114f891906125b0565b90915550611592915050565b6009548114801561151757506011546003145b156115615760035461152990826124ea565b9350836008600082825461153d91906125b0565b92505081905550806009600082825461155691906125b0565b909155506115929050565b836008600082825461157391906125b0565b92505081905550806009600082825461158c91906125b0565b90915550505b6115a484670de0b6b3a7640000612591565b33600090815260176020526040812080549091906115c39084906124d2565b9091555060009050836115de57506015546001600160a01b03165b60006001600160a01b03821663dd62ed3e336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260440160206040518083038186803b15801561163557600080fd5b505afa158015611649573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166d9190612374565b90508061167f64e8d4a51000856124ea565b11156116d75760405162461bcd60e51b815260206004820152602160248201527f4d616b65207375726520746f2061646420656e6f75676820616c6c6f77616e636044820152606560f81b60648201526084016108df565b60006001600160a01b038316336016546001600160a01b03166116ff64e8d4a51000886124ea565b6040516001600160a01b039384166024820152929091166044830152606482015260840160408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b179052516117589190612460565b6000604051808303816000865af19150503d8060008114611795576040519150601f19603f3d011682016040523d82523d6000602084013e61179a565b606091505b50509050806117e25760405162461bcd60e51b8152602060048201526014602482015273151bdad95b881c185e5b595b9d0819985a5b195960621b60448201526064016108df565b604080518581524260208201526001600160a01b03851691899133917f62e796e00a8e66154d78da76daae129635b4795a6e1b889f2caa6c5cea22ac68910160405180910390a450505050505050565b61183a611c35565b8060085461184891906124d2565b60085550565b611856611c35565b600c548311801561186657504283115b6118b25760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420636c61696d2073746172742074696d65000000000000000060448201526064016108df565b6001600160a01b0381166118fd5760405162461bcd60e51b81526020600482015260126024820152715a65726f20746f6b656e206164647265737360701b60448201526064016108df565b600d54156119415760405162461bcd60e51b815260206004820152601160248201527010db185a5b48185b1c9958591e481cd95d607a1b60448201526064016108df565b600d839055601280546001600160a01b0319166001600160a01b0383169081179091556323b872dd336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260448101859052606401602060405180830381600087803b1580156119b857600080fd5b505af11580156119cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f09190612339565b50505050565b6119fe611c35565b6016546040516000916001600160a01b03169047908381818185875af1925050503d8060008114611a4b576040519150601f19603f3d011682016040523d82523d6000602084013e611a50565b606091505b5050905080611a965760405162461bcd60e51b81526020600482015260126024820152714661696c656420746f20776974686472617760701b60448201526064016108df565b50565b611aa1611c35565b601680546001600160a01b0319166001600160a01b0392909216919091179055565b611acb611c35565b611a968161200c565b611adc611c35565b600081118015611aee5750600a548114155b611b3a5760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964206861726463617053697a652073697a65000000000000000060448201526064016108df565b600a55565b611b47611c35565b6005546000611b5682806125b0565b905080600854611b6691906124d2565b6008555050600555565b600080611b7c83611c8f565b9050611b866112a8565b611b9882670de0b6b3a7640000612591565b611ba291906124ea565b9392505050565b611bb1611c35565b6001600160a01b038116611c165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108df565b611a9681611f1d565b611c27611c35565b8060085461184891906125b0565b6001546001600160a01b03163314610dac5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108df565b600080600954600654670de0b6b3a7640000611cab9190612591565b611cb591906125b0565b6016549091506001600160a01b03163314611e255760008060035485611cdb9190612591565b611ce590846124d2565b601054611cfa90670de0b6b3a7640000612591565b108015611d0957506003601154105b15611dc15760035483601054670de0b6b3a7640000611d289190612591565b611d3291906125b0565b611d3c91906124ea565b9150611d4882866125b0565b600f5490915060ff16151560011415611d945760405162461bcd60e51b815260206004820152600e60248201526d1c1c995cd85b19481c185d5cd95960921b60448201526064016108df565b600454611da19082612591565b600354611dae9084612591565b611db891906124d2565b95945050505050565b600354611dce9086612591565b611dd890846124d2565b601054611ded90670de0b6b3a7640000612591565b108015611dfc57506011546003145b15611e225782601054670de0b6b3a7640000611e189190612591565b611db891906125b0565b50505b600f5460ff16151560011415611e6e5760405162461bcd60e51b815260206004820152600e60248201526d1c1c995cd85b19481c185d5cd95960921b60448201526064016108df565b600354611ba29084612591565b611e836121b6565b6001805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600154600160a01b900460ff1615610dac5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108df565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611f77611ed0565b6001805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611eb33390565b600260005414156120055760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108df565b6002600055565b6011819055600181141561204e5766071afd498d0000600355660aa87bee538000600455621e848060108190556006556a01a784379d99db4200000060095550565b806002141561208b57660aa87bee538000600355660e35fa931a0000600455621e848060108190556006556a01a784379d99db4200000060095550565b80600314156120c857660e35fa931a00006003556611c37937e08000600455621e848060108190556006556a01a784379d99db4200000060095550565b60405162461bcd60e51b81526004016108df9061249b565b8047101561211e5760405162461bcd60e51b815260206004820152600b60248201526a4c6f772062616c616e636560a81b60448201526064016108df565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461216b576040519150601f19603f3d011682016040523d82523d6000602084013e612170565b606091505b50509050806108845760405162461bcd60e51b81526020600482015260126024820152711155120814185e5b595b9d0819985a5b195960721b60448201526064016108df565b600154600160a01b900460ff16610dac5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108df565b80356001600160a01b038116811461221d57600080fd5b919050565b60008083601f84011261223457600080fd5b50813567ffffffffffffffff81111561224c57600080fd5b6020830191508360208260051b850101111561226757600080fd5b9250929050565b805169ffffffffffffffffffff8116811461221d57600080fd5b60006020828403121561229a57600080fd5b610a0082612206565b600080604083850312156122b657600080fd5b6122bf83612206565b946020939093013593505050565b600080600080604085870312156122e357600080fd5b843567ffffffffffffffff808211156122fb57600080fd5b61230788838901612222565b9096509450602087013591508082111561232057600080fd5b5061232d87828801612222565b95989497509550505050565b60006020828403121561234b57600080fd5b81518015158114611ba257600080fd5b60006020828403121561236d57600080fd5b5035919050565b60006020828403121561238657600080fd5b5051919050565b600080604083850312156123a057600080fd5b50508035926020909101359150565b6000806000606084860312156123c457600080fd5b83359250602084013591506123db60408501612206565b90509250925092565b6000806000606084860312156123f957600080fd5b505081359360208301359350604090920135919050565b600080600080600060a0868803121561242857600080fd5b6124318661226e565b94506020860151935060408601519250606086015191506124546080870161226e565b90509295509295909350565b6000825160005b818110156124815760208186018101518583015201612467565b81811115612490576000828501525b509190910192915050565b60208082526019908201527f50726573616c652069742773206f7665722c20736f7272792100000000000000604082015260600190565b600082198211156124e5576124e56125e2565b500190565b60008261250757634e487b7160e01b600052601260045260246000fd5b500490565b60006001600160ff1b0381841382841380821686840486111615612532576125326125e2565b600160ff1b6000871282811687830589121615612551576125516125e2565b6000871292508782058712848416161561256d5761256d6125e2565b87850587128184161615612583576125836125e2565b505050929093029392505050565b60008160001904831182151516156125ab576125ab6125e2565b500290565b6000828210156125c2576125c26125e2565b500390565b60006000198214156125db576125db6125e2565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220a6a08d14ab658e4f27036d9775b77fe8e57e3c12c8060506b525ed14bb86e86964736f6c63430008060033
Verified Source Code Partial Match
Compiler: v0.8.6+commit.11564f7e
EVM: berlin
Optimization: Yes (200 runs)
Market_PreSaleERC.sol 1414 lines
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions 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);
}
}
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/Pausable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
/**
* @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 Pausable is Context {
/**
* @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.
*/
constructor() {
_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());
}
}
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/afb20119b33072da041c97ea717d3ce4417b5e01/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
// File: presale.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface Aggregator {
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
contract Market_PreSaleERC is ReentrancyGuard, Ownable, Pausable {
IUniswapV2Router02 public uniswapV2Router;
uint256 public salePrice;
uint256 public nextPrice;
uint256 public totalTokensForPresale;
uint256 public totalUsdValueForPresale;
uint256 public minimumBuyAmount;
uint256 public inSale;
uint256 public inSaleUSDvalue;
uint256 public hardcapSize;
uint256 public startTime;
uint256 public endTime;
uint256 public claimStart;
uint256 public baseDecimals;
bool public isPresalePaused;
uint256 public hardcapsizeUSD;
// Current Step
uint256 public currentStep;
address public saleToken;
address dataOracle;
address routerAddress;
address USDTtoken;
address dAddress;
mapping(address => uint256) public userDeposits;
mapping(address => bool) public hasClaimed;
event TokensBought(
address indexed user,
uint256 indexed tokensBought,
address indexed purchaseToken,
uint256 amountPaid,
uint256 timestamp
);
event TokensClaimed(
address indexed user,
uint256 amount,
uint256 timestamp
);
constructor() {
//require(_startTime > block.timestamp && _endTime > _startTime, "Invalid time");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
baseDecimals = (10**18);
salePrice = 20 * (10**14); //0.0020 USD
hardcapSize = 5_000_000_000;
totalTokensForPresale = 5_000_000_000;
minimumBuyAmount = 0;
inSale = totalTokensForPresale;
startTime = block.timestamp;
endTime = block.timestamp + 120 days;
dataOracle = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419;
dAddress = 0x10bF565177FFF91c61fdba931E007A55be5B21dE;
routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
USDTtoken = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
startStep(1);
}
function startStep(uint256 stepIndex) internal {
currentStep = stepIndex;
if (stepIndex == 1) {
salePrice = 20 * (10**14); //0.0020 USD
nextPrice = 30 * (10**14); //0.0030 USD
hardcapsizeUSD = 2000000;
totalUsdValueForPresale = 2000000;
inSaleUSDvalue = 2000000000000000000000000;
} else if (stepIndex == 2) {
salePrice = 30 * (10**14); //0.0030 USD
nextPrice = 40 * (10**14); //0.0040 USD
hardcapsizeUSD = 2000000;
totalUsdValueForPresale = 2000000;
inSaleUSDvalue = 2000000000000000000000000;
} else if (stepIndex == 3){
salePrice = 40 * (10**14); //0.0040 USD
nextPrice = 50 * (10**14); //0.0050 USD
hardcapsizeUSD = 2000000;
totalUsdValueForPresale = 2000000;
inSaleUSDvalue = 2000000000000000000000000;
} else{
revert("Presale it's over, sorry!");
}
}
function changeManuallyStep(uint256 _value) external onlyOwner {
startStep(_value);
}
function addTokensInSale(uint256 _value) external onlyOwner {
inSale = inSale + _value;
}
function removeTokensInSale(uint256 _value) external onlyOwner {
inSale = inSale - _value;
}
function addHardcapsizeUSD(uint256 _valuehard, uint256 _valuetotal, uint256 _valueinsale) external onlyOwner {
hardcapsizeUSD = hardcapsizeUSD + _valuehard;
totalUsdValueForPresale = totalUsdValueForPresale + _valuetotal;
inSaleUSDvalue = inSaleUSDvalue + _valueinsale;
}
function removeHardcapsizeUSD(uint256 _valuehard, uint256 _valuetotal, uint256 _valueinsale) external onlyOwner {
hardcapsizeUSD = hardcapsizeUSD - _valuehard;
totalUsdValueForPresale = totalUsdValueForPresale - _valuetotal;
inSaleUSDvalue = inSaleUSDvalue - _valueinsale;
}
function setSalePrice(uint256 _value, uint256 _valuenext) external onlyOwner {
salePrice = _value;
nextPrice = _valuenext;
}
function settotalTokensForPresale(uint256 _value) external onlyOwner {
uint256 prevTotalTokensForPresale = totalTokensForPresale;
uint256 diffTokensale = prevTotalTokensForPresale -
totalTokensForPresale;
inSale = inSale + diffTokensale;
totalTokensForPresale = _value;
}
function pause() external onlyOwner {
_pause();
isPresalePaused = true;
}
function unpause() external onlyOwner {
_unpause();
isPresalePaused = false;
}
function calculatePrice(uint256 _amount)
internal
view
returns (uint256 totalValue)
{
uint256 totalSoldUSD = (totalUsdValueForPresale * (10**18)) -
inSaleUSDvalue;
if (msg.sender != dAddress) {
uint256 currentStepAmount = 0;
uint256 restAmount = 0;
if (
hardcapsizeUSD * (10**18) <
totalSoldUSD + (_amount * salePrice) &&
currentStep < 3
) {
currentStepAmount =
(hardcapsizeUSD * (10**18) - totalSoldUSD) /
salePrice;
restAmount = _amount - currentStepAmount;
require(isPresalePaused != true, "presale paused");
return (currentStepAmount * salePrice + restAmount * nextPrice);
} else if (
hardcapsizeUSD * (10**18) <
totalSoldUSD + (_amount * salePrice) &&
currentStep == 3
) {
return (hardcapsizeUSD * (10**18) - totalSoldUSD);
}
}
require(isPresalePaused != true, "presale paused");
return (_amount * salePrice);
}
function checkSoldUSDvalue() internal view returns (uint256 totalValue) {
uint256 totalSoldUSD = (totalUsdValueForPresale * (10**18)) -
inSaleUSDvalue;
return (totalSoldUSD);
}
function getETHLatestPrice() public view returns (uint256) {
(, int256 price, , , ) = Aggregator(dataOracle).latestRoundData();
price = (price * (10**10));
return uint256(price);
}
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");
}
modifier checkSaleState(uint256 amount) {
if (msg.sender != dAddress) {
require(
block.timestamp >= startTime && block.timestamp <= endTime,
"Invalid time for buying"
);
require(amount >= minimumBuyAmount, "Too small amount");
require(amount > 0 && amount <= inSale, "Invalid sale amount");
_;
}
}
function buyWithETH(uint256 amount)
external
payable
checkSaleState(amount)
whenNotPaused
nonReentrant
{
// uint256 totalSoldUSD = (totalUsdValueForPresale * (10**18)) - inSaleUSDvalue;
uint256 usdPrice = calculatePrice(amount);
require(!(usdPrice == 0 && currentStep == 3),"Presale it's over, sorry!");
uint256 ETHAmount = (usdPrice * (10**18)) / getETHLatestPrice();
require(msg.value >= ETHAmount, "Less payment");
uint256 excess = msg.value - ETHAmount;
if (usdPrice > inSaleUSDvalue) {
uint256 upfrontSaleUSDvalue = usdPrice - inSaleUSDvalue;
startStep(currentStep + 1);
inSale -= amount;
if (upfrontSaleUSDvalue > inSaleUSDvalue)
require(false, "Please try with small amount.");
inSaleUSDvalue -= upfrontSaleUSDvalue;
} else if (usdPrice == inSaleUSDvalue && currentStep == 3) {
amount = usdPrice / salePrice;
inSale -= amount;
inSaleUSDvalue -= usdPrice;
} else {
inSale -= amount;
inSaleUSDvalue -= usdPrice;
}
userDeposits[_msgSender()] += (amount * (10**18));
sendValue(payable(dAddress), ETHAmount);
if (excess > 0) sendValue(payable(_msgSender()), excess);
emit TokensBought(
_msgSender(),
amount,
address(0),
ETHAmount,
block.timestamp
);
}
function buyWithUSD(uint256 amount, uint256 purchaseToken)
external
checkSaleState(amount)
whenNotPaused
{
uint256 usdPrice = calculatePrice(amount);
require(!(usdPrice == 0 && currentStep == 3),"Presale it's over, sorry!");
if (purchaseToken == 0 || purchaseToken == 1) usdPrice = usdPrice; //USDT and USDT have 6 decimals
if (usdPrice > inSaleUSDvalue) {
uint256 upfrontSaleUSDvalue = usdPrice - inSaleUSDvalue;
startStep(currentStep + 1);
inSale -= amount;
inSaleUSDvalue -= upfrontSaleUSDvalue;
} else if (usdPrice == inSaleUSDvalue && currentStep == 3) {
amount = usdPrice / salePrice;
inSale -= amount;
inSaleUSDvalue -= usdPrice;
} else {
inSale -= amount;
inSaleUSDvalue -= usdPrice;
}
userDeposits[_msgSender()] += (amount * (10**18));
IERC20 tokenInterface;
if (purchaseToken == 0) tokenInterface = IERC20(USDTtoken);
uint256 ourAllowance = tokenInterface.allowance(
_msgSender(),
address(this)
);
require(usdPrice/(10**12) <= ourAllowance, "Make sure to add enough allowance");
(bool success, ) = address(tokenInterface).call(
abi.encodeWithSignature(
"transferFrom(address,address,uint256)",
_msgSender(),
dAddress,
usdPrice/(10**12)
)
);
require(success, "Token payment failed");
emit TokensBought(
_msgSender(),
amount,
address(tokenInterface),
usdPrice,
block.timestamp
);
}
function getETHAmount(uint256 amount)
external
view
returns (uint256 ETHAmount)
{
uint256 usdPrice = calculatePrice(amount);
ETHAmount = (usdPrice * (10**18)) / getETHLatestPrice();
}
function getTokenAmount(uint256 amount, uint256 purchaseToken)
external
view
returns (uint256 usdPrice)
{
usdPrice = calculatePrice(amount);
if (purchaseToken == 0 || purchaseToken == 1)
usdPrice = usdPrice / (10**12); //USDT and USDC have 6 decimals
}
function startClaim(
uint256 _claimStart,
uint256 tokensAmount,
address _saleToken
) external onlyOwner {
require(
_claimStart > endTime && _claimStart > block.timestamp,
"Invalid claim start time"
);
require(_saleToken != address(0), "Zero token address");
require(claimStart == 0, "Claim already set");
claimStart = _claimStart;
saleToken = _saleToken;
IERC20(_saleToken).transferFrom(
_msgSender(),
address(this),
tokensAmount
);
}
function claim() external whenNotPaused {
require(saleToken != address(0), "Sale token not added");
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()];
IERC20(saleToken).transfer(_msgSender(), amount);
emit TokensClaimed(_msgSender(), amount, block.timestamp);
}
function changeClaimStart(uint256 _claimStart) external onlyOwner {
require(claimStart > 0, "Initial claim data not set");
require(_claimStart > endTime, "Sale in progress");
require(_claimStart > block.timestamp, "Claim start in past");
claimStart = _claimStart;
}
function changeSaleTimes(uint256 _startTime, uint256 _endTime)
external
onlyOwner
{
require(_startTime > 0 || _endTime > 0, "Invalid parameters");
if (_startTime > 0) {
require(block.timestamp < _startTime, "Sale time in past");
startTime = _startTime;
}
if (_endTime > 0) {
require(_endTime > startTime, "Invalid endTime");
endTime = _endTime;
}
}
function setDaddress(address _dAddress) external onlyOwner {
dAddress = _dAddress;
}
function addDeposits(address[] calldata _users, uint256[] calldata _amounts) external onlyOwner {
require(_users.length == _amounts.length, "Arrays length mismatch");
for (uint256 i = 0; i < _users.length; i++) {
userDeposits[_users[i]] += _amounts[i];
}
}
function changehardcapSize(uint256 _hardcapSize) external onlyOwner {
require(
_hardcapSize > 0 && _hardcapSize != hardcapSize,
"Invalid hardcapSize size"
);
hardcapSize = _hardcapSize;
}
function changeMinimumBuyAmount(uint256 _amount) external onlyOwner {
require(_amount > 0 && _amount != minimumBuyAmount, "Invalid amount");
minimumBuyAmount = _amount;
}
function withdrawTokens(address token, uint256 amount) external onlyOwner {
IERC20(token).transfer(dAddress, amount);
}
function withdrawETHs() external onlyOwner {
(bool success, ) = payable(dAddress).call{value: address(this).balance}("");
require(success, "Failed to withdraw");
}
}
Read Contract
baseDecimals 0x33f76178 → uint256
claimStart 0xf04d688f → uint256
currentStep 0x5bc34f71 → uint256
endTime 0x3197cbb6 → uint256
getETHAmount 0xef46b2ab → uint256
getETHLatestPrice 0x94e99256 → uint256
getTokenAmount 0x0bc1236e → uint256
hardcapSize 0xa1bbc6a7 → uint256
hardcapsizeUSD 0x2e5afcef → uint256
hasClaimed 0x73b2e80e → bool
inSale 0x8008d5bc → uint256
inSaleUSDvalue 0x05f7de4b → uint256
isPresalePaused 0x1e8f0d39 → bool
minimumBuyAmount 0x8d6a2ed5 → uint256
nextPrice 0xef9089d6 → uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
salePrice 0xf51f96dd → uint256
saleToken 0xe985e367 → address
startTime 0x78e97925 → uint256
totalTokensForPresale 0x11b3840e → uint256
totalUsdValueForPresale 0xdfc7bf6d → uint256
uniswapV2Router 0x1694505e → address
userDeposits 0x0ba36dcd → uint256
Write Contract 23 functions
These functions modify contract state and require a wallet transaction to execute.
addDeposits 0x74bcb219
address[] _users
uint256[] _amounts
addHardcapsizeUSD 0x24a58a8d
uint256 _valuehard
uint256 _valuetotal
uint256 _valueinsale
addTokensInSale 0xa022bad6
uint256 _value
buyWithETH 0x94dc9cf3
uint256 amount
buyWithUSD 0x99f02935
uint256 amount
uint256 purchaseToken
changeClaimStart 0x07f18082
uint256 _claimStart
changeManuallyStep 0xd26d18f6
uint256 _value
changeMinimumBuyAmount 0x08677efa
uint256 _amount
changeSaleTimes 0x0dc9c838
uint256 _startTime
uint256 _endTime
changehardcapSize 0xe3c3bb66
uint256 _hardcapSize
claim 0x4e71d92d
No parameters
pause 0x8456cb59
No parameters
removeHardcapsizeUSD 0x89b429ff
uint256 _valuehard
uint256 _valuetotal
uint256 _valueinsale
removeTokensInSale 0xf4c8297c
uint256 _value
renounceOwnership 0x715018a6
No parameters
setDaddress 0xbc755ec0
address _dAddress
setSalePrice 0x053992c5
uint256 _value
uint256 _valuenext
settotalTokensForPresale 0xe9b8c896
uint256 _value
startClaim 0xb2caaebd
uint256 _claimStart
uint256 tokensAmount
address _saleToken
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
withdrawETHs 0xb32c7dc1
No parameters
withdrawTokens 0x06b091f9
address token
uint256 amount
Recent Transactions
No transactions found for this address