Address Contract Verified
Address
0xc9B06E927E914d7eC563435B543DC2f2BeD0b1C5
Balance
0 ETH
Nonce
1
Code Size
9227 bytes
Creator
0x6e9eea48...9cd7 at tx 0xb5b13ad8...d862b1
Indexed Transactions
0
Contract Bytecode
9227 bytes
0x608060405234801561000f575f5ffd5b50600436106101e3575f3560e01c806376f6435c1161010d578063b071cbe6116100a0578063e62641171161006f578063e626411714610503578063f26ce26014610521578063f2fde38b1461053f578063fe67a1891461055b576101e3565b8063b071cbe61461047b578063bb8b2b4714610499578063d20d0a2f146104c9578063e18132c4146104e5576101e3565b806381d136cb116100dc57806381d136cb146104035780638d4e4083146104215780638da5cb5b1461043f578063a98ad46c1461045d576101e3565b806376f6435c1461038d57806376fba382146103a957806378e97925146103c75780637ff9b596146103e5576101e3565b80633d5dff5311610185578063518ab2a811610154578063518ab2a81461032b5780635ef8086f146103495780636681b9fd14610365578063715018a614610383576101e3565b80633d5dff53146102b757806342e94c90146102e757806348c54b9d146103175780634bb278f314610321576101e3565b80631ed77dc8116101c15780631ed77dc81461023f5780631f2211f71461025d57806322f3e2d41461027b57806333b5b62e14610299576101e3565b80630a2125c3146101e75780630ec1ecac146102055780631481794e14610223575b5f5ffd5b6101ef610579565b6040516101fc9190611ec3565b60405180910390f35b61020d61058f565b60405161021a9190611ec3565b60405180910390f35b61023d60048036038101906102389190611f64565b610598565b005b6102476107ce565b6040516102549190611fb1565b60405180910390f35b6102656107f3565b6040516102729190611ec3565b60405180910390f35b6102836107f9565b6040516102909190611fe4565b60405180910390f35b6102a161083b565b6040516102ae9190611ec3565b60405180910390f35b6102d160048036038101906102cc9190611ffd565b610841565b6040516102de9190611ec3565b60405180910390f35b61030160048036038101906102fc9190611ffd565b610856565b60405161030e9190611ec3565b60405180910390f35b61031f61086b565b005b610329610b55565b005b610333610d4a565b6040516103409190611ec3565b60405180910390f35b610363600480360381019061035e9190612028565b610d50565b005b61036d6112a7565b60405161037a9190611ec3565b60405180910390f35b61038b6112ad565b005b6103a760048036038101906103a29190612028565b6112c0565b005b6103b161140d565b6040516103be9190611ec3565b60405180910390f35b6103cf61147f565b6040516103dc9190611ec3565b60405180910390f35b6103ed611485565b6040516103fa9190611ec3565b60405180910390f35b61040b61148b565b6040516104189190611ec3565b60405180910390f35b610429611491565b6040516104369190611fe4565b60405180910390f35b6104476114a3565b6040516104549190611fb1565b60405180910390f35b6104656114ca565b60405161047291906120ae565b60405180910390f35b6104836114ee565b6040516104909190611ec3565b60405180910390f35b6104b360048036038101906104ae9190611ffd565b6114f4565b6040516104c09190611ec3565b60405180910390f35b6104e360048036038101906104de9190612028565b61153a565b005b6104ed611a35565b6040516104fa9190611ec3565b60405180910390f35b61050b611a3c565b6040516105189190611ec3565b60405180910390f35b610529611a45565b60405161053691906120ae565b60405180910390f35b61055960048036038101906105549190611ffd565b611a69565b005b610563611aed565b6040516105709190611ec3565b60405180910390f35b5f600b5460055461058a91906120f4565b905090565b5f600a54905090565b6105a0611af3565b6105a8611b39565b5f81036105e1576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610646576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016106a09190611fb1565b602060405180830381865afa1580156106bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106df919061213b565b9050818110156107285781816040517fcf47918100000000000000000000000000000000000000000000000000000000815260040161071f929190612166565b60405180910390fd5b61077383837f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec773ffffffffffffffffffffffffffffffffffffffff16611bc09092919063ffffffff16565b8273ffffffffffffffffffffffffffffffffffffffff167feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d836040516107b99190611ec3565b60405180910390a2506107ca611c3f565b5050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e5481565b5f6006544210158015610818575060075f9054906101000a900460ff16155b80156108275750600554600b54105b80156108365750600454600a54105b905090565b60095481565b600d602052805f5260405f205f915090505481565b600c602052805f5260405f205f915090505481565b610873611af3565b60075f9054906101000a900460ff166108b8576040517f1bee0d5a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f620151806008546108ca919061218d565b90508042101561091157806040517fb11a8edb0000000000000000000000000000000000000000000000000000000081526004016109089190611ec3565b60405180910390fd5b5f600d5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205490505f810361098b576040517f0f3f861000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f0000000000000000000000003892f5076cadadfe182784081792fedd8e13e4b973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016109e59190611fb1565b602060405180830381865afa158015610a00573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a24919061213b565b905081811015610a6d5780826040517f1e8422ef000000000000000000000000000000000000000000000000000000008152600401610a64929190612166565b60405180910390fd5b5f600d5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550610afa33837f0000000000000000000000003892f5076cadadfe182784081792fedd8e13e4b973ffffffffffffffffffffffffffffffffffffffff16611bc09092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f896e034966eaaf1adc54acc0f257056febbd300c9e47182cf761982cf1f5e43083604051610b409190611ec3565b60405180910390a2505050610b53611c3f565b565b610b5d611af3565b610b65611b39565b60075f9054906101000a900460ff1615610bab576040517f475a253500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600454600a54101580610bc25750600554600b5410155b610bf8576040517f8c24ea7400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f0000000000000000000000003892f5076cadadfe182784081792fedd8e13e4b973ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610c529190611fb1565b602060405180830381865afa158015610c6d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c91919061213b565b9050600b54811015610cde5780600b546040517f1e8422ef000000000000000000000000000000000000000000000000000000008152600401610cd5929190612166565b60405180910390fd5b600160075f6101000a81548160ff021916908315150217905550426008819055507f5d1123cb406a2b0c1ff0d762fb77c97d0528cc3d14abcfc630421fa0ff9adf536001600b54600a54604051610d37939291906121c0565b60405180910390a150610d48611c3f565b565b600b5481565b610d58611af3565b600654421015610d94576040517fe113695c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075f9054906101000a900460ff1615610dda576040517f475a253500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8103610e13576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610e33670de0b6b3a764000083610e2b91906121f5565b600354611c48565b90505f8103610e6e576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600b54600554610e7f91906120f4565b90505f8103610ecb57600b546005546040517fb4e6cb40000000000000000000000000000000000000000000000000000000008152600401610ec2929190612166565b60405180910390fd5b5f600a5460045411610edd575f610eee565b600a54600454610eed91906120f4565b5b90505f8103610f3c5760045484600a546040517f098462bc000000000000000000000000000000000000000000000000000000008152600401610f3393929190612236565b60405180910390fd5b5f610f4682611c85565b90505f8103610f945760045485600a546040517f098462bc000000000000000000000000000000000000000000000000000000008152600401610f8b93929190612236565b60405180910390fd5b5f610f9f8483611cae565b90505f81861190505f81610fb35786610fb5565b825b90505f670de0b6b3a764000060035483610fcf91906121f5565b610fd99190612298565b905082158015610fea575060095481105b1561102e576009546040517f291f24100000000000000000000000000000000000000000000000000000000081526004016110259190611ec3565b60405180910390fd5b80600c5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461107a919061218d565b9250508190555080600a5f828254611092919061218d565b9250508190555081600b5f8282546110aa919061218d565b9250508190555081600d5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546110fd919061218d565b925050819055506111513330837f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec773ffffffffffffffffffffffffffffffffffffffff16611cc6909392919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f34987d73948b60cfba9beeb35760c345a3be430f3540605113911ead78a0830e8284600a54600b546040516111a194939291906122c8565b60405180910390a2600454600a54106111ee577f577590a2a51593a5ccb2384eb09246874128b913fdfb537868ec3a7b454e5fa36004546040516111e59190611ec3565b60405180910390a15b600554600b541061129457600160075f6101000a81548160ff021916908315150217905550426008819055507f59d9d0d8d14561d606097bdf52cc4da76108ddace5e77f71e36b06cfd6d0fa05600b5460405161124b9190611ec3565b60405180910390a17f5d1123cb406a2b0c1ff0d762fb77c97d0528cc3d14abcfc630421fa0ff9adf536001600b54600a5460405161128b939291906121c0565b60405180910390a15b50505050505050506112a4611c3f565b50565b600a5481565b6112b5611b39565b6112be5f611d48565b565b6112c8611b39565b6112d0611af3565b5f8103611309576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075f9054906101000a900460ff161561134f576040517f475a253500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61139c3330837f0000000000000000000000003892f5076cadadfe182784081792fedd8e13e4b973ffffffffffffffffffffffffffffffffffffffff16611cc6909392919063ffffffff16565b80600e5f8282546113ad919061218d565b925050819055503373ffffffffffffffffffffffffffffffffffffffff167f0e139329822c7ef16ff7ff9e517729d40909281d9710d1dd2c33dac76429366d826040516113fa9190611ec3565b60405180910390a261140a611c3f565b50565b5f6114166107f9565b611422575f905061147c565b5f600a5460045461143391906120f4565b90505f670de0b6b3a7640000600354600b5460055461145291906120f4565b61145c91906121f5565b6114669190612298565b90508082106114755780611477565b815b925050505b90565b60065481565b60035481565b60055481565b60075f9054906101000a900460ff1681565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b60045481565b5f600c5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b611542611af3565b60065442101561157e576040517fe113695c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075f9054906101000a900460ff16156115c4576040517f475a253500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f81036115fd576040517f1f2a200500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600b5460055461160e91906120f4565b90505f810361165a57600b546005546040517fb4e6cb40000000000000000000000000000000000000000000000000000000008152600401611651929190612166565b60405180910390fd5b5f600a546004541161166c575f61167d565b600a5460045461167c91906120f4565b5b90505f81036116cb576004545f600a546040517f098462bc0000000000000000000000000000000000000000000000000000000081526004016116c293929190612344565b60405180910390fd5b5f6116d582611c85565b90505f8103611723576004545f600a546040517f098462bc00000000000000000000000000000000000000000000000000000000815260040161171a93929190612344565b60405180910390fd5b5f61172e8483611cae565b90505f81861190505f816117425786611744565b825b90505f670de0b6b3a76400006003548361175e91906121f5565b6117689190612298565b905082158015611779575060095481105b156117bd576009546040517f291f24100000000000000000000000000000000000000000000000000000000081526004016117b49190611ec3565b60405180910390fd5b80600c5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254611809919061218d565b9250508190555080600a5f828254611821919061218d565b9250508190555081600b5f828254611839919061218d565b9250508190555081600d5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461188c919061218d565b925050819055506118e03330837f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec773ffffffffffffffffffffffffffffffffffffffff16611cc6909392919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f34987d73948b60cfba9beeb35760c345a3be430f3540605113911ead78a0830e8284600a54600b5460405161193094939291906122c8565b60405180910390a2600454600a541061197d577f577590a2a51593a5ccb2384eb09246874128b913fdfb537868ec3a7b454e5fa36004546040516119749190611ec3565b60405180910390a15b600554600b5410611a2357600160075f6101000a81548160ff021916908315150217905550426008819055507f59d9d0d8d14561d606097bdf52cc4da76108ddace5e77f71e36b06cfd6d0fa05600b546040516119da9190611ec3565b60405180910390a17f5d1123cb406a2b0c1ff0d762fb77c97d0528cc3d14abcfc630421fa0ff9adf536001600b54600a54604051611a1a939291906121c0565b60405180910390a15b50505050505050611a32611c3f565b50565b6201518081565b5f600b54905090565b7f0000000000000000000000003892f5076cadadfe182784081792fedd8e13e4b981565b611a71611b39565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611ae1575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401611ad89190611fb1565b60405180910390fd5b611aea81611d48565b50565b60085481565b600260015403611b2f576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600181905550565b611b41611e09565b73ffffffffffffffffffffffffffffffffffffffff16611b5f6114a3565b73ffffffffffffffffffffffffffffffffffffffff1614611bbe57611b82611e09565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611bb59190611fb1565b60405180910390fd5b565b611c3a838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401611bf3929190612379565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611e10565b505050565b60018081905550565b5f5f8303611c58575f9050611c7f565b600182600185611c6891906120f4565b611c729190612298565b611c7c919061218d565b90505b92915050565b5f600354670de0b6b3a764000083611c9d91906121f5565b611ca79190612298565b9050919050565b5f818310611cbc5781611cbe565b825b905092915050565b611d42848573ffffffffffffffffffffffffffffffffffffffff166323b872dd868686604051602401611cfb939291906123a0565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611e10565b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f5f60205f8451602086015f885af180611e2f576040513d5f823e3d81fd5b3d92505f519150505f8214611e48576001811415611e63565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b15611ea557836040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401611e9c9190611fb1565b60405180910390fd5b50505050565b5f819050919050565b611ebd81611eab565b82525050565b5f602082019050611ed65f830184611eb4565b92915050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611f0982611ee0565b9050919050565b611f1981611eff565b8114611f23575f5ffd5b50565b5f81359050611f3481611f10565b92915050565b611f4381611eab565b8114611f4d575f5ffd5b50565b5f81359050611f5e81611f3a565b92915050565b5f5f60408385031215611f7a57611f79611edc565b5b5f611f8785828601611f26565b9250506020611f9885828601611f50565b9150509250929050565b611fab81611eff565b82525050565b5f602082019050611fc45f830184611fa2565b92915050565b5f8115159050919050565b611fde81611fca565b82525050565b5f602082019050611ff75f830184611fd5565b92915050565b5f6020828403121561201257612011611edc565b5b5f61201f84828501611f26565b91505092915050565b5f6020828403121561203d5761203c611edc565b5b5f61204a84828501611f50565b91505092915050565b5f819050919050565b5f61207661207161206c84611ee0565b612053565b611ee0565b9050919050565b5f6120878261205c565b9050919050565b5f6120988261207d565b9050919050565b6120a88161208e565b82525050565b5f6020820190506120c15f83018461209f565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6120fe82611eab565b915061210983611eab565b9250828203905081811115612121576121206120c7565b5b92915050565b5f8151905061213581611f3a565b92915050565b5f602082840312156121505761214f611edc565b5b5f61215d84828501612127565b91505092915050565b5f6040820190506121795f830185611eb4565b6121866020830184611eb4565b9392505050565b5f61219782611eab565b91506121a283611eab565b92508282019050808211156121ba576121b96120c7565b5b92915050565b5f6060820190506121d35f830186611fd5565b6121e06020830185611eb4565b6121ed6040830184611eb4565b949350505050565b5f6121ff82611eab565b915061220a83611eab565b925082820261221881611eab565b9150828204841483151761222f5761222e6120c7565b5b5092915050565b5f6060820190506122495f830186611eb4565b6122566020830185611eb4565b6122636040830184611eb4565b949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6122a282611eab565b91506122ad83611eab565b9250826122bd576122bc61226b565b5b828204905092915050565b5f6080820190506122db5f830187611eb4565b6122e86020830186611eb4565b6122f56040830185611eb4565b6123026060830184611eb4565b95945050505050565b5f819050919050565b5f61232e6123296123248461230b565b612053565b611eab565b9050919050565b61233e81612314565b82525050565b5f6060820190506123575f830186611eb4565b6123646020830185612335565b6123716040830184611eb4565b949350505050565b5f60408201905061238c5f830185611fa2565b6123996020830184611eb4565b9392505050565b5f6060820190506123b35f830186611fa2565b6123c06020830185611fa2565b6123cd6040830184611eb4565b94935050505056fea26469706673582212205e019ac2d8ad1e36a22bcb95a58b8ee902150eca9442ec806a7ce524fe2d409664736f6c634300081b0033
Verified Source Code Full Match
Compiler: v0.8.27+commit.40a35a09
EVM: cancun
Optimization: No
PRESALE-ONLINE-TEST.sol 314 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// OZ v5 location:
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
contract TokenPresaleUSDT is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
// --- State Variables ---
IERC20 public immutable gentestToken; // GENtest token sold in presale (18 decimals)
IERC20 public immutable usdtToken; // USDT used to buy GENtest (6 decimals)
address public presaleWallet;
uint256 public tokenPrice; // price of 1 GENtest in USDT (6 decimals)
uint256 public hardcap; // maximum USDT to raise (6 decimals)
uint256 public presaleAllocation; // GENtest tokens allocated for presale (18 decimals)
uint256 public startTime; // presale start timestamp
bool public isFinalized; // true if presale finalized
uint256 public finalizedTime;
uint256 public minPurchase; // minimum USDT purchase (6 decimals)
uint256 public fundsRaised; // total USDT raised (6 decimals)
uint256 public tokensSold; // total GENtest sold (18 decimals)
mapping(address => uint256) public contributions; // USDT spent by buyer
mapping(address => uint256) public tokensOwed; // GENtest owed to buyer
// --- ADDED State ---
uint256 public gentestDeposited; // amount of GENtest deposited via fundPresale
uint256 public constant CLAIM_DELAY = 24 hours; // claim delay after finalize
// --- Events ---
event PresaleDeployed(
address indexed gentestToken,
address indexed usdtToken,
uint256 tokenPrice,
uint256 hardcap,
uint256 presaleAllocation,
uint256 startTime
);
event TokensPurchased(
address indexed buyer,
uint256 usdtAmount,
uint256 gentestAmount,
uint256 totalUSDTRaised,
uint256 totalGENtestSold
);
event TokensClaimed(address indexed claimer, uint256 amount);
event FundsWithdrawn(address indexed wallet, uint256 amount);
event PresaleFinalized(bool success, uint256 totalTokensSold, uint256 totalUSDTRaised);
event HardcapReached(uint256 hardcap);
event AllTokensSold(uint256 totalTokensSold);
// --- ADDED Event ---
event PresaleFunded(address indexed from, uint256 amount);
// --- Errors ---
error PresaleNotActive();
error AlreadyFinalized();
error ZeroAddress();
error ZeroAmount();
error PresaleEnded(uint256 tokensSold, uint256 presaleAllocation);
error HardcapExceeded(uint256 hardcap, uint256 requested, uint256 current);
error InsufficientGENtest(uint256 available, uint256 requested);
error InsufficientBalance(uint256 requested, uint256 available);
error WithdrawFailed();
error ClaimNotAllowedYet();
error NoTokensToClaim();
error PurchaseTooSmall(uint256 minPurchase);
error CannotFinalizeBeforeConditions();
error InvalidGENtestDecimals(uint8 expected, uint8 actual);
error InvalidUSDTDecimals(uint8 expected, uint8 actual);
// --- ADDED Errors ---
error NotFinalized();
error ClaimTooEarly(uint256 earliestTime);
// --- Constructor ---
constructor(
address _gentestTokenAddress,
address _usdtTokenAddress,
address _presaleWallet,
uint256 _tokenPrice,
uint256 _hardcap,
uint256 _presaleAllocation,
uint256 _startTime,
uint256 _minPurchase
) Ownable(msg.sender) {
if (_gentestTokenAddress == address(0)) revert ZeroAddress();
if (_usdtTokenAddress == address(0)) revert ZeroAddress();
if (_presaleWallet == address(0)) revert ZeroAddress();
if (_startTime <= block.timestamp) revert PresaleNotActive();
if (_tokenPrice == 0) revert ZeroAmount();
if (_hardcap == 0) revert ZeroAmount();
if (_presaleAllocation == 0) revert ZeroAmount();
if (_minPurchase == 0) revert ZeroAmount();
gentestToken = IERC20(_gentestTokenAddress);
usdtToken = IERC20(_usdtTokenAddress);
// Check GENtest decimals = 18
uint8 genDecimals = IERC20Metadata(_gentestTokenAddress).decimals();
if (genDecimals != 18) revert InvalidGENtestDecimals(18, genDecimals);
// Check USDT decimals = 6
uint8 usdtDecimals = IERC20Metadata(_usdtTokenAddress).decimals();
if (usdtDecimals != 6) revert InvalidUSDTDecimals(6, usdtDecimals);
presaleWallet = _presaleWallet;
tokenPrice = _tokenPrice;
hardcap = _hardcap;
presaleAllocation = _presaleAllocation;
startTime = _startTime;
minPurchase = _minPurchase;
emit PresaleDeployed(
_gentestTokenAddress,
_usdtTokenAddress,
_tokenPrice,
_hardcap,
_presaleAllocation,
_startTime
);
}
// --- Owner funds presale by transferring GENtest from owner to this contract ---
/// @notice Owner deposits GENtest into the presale contract. Owner must approve the presale contract first.
function fundPresale(uint256 amount) external onlyOwner nonReentrant {
if (amount == 0) revert ZeroAmount();
if (isFinalized) revert AlreadyFinalized(); // disallow funding after finalize
gentestToken.safeTransferFrom(msg.sender, address(this), amount);
gentestDeposited += amount;
emit PresaleFunded(msg.sender, amount);
}
// --- Helpers ---
function divRoundUp(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
return (a - 1) / b + 1;
}
function _min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function _gentestForUSDTFloor(uint256 availableUSDT) internal view returns (uint256) {
// Calculate GENtest amount from USDT (6 decimals) and tokenPrice (6 decimals)
// GENtest has 18 decimals, so scale by 1e18
return (availableUSDT * 1e18) / tokenPrice;
}
// --- Core Functions ---
function buyTokensWithUSDT(uint256 usdtAmount) external nonReentrant {
if (block.timestamp < startTime) revert PresaleNotActive();
if (isFinalized) revert AlreadyFinalized();
if (usdtAmount == 0) revert ZeroAmount();
uint256 gentestDesired = divRoundUp(usdtAmount * 1e18, tokenPrice);
if (gentestDesired == 0) revert ZeroAmount();
uint256 availableGENtest = presaleAllocation - tokensSold;
if (availableGENtest == 0) revert PresaleEnded(tokensSold, presaleAllocation);
uint256 remainingUSDTCap = hardcap > fundsRaised ? hardcap - fundsRaised : 0;
if (remainingUSDTCap == 0) revert HardcapExceeded(hardcap, usdtAmount, fundsRaised);
uint256 gentestByHardcap = _gentestForUSDTFloor(remainingUSDTCap);
if (gentestByHardcap == 0) revert HardcapExceeded(hardcap, usdtAmount, fundsRaised);
uint256 effectiveAvailable = _min(availableGENtest, gentestByHardcap);
// Partial fill logic
bool partialFill = gentestDesired > effectiveAvailable;
uint256 gentestToSell = partialFill ? effectiveAvailable : gentestDesired;
uint256 usdtRequired = (gentestToSell * tokenPrice) / 1e18;
if (!partialFill && usdtRequired < minPurchase) revert PurchaseTooSmall(minPurchase);
contributions[msg.sender] += usdtRequired;
fundsRaised += usdtRequired;
tokensSold += gentestToSell;
tokensOwed[msg.sender] += gentestToSell;
usdtToken.safeTransferFrom(msg.sender, address(this), usdtRequired);
emit TokensPurchased(msg.sender, usdtRequired, gentestToSell, fundsRaised, tokensSold);
if (fundsRaised >= hardcap) emit HardcapReached(hardcap);
if (tokensSold >= presaleAllocation) {
isFinalized = true;
finalizedTime = block.timestamp;
emit AllTokensSold(tokensSold);
emit PresaleFinalized(true, tokensSold, fundsRaised);
}
}
function buyExactTokens(uint256 gentestAmount) external nonReentrant {
if (block.timestamp < startTime) revert PresaleNotActive();
if (isFinalized) revert AlreadyFinalized();
if (gentestAmount == 0) revert ZeroAmount();
uint256 availableGENtest = presaleAllocation - tokensSold;
if (availableGENtest == 0) revert PresaleEnded(tokensSold, presaleAllocation);
uint256 remainingUSDTCap = hardcap > fundsRaised ? hardcap - fundsRaised : 0;
if (remainingUSDTCap == 0) revert HardcapExceeded(hardcap, 0, fundsRaised);
uint256 gentestByHardcap = _gentestForUSDTFloor(remainingUSDTCap);
if (gentestByHardcap == 0) revert HardcapExceeded(hardcap, 0, fundsRaised);
uint256 effectiveAvailable = _min(availableGENtest, gentestByHardcap);
bool partialFill = gentestAmount > effectiveAvailable;
uint256 gentestToSell = partialFill ? effectiveAvailable : gentestAmount;
uint256 usdtRequired = (gentestToSell * tokenPrice) / 1e18;
if (!partialFill && usdtRequired < minPurchase) revert PurchaseTooSmall(minPurchase);
contributions[msg.sender] += usdtRequired;
fundsRaised += usdtRequired;
tokensSold += gentestToSell;
tokensOwed[msg.sender] += gentestToSell;
usdtToken.safeTransferFrom(msg.sender, address(this), usdtRequired);
emit TokensPurchased(msg.sender, usdtRequired, gentestToSell, fundsRaised, tokensSold);
if (fundsRaised >= hardcap) emit HardcapReached(hardcap);
if (tokensSold >= presaleAllocation) {
isFinalized = true;
finalizedTime = block.timestamp;
emit AllTokensSold(tokensSold);
emit PresaleFinalized(true, tokensSold, fundsRaised);
}
}
function claimTokens() external nonReentrant {
if (!isFinalized) revert NotFinalized();
uint256 earliest = finalizedTime + CLAIM_DELAY;
if (block.timestamp < earliest) revert ClaimTooEarly(earliest);
uint256 amount = tokensOwed[msg.sender];
if (amount == 0) revert NoTokensToClaim();
uint256 availableGENtestInContract = gentestToken.balanceOf(address(this));
if (availableGENtestInContract < amount) revert InsufficientGENtest(availableGENtestInContract, amount);
tokensOwed[msg.sender] = 0;
gentestToken.safeTransfer(msg.sender, amount);
emit TokensClaimed(msg.sender, amount);
}
function withdrawUSDT(address _to, uint256 _amount) external nonReentrant onlyOwner {
if (_amount == 0) revert ZeroAmount();
if (_to == address(0)) revert ZeroAddress();
uint256 contractBalance = usdtToken.balanceOf(address(this));
if (contractBalance < _amount) revert InsufficientBalance(_amount, contractBalance);
usdtToken.safeTransfer(_to, _amount);
emit FundsWithdrawn(_to, _amount);
}
function finalize() external nonReentrant onlyOwner {
if (isFinalized) revert AlreadyFinalized();
if (!(fundsRaised >= hardcap || tokensSold >= presaleAllocation)) {
revert CannotFinalizeBeforeConditions();
}
uint256 availableGENtestInContract = gentestToken.balanceOf(address(this));
if (availableGENtestInContract < tokensSold) revert InsufficientGENtest(availableGENtestInContract, tokensSold);
isFinalized = true;
finalizedTime = block.timestamp;
emit PresaleFinalized(true, tokensSold, fundsRaised);
}
// --- View Functions ---
function isActive() public view returns (bool) {
return block.timestamp >= startTime &&
!isFinalized &&
tokensSold < presaleAllocation &&
fundsRaised < hardcap;
}
function remainingGENtest() public view returns (uint256) {
return presaleAllocation - tokensSold;
}
function remainingUSDTCapacity() public view returns (uint256) {
if (!isActive()) return 0;
uint256 maxByHardcap = hardcap - fundsRaised;
uint256 maxByGENtest = (presaleAllocation - tokensSold) * tokenPrice / 1e18;
return maxByHardcap < maxByGENtest ? maxByHardcap : maxByGENtest;
}
function usdtRaised() public view returns (uint256) {
return fundsRaised;
}
function gentestSold() public view returns (uint256) {
return tokensSold;
}
function getUserContribution(address user) public view returns (uint256) {
return contributions[user];
}
}
ReentrancyGuard.sol 87 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
* consider using {ReentrancyGuardTransient} instead.
*
* 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;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
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
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// 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;
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}
SafeERC20.sol 212 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity >=0.6.2;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
IERC1363.sol 86 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
import {IERC165} from "../utils/introspection/IERC165.sol";
IERC20.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
import {IERC20} from "../token/ERC20/IERC20.sol";
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
Read Contract
CLAIM_DELAY 0xe18132c4 → uint256
contributions 0x42e94c90 → uint256
finalizedTime 0xfe67a189 → uint256
fundsRaised 0x6681b9fd → uint256
gentestDeposited 0x1f2211f7 → uint256
gentestSold 0xe6264117 → uint256
gentestToken 0xf26ce260 → address
getUserContribution 0xbb8b2b47 → uint256
hardcap 0xb071cbe6 → uint256
isActive 0x22f3e2d4 → bool
isFinalized 0x8d4e4083 → bool
minPurchase 0x33b5b62e → uint256
owner 0x8da5cb5b → address
presaleAllocation 0x81d136cb → uint256
presaleWallet 0x1ed77dc8 → address
remainingGENtest 0x0a2125c3 → uint256
remainingUSDTCapacity 0x76fba382 → uint256
startTime 0x78e97925 → uint256
tokenPrice 0x7ff9b596 → uint256
tokensOwed 0x3d5dff53 → uint256
tokensSold 0x518ab2a8 → uint256
usdtRaised 0x0ec1ecac → uint256
usdtToken 0xa98ad46c → address
Write Contract 8 functions
These functions modify contract state and require a wallet transaction to execute.
buyExactTokens 0xd20d0a2f
uint256 gentestAmount
buyTokensWithUSDT 0x5ef8086f
uint256 usdtAmount
claimTokens 0x48c54b9d
No parameters
finalize 0x4bb278f3
No parameters
fundPresale 0x76f6435c
uint256 amount
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
withdrawUSDT 0x1481794e
address _to
uint256 _amount
Recent Transactions
No transactions found for this address