ETH Price: $2,055.82 (+0.72%)

Contract

0x8E43aCB5Ea96A8Ce64Ac26e2C8A5F03973F054fA
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw174374532023-06-08 18:49:471026 days ago1686250187IN
0x8E43aCB5...973F054fA
0 ETH0.0011110128.03542523
Buy Tokens174014802023-06-03 16:56:591031 days ago1685811419IN
0x8E43aCB5...973F054fA
0.002 ETH0.0014993724.04352377
Buy Tokens174014192023-06-03 16:44:471031 days ago1685810687IN
0x8E43aCB5...973F054fA
0.01 ETH0.0025122826.01756554
Withdraw173949412023-06-02 18:52:471032 days ago1685731967IN
0x8E43aCB5...973F054fA
0 ETH0.0009219623.26484041

Latest 2 internal transactions

Advanced mode:
Parent Transaction Hash Method Block
From
To
Transfer174014802023-06-03 16:56:591031 days ago1685811419
0x8E43aCB5...973F054fA
0.002 ETH
Transfer174014192023-06-03 16:44:471031 days ago1685810687
0x8E43aCB5...973F054fA
0.01 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Crowdsale

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "IERC20.sol";


/**
 * @title Crowdsale
 * @dev Crowdsale is a base contract for managing a token crowdsale,
 * allowing investors to purchase tokens with ether. This contract implements
 * such functionality in its most fundamental form and can be extended to provide additional
 * functionality and/or custom behavior.
 * The external interface represents the basic interface for purchasing tokens, and conform
 * the base architecture for crowdsales. They are *not* intended to be modified / overriden.
 * The internal interface conforms the extensible and modifiable surface of crowdsales. Override
 * the methods to add functionality. Consider using 'super' where appropiate to concatenate
 * behavior.
 */
contract Crowdsale {

  IERC20 public Mytoken;
  address payable public owner;

  // How many token units a buyer gets per wei
  uint256 public rate;

  // Amount of wei raised
  uint256 public weiRaised;

  /**
   * Event for token purchase logging
   * @param purchaser who paid for the tokens
   * @param beneficiary who got the tokens
   * @param value weis paid for purchase
   * @param amount amount of tokens purchased
   */
  event TokenPurchase(
    address indexed purchaser,
    address indexed beneficiary,
    uint256 value,
    uint256 amount
  );

  /**
   * @param _rate Number of token units a buyer gets per wei
   * @param _token Address of the token being sold
   */
  constructor(uint256 _rate, IERC20 _token) {
    require(_rate > 0);
    rate = _rate;
    Mytoken = IERC20(_token);
    owner = payable(msg.sender);
  }

  // -----------------------------------------
  // Crowdsale external interface
  // -----------------------------------------

  /**
   * @dev fallback function ***DO NOT OVERRIDE***
   */
  fallback() external payable {
    buyTokens();
  }

  receive() external payable {
      buyTokens();
  }

  modifier onlyOwner {
      require(msg.sender == owner, "caller is not the owner");
      _;
  }
  
  function buyTokens() public payable {
    address _beneficiary = msg.sender;
    uint256 weiAmount = msg.value;
    
    _preValidatePurchase(_beneficiary, weiAmount);

    // calculate token amount to be created
    uint256 tokens = _getTokenAmount(weiAmount);

    // update state
    weiRaised += weiAmount;

    _processPurchase(_beneficiary, tokens);
    emit TokenPurchase(
      msg.sender,
      _beneficiary,
      weiAmount,
      tokens
    );

    _updatePurchasingState(_beneficiary, weiAmount);

    _forwardFunds();
    _postValidatePurchase(_beneficiary, weiAmount);
  }
    function withdraw() external onlyOwner {
        uint256 balance = Mytoken.balanceOf(address(this));
        Mytoken.transfer(owner,balance);
    }
  // -----------------------------------------
  // Internal interface (extensible)
  // -----------------------------------------

  /**
   * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
   * @param _beneficiary Address performing the token purchase
   * @param _weiAmount Value in wei involved in the purchase
   */
  function _preValidatePurchase(
    address _beneficiary,
    uint256 _weiAmount
  )
    internal
  {
    require(_beneficiary != address(0));
    require(_weiAmount != 0);
  }

  /**
   * @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
   * @param _beneficiary Address performing the token purchase
   * @param _weiAmount Value in wei involved in the purchase
   */
  function _postValidatePurchase(
    address _beneficiary,
    uint256 _weiAmount
  )
    internal
  {
    // optional override
  }

  /**
   * @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
   * @param _beneficiary Address performing the token purchase
   * @param _tokenAmount Number of tokens to be emitted
   */
  function _deliverTokens(
    address _beneficiary,
    uint256 _tokenAmount
  )
    internal
  {
    Mytoken.transfer(_beneficiary, _tokenAmount);
  }

  /**
   * @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
   * @param _beneficiary Address receiving the tokens
   * @param _tokenAmount Number of tokens to be purchased
   */
  function _processPurchase(
    address _beneficiary,
    uint256 _tokenAmount
  )
    internal
  {
    _deliverTokens(_beneficiary, _tokenAmount);
  }

  /**
   * @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
   * @param _beneficiary Address receiving the tokens
   * @param _weiAmount Value in wei involved in the purchase
   */
  function _updatePurchasingState(
    address _beneficiary,
    uint256 _weiAmount
  )
    internal
  {
    // optional override
  }

  /**
   * @dev Override to extend the way in which ether is converted to tokens.
   * @param _weiAmount Value in wei to be converted into tokens
   * @return Number of tokens that can be purchased with the specified _weiAmount
   */
  function _getTokenAmount(uint256 _weiAmount)
    internal view returns (uint256)
  {
    return _weiAmount * rate;
  }

  /**
   * @dev Determines how ETH is stored/forwarded on purchases.
   */
  function _forwardFunds() internal {
    owner.transfer(msg.value);
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount
    ) external returns (bool);
}

