Forkchoice Ethereum Mainnet

Address Contract Verified

Address 0x19a7C66d02c1F7404a126eFbF38854EAead8a661
Balance 0 ETH
Nonce 1
Code Size 6451 bytes
Indexed Transactions 0 (1 on-chain, 0% indexed)
External Etherscan · Sourcify

Contract Bytecode

6451 bytes
0x6080604052600436106101815760003560e01c80637ce3489b116100d1578063a9059cbb1161008a578063dd62ed3e11610064578063dd62ed3e1461043f578063e952f74f1461045f578063f2fde38b14610474578063f887ea401461049457600080fd5b8063a9059cbb146103e9578063acaad0d814610409578063cb8eebc11461042957600080fd5b80637ce3489b1461034d5780637fd6f15c1461036d5780638da5cb5b1461038357806395d89b41146103a15780639ccb0744146103b6578063a457c2d7146103c957600080fd5b806327af9e381161013e578063395093511161011857806339509351146102cd57806370a08231146102ed57806370db69d61461032357806373f425611461033857600080fd5b806327af9e381461024e578063313ce5671461029a578063333a0072146102b657600080fd5b806306fdde0314610186578063095ea7b3146101b157806313a4486c146101e157806318160ddd1461020457806322194e6a1461021957806323b872dd1461022e575b600080fd5b34801561019257600080fd5b5061019b6104c8565b6040516101a891906114d3565b60405180910390f35b3480156101bd57600080fd5b506101d16101cc36600461153a565b61055a565b60405190151581526020016101a8565b3480156101ed57600080fd5b506101f6610574565b6040519081526020016101a8565b34801561021057600080fd5b506002546101f6565b34801561022557600080fd5b506101f6610591565b34801561023a57600080fd5b506101d1610249366004611566565b6105b6565b34801561025a57600080fd5b506102827f000000000000000000000000b495a6312400938ae89ee88d1d2d0cfc18ffe12081565b6040516001600160a01b0390911681526020016101a8565b3480156102a657600080fd5b50604051600981526020016101a8565b3480156102c257600080fd5b506102cb6105da565b005b3480156102d957600080fd5b506101d16102e836600461153a565b610648565b3480156102f957600080fd5b506101f66103083660046115a7565b6001600160a01b031660009081526020819052604090205490565b34801561032f57600080fd5b506101f661066a565b34801561034457600080fd5b506101f6610765565b34801561035957600080fd5b506102cb6103683660046115cb565b610794565b34801561037957600080fd5b506101f660085481565b34801561038f57600080fd5b506005546001600160a01b0316610282565b3480156103ad57600080fd5b5061019b6107d1565b6102cb6103c43660046115a7565b6107e0565b3480156103d557600080fd5b506101d16103e436600461153a565b610b2d565b3480156103f557600080fd5b506101d161040436600461153a565b610ba8565b34801561041557600080fd5b506102cb6104243660046115cb565b610bb6565b34801561043557600080fd5b506101f660095481565b34801561044b57600080fd5b506101f661045a3660046115e4565b610bf3565b34801561046b57600080fd5b506101f6610c1e565b34801561048057600080fd5b506102cb61048f3660046115a7565b610c4f565b3480156104a057600080fd5b506102827f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6060600380546104d79061161d565b80601f01602080910402602001604051908101604052809291908181526020018280546105039061161d565b80156105505780601f1061052557610100808354040283529160200191610550565b820191906000526020600020905b81548152906001019060200180831161053357829003601f168201915b5050505050905090565b600033610568818585610c9b565b60019150505b92915050565b6105806009600a611751565b61058e90633b9aca00611760565b81565b600061059f6009600a611751565b6105a761066a565b6105b19190611777565b905090565b6000336105c4858285610dc0565b6105cf858585610e3a565b506001949350505050565b6005546001600160a01b0316331461060d5760405162461bcd60e51b815260040161060490611799565b60405180910390fd5b600580546001600160a01b03191690556040517f6e4ee811a17215345b89e3506064ff2d62f4feedff3566e9d09219cda7e8cadb90600090a1565b60003361056881858561065b8383610bf3565b61066591906117bd565b610c9b565b6006546000906001600160a01b0316610697576106896009600a611751565b6105b190633b9aca00611760565b60006127106001600754426106ac91906117d0565b6106b86009600a611751565b6106c690633b9aca00611760565b6106d09190611760565b6106da9190611760565b6106e49190611777565b6127106106f36009600a611751565b61070190633b9aca00611760565b61070c906019611760565b6107169190611777565b61072091906117bd565b905061072e6009600a611751565b61073c90633b9aca00611760565b8111156107605761074f6009600a611751565b61075d90633b9aca00611760565b90505b919050565b600061077060025490565b61077c6009600a611751565b61078a90633b9aca00611760565b6105b191906117d0565b6005546001600160a01b031633146107be5760405162461bcd60e51b815260040161060490611799565b600a8111156107cc57600080fd5b600855565b6060600480546104d79061161d565b6005805460ff60a01b1916600160a01b1790556040805163c45a015560e01b815290516001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169163c45a01559160048083019260209291908290030181865afa158015610858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087c91906117e3565b6001600160a01b031663c9c65396307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090d91906117e3565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561095a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097e91906117e3565b600680546001600160a01b0319166001600160a01b03929092169190911790556109d88160646109b06009600a611751565b6109be90633b9aca00611760565b6109c9906006611760565b6109d39190611777565b610fc1565b600060646109e86009600a611751565b6109f690633b9aca00611760565b610a01906006611760565b610a0b9190611777565b610a176009600a611751565b610a2590633b9aca00611760565b610a2f91906117d0565b9050610a3b3082610fc1565b610a68307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d600019610c9b565b60405163f305d71960e01b81523060048201526024810182905260006044820181905260648201523360848201524260a48201527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03169063f305d71990349060c40160606040518083038185885af1158015610af0573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b159190611800565b50504260075550506005805460ff60a01b1916905550565b60003381610b3b8286610bf3565b905083811015610b9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610604565b6105cf8286868403610c9b565b600033610568818585610e3a565b6005546001600160a01b03163314610be05760405162461bcd60e51b815260040161060490611799565b6064811115610bee57600080fd5b600955565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6064610c2c6009600a611751565b610c3a90633b9aca00611760565b610c45906006611760565b61058e9190611777565b6005546001600160a01b03163314610c795760405162461bcd60e51b815260040161060490611799565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610cfd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610604565b6001600160a01b038216610d5e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610604565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000610dcc8484610bf3565b90506000198114610e345781811015610e275760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610604565b610e348484848403610c9b565b50505050565b600554600160a01b900460ff1615610e5c57610e57838383611080565b505050565b6001600160a01b038216610efe576001600160a01b038316600090815260208190526040902054811115610ea25760405162461bcd60e51b81526004016106049061182e565b6001600160a01b0383811660008181526020818152604091829020805486900390556002805486900390559051848152928516927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610db3565b6006546001600160a01b0390811690841603610f9657610f1e8282611184565b7f000000000000000000000000b495a6312400938ae89ee88d1d2d0cfc18ffe1206001600160a01b031663f2e0bf506040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f7957600080fd5b505af1158015610f8d573d6000803e3d6000fd5b50505050505050565b6006546001600160a01b0390811690831603610fb657610f1e83826112bc565b610e57838383611080565b6001600160a01b0382166110175760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610604565b806002600082825461102991906117bd565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0383166110e45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610604565b6001600160a01b0383166000908152602081905260409020548181101561111d5760405162461bcd60e51b81526004016106049061182e565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a350505050565b61118c61066a565b8111156111db5760405162461bcd60e51b815260206004820152601760248201527f6d6178696d756d2062757920636f756e74206c696d69740000000000000000006044820152606401610604565b6000606460026008546111ee9190611777565b6111f89084611760565b6112029190611777565b905060006064600954836112169190611760565b6112209190611777565b9050600061122e82846117d0565b9050811561126d5760065461126d906001600160a01b03167f000000000000000000000000b495a6312400938ae89ee88d1d2d0cfc18ffe12084611080565b801561128a5760065461128a906001600160a01b03163083611080565b6006546112b5906001600160a01b0316866112a6866002611760565b6112b090886117d0565b611080565b5050505050565b30600090815260208190526040812054906112d8836002611760565b9050808211156112e6578091505b6112ef82611307565b600654610e349085906001600160a01b031685611080565b6005805460ff60a01b1916600160a01b17905580156114c357604080516002808252606082018352600092602083019080368337019050509050308160008151811061135557611355611874565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f791906117e3565b8160018151811061140a5761140a611874565b6001600160a01b0392831660209182029290920101526040516318cbafe560e01b81527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d909116906318cbafe59061148f90859060009086907f000000000000000000000000b495a6312400938ae89ee88d1d2d0cfc18ffe12090429060040161188a565b600060405180830381600087803b1580156114a957600080fd5b505af11580156114bd573d6000803e3d6000fd5b50505050505b506005805460ff60a01b19169055565b60006020808352835180602085015260005b81811015611501578581018301518582016040015282016114e5565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b038116811461153757600080fd5b50565b6000806040838503121561154d57600080fd5b823561155881611522565b946020939093013593505050565b60008060006060848603121561157b57600080fd5b833561158681611522565b9250602084013561159681611522565b929592945050506040919091013590565b6000602082840312156115b957600080fd5b81356115c481611522565b9392505050565b6000602082840312156115dd57600080fd5b5035919050565b600080604083850312156115f757600080fd5b823561160281611522565b9150602083013561161281611522565b809150509250929050565b600181811c9082168061163157607f821691505b60208210810361165157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156116a857816000190482111561168e5761168e611657565b8085161561169b57918102915b93841c9390800290611672565b509250929050565b6000826116bf5750600161056e565b816116cc5750600061056e565b81600181146116e257600281146116ec57611708565b600191505061056e565b60ff8411156116fd576116fd611657565b50506001821b61056e565b5060208310610133831016604e8410600b841016171561172b575081810a61056e565b611735838361166d565b806000190482111561174957611749611657565b029392505050565b60006115c460ff8416836116b0565b808202811582820484141761056e5761056e611657565b60008261179457634e487b7160e01b600052601260045260246000fd5b500490565b6020808252600a908201526937b7363c9037bbb732b960b11b604082015260600190565b8082018082111561056e5761056e611657565b8181038181111561056e5761056e611657565b6000602082840312156117f557600080fd5b81516115c481611522565b60008060006060848603121561181557600080fd5b8351925060208401519150604084015190509250925092565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b600060a08201878352602087602085015260a0604085015281875180845260c08601915060208901935060005b818110156118dc5784516001600160a01b0316835293830193918301916001016118b7565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122098a3fbdc3331d9bf5da46d0ee49352eb0d1bd25d2aa308955b252278fab73c3364736f6c63430008190033

