ETH Price: $3,368.29 (-3.08%)

Contract

0xC2EcB66738C76E4eE89b687fdAA43Cf462a0d3B9
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Swap213997052024-12-14 8:57:4712 days ago1734166667IN
0xC2EcB667...462a0d3B9
0 ETH0.001524978.61598602
Swap212041882024-11-17 1:37:2339 days ago1731807443IN
0xC2EcB667...462a0d3B9
0 ETH0.0040687810.68104746
Swap211060072024-11-03 8:46:1153 days ago1730623571IN
0xC2EcB667...462a0d3B9
0 ETH0.000645193.64530028
Swap210821072024-10-31 0:42:3556 days ago1730335355IN
0xC2EcB667...462a0d3B9
0 ETH0.001541628.71002433
Swap208015932024-09-21 21:19:2395 days ago1726953563IN
0xC2EcB667...462a0d3B9
0 ETH0.001265847.35127734
Swap207951922024-09-20 23:50:3596 days ago1726876235IN
0xC2EcB667...462a0d3B9
0 ETH0.0024548613.86977412
Swap207938132024-09-20 19:12:4796 days ago1726859567IN
0xC2EcB667...462a0d3B9
0 ETH0.0047373512.5
Swap207918712024-09-20 12:42:4796 days ago1726836167IN
0xC2EcB667...462a0d3B9
0 ETH0.0017269710.02924161
Swap206047402024-08-25 9:34:11123 days ago1724578451IN
0xC2EcB667...462a0d3B9
0 ETH0.000183741.03813927
Swap205408982024-08-16 11:29:23132 days ago1723807763IN
0xC2EcB667...462a0d3B9
0 ETH0.000293371.65751886
Swap205389342024-08-16 4:55:35132 days ago1723784135IN
0xC2EcB667...462a0d3B9
0 ETH0.000351551.98627576
Swap205387902024-08-16 4:26:47132 days ago1723782407IN
0xC2EcB667...462a0d3B9
0 ETH0.00057141.5
Swap205386472024-08-16 3:57:59132 days ago1723780679IN
0xC2EcB667...462a0d3B9
0 ETH0.00036972.0888146
Swap205385002024-08-16 3:28:35132 days ago1723778915IN
0xC2EcB667...462a0d3B9
0 ETH0.00034071.92492551
Swap205383042024-08-16 2:49:23132 days ago1723776563IN
0xC2EcB667...462a0d3B9
0 ETH0.000438672.47849803
Swap205381582024-08-16 2:20:11132 days ago1723774811IN
0xC2EcB667...462a0d3B9
0 ETH0.00032931.86054544
Swap205380102024-08-16 1:50:35132 days ago1723773035IN
0xC2EcB667...462a0d3B9
0 ETH0.000378282.13724925
Swap205320592024-08-15 5:51:47133 days ago1723701107IN
0xC2EcB667...462a0d3B9
0 ETH0.000463822.62055164
Swap205309392024-08-15 2:06:23133 days ago1723687583IN
0xC2EcB667...462a0d3B9
0 ETH0.000530983
Swap205306252024-08-15 1:03:35133 days ago1723683815IN
0xC2EcB667...462a0d3B9
0 ETH0.000353982
Swap205302742024-08-14 23:52:59133 days ago1723679579IN
0xC2EcB667...462a0d3B9
0 ETH0.000353982
Swap204115432024-07-29 10:12:47150 days ago1722247967IN
0xC2EcB667...462a0d3B9
0 ETH0.000331091.8706532
Swap204114552024-07-29 9:55:11150 days ago1722246911IN
0xC2EcB667...462a0d3B9
0 ETH0.000407932.30478132
Swap204113542024-07-29 9:34:59150 days ago1722245699IN
0xC2EcB667...462a0d3B9
0 ETH0.000464212.6227727
Swap203647622024-07-22 21:29:59156 days ago1721683799IN
0xC2EcB667...462a0d3B9
0 ETH0.0020027411.01653906
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xdd977C72...e3EE75F6D
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
GMSwap

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 4 : GMSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

interface IERC20Decimals is IERC20 {
  function decimals() external view returns (uint8);
}

/**
 * @title GMSwap
 * @dev Swap GMv1 for GMv2
 */
contract GMSwap is Ownable {
  IERC20Decimals private gmV1;
  IERC20Decimals private gmV2;

  mapping(address => bool) public swapped;

  constructor(address _v1, address _v2) {
    gmV1 = IERC20Decimals(_v1);
    gmV2 = IERC20Decimals(_v2);
  }

  function swap() external {
    require(!swapped[msg.sender], 'already swapped V1 for V2');
    swapped[msg.sender] = true;

    uint256 _v1Bal = gmV1.balanceOf(msg.sender);
    require(_v1Bal > 0, 'you do not have any V1 tokens');
    uint256 _v2Amount = (_v1Bal * 10**gmV2.decimals()) / 10**gmV1.decimals();
    require(
      gmV2.balanceOf(address(this)) >= _v2Amount,
      'not enough V2 liquidity to complete swap'
    );
    gmV1.transferFrom(msg.sender, address(this), _v1Bal);
    gmV2.transfer(msg.sender, _v2Amount);
  }

  function v1() external view returns (address) {
    return address(gmV1);
  }

  function v2() external view returns (address) {
    return address(gmV2);
  }

  function setSwapped(address _wallet, bool _swapped) external onlyOwner {
    swapped[_wallet] = _swapped;
  }

  function withdrawTokens(address _tokenAddy, uint256 _amount)
    external
    onlyOwner
  {
    IERC20 _token = IERC20(_tokenAddy);
    _amount = _amount > 0 ? _amount : _token.balanceOf(address(this));
    require(_amount > 0, 'make sure there is a balance available to withdraw');
    _token.transfer(owner(), _amount);
  }
}

