ETH Price: $2,833.71 (-7.21%)
Gas: 4 Gwei

Contract

0x1dA191b3172acc8B8C27554CF973B6168AFcC5ff
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Transfer Ownersh...157273692022-10-11 20:51:11635 days ago1665521471IN
0x1dA191b3...68AFcC5ff
0 ETH0.0008315728.70860711
0x60c06040157273492022-10-11 20:47:11635 days ago1665521231IN
 Create: Presale
0 ETH0.017945124.93639183

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Presale

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 2 : Presale.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import "./interfaces/IWETH.sol";

error Unauthorized(address caller);
error InsufficientTokenSupply();
error TransferFailed();

contract Ownable
{    
  address private _owner;

  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
  
  /**
   * @dev Sets the original owner of contract when deployed
   */
  constructor()
  {
    _owner = msg.sender;
  }

  /**
   * @dev Returns the address of the current owner.
   */
  function owner() public view returns(address) 
  {
    return _owner;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() 
  {
    if(_isOwner() != true)
      revert Unauthorized(msg.sender);
    _;
  }

  /**
   * @dev Returns bool depending on message sender's ownership.
   */
  function _isOwner() internal view returns(bool)
  {
    return msg.sender == _owner;
  }

  /**
   * @dev Transfers ownership of the contract to a new account (`newOwner`).
   * Can only be called by the current owner.
   */
  function transferOwnership(address newOwner) public virtual onlyOwner {
    _transferOwnership(newOwner);
  }

  /**
   * @dev Transfers ownership of the contract to a new account (`newOwner`).
   * Internal function without access restriction.
   */
  function _transferOwnership(address newOwner) internal virtual {
    address oldOwner = _owner;
    _owner = newOwner;
    emit OwnershipTransferred(oldOwner, newOwner);
  }
}

contract Presale is Ownable {
  uint256 public immutable maxTokenSupply;
  uint256 public immutable presalePriceWei; 
  uint256 public tokenSupply;
  IWETH private wETH; 
  
  mapping(address => uint256) public selectedBids;

  event BidSelected(address bidderAddress, uint256 tokenQuantity);
  event Withdraw(uint256 amount);

  constructor(address _wETHAddress, 
    uint256 _maxTokenSupply, 
    uint256 _presalePriceWei) { 
    wETH = IWETH(_wETHAddress);
    maxTokenSupply = _maxTokenSupply;
    presalePriceWei = _presalePriceWei;
    tokenSupply = maxTokenSupply;
    }

  /**
   * @notice Transfers wETH from (`_selectedAddress`) to contract.
   * wETH is calculated using (`_bidQuantity`) and base price of 1 bid.
   * This function should only be invoked when the contract owner wants to select a presale bid.
   */
  function selectBid(address _selectedAddress, uint256 _bidQuantity) external onlyOwner {
    if(_bidQuantity > tokenSupply)
      revert InsufficientTokenSupply();

    uint256 amountWei = _bidQuantity * presalePriceWei;
    tokenSupply -= _bidQuantity;
    selectedBids[_selectedAddress] = _bidQuantity;

    if(wETH.transferFrom(_selectedAddress, address(this), amountWei) != true)
      revert TransferFailed();

    emit BidSelected(_selectedAddress, _bidQuantity);
  }

  /**
   * @notice Withdraw all wETH from contract and transfer to owner.
   */
  function withdraw() external onlyOwner {
    uint256 amount = wETH.balanceOf(address(this));
    
    wETH.transfer(owner(), amount);
    emit Withdraw(amount);
  }
}

File 2 of 2 : IWETH.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

interface IWETH {
    function deposit() external payable;

    function transfer(address to, uint256 value) external returns (bool);

    function approve(address guy, uint256 wad) external returns (bool);

    function balanceOf(address account) external view returns (uint256);

    function withdraw(uint256) external;

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);
}