Verified Source Code Full Match

Compiler: v0.8.25+commit.b61c2a91 EVM: paris Optimization: Yes (200 runs)
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);
}
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;
    }
}
ERC20.sol 332 lines
pragma solidity ^0.8.21;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";

contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) internal _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 internal _totalSupply;
    uint8 internal constant _decimals = 9;

    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 override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override 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 pure returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(
        address account
    ) public view virtual override 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 `amount`.
     */
    function transfer(
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(
        address owner,
        address spender
    ) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` 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 amount
    ) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        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 `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(
        address spender,
        uint256 addedValue
    ) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(
        address spender,
        uint256 subtractedValue
    ) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(
            currentAllowance >= subtractedValue,
            "ERC20: decreased allowance below zero"
        );
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `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.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");

        uint256 fromBalance = _balances[from];
        require(
            fromBalance >= amount,
            "ERC20: transfer amount exceeds balance"
        );
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` 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.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(
                currentAllowance >= amount,
                "ERC20: insufficient allowance"
            );
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }
}
ISpace.sol 5 lines
pragma solidity ^0.8.21;

interface ISpace {
    function executeNewPlanets() external;
}
IUniswapV2Factory.sol 12 lines
pragma solidity ^0.8.21;

interface IUniswapV2Factory {
    function createPair(address tokenA, address tokenB)
        external
        returns (address pair);
    