Settings
{
  "evmVersion": "istanbul",
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "libraries": {
    "GumboLimboCrowdsale.sol": {}
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"},{"internalType":"contract IERC20","name":"_token","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"purchaser","type":"address"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenPurchase","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"Mytoken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weiRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b5060405161056538038061056583398101604081905261002f91610070565b6000821161003c57600080fd5b600291909155600080546001600160a01b039092166001600160a01b031992831617905560018054909116331790556100ad565b6000806040838503121561008357600080fd5b825160208401519092506001600160a01b03811681146100a257600080fd5b809150509250929050565b6104a9806100bc6000396000f3fe6080604052600436106100595760003560e01c80632c4e722e146100705780633ccfd60b146100995780634042b66f146100ae578063531deabf146100c45780638da5cb5b146100fc578063d0febe4c1461006857610068565b366100685761006661011c565b005b61006661011c565b34801561007c57600080fd5b5061008660025481565b6040519081526020015b60405180910390f35b3480156100a557600080fd5b506100666101aa565b3480156100ba57600080fd5b5061008660035481565b3480156100d057600080fd5b506000546100e4906001600160a01b031681565b6040516001600160a01b039091168152602001610090565b34801561010857600080fd5b506001546100e4906001600160a01b031681565b333461012882826102f4565b600061013382610311565b9050816003600082825461014791906103fa565b9091555061015790508382610327565b60408051838152602081018390526001600160a01b0385169133917f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18910160405180910390a36101a5610331565b505050565b6001546001600160a01b031633146102085760405162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015260640160405180910390fd5b600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610251573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102759190610412565b60005460015460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af11580156102cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f0919061042b565b5050565b6001600160a01b03821661030757600080fd5b806102f057600080fd5b6000600254826103219190610454565b92915050565b6102f0828261036d565b6001546040516001600160a01b03909116903480156108fc02916000818181858888f1935050505015801561036a573d6000803e3d6000fd5b50565b60005460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af11580156103c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a5919061042b565b634e487b7160e01b600052601160045260246000fd5b6000821982111561040d5761040d6103e4565b500190565b60006020828403121561042457600080fd5b5051919050565b60006020828403121561043d57600080fd5b8151801515811461044d57600080fd5b9392505050565b600081600019048311821515161561046e5761046e6103e4565b50029056fea2646970667358221220a7e767c3091b3ff51bfec07ca9666fc063e406606511bd3eebd826ff93ec4abc64736f6c634300080a0033000000000000000000000000000000000000000000000000000000000000189c000000000000000000000000a52a4fb0e09da17598b570180722d1ef3712b845

Deployed Bytecode

0x6080604052600436106100595760003560e01c80632c4e722e146100705780633ccfd60b146100995780634042b66f146100ae578063531deabf146100c45780638da5cb5b146100fc578063d0febe4c1461006857610068565b366100685761006661011c565b005b61006661011c565b34801561007c57600080fd5b5061008660025481565b6040519081526020015b60405180910390f35b3480156100a557600080fd5b506100666101aa565b3480156100ba57600080fd5b5061008660035481565b3480156100d057600080fd5b506000546100e4906001600160a01b031681565b6040516001600160a01b039091168152602001610090565b34801561010857600080fd5b506001546100e4906001600160a01b031681565b333461012882826102f4565b600061013382610311565b9050816003600082825461014791906103fa565b9091555061015790508382610327565b60408051838152602081018390526001600160a01b0385169133917f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18910160405180910390a36101a5610331565b505050565b6001546001600160a01b031633146102085760405162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015260640160405180910390fd5b600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610251573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102759190610412565b60005460015460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb906044016020604051808303816000875af11580156102cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f0919061042b565b5050565b6001600160a01b03821661030757600080fd5b806102f057600080fd5b6000600254826103219190610454565b92915050565b6102f0828261036d565b6001546040516001600160a01b03909116903480156108fc02916000818181858888f1935050505015801561036a573d6000803e3d6000fd5b50565b60005460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af11580156103c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101a5919061042b565b634e487b7160e01b600052601160045260246000fd5b6000821982111561040d5761040d6103e4565b500190565b60006020828403121561042457600080fd5b5051919050565b60006020828403121561043d57600080fd5b8151801515811461044d57600080fd5b9392505050565b600081600019048311821515161561046e5761046e6103e4565b50029056fea2646970667358221220a7e767c3091b3ff51bfec07ca9666fc063e406606511bd3eebd826ff93ec4abc64736f6c634300080a0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000000000000000000000000000000000000000189c000000000000000000000000a52a4fb0e09da17598b570180722d1ef3712b845

-----Decoded View---------------
Arg [0] : _rate (uint256): 6300
Arg [1] : _token (address): 0xa52a4fB0e09Da17598B570180722D1EF3712b845

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000000189c
Arg [1] : 000000000000000000000000a52a4fb0e09da17598b570180722d1ef3712b845


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.