File 2 of 4 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 4 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

File 4 of 4 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/*
 * @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;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_v1","type":"address"},{"internalType":"address","name":"_v2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"bool","name":"_swapped","type":"bool"}],"name":"setSwapped","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"swapped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"v1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddy","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638119c065116100665780638119c065146100f257806381c61090146100fa5780638da5cb5b1461012d578063f2fde38b1461013e578063f3acae3a1461015157600080fd5b806306b091f91461009857806307127168146100ad5780636854171d146100c0578063715018a6146100ea575b600080fd5b6100ab6100a6366004610982565b610162565b005b6100ab6100bb36600461094c565b61032d565b6001546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100ab610382565b6100ab6103b8565b61011d61010836600461092b565b60036020526000908152604090205460ff1681565b60405190151581526020016100e1565b6000546001600160a01b03166100cd565b6100ab61014c36600461092b565b610824565b6002546001600160a01b03166100cd565b6000546001600160a01b031633146101955760405162461bcd60e51b815260040161018c90610a00565b60405180910390fd5b8181610217576040516370a0823160e01b81523060048201526001600160a01b038216906370a082319060240160206040518083038186803b1580156101da57600080fd5b505afa1580156101ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021291906109c7565b610219565b815b9150600082116102865760405162461bcd60e51b815260206004820152603260248201527f6d616b65207375726520746865726520697320612062616c616e636520617661604482015271696c61626c6520746f20776974686472617760701b606482015260840161018c565b806001600160a01b031663a9059cbb6102a76000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b1580156102ef57600080fd5b505af1158015610303573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032791906109ab565b50505050565b6000546001600160a01b031633146103575760405162461bcd60e51b815260040161018c90610a00565b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146103ac5760405162461bcd60e51b815260040161018c90610a00565b6103b660006108bf565b565b3360009081526003602052604090205460ff16156104185760405162461bcd60e51b815260206004820152601960248201527f616c7265616479207377617070656420563120666f7220563200000000000000604482015260640161018c565b33600081815260036020526040808220805460ff191660019081179091555490516370a0823160e01b8152600481019390935290916001600160a01b03909116906370a082319060240160206040518083038186803b15801561047a57600080fd5b505afa15801561048e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b291906109c7565b9050600081116105045760405162461bcd60e51b815260206004820152601d60248201527f796f7520646f206e6f74206861766520616e7920563120746f6b656e73000000604482015260640161018c565b6001546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b15801561054957600080fd5b505afa15801561055d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058191906109df565b61058c90600a610a98565b600260009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156105da57600080fd5b505afa1580156105ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061291906109df565b61061d90600a610a98565b6106279084610b45565b6106319190610a35565b6002546040516370a0823160e01b815230600482015291925082916001600160a01b03909116906370a082319060240160206040518083038186803b15801561067957600080fd5b505afa15801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b191906109c7565b10156107105760405162461bcd60e51b815260206004820152602860248201527f6e6f7420656e6f756768205632206c697175696469747920746f20636f6d706c604482015267065746520737761760c41b606482015260840161018c565b6001546040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03909116906323b872dd90606401602060405180830381600087803b15801561076257600080fd5b505af1158015610776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079a91906109ab565b5060025460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156107e757600080fd5b505af11580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f91906109ab565b505050565b6000546001600160a01b0316331461084e5760405162461bcd60e51b815260040161018c90610a00565b6001600160a01b0381166108b35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161018c565b6108bc816108bf565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461092657600080fd5b919050565b60006020828403121561093c578081fd5b6109458261090f565b9392505050565b6000806040838503121561095e578081fd5b6109678361090f565b9150602083013561097781610b7a565b809150509250929050565b60008060408385031215610994578182fd5b61099d8361090f565b946020939093013593505050565b6000602082840312156109bc578081fd5b815161094581610b7a565b6000602082840312156109d8578081fd5b5051919050565b6000602082840312156109f0578081fd5b815160ff81168114610945578182fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082610a5057634e487b7160e01b81526012600452602481fd5b500490565b600181815b80851115610a90578160001904821115610a7657610a76610b64565b80851615610a8357918102915b93841c9390800290610a5a565b509250929050565b600061094560ff841683600082610ab157506001610b3f565b81610abe57506000610b3f565b8160018114610ad45760028114610ade57610afa565b6001915050610b3f565b60ff841115610aef57610aef610b64565b50506001821b610b3f565b5060208310610133831016604e8410600b8410161715610b1d575081810a610b3f565b610b278383610a55565b8060001904821115610b3b57610b3b610b64565b0290505b92915050565b6000816000190483118215151615610b5f57610b5f610b64565b500290565b634e487b7160e01b600052601160045260246000fd5b80151581146108bc57600080fdfea164736f6c6343000804000a

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.