    function getPair(address tokenA, address tokenB)
        external
        view
        returns (address pair);
}
IUniswapV2Router02.sol 65 lines
pragma solidity ^0.8.21;

interface IUniswapV2Router02 {
    function swapExactTokensForETH(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;

    function swapETHForExactTokens(
        uint256 amountOut,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable returns (uint256[] memory amounts);

    function factory() external pure returns (address);

    function WETH() external pure returns (address);

    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);

    function swapExactETHForTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable returns (uint[] memory amounts);

    function getReserves(
        address factory,
        address tokenA,
        address tokenB
    ) external view returns (uint reserveA, uint reserveB);

    function getAmountsIn(
        uint amountOut,
        address[] memory path
    ) external view returns (uint[] memory amounts);

    function getAmountsOut(
        uint amountIn,
        address[] memory path
    ) external view returns (uint[] memory amounts);
}
Ownable.sol 30 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

contract Ownable {
    address _owner;

    event RenounceOwnership();

    constructor() {
        _owner = msg.sender;
    }

    modifier onlyOwner() {
        require(_owner == msg.sender, "only owner");
        _;
    }

    function owner() external view virtual returns (address) {
        return _owner;
    }

    function ownerRenounce() public onlyOwner {
        _owner = address(0);
        emit RenounceOwnership();
    }

    function transferOwnership(address newOwner) external onlyOwner {
        _owner = newOwner;
    }
}
ThePirateBay.sol 161 lines
pragma solidity ^0.8.21;

import "./ERC20.sol";
import "./ISpace.sol";
import "./IUniswapV2Router02.sol";
import "./IUniswapV2Factory.sol";
import "./Ownable.sol";

contract ThePirateBay is ERC20, Ownable {
    uint256 public constant startTotalSupply = 1e9 * (10 ** _decimals);
    uint256 public constant airdropCount = (startTotalSupply * 6) / 100;
    uint256 constant _startMaxBuyCount = (startTotalSupply * 25) / 10000;
    uint256 constant _addMaxBuyPercentPerSec = 1; // add 0.01%/second
    IUniswapV2Router02 public immutable router;
    ISpace public immutable space;
    bool _inSwap;
    address pair;
    uint256 _startTime;
    uint256 public feePercent = 10;
    uint256 public ercFeePercent = 20; // noe of this is starts destruction on claim

    constructor(
        address space_,
        address uniswapRouter_
    ) ERC20("The Pirate Bay", "BAY") {
        space = ISpace(space_);
        router = IUniswapV2Router02(uniswapRouter_);
    }

    function setFeePercent(uint256 percent) external onlyOwner {
        require(percent <= 10);
        feePercent = percent;
    }

    function setErcPercent(uint256 percent) external onlyOwner {
        require(percent <= 100);
        ercFeePercent = percent;
    }

    modifier lockTheSwap() {
        _inSwap = true;
        _;
        _inSwap = false;
    }

    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal override {
        if (_inSwap) {
            super._transfer(from, to, amount);
            return;
        }

        if (to == address(0)) {
            require(
                _balances[from] >= amount,
                "ERC20: transfer amount exceeds balance"
            );
            unchecked {
                _balances[from] -= amount;
                _totalSupply -= amount;
            }
            emit Transfer(from, to, amount);
            return;
        }

        if (from == pair) {
            transferFromPair(to, amount);
            space.executeNewPlanets();
            return;
        }

        if (to == pair) {
            transferToPair(from, amount);
            space.executeNewPlanets();
            return;
        }

        super._transfer(from, to, amount);
    }

    function transferFromPair(address to, uint256 amount) private {
        require(amount <= maxBuy(), "maximum buy count limit");
        uint256 tax = (amount * (feePercent / 2)) / 100;
        uint256 ercPercent = (tax * ercFeePercent) / 100;
        uint256 ethPercent = tax - ercPercent;
        if (ercPercent > 0) super._transfer(pair, address(space), ercPercent);
        if (ethPercent > 0) super._transfer(pair, address(this), ethPercent);
        super._transfer(pair, to, amount - 2 * tax);
    }

    function transferToPair(address from, uint256 amount) private {
        uint256 swapCount = balanceOf(address(this));
        uint256 maxSwapCount = 2 * amount;
        if (swapCount > maxSwapCount) swapCount = maxSwapCount;
        _swapTokensForEth(swapCount);
        super._transfer(from, pair, amount);
    }

    function _swapTokensForEth(uint256 tokenAmount) internal lockTheSwap {
        if (tokenAmount == 0) return;
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = router.WETH();

        // make the swap
        router.swapExactTokensForETH(
            tokenAmount,
            0, // accept any amount of ETH
            path,
            address(space),
            block.timestamp
        );
    }

    function burned() public view returns (uint256) {
        return startTotalSupply - totalSupply();
    }

    function createPair(address airdropAddress) external payable lockTheSwap {
        pair = IUniswapV2Factory(router.factory()).createPair(
            address(this),
            router.WETH()
        );
        
        // Mint airdrop tokens to deployer
        _mint(airdropAddress, airdropCount);
        
        // Mint remaining tokens to this contract for liquidity pool
        uint256 liquidityAmount = startTotalSupply - airdropCount;
        _mint(address(this), liquidityAmount);
        
        _approve(address(this), address(router), type(uint256).max);
        router.addLiquidityETH{value: msg.value}(
            address(this),
            liquidityAmount,
            0,
            0,
            msg.sender,
            block.timestamp
        );
        _startTime = block.timestamp;
    }

    function maxBuy() public view returns (uint256) {
        if (pair == address(0)) return startTotalSupply;
        uint256 count = _startMaxBuyCount +
            (startTotalSupply *
                (block.timestamp - _startTime) *
                _addMaxBuyPercentPerSec) /
            10000;
        if (count > startTotalSupply) count = startTotalSupply;
        return count;
    }

    function maxBuyWithoutDecimals() public view returns (uint256) {
        return maxBuy() / (10 ** _decimals);
    }
}

Read Contract

airdropCount 0xe952f74f → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
burned 0x73f42561 → uint256
decimals 0x313ce567 → uint8
ercFeePercent 0xcb8eebc1 → uint256
feePercent 0x7fd6f15c → uint256
maxBuy 0x70db69d6 → uint256
maxBuyWithoutDecimals 0x22194e6a → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
router 0xf887ea40 → address
space 0x27af9e38 → address
startTotalSupply 0x13a4486c → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256

Write Contract 10 functions

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

approve 0x095ea7b3
address spender
uint256 amount
returns: bool
createPair 0x9ccb0744
address airdropAddress
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
ownerRenounce 0x333a0072
No parameters
setErcPercent 0xacaad0d8
uint256 percent
setFeePercent 0x7ce3489b
uint256 percent
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

This address has 1 on-chain transactions, but only 0% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →