Address Contract Verified
Address
0x10aa951fB435e21A85Ca2e3CF6819DaB4887c19A
Balance
0 ETH
Nonce
1
Code Size
6877 bytes
Creator
0xF6a43c94...3436 at tx 0xd3cf8469...679636
Indexed Transactions
0
Contract Bytecode
6877 bytes
0x60806040526004361061010d5760003560e01c80638da5cb5b11610095578063bcd2f64a11610064578063bcd2f64a146102e5578063f2fde38b1461030e578063f38d00f014610337578063f751758b14610362578063f887ea401461038d57610114565b80638da5cb5b14610251578063974654c61461027c5780639e1022e514610293578063a132aad1146102bc57610114565b806351906bb0116100dc57806351906bb0146101c557806351cff8d9146101f057806354f63ee5146102195780636effdc3014610230578063715018a61461023a57610114565b806304549d6f1461011957806312065fe014610144578063164500921461016f57806343950f341461019a57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e6103b8565b60405161013b9190611149565b60405180910390f35b34801561015057600080fd5b506101596103cb565b604051610166919061117d565b60405180910390f35b34801561017b57600080fd5b50610184610412565b604051610191919061117d565b60405180910390f35b3480156101a657600080fd5b506101af610418565b6040516101bc919061117d565b60405180910390f35b3480156101d157600080fd5b506101da610471565b6040516101e7919061117d565b60405180910390f35b3480156101fc57600080fd5b506102176004803603810190610212919061120a565b610477565b005b34801561022557600080fd5b5061022e6105be565b005b610238610627565b005b34801561024657600080fd5b5061024f610adf565b005b34801561025d57600080fd5b50610266610af3565b6040516102739190611246565b60405180910390f35b34801561028857600080fd5b50610291610b1c565b005b34801561029f57600080fd5b506102ba60048036038101906102b5919061128d565b610b40565b005b3480156102c857600080fd5b506102e360048036038101906102de919061128d565b610b94565b005b3480156102f157600080fd5b5061030c6004803603810190610307919061128d565b610c0a565b005b34801561031a57600080fd5b506103356004803603810190610330919061120a565b610eec565b005b34801561034357600080fd5b5061034c610f72565b604051610359919061117d565b60405180910390f35b34801561036e57600080fd5b50610377610f78565b604051610384919061117d565b60405180910390f35b34801561039957600080fd5b506103a2610fb5565b6040516103af9190611319565b60405180910390f35b600060149054906101000a900460ff1681565b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905090565b60035481565b6000600254421061045e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045590611391565b60405180910390fd5b4260025461046c91906113e0565b905090565b60025481565b61047f610fdb565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016105199190611246565b602060405180830381865afa158015610536573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055a9190611429565b6040518363ffffffff1660e01b8152600401610577929190611456565b6020604051808303816000875af1158015610596573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ba91906114ab565b5050565b6105c6610fdb565b600254421061060a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060190611524565b60405180910390fd5b6001600060146101000a81548160ff021916908315150217905550565b600254421061064b5760008060146101000a81548160ff0219169083151502179055505b600154421161068f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068690611590565b60405180910390fd5b60011515600060149054906101000a900460ff161515146106e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106dc90611391565b60405180910390fd5b34600010610728576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071f90611622565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610797573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bb9190611657565b90506000600267ffffffffffffffff8111156107da576107d9611684565b5b6040519080825280602002602001820160405280156108085781602001602082028036833780820191505090505b50905081816000815181106108205761081f6116b3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505073dac17f958d2ee523a2206206994597c13d831ec781600181518110610883576108826116b3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637ff36ab534600085306103844261091091906116e2565b6040518663ffffffff1660e01b815260040161092f949392919061180f565b60006040518083038185885af115801561094d573d6000803e3d6000fd5b50505050506040513d6000823e3d601f19601f820116820180604052508101906109779190611985565b905060008160018151811061098f5761098e6116b3565b5b6020026020010151905060006109a3610f78565b9050600081662386f26fc10000846109bb91906119ce565b6109c59190611a3f565b905082600360008282546109d991906116e2565b92505081905550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a3d929190611456565b6020604051808303816000875af1158015610a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8091906114ab565b5080600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ad091906116e2565b92505081905550505050505050565b610ae7610fdb565b610af16000611062565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610b24610fdb565b60008060146101000a81548160ff021916908315150217905550565b610b48610fdb565b804210610b8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8190611524565b60405180910390fd5b8060028190555050565b610b9c610fdb565b804210610bde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd590611524565b60405180910390fd5b42600181905550806002819055506001600060146101000a81548160ff02191690831515021790555050565b6002544210610c2e5760008060146101000a81548160ff0219169083151502179055505b6001544211610c72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6990611590565b60405180910390fd5b60011515600060149054906101000a900460ff16151514610cc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cbf90611391565b60405180910390fd5b80600010610d0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0290611622565b60405180910390fd5b6000610d15610f78565b9050600081662386f26fc1000084610d2d91906119ce565b610d379190611a3f565b905082600354610d4791906116e2565b600381905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b8152600401610dac93929190611a70565b6020604051808303816000875af1158015610dcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610def91906114ab565b50600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610e4d929190611456565b6020604051808303816000875af1158015610e6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9091906114ab565b5080600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee091906116e2565b92505081905550505050565b610ef4610fdb565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610f665760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401610f5d9190611246565b60405180910390fd5b610f6f81611062565b50565b60015481565b60008064746a528800600354610f8e9190611a3f565b90506000601482610f9f91906119ce565b600e610fab91906116e2565b9050809250505090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610fe3611126565b73ffffffffffffffffffffffffffffffffffffffff16611001610af3565b73ffffffffffffffffffffffffffffffffffffffff161461106057611024611126565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016110579190611246565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b60008115159050919050565b6111438161112e565b82525050565b600060208201905061115e600083018461113a565b92915050565b6000819050919050565b61117781611164565b82525050565b6000602082019050611192600083018461116e565b92915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006111d7826111ac565b9050919050565b6111e7816111cc565b81146111f257600080fd5b50565b600081359050611204816111de565b92915050565b6000602082840312156112205761121f6111a2565b5b600061122e848285016111f5565b91505092915050565b611240816111cc565b82525050565b600060208201905061125b6000830184611237565b92915050565b61126a81611164565b811461127557600080fd5b50565b60008135905061128781611261565b92915050565b6000602082840312156112a3576112a26111a2565b5b60006112b184828501611278565b91505092915050565b6000819050919050565b60006112df6112da6112d5846111ac565b6112ba565b6111ac565b9050919050565b60006112f1826112c4565b9050919050565b6000611303826112e6565b9050919050565b611313816112f8565b82525050565b600060208201905061132e600083018461130a565b92915050565b600082825260208201905092915050565b7f50726573616c6520697320656e64656400000000000000000000000000000000600082015250565b600061137b601083611334565b915061138682611345565b602082019050919050565b600060208201905081810360008301526113aa8161136e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006113eb82611164565b91506113f683611164565b925082820390508181111561140e5761140d6113b1565b5b92915050565b60008151905061142381611261565b92915050565b60006020828403121561143f5761143e6111a2565b5b600061144d84828501611414565b91505092915050565b600060408201905061146b6000830185611237565b611478602083018461116e565b9392505050565b6114888161112e565b811461149357600080fd5b50565b6000815190506114a58161147f565b92915050565b6000602082840312156114c1576114c06111a2565b5b60006114cf84828501611496565b91505092915050565b7f55706461746520656e6474696d6520696e207468652066757475726500000000600082015250565b600061150e601c83611334565b9150611519826114d8565b602082019050919050565b6000602082019050818103600083015261153d81611501565b9050919050565b7f50726573616c65206973206e6f74207374617274656400000000000000000000600082015250565b600061157a601683611334565b915061158582611544565b602082019050919050565b600060208201905081810360008301526115a98161156d565b9050919050565b7f556e617661696c61626c6520616d6f756e74206f6620746f6b656e20746f206260008201527f7579000000000000000000000000000000000000000000000000000000000000602082015250565b600061160c602283611334565b9150611617826115b0565b604082019050919050565b6000602082019050818103600083015261163b816115ff565b9050919050565b600081519050611651816111de565b92915050565b60006020828403121561166d5761166c6111a2565b5b600061167b84828501611642565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006116ed82611164565b91506116f883611164565b92508282019050808211156117105761170f6113b1565b5b92915050565b6000819050919050565b600061173b61173661173184611716565b6112ba565b611164565b9050919050565b61174b81611720565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611786816111cc565b82525050565b6000611798838361177d565b60208301905092915050565b6000602082019050919050565b60006117bc82611751565b6117c6818561175c565b93506117d18361176d565b8060005b838110156118025781516117e9888261178c565b97506117f4836117a4565b9250506001810190506117d5565b5085935050505092915050565b60006080820190506118246000830187611742565b818103602083015261183681866117b1565b90506118456040830185611237565b611852606083018461116e565b95945050505050565b600080fd5b6000601f19601f8301169050919050565b61187a82611860565b810181811067ffffffffffffffff8211171561189957611898611684565b5b80604052505050565b60006118ac611198565b90506118b88282611871565b919050565b600067ffffffffffffffff8211156118d8576118d7611684565b5b602082029050602081019050919050565b600080fd5b60006119016118fc846118bd565b6118a2565b90508083825260208201905060208402830185811115611924576119236118e9565b5b835b8181101561194d57806119398882611414565b845260208401935050602081019050611926565b5050509392505050565b600082601f83011261196c5761196b61185b565b5b815161197c8482602086016118ee565b91505092915050565b60006020828403121561199b5761199a6111a2565b5b600082015167ffffffffffffffff8111156119b9576119b86111a7565b5b6119c584828501611957565b91505092915050565b60006119d982611164565b91506119e483611164565b92508282026119f281611164565b91508282048414831517611a0957611a086113b1565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611a4a82611164565b9150611a5583611164565b925082611a6557611a64611a10565b5b828204905092915050565b6000606082019050611a856000830186611237565b611a926020830185611237565b611a9f604083018461116e565b94935050505056fea2646970667358221220a60e0f3bf96fc0f2eacadc0a8239372d5a972bae4110d34e10601c12b672077164736f6c63430008180033
Verified Source Code Full Match
Compiler: v0.8.24+commit.e11b9ed9
EVM: paris
Optimization: No
Presale.sol 155 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
// Uncomment this line to use console.log
// import "hardhat/console.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
uint256 constant INITIAL_TOKEN_PRICE = 14; //0.0014
address constant MAINNET_USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; //USDT address in Ethereum
address constant MAINNET_PSHIBA = 0x5DFADeacc8239edBDa5598AEEd615d18F6825dE9;
address constant UNISWAPV2_ROUTER_ADDRESS = address(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
contract Presale is Ownable {
bool public presaleStarted;
uint public startTimeStamp;
uint public endTimeStamp;
uint256 public totalCap;
IUniswapV2Router02 public router =
IUniswapV2Router02(address(UNISWAPV2_ROUTER_ADDRESS));
IERC20 usdt = IERC20(MAINNET_USDT); // USDT contract address
IERC20 pshiba = IERC20(MAINNET_PSHIBA);
mapping (address=>uint256) private balances;
receive() external payable {}
constructor(uint _endTimeStamp) Ownable(msg.sender) {
require(
block.timestamp < _endTimeStamp,
"Presale end time should be in the future"
);
endTimeStamp = _endTimeStamp;
startTimeStamp = _endTimeStamp;
totalCap = 0;
presaleStarted = false;
}
// function initialize(uint _endTimeStamp) public initializer {
// __Ownable_init(msg.sender);
// require(
// block.timestamp < _endTimeStamp,
// "Presale end time should be in the future"
// );
// startTimeStamp = block.timestamp;
// endTimeStamp = _endTimeStamp;
// totalCap = 0;
// }
function finishPresale() public onlyOwner {
presaleStarted = false;
}
function resumePresale() public onlyOwner {
require(
block.timestamp < endTimeStamp,
"Update endtime in the future"
);
presaleStarted = true;
}
function updateEndTimeStamp(uint256 _endTimeStamp) public onlyOwner {
require(
block.timestamp < _endTimeStamp,
"Update endtime in the future"
);
endTimeStamp = _endTimeStamp;
}
function getCurrentTokenPrice() public view returns (uint256) {
uint256 currentStep = totalCap / (500 * 10 ** (3 + 6));
uint256 tokenPrice = INITIAL_TOKEN_PRICE + currentStep * 20;
return tokenPrice;
}
// function approveContract(address _spender, uint256 _amount) external {
// require(usdt.approve(_spender, _amount), "Approval failed");
// }
function startPresale (uint256 _endTimeStamp) public onlyOwner {
require(
block.timestamp < _endTimeStamp,
"Update endtime in the future"
);
startTimeStamp = block.timestamp;
endTimeStamp = _endTimeStamp;
presaleStarted = true;
}
function calculateRemainingTime() public view returns(uint256) {
require(block.timestamp < endTimeStamp, "Presale is ended");
return (endTimeStamp - block.timestamp);
}
function buyTokenWithUSDT(uint256 _usdtAmount) public {
if(block.timestamp >= endTimeStamp) presaleStarted = false;
require(block.timestamp > startTimeStamp, "Presale is not started");
require(presaleStarted == true, "Presale is ended");
require(0 < _usdtAmount, "Unavailable amount of token to buy");
uint256 currentTokenPrice = getCurrentTokenPrice();
uint256 tokenAmount = (_usdtAmount * 10 ** (4 + 12)) / currentTokenPrice;
totalCap = totalCap + _usdtAmount;
usdt.transferFrom(msg.sender, address(this), _usdtAmount);
pshiba.transfer(msg.sender, tokenAmount);
balances[msg.sender] += tokenAmount;
}
function buyTokenWithETH() public payable {
if(block.timestamp >= endTimeStamp) presaleStarted = false;
require(block.timestamp > startTimeStamp, "Presale is not started");
require(presaleStarted == true, "Presale is ended");
require(0 < msg.value, "Unavailable amount of token to buy");
address WETH = router.WETH();
address[] memory path = new address[](2);
path[0] = WETH;
path[1] = MAINNET_USDT;
uint256[] memory amounts = router.swapExactETHForTokens{
value: msg.value
}(0, path, address(this), block.timestamp + 15 minutes);
uint256 usdAmount = amounts[1];
uint256 currentTokenPrice = getCurrentTokenPrice();
uint256 tokenAmount = (usdAmount * 10 ** (4 + 12) ) / currentTokenPrice;
totalCap += usdAmount;
pshiba.transfer(msg.sender, tokenAmount);
balances[msg.sender] += tokenAmount;
}
function getBalance () public view returns (uint256){
return balances[msg.sender];
}
function withdraw(address _to) public onlyOwner {
// require(block.timestamp > endTimeStamp, "Presale is not ended");
//usdt.transferFrom(address(this), _to, usdt.balanceOf(address(this)));
usdt.transfer(_to, usdt.balanceOf(address(this)));
}
}
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;
}
}
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);
}
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 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);
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 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);
}
IUniswapV2Router01.sol 95 lines
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
IUniswapV2Router02.sol 44 lines
pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
Read Contract
calculateRemainingTime 0x43950f34 → uint256
endTimeStamp 0x51906bb0 → uint256
getBalance 0x12065fe0 → uint256
getCurrentTokenPrice 0xf751758b → uint256
owner 0x8da5cb5b → address
presaleStarted 0x04549d6f → bool
router 0xf887ea40 → address
startTimeStamp 0xf38d00f0 → uint256
totalCap 0x16450092 → uint256
Write Contract 9 functions
These functions modify contract state and require a wallet transaction to execute.
buyTokenWithETH 0x6effdc30
No parameters
buyTokenWithUSDT 0xbcd2f64a
uint256 _usdtAmount
finishPresale 0x974654c6
No parameters
renounceOwnership 0x715018a6
No parameters
resumePresale 0x54f63ee5
No parameters
startPresale 0xa132aad1
uint256 _endTimeStamp
transferOwnership 0xf2fde38b
address newOwner
updateEndTimeStamp 0x9e1022e5
uint256 _endTimeStamp
withdraw 0x51cff8d9
address _to
Token Balances (1)
View Transfers →Recent Transactions
No transactions found for this address