Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x44cdF56edB64fb6fb5cEa8503c8367A21325D2c3
Balance 0 ETH
Nonce 2
Code Size 4102 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

4102 bytes
0x6080604052600436106100fd575f3560e01c80638091f3bf11610092578063c45a015511610062578063c45a0155146102a6578063c4c69d8f146102c5578063c5c4744c146102e4578063df8de3e7146102f9578063fc0c546a14610318575f80fd5b80638091f3bf146102255780638d3d657614610253578063a5bf8ec614610268578063b9795b6d14610287575f80fd5b806360219c7b116100cd57806360219c7b146101bb5780636334a8c4146101d057806373e888fd146101fb5780637e1c0c0914610210575f80fd5b806302d05d3f146101085780632c5b5ae21461014457806342e94c90146101635780634f0e0ef31461019c575f80fd5b3661010457005b5f80fd5b348015610113575f80fd5b50600254610127906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014f575f80fd5b50600b54610127906001600160a01b031681565b34801561016e575f80fd5b5061018e61017d366004610d09565b60096020525f908152604090205481565b60405190815260200161013b565b3480156101a7575f80fd5b50600a54610127906001600160a01b031681565b3480156101c6575f80fd5b5061018e60045481565b3480156101db575f80fd5b506008546101e99060ff1681565b60405160ff909116815260200161013b565b61020e610209366004610d09565b610337565b005b34801561021b575f80fd5b5061018e60055481565b348015610230575f80fd5b5060085461024390610100900460ff1681565b604051901515815260200161013b565b34801561025e575f80fd5b5061018e60075481565b348015610273575f80fd5b5061020e610282366004610d09565b61045c565b348015610292575f80fd5b5061020e6102a1366004610d09565b610627565b3480156102b1575f80fd5b50600354610127906001600160a01b031681565b3480156102d0575f80fd5b5061020e6102df366004610d39565b610732565b3480156102ef575f80fd5b5061018e60065481565b348015610304575f80fd5b5061020e610313366004610d09565b610a51565b348015610323575f80fd5b50600154610127906001600160a01b031681565b6003546001600160a01b0316331461036a5760405162461bcd60e51b815260040161036190610da6565b60405180910390fd5b610372610c9e565b600854610100900460ff161561039a5760405162461bcd60e51b815260040161036190610dcc565b6007546001600160a01b0382165f908152600960205260409020546103c0903490610e0f565b111561040e5760405162461bcd60e51b815260206004820152601860248201527f436f6e747269627574696f6e2065786365656473206d617800000000000000006044820152606401610361565b6001600160a01b0381165f9081526009602052604081208054349290610435908490610e0f565b925050819055503460065f82825461044d9190610e0f565b909155505060015f5550565b50565b6003546001600160a01b031633146104865760405162461bcd60e51b815260040161036190610da6565b61048e610c9e565b600b54600154600a5460405163e6a4390560e01b81526001600160a01b03928316600482015290821660248201529116905f90829063e6a4390590604401602060405180830381865afa1580156104e7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061050b9190610e28565b90506001600160a01b0381166105545760405162461bcd60e51b815260206004820152600e60248201526d14185a5c881b9bdd08199bdd5b9960921b6044820152606401610361565b5f819050806001600160a01b031663666da64f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610590575f80fd5b505af11580156105a2573d5f803e3d5ffd5b504792505050806105e65760405162461bcd60e51b815260206004820152600e60248201526d139bc81155120818db185a5b595960921b6044820152606401610361565b6040516001600160a01b0386169082156108fc029083905f818181858888f19350505050158015610619573d5f803e3d5ffd5b505050505061045960015f55565b6003546001600160a01b031633146106515760405162461bcd60e51b815260040161036190610da6565b610659610c9e565b600854610100900460ff16156106815760405162461bcd60e51b815260040161036190610dcc565b6001600160a01b0381165f90815260096020526040902054806106e65760405162461bcd60e51b815260206004820152601960248201527f4e6f20636f6e747269627574696f6e20746f20726566756e64000000000000006044820152606401610361565b6001600160a01b0382165f818152600960205260408082208290555183156108fc0291849190818181858888f19350505050158015610727573d5f803e3d5ffd5b505061045960015f55565b6003546001600160a01b0316331461075c5760405162461bcd60e51b815260040161036190610da6565b610764610c9e565b600854610100900460ff161561078c5760405162461bcd60e51b815260040161036190610dcc565b6008805461ff0019166101001790556001546040805163313ce56760e01b815290515f926001600160a01b03169163313ce5679160048083019260209291908290030181865afa1580156107e2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108069190610e43565b61081190600a610f41565b6004546005546108219190610f4f565b61082b9190610f62565b600654600854919250905f9060649083906108499060ff1683610f79565b60ff166108569190610f62565b6108609190610f92565b60015460405163095ea7b360e01b81526001600160a01b038b811660048301526024820187905292935091169063095ea7b3906044016020604051808303815f875af11580156108b2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108d69190610fb1565b6109145760405162461bcd60e51b815260206004820152600f60248201526e105c1c1c9bdd985b0819985a5b1959608a1b6044820152606401610361565b600154600254604051637f0dfdd360e11b81526001600160a01b039283166004820152602481018690525f60448201819052606482015260ff808b166084830152808a1660a483015280891660c4830152871660e48201529082166101048201529089169063fe1bfba6908390610124015f604051808303818588803b15801561099c575f80fd5b505af11580156109ae573d5f803e3d5ffd5b5047935050508115159050610a055760405162461bcd60e51b815260206004820152601c60248201527f4e6f2062616c616e636520666f722063726561746f72207368617265000000006044820152606401610361565b6002546040516001600160a01b039091169082156108fc029083905f818181858888f19350505050158015610a3c573d5f803e3d5ffd5b5050505050610a4a60015f55565b5050505050565b6003546001600160a01b03163314610a7b5760405162461bcd60e51b815260040161036190610da6565b610a83610c9e565b600854610100900460ff16610ace5760405162461bcd60e51b815260206004820152601160248201527014d85b19481b9bdd081b185d5b98da1959607a1b6044820152606401610361565b6001600160a01b0381165f9081526009602052604090205480610b255760405162461bcd60e51b815260206004820152600f60248201526e27379031b7b73a3934b13aba34b7b760891b6044820152606401610361565b6001546040805163313ce56760e01b815290515f926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610b6c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b909190610e43565b90505f60065482600a610ba39190610f41565b600454610bb09086610f62565b610bba9190610f62565b610bc49190610f92565b6001600160a01b038581165f8181526009602052604080822091909155600154905163a9059cbb60e01b815260048101929092526024820184905292935091169063a9059cbb906044016020604051808303815f875af1158015610c2a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c4e9190610fb1565b610c925760405162461bcd60e51b8152602060048201526015602482015274151bdad95b881d1c985b9cd9995c8819985a5b1959605a1b6044820152606401610361565b50505061045960015f55565b60025f5403610cef5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610361565b60025f55565b6001600160a01b0381168114610459575f80fd5b5f60208284031215610d19575f80fd5b8135610d2481610cf5565b9392505050565b60ff81168114610459575f80fd5b5f805f805f60a08688031215610d4d575f80fd5b8535610d5881610cf5565b94506020860135610d6881610d2b565b93506040860135610d7881610d2b565b92506060860135610d8881610d2b565b91506080860135610d9881610d2b565b809150509295509295909350565b6020808252600c908201526b4f6e6c7920666163746f727960a01b604082015260600190565b60208082526015908201527414d85b1948185b1c9958591e481b185d5b98da1959605a1b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610e2257610e22610dfb565b92915050565b5f60208284031215610e38575f80fd5b8151610d2481610cf5565b5f60208284031215610e53575f80fd5b8151610d2481610d2b565b6001815b6001841115610e9957808504811115610e7d57610e7d610dfb565b6001841615610e8b57908102905b60019390931c928002610e62565b935093915050565b5f82610eaf57506001610e22565b81610ebb57505f610e22565b8160018114610ed15760028114610edb57610ef7565b6001915050610e22565b60ff841115610eec57610eec610dfb565b50506001821b610e22565b5060208310610133831016604e8410600b8410161715610f1a575081810a610e22565b610f265f198484610e5e565b805f1904821115610f3957610f39610dfb565b029392505050565b5f610d2460ff841683610ea1565b81810381811115610e2257610e22610dfb565b8082028115828204841417610e2257610e22610dfb565b60ff8281168282160390811115610e2257610e22610dfb565b5f82610fac57634e487b7160e01b5f52601260045260245ffd5b500490565b5f60208284031215610fc1575f80fd5b81518015158114610d24575f80fdfea264697066735822122027ef21838595f0696bf385c053475ae955ce47b3f0baaf503bdf8d4220b5177e64736f6c634300081a0033

Verified Source Code Full Match

Compiler: v0.8.26+commit.8a97fa7a EVM: cancun Optimization: Yes (200 runs)
SaleToken.sol 20 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

// SaleToken: ERC-20 token for the sale
contract SaleToken is ERC20 {
    address public saleContract;

    constructor(
        string memory name,
        string memory symbol,
        uint256 totalSupply,
        address _saleContract
    ) ERC20(name, symbol) {
        saleContract = _saleContract;
        // Mint total supply to the sale contract, adjusted for decimals
        _mint(_saleContract, totalSupply * (10 ** decimals()));
    }
}
SaleContract.sol 160 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./SaleToken.sol";


interface IVistaFactory {
    function getPair(address tokenA, address tokenB) external view returns (address);
}

interface IPair {
    function claimShare() external;
}

interface ILaunchContract {
    function launch(
        address token,
        uint256 amountTokenDesired,
        uint256 amountETHMin,
        uint256 amountTokenMin,
        uint8 buyLpFee,
        uint8 sellLpFee,
        uint8 buyProtocolFee,
        uint8 sellProtocolFee,
        address protocolAddress
    ) external payable;
}

contract SaleContract is ReentrancyGuard {
    address public token;
    address public creator;
    address public factory;
    uint256 public totalTokensForSale;
    uint256 public totalTokens;
    uint256 public totalRaised;
    uint256 public maxContribution;
    uint8 public creatorshare;
    bool public launched;
    mapping(address => uint256) public contributions;

    address public wethAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
    address public vistaFactoryAddress = 0x9a27cb5ae0B2cEe0bb71f9A85C0D60f3920757B4;

    modifier onlyFactory() {
        require(msg.sender == factory, "Only factory");
        _;
    }

    constructor(
        string memory name,
        string memory symbol,
        address _creator,
        address _factory,
        uint256 _totalTokens,
        uint256 _totalTokensForSale,
        uint256 _maxContribution,
        uint8 _creatorshare
    ) {
        creator = _creator;
        factory = _factory;
        totalTokens = _totalTokens;
        totalTokensForSale = _totalTokensForSale;
        maxContribution = _maxContribution;
        creatorshare = _creatorshare;


        // Deploy the token directly from SaleContract and mint to SaleContract address
        SaleToken newToken = new SaleToken(name, symbol, _totalTokens, address(this));
        token = address(newToken);
    }

    function contribute(address user) external payable onlyFactory nonReentrant {
        require(!launched, "Sale already launched");
        require(contributions[user] + msg.value <= maxContribution, "Contribution exceeds max");

        contributions[user] += msg.value;
        totalRaised += msg.value;
    }

    function claimTokens(address user) external onlyFactory nonReentrant {
        require(launched, "Sale not launched");
        uint256 contribution = contributions[user];
        require(contribution > 0, "No contribution");

        uint8 decimals = ERC20(token).decimals();
        uint256 tokensToClaim = (contribution * totalTokensForSale * (10 ** decimals)) / totalRaised;

        contributions[user] = 0;

        require(ERC20(token).transfer(user, tokensToClaim), "Token transfer failed");
    }

    function launchSale(
    address _launchContract,
    uint8 buyLpFee,
    uint8 sellLpFee,
    uint8 buyProtocolFee,
    uint8 sellProtocolFee
) external onlyFactory nonReentrant {
    require(!launched, "Sale already launched");
    launched = true;

    uint256 tokenAmount = (totalTokens - totalTokensForSale) * (10 ** ERC20(token).decimals());
    uint256 ethAmount = totalRaised;

    // Calculate the amount to use for launching after creator's share deduction
    uint256 launchEthAmount = ((100 - creatorshare) * ethAmount) / 100;

    // Approve the launch contract to spend the SaleContract's tokens
    require(ERC20(token).approve(_launchContract, tokenAmount), "Approval failed");

    // Launch the sale using the deducted ETH amount (after creator's share deduction)
    ILaunchContract(_launchContract).launch{value: launchEthAmount}(
        token,
        tokenAmount,
        0,
        0,
        buyLpFee,
        sellLpFee,
        buyProtocolFee,
        sellProtocolFee,
        creator
    );

    // Transfer the remaining balance (creator's share) to the creator
    uint256 creatorShareAmount = address(this).balance;
    require(creatorShareAmount > 0, "No balance for creator share");

    payable(creator).transfer(creatorShareAmount);
}



    function processRefund(address user) external onlyFactory nonReentrant {
        require(!launched, "Sale already launched");
        uint256 contribution = contributions[user];
        require(contribution > 0, "No contribution to refund");

        contributions[user] = 0;
        payable(user).transfer(contribution);
    }

    function takeFee(address lockFactoryOwner) external onlyFactory nonReentrant {
        IVistaFactory vistaFactory = IVistaFactory(vistaFactoryAddress);
        address pairAddress = vistaFactory.getPair(token, wethAddress);

        require(pairAddress != address(0), "Pair not found");

        IPair pair = IPair(pairAddress);
        pair.claimShare();

        uint256 claimedEth = address(this).balance;
        require(claimedEth > 0, "No ETH claimed");

        payable(lockFactoryOwner).transfer(claimedEth);
    }

    receive() external payable {}
}
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 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);
}
ReentrancyGuard.sol 77 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
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);
}

Read Contract

contributions 0x42e94c90 → uint256
creator 0x02d05d3f → address
creatorshare 0x6334a8c4 → uint8
factory 0xc45a0155 → address
launched 0x8091f3bf → bool
maxContribution 0x8d3d6576 → uint256
token 0xfc0c546a → address
totalRaised 0xc5c4744c → uint256
totalTokens 0x7e1c0c09 → uint256
totalTokensForSale 0x60219c7b → uint256
vistaFactoryAddress 0x2c5b5ae2 → address
wethAddress 0x4f0e0ef3 → address

Write Contract 5 functions

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

claimTokens 0xdf8de3e7
address user
contribute 0x73e888fd
address user
launchSale 0xc4c69d8f
address _launchContract
uint8 buyLpFee
uint8 sellLpFee
uint8 buyProtocolFee
uint8 sellProtocolFee
processRefund 0xb9795b6d
address user
takeFee 0xa5bf8ec6
address lockFactoryOwner

Recent Transactions

No transactions found for this address