Settings
{
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_wETHAddress","type":"address"},{"internalType":"uint256","name":"_maxTokenSupply","type":"uint256"},{"internalType":"uint256","name":"_presalePriceWei","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InsufficientTokenSupply","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bidderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenQuantity","type":"uint256"}],"name":"BidSelected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"maxTokenSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presalePriceWei","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_selectedAddress","type":"address"},{"internalType":"uint256","name":"_bidQuantity","type":"uint256"}],"name":"selectBid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"selectedBids","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b5060405162000cc938038062000cc983398181016040528101906200003791906200017f565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081608081815250508060a08181525050608051600181905550505050620001db565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200010c82620000df565b9050919050565b6200011e81620000ff565b81146200012a57600080fd5b50565b6000815190506200013e8162000113565b92915050565b6000819050919050565b620001598162000144565b81146200016557600080fd5b50565b60008151905062000179816200014e565b92915050565b6000806000606084860312156200019b576200019a620000da565b5b6000620001ab868287016200012d565b9350506020620001be8682870162000168565b9250506040620001d18682870162000168565b9150509250925092565b60805160a051610ac162000208600039600081816103f101526105bd015260006105990152610ac16000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063730e33851161005b578063730e3385146101015780637824407f1461011f5780638da5cb5b1461013d578063f2fde38b1461015b57610088565b80633ccfd60b1461008d5780634532504c146100975780634aa57aeb146100c757806350f7c204146100e3575b600080fd5b610095610177565b005b6100b160048036038101906100ac91906107e8565b610349565b6040516100be919061082e565b60405180910390f35b6100e160048036038101906100dc9190610875565b610361565b005b6100eb610597565b6040516100f8919061082e565b60405180910390f35b6101096105bb565b604051610116919061082e565b60405180910390f35b6101276105df565b604051610134919061082e565b60405180910390f35b6101456105e5565b60405161015291906108c4565b60405180910390f35b610175600480360381019061017091906107e8565b61060e565b005b6001151561018361066a565b1515146101c757336040517f8e4a23d60000000000000000000000000000000000000000000000000000000081526004016101be91906108c4565b60405180910390fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161022491906108c4565b602060405180830381865afa158015610241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026591906108f4565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6102ad6105e5565b836040518363ffffffff1660e01b81526004016102cb929190610921565b6020604051808303816000875af11580156102ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030e9190610982565b507f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d8160405161033e919061082e565b60405180910390a150565b60036020528060005260406000206000915090505481565b6001151561036d61066a565b1515146103b157336040517f8e4a23d60000000000000000000000000000000000000000000000000000000081526004016103a891906108c4565b60405180910390fd5b6001548111156103ed576040517f639e75a200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000008261041b91906109de565b9050816001600082825461042f9190610a20565b9250508190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060011515600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8530856040518463ffffffff1660e01b81526004016104dd93929190610a54565b6020604051808303816000875af11580156104fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105209190610982565b151514610559576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fc053987cc37c20b31c548d40bf9cf839114d157994f4b1bb00460f74c7d5ef7d838360405161058a929190610921565b60405180910390a1505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6001151561061a61066a565b15151461065e57336040517f8e4a23d600000000000000000000000000000000000000000000000000000000815260040161065591906108c4565b60405180910390fd5b610667816106c1565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006107b58261078a565b9050919050565b6107c5816107aa565b81146107d057600080fd5b50565b6000813590506107e2816107bc565b92915050565b6000602082840312156107fe576107fd610785565b5b600061080c848285016107d3565b91505092915050565b6000819050919050565b61082881610815565b82525050565b6000602082019050610843600083018461081f565b92915050565b61085281610815565b811461085d57600080fd5b50565b60008135905061086f81610849565b92915050565b6000806040838503121561088c5761088b610785565b5b600061089a858286016107d3565b92505060206108ab85828601610860565b9150509250929050565b6108be816107aa565b82525050565b60006020820190506108d960008301846108b5565b92915050565b6000815190506108ee81610849565b92915050565b60006020828403121561090a57610909610785565b5b6000610918848285016108df565b91505092915050565b600060408201905061093660008301856108b5565b610943602083018461081f565b9392505050565b60008115159050919050565b61095f8161094a565b811461096a57600080fd5b50565b60008151905061097c81610956565b92915050565b60006020828403121561099857610997610785565b5b60006109a68482850161096d565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006109e982610815565b91506109f483610815565b9250828202610a0281610815565b91508282048414831517610a1957610a186109af565b5b5092915050565b6000610a2b82610815565b9150610a3683610815565b9250828203905081811115610a4e57610a4d6109af565b5b92915050565b6000606082019050610a6960008301866108b5565b610a7660208301856108b5565b610a83604083018461081f565b94935050505056fea26469706673582212203d20b2dabd67ef3e8d31954d5b9cd619a645c737b2da5620f86488799e7c286e64736f6c63430008110033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000003782dace9d90000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063730e33851161005b578063730e3385146101015780637824407f1461011f5780638da5cb5b1461013d578063f2fde38b1461015b57610088565b80633ccfd60b1461008d5780634532504c146100975780634aa57aeb146100c757806350f7c204146100e3575b600080fd5b610095610177565b005b6100b160048036038101906100ac91906107e8565b610349565b6040516100be919061082e565b60405180910390f35b6100e160048036038101906100dc9190610875565b610361565b005b6100eb610597565b6040516100f8919061082e565b60405180910390f35b6101096105bb565b604051610116919061082e565b60405180910390f35b6101276105df565b604051610134919061082e565b60405180910390f35b6101456105e5565b60405161015291906108c4565b60405180910390f35b610175600480360381019061017091906107e8565b61060e565b005b6001151561018361066a565b1515146101c757336040517f8e4a23d60000000000000000000000000000000000000000000000000000000081526004016101be91906108c4565b60405180910390fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161022491906108c4565b602060405180830381865afa158015610241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026591906108f4565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6102ad6105e5565b836040518363ffffffff1660e01b81526004016102cb929190610921565b6020604051808303816000875af11580156102ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030e9190610982565b507f5b6b431d4476a211bb7d41c20d1aab9ae2321deee0d20be3d9fc9b1093fa6e3d8160405161033e919061082e565b60405180910390a150565b60036020528060005260406000206000915090505481565b6001151561036d61066a565b1515146103b157336040517f8e4a23d60000000000000000000000000000000000000000000000000000000081526004016103a891906108c4565b60405180910390fd5b6001548111156103ed576040517f639e75a200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007f00000000000000000000000000000000000000000000000003782dace9d900008261041b91906109de565b9050816001600082825461042f9190610a20565b9250508190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060011515600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8530856040518463ffffffff1660e01b81526004016104dd93929190610a54565b6020604051808303816000875af11580156104fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105209190610982565b151514610559576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fc053987cc37c20b31c548d40bf9cf839114d157994f4b1bb00460f74c7d5ef7d838360405161058a929190610921565b60405180910390a1505050565b7f00000000000000000000000000000000000000000000000000000000000001f481565b7f00000000000000000000000000000000000000000000000003782dace9d9000081565b60015481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6001151561061a61066a565b15151461065e57336040517f8e4a23d600000000000000000000000000000000000000000000000000000000815260040161065591906108c4565b60405180910390fd5b610667816106c1565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006107b58261078a565b9050919050565b6107c5816107aa565b81146107d057600080fd5b50565b6000813590506107e2816107bc565b92915050565b6000602082840312156107fe576107fd610785565b5b600061080c848285016107d3565b91505092915050565b6000819050919050565b61082881610815565b82525050565b6000602082019050610843600083018461081f565b92915050565b61085281610815565b811461085d57600080fd5b50565b60008135905061086f81610849565b92915050565b6000806040838503121561088c5761088b610785565b5b600061089a858286016107d3565b92505060206108ab85828601610860565b9150509250929050565b6108be816107aa565b82525050565b60006020820190506108d960008301846108b5565b92915050565b6000815190506108ee81610849565b92915050565b60006020828403121561090a57610909610785565b5b6000610918848285016108df565b91505092915050565b600060408201905061093660008301856108b5565b610943602083018461081f565b9392505050565b60008115159050919050565b61095f8161094a565b811461096a57600080fd5b50565b60008151905061097c81610956565b92915050565b60006020828403121561099857610997610785565b5b60006109a68482850161096d565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006109e982610815565b91506109f483610815565b9250828202610a0281610815565b91508282048414831517610a1957610a186109af565b5b5092915050565b6000610a2b82610815565b9150610a3683610815565b9250828203905081811115610a4e57610a4d6109af565b5b92915050565b6000606082019050610a6960008301866108b5565b610a7660208301856108b5565b610a83604083018461081f565b94935050505056fea26469706673582212203d20b2dabd67ef3e8d31954d5b9cd619a645c737b2da5620f86488799e7c286e64736f6c63430008110033

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000003782dace9d90000

-----Decoded View---------------
Arg [0] : _wETHAddress (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [1] : _maxTokenSupply (uint256): 500
Arg [2] : _presalePriceWei (uint256): 250000000000000000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [2] : 00000000000000000000000000000000000000000000000003782dace9d90000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.