Address Contract Verified
Address
0x7d39079c7063838f18c64a9162Cf2e81b00afc0A
Balance
0.029798 ETH
Nonce
1
Code Size
7447 bytes
Creator
0x9b2EB564...75cC at tx 0xa8db0bf4...415759
Indexed Transactions
0
Contract Bytecode
7447 bytes
0x60806040526004361061014e575f3560e01c80638da5cb5b116100b5578063d0febe4c1161006e578063d0febe4c14610473578063d2d8cb671461047d578063dd62ed3e146104a7578063e6c8056a146104e3578063f2fde38b146104f9578063fd177667146105215761015d565b80638da5cb5b146103655780638ea5220f1461038f57806395d89b41146103b95780639c986764146103e3578063a9059cbb1461040d578063c5c4744c146104495761015d565b80634ada218b116101075780634ada218b1461028157806353135ca0146102ab5780636b2ce7f1146102d557806370a08231146102fd578063715018a6146103395780638a8c523c1461034f5761015d565b806306fdde0314610161578063095ea7b31461018b57806318160ddd146101c757806323b872dd146101f1578063313ce5671461022d5780633a03171c146102575761015d565b3661015d5761015b61054b565b005b5f5ffd5b34801561016c575f5ffd5b50610175610772565b604051610182919061155a565b60405180910390f35b348015610196575f5ffd5b506101b160048036038101906101ac919061160b565b610802565b6040516101be9190611663565b60405180910390f35b3480156101d2575f5ffd5b506101db610824565b6040516101e8919061168b565b60405180910390f35b3480156101fc575f5ffd5b50610217600480360381019061021291906116a4565b61082d565b6040516102249190611663565b60405180910390f35b348015610238575f5ffd5b5061024161085b565b60405161024e919061170f565b60405180910390f35b348015610262575f5ffd5b5061026b610863565b604051610278919061168b565b60405180910390f35b34801561028c575f5ffd5b50610295610871565b6040516102a29190611663565b60405180910390f35b3480156102b6575f5ffd5b506102bf610884565b6040516102cc9190611663565b60405180910390f35b3480156102e0575f5ffd5b506102fb60048036038101906102f69190611752565b610897565b005b348015610308575f5ffd5b50610323600480360381019061031e919061177d565b6108bc565b604051610330919061168b565b60405180910390f35b348015610344575f5ffd5b5061034d610901565b005b34801561035a575f5ffd5b50610363610914565b005b348015610370575f5ffd5b50610379610939565b60405161038691906117b7565b60405180910390f35b34801561039a575f5ffd5b506103a3610961565b6040516103b091906117f0565b60405180910390f35b3480156103c4575f5ffd5b506103cd610986565b6040516103da919061155a565b60405180910390f35b3480156103ee575f5ffd5b506103f7610a16565b604051610404919061168b565b60405180910390f35b348015610418575f5ffd5b50610433600480360381019061042e919061160b565b610a1b565b6040516104409190611663565b60405180910390f35b348015610454575f5ffd5b5061045d610a3d565b60405161046a919061168b565b60405180910390f35b61047b61054b565b005b348015610488575f5ffd5b50610491610a43565b60405161049e919061168b565b60405180910390f35b3480156104b2575f5ffd5b506104cd60048036038101906104c89190611809565b610a4d565b6040516104da919061168b565b60405180910390f35b3480156104ee575f5ffd5b506104f7610acf565b005b348015610504575f5ffd5b5061051f600480360381019061051a919061177d565b610bb8565b005b34801561052c575f5ffd5b50610535610c3c565b604051610542919061168b565b60405180910390f35b610553610c41565b600860149054906101000a900460ff166105a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059990611891565b60405180910390fd5b69010f0cf064dd59200000346007546105bb91906118dc565b11156105fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f390611959565b60405180910390fd5b662386f26fc10000341015610646576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063d906119c1565b60405180910390fd5b5f655af3107a4000670de0b6b3a76400003461066291906119df565b61066c9190611a4d565b905080610678306108bc565b10156106b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b090611ac7565b60405180910390fd5b3460075f8282546106ca91906118dc565b925050819055505f60646002836106e191906119df565b6106eb9190611a4d565b90505f60646001846106fd91906119df565b6107079190611a4d565b90505f8183856107179190611ae5565b6107219190611ae5565b905061072d3083610c87565b6107593060085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610d06565b610764303383610d06565b50505050610770610df6565b565b60606003805461078190611b45565b80601f01602080910402602001604051908101604052809291908181526020018280546107ad90611b45565b80156107f85780601f106107cf576101008083540402835291602001916107f8565b820191905f5260205f20905b8154815290600101906020018083116107db57829003601f168201915b5050505050905090565b5f5f61080c610e00565b9050610819818585610e07565b600191505092915050565b5f600254905090565b5f5f610837610e00565b9050610844858285610e19565b61084f858585610d06565b60019150509392505050565b5f6012905090565b69010f0cf064dd5920000081565b600860159054906101000a900460ff1681565b600860149054906101000a900460ff1681565b61089f610eac565b80600860146101000a81548160ff02191690831515021790555050565b5f5f5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610909610eac565b6109125f610f33565b565b61091c610eac565b6001600860156101000a81548160ff021916908315150217905550565b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606004805461099590611b45565b80601f01602080910402602001604051908101604052809291908181526020018280546109c190611b45565b8015610a0c5780601f106109e357610100808354040283529160200191610a0c565b820191905f5260205f20905b8154815290600101906020018083116109ef57829003601f168201915b5050505050905090565b600181565b5f5f610a25610e00565b9050610a32818585610d06565b600191505092915050565b60075481565b655af3107a400081565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b610ad7610eac565b610adf610c41565b5f4790505f60085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682604051610b2990611ba2565b5f6040518083038185875af1925050503d805f8114610b63576040519150601f19603f3d011682016040523d82523d5f602084013e610b68565b606091505b5050905080610bac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba390611c00565b60405180910390fd5b5050610bb6610df6565b565b610bc0610eac565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c30575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401610c2791906117b7565b60405180910390fd5b610c3981610f33565b50565b600281565b600260065403610c7d576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600681905550565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610cf7575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401610cee91906117b7565b60405180910390fd5b610d02825f83610ff6565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610d76575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401610d6d91906117b7565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610de6575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401610ddd91906117b7565b60405180910390fd5b610df1838383610ff6565b505050565b6001600681905550565b5f33905090565b610e148383836001611102565b505050565b5f610e248484610a4d565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610ea65781811015610e97578281836040517ffb8f41b2000000000000000000000000000000000000000000000000000000008152600401610e8e93929190611c1e565b60405180910390fd5b610ea584848484035f611102565b5b50505050565b610eb4610e00565b73ffffffffffffffffffffffffffffffffffffffff16610ed2610939565b73ffffffffffffffffffffffffffffffffffffffff1614610f3157610ef5610e00565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610f2891906117b7565b60405180910390fd5b565b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160055f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561105e57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561109d575061106d610939565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156110f257600860159054906101000a900460ff166110f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e890611cc3565b60405180910390fd5b5b6110fd8383836112d1565b505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611172575f6040517fe602df0500000000000000000000000000000000000000000000000000000000815260040161116991906117b7565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036111e2575f6040517f94280d620000000000000000000000000000000000000000000000000000000081526004016111d991906117b7565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f208190555080156112cb578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516112c2919061168b565b60405180910390a35b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611321578060025f82825461131591906118dc565b925050819055506113ef565b5f5f5f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156113aa578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016113a193929190611c1e565b60405180910390fd5b8181035f5f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611436578060025f8282540392505081905550611480565b805f5f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516114dd919061168b565b60405180910390a3505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61152c826114ea565b61153681856114f4565b9350611546818560208601611504565b61154f81611512565b840191505092915050565b5f6020820190508181035f8301526115728184611522565b905092915050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6115a78261157e565b9050919050565b6115b78161159d565b81146115c1575f5ffd5b50565b5f813590506115d2816115ae565b92915050565b5f819050919050565b6115ea816115d8565b81146115f4575f5ffd5b50565b5f81359050611605816115e1565b92915050565b5f5f604083850312156116215761162061157a565b5b5f61162e858286016115c4565b925050602061163f858286016115f7565b9150509250929050565b5f8115159050919050565b61165d81611649565b82525050565b5f6020820190506116765f830184611654565b92915050565b611685816115d8565b82525050565b5f60208201905061169e5f83018461167c565b92915050565b5f5f5f606084860312156116bb576116ba61157a565b5b5f6116c8868287016115c4565b93505060206116d9868287016115c4565b92505060406116ea868287016115f7565b9150509250925092565b5f60ff82169050919050565b611709816116f4565b82525050565b5f6020820190506117225f830184611700565b92915050565b61173181611649565b811461173b575f5ffd5b50565b5f8135905061174c81611728565b92915050565b5f602082840312156117675761176661157a565b5b5f6117748482850161173e565b91505092915050565b5f602082840312156117925761179161157a565b5b5f61179f848285016115c4565b91505092915050565b6117b18161159d565b82525050565b5f6020820190506117ca5f8301846117a8565b92915050565b5f6117da8261157e565b9050919050565b6117ea816117d0565b82525050565b5f6020820190506118035f8301846117e1565b92915050565b5f5f6040838503121561181f5761181e61157a565b5b5f61182c858286016115c4565b925050602061183d858286016115c4565b9150509250929050565b7f50726573616c6520697320636c6f7365640000000000000000000000000000005f82015250565b5f61187b6011836114f4565b915061188682611847565b602082019050919050565b5f6020820190508181035f8301526118a88161186f565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6118e6826115d8565b91506118f1836115d8565b9250828201905080821115611909576119086118af565b5b92915050565b7f48617264204361702072656163686564000000000000000000000000000000005f82015250565b5f6119436010836114f4565b915061194e8261190f565b602082019050919050565b5f6020820190508181035f83015261197081611937565b9050919050565b7f4d696e696d756d20302e303120455448000000000000000000000000000000005f82015250565b5f6119ab6010836114f4565b91506119b682611977565b602082019050919050565b5f6020820190508181035f8301526119d88161199f565b9050919050565b5f6119e9826115d8565b91506119f4836115d8565b9250828202611a02816115d8565b91508282048414831517611a1957611a186118af565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f611a57826115d8565b9150611a62836115d8565b925082611a7257611a71611a20565b5b828204905092915050565b7f436f6e7472616374206f7574206f6620746f6b656e73000000000000000000005f82015250565b5f611ab16016836114f4565b9150611abc82611a7d565b602082019050919050565b5f6020820190508181035f830152611ade81611aa5565b9050919050565b5f611aef826115d8565b9150611afa836115d8565b9250828203905081811115611b1257611b116118af565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680611b5c57607f821691505b602082108103611b6f57611b6e611b18565b5b50919050565b5f81905092915050565b50565b5f611b8d5f83611b75565b9150611b9882611b7f565b5f82019050919050565b5f611bac82611b82565b9150819050919050565b7f5472616e73666572206661696c656400000000000000000000000000000000005f82015250565b5f611bea600f836114f4565b9150611bf582611bb6565b602082019050919050565b5f6020820190508181035f830152611c1781611bde565b9050919050565b5f606082019050611c315f8301866117a8565b611c3e602083018561167c565b611c4b604083018461167c565b949350505050565b7f5446503a2054726164696e672069732063757272656e746c79206c6f636b65645f8201527f20666f722047656e657369732050686173650000000000000000000000000000602082015250565b5f611cad6032836114f4565b9150611cb882611c53565b604082019050919050565b5f6020820190508181035f830152611cda81611ca1565b905091905056fea2646970667358221220731f93310c0971103bf01f1ad7cc91a3794b369d175dfea05c7c0117ba12199a64736f6c634300081f0033
Verified Source Code Full Match
Compiler: v0.8.31+commit.fd3a2265
EVM: osaka
Optimization: No
ForestationProject.sol 79 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
contract ForestTokenSecure is ERC20, Ownable, ReentrancyGuard {
uint256 public constant TOKEN_PRICE = 0.0001 ether;
uint256 public constant HARD_CAP = 5000 ether;
uint256 public totalRaised;
uint256 public constant TAX_PERCENT = 2;
uint256 public constant BURN_PERCENT = 1;
address payable public devWallet;
bool public presaleActive = true;
bool public tradingEnabled = false; // THE LOCK: Set to false by default
constructor(address payable _devWallet) ERC20("The Forestation Project", "TFP") Ownable(msg.sender) {
require(_devWallet != address(0), "Invalid wallet");
devWallet = _devWallet;
_mint(address(this), 1_000_000_000 * 10**18);
}
// --- TRANSFER OVERRIDE (THE LOCK) ---
function _update(address from, address to, uint256 value) internal override {
// Allow the contract to send tokens to buyers
// Allow the owner to move tokens for liquidity
// Otherwise, trading must be enabled
if (from != address(0) && from != address(this) && from != owner()) {
require(tradingEnabled, "TFP: Trading is currently locked for Genesis Phase");
}
super._update(from, to, value);
}
// --- PURCHASE LOGIC ---
receive() external payable {
buyTokens();
}
function buyTokens() public payable nonReentrant {
require(presaleActive, "Presale is closed");
require(totalRaised + msg.value <= HARD_CAP, "Hard Cap reached");
require(msg.value >= 0.01 ether, "Minimum 0.01 ETH");
uint256 amountToBuy = (msg.value * 10**18) / TOKEN_PRICE;
require(balanceOf(address(this)) >= amountToBuy, "Contract out of tokens");
totalRaised += msg.value;
uint256 taxAmount = (amountToBuy * TAX_PERCENT) / 100;
uint256 burnAmount = (amountToBuy * BURN_PERCENT) / 100;
uint256 finalUserAmount = amountToBuy - taxAmount - burnAmount;
_burn(address(this), burnAmount);
_transfer(address(this), devWallet, taxAmount);
_transfer(address(this), msg.sender, finalUserAmount);
}
// --- ADMIN CONTROLS ---
function withdrawProjectFunds() external onlyOwner nonReentrant {
uint256 amount = address(this).balance;
(bool success, ) = devWallet.call{value: amount}("");
require(success, "Transfer failed");
}
function togglePresale(bool _status) external onlyOwner {
presaleActive = _status;
}
// Call this function when you are ready to allow investors to sell/trade
function enableTrading() external onlyOwner {
tradingEnabled = true;
}
}
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);
}
}
ERC20.sol 305 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.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 ERC-20
* applications.
*/
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}.
*
* Both 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;
}
/// @inheritdoc IERC20
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/// @inheritdoc IERC20
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;
}
/// @inheritdoc IERC20
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}.
*
* Skips emitting an {Approval} event indicating an allowance update. This is not
* required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
*
* 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:
*
* ```solidity
* 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);
}
}
}
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)
pragma solidity >=0.8.4;
/**
* @dev Standard ERC-20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 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 ERC-721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-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 ERC-1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 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);
}
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;
}
}
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);
}
Read Contract
BURN_PERCENT 0x9c986764 → uint256
HARD_CAP 0x3a03171c → uint256
TAX_PERCENT 0xfd177667 → uint256
TOKEN_PRICE 0xd2d8cb67 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
devWallet 0x8ea5220f → address
name 0x06fdde03 → string
owner 0x8da5cb5b → address
presaleActive 0x53135ca0 → bool
symbol 0x95d89b41 → string
totalRaised 0xc5c4744c → uint256
totalSupply 0x18160ddd → uint256
tradingEnabled 0x4ada218b → bool
Write Contract 9 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 value
returns: bool
buyTokens 0xd0febe4c
No parameters
enableTrading 0x8a8c523c
No parameters
renounceOwnership 0x715018a6
No parameters
togglePresale 0x6b2ce7f1
bool _status
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
withdrawProjectFunds 0xe6c8056a
No parameters
Recent Transactions
No transactions found for this address