ETH Price: $3,476.77 (+4.29%)

Contract

0xEf1efB7F22fB728820D4952b33012a7115E87687
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0xad05dc8c16879906fb373a4b931addfa54311bef19080bd5ecd92017d87df0a5 Swap(pending)2024-12-15 1:34:109 days ago1734226450IN
0xEf1efB7F...115E87687
0 ETH(Pending)(Pending)
Swap213993782024-12-14 7:51:5910 days ago1734162719IN
0xEf1efB7F...115E87687
0 ETH0.00065946.7867557
Swap213990082024-12-14 6:37:2310 days ago1734158243IN
0xEf1efB7F...115E87687
0 ETH0.000656338.19924003
Swap213989832024-12-14 6:32:2310 days ago1734157943IN
0xEf1efB7F...115E87687
0 ETH0.000749428.35963742
Swap213989572024-12-14 6:27:1110 days ago1734157631IN
0xEf1efB7F...115E87687
0 ETH0.000753098.40060383
Swap213989422024-12-14 6:24:1110 days ago1734157451IN
0xEf1efB7F...115E87687
0 ETH0.0006787.56291388
Swap213989092024-12-14 6:17:3510 days ago1734157055IN
0xEf1efB7F...115E87687
0 ETH0.000769428.58275291
Swap213920492024-12-13 7:18:3511 days ago1734074315IN
0xEf1efB7F...115E87687
0 ETH0.000838379.35183363
Swap213829952024-12-12 0:58:4712 days ago1733965127IN
0xEf1efB7F...115E87687
0 ETH0.0014385314.10885832
Swap213711122024-12-10 9:08:3514 days ago1733821715IN
0xEf1efB7F...115E87687
0 ETH0.0017242416.91102488
Swap213670282024-12-09 19:26:5915 days ago1733772419IN
0xEf1efB7F...115E87687
0 ETH0.0022753223.41834368
Swap213641962024-12-09 9:57:4715 days ago1733738267IN
0xEf1efB7F...115E87687
0 ETH0.000797238.89291522
Swap213637492024-12-09 8:28:2315 days ago1733732903IN
0xEf1efB7F...115E87687
0 ETH0.000884468.28550981
Swap213561702024-12-08 7:06:2316 days ago1733641583IN
0xEf1efB7F...115E87687
0 ETH0.000932239.59602714
Swap213491362024-12-07 7:30:3517 days ago1733556635IN
0xEf1efB7F...115E87687
0 ETH0.0012723813.09575594
Swap213431482024-12-06 11:26:4718 days ago1733484407IN
0xEf1efB7F...115E87687
0 ETH0.001221812.57826994
Swap213389512024-12-05 21:22:2318 days ago1733433743IN
0xEf1efB7F...115E87687
0 ETH0.0022939323.6157442
Swap213355822024-12-05 10:04:5919 days ago1733393099IN
0xEf1efB7F...115E87687
0 ETH0.0027877228.69569931
Swap213072032024-12-01 10:56:3523 days ago1733050595IN
0xEf1efB7F...115E87687
0 ETH0.000807148.3083581
Swap212956752024-11-29 20:16:4724 days ago1732911407IN
0xEf1efB7F...115E87687
0 ETH0.0010871611.19076177
Swap212652002024-11-25 13:54:2329 days ago1732542863IN
0xEf1efB7F...115E87687
0 ETH0.0016197716.67323422
Swap212441832024-11-22 15:31:2332 days ago1732289483IN
0xEf1efB7F...115E87687
0 ETH0.0015931916.39962843
Swap212252932024-11-20 0:13:3534 days ago1732061615IN
0xEf1efB7F...115E87687
0 ETH0.0012517412.88489479
Swap211946612024-11-15 17:43:4739 days ago1731692627IN
0xEf1efB7F...115E87687
0 ETH0.0020813128.59887925
Swap211498122024-11-09 11:30:4745 days ago1731151847IN
0xEf1efB7F...115E87687
0 ETH0.000922769.49742164
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 0x2024CB47...1999fE8c7
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
TokenSwap

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 5 : TokenSwap.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "./libs/token/ERC20/IERC20.sol";
import "./libs/utils/ReentrancyGuard.sol";
import "./libs/utils/Utils.sol";
import "./libs/math/SafeMath.sol";

contract TokenSwap is ReentrancyGuard {
    using SafeMath for uint256;

    /// legacy zil address
    address private _address0;
    /// wrapped zil address
    address private _address1;

    address private _admin;

    address private _payer;

    event SwapEvent(
        address indexed sender,
        uint256 amount
    );

    constructor (address address0, address address1, address admin, address initPayer) {
        _address0 = address0;
        _address1 = address1;
        _admin = admin;
        _payer = initPayer;
    }

    function swap(
        uint256 _callAmount
    )
        external
        nonReentrant
        returns (bool)
    {
        IERC20 token0 = IERC20(_address0);
        bool burnt = token0.burnFrom(msg.sender, _callAmount);
        require(burnt, "burnt failed");
        IERC20 token1 = IERC20(_address1);
        bool transferred = token1.transferFrom(_payer, msg.sender,_callAmount);
        require(transferred, "transfer failed");
        emit SwapEvent(msg.sender, _callAmount);
        return true;
    }

    function changePayer(address newPayer) external nonReentrant returns (bool) {
        require(msg.sender == _admin,"sender should be admin");
        _payer = newPayer;
        return true;
    }

    function payer() public view returns (address) {
        return _payer;
    }
}

File 2 of 5 : 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);

    function burnFrom(address from, uint256 amount) external returns (bool);

    function burn(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 3 of 5 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

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].
 */
contract ReentrancyGuard {
    bool private _notEntered;

    constructor () {
        // Storing an initial 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 percetange 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.
        _notEntered = true;
    }

    /**
     * @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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_notEntered, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _notEntered = false;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _notEntered = true;
    }
}

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

pragma solidity ^0.8.0;

import "../token/ERC20/IERC20.sol";

library Utils {


    /**
     * @dev Returns true if `account` is a contract.
     *      Refer from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol#L18
     *
     * This test is non-exhaustive, and there may be false-negatives: during the
     * execution of a contract's constructor, its address will be reported as
     * not containing a contract.
     *
     * IMPORTANT: It is unsafe to assume that an address for which this
     * function returns false is an externally-owned account (EOA) and not a
     * contract.
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != 0x0 && codehash != accountHash);
    }
}

File 5 of 5 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

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":"address0","type":"address"},{"internalType":"address","name":"address1","type":"address"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"initPayer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SwapEvent","type":"event"},{"inputs":[{"internalType":"address","name":"newPayer","type":"address"}],"name":"changePayer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"payer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_callAmount","type":"uint256"}],"name":"swap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063123119cd1461004657806394b918de14610064578063d6ea53b114610094575b600080fd5b61004e6100c4565b60405161005b919061057f565b60405180910390f35b61007e600480360381019061007991906105d5565b6100ee565b60405161008b919061061d565b60405180910390f35b6100ae60048036038101906100a99190610664565b6103e0565b6040516100bb919061061d565b60405180910390f35b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900460ff1661013e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610135906106ee565b60405180910390fd5b60008060006101000a81548160ff02191690831515021790555060008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff166379cc679033866040518363ffffffff1660e01b81526004016101bb92919061071d565b602060405180830381600087803b1580156101d557600080fd5b505af11580156101e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020d9190610772565b90508061024f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610246906107eb565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff166323b872dd600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633896040518463ffffffff1660e01b81526004016102d79392919061080b565b602060405180830381600087803b1580156102f157600080fd5b505af1158015610305573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103299190610772565b90508061036b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103629061088e565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167fb1d5848b979812bb0b549861ffb0c6a20e89c976e1ae7a6e8d4a8a35ceeaa419876040516103b191906108ae565b60405180910390a2600194505050505060016000806101000a81548160ff021916908315150217905550919050565b60008060009054906101000a900460ff16610430576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610427906106ee565b60405180910390fd5b60008060006101000a81548160ff021916908315150217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d190610915565b60405180910390fd5b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905060016000806101000a81548160ff021916908315150217905550919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006105698261053e565b9050919050565b6105798161055e565b82525050565b60006020820190506105946000830184610570565b92915050565b600080fd5b6000819050919050565b6105b28161059f565b81146105bd57600080fd5b50565b6000813590506105cf816105a9565b92915050565b6000602082840312156105eb576105ea61059a565b5b60006105f9848285016105c0565b91505092915050565b60008115159050919050565b61061781610602565b82525050565b6000602082019050610632600083018461060e565b92915050565b6106418161055e565b811461064c57600080fd5b50565b60008135905061065e81610638565b92915050565b60006020828403121561067a5761067961059a565b5b60006106888482850161064f565b91505092915050565b600082825260208201905092915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60006106d8601f83610691565b91506106e3826106a2565b602082019050919050565b60006020820190508181036000830152610707816106cb565b9050919050565b6107178161059f565b82525050565b60006040820190506107326000830185610570565b61073f602083018461070e565b9392505050565b61074f81610602565b811461075a57600080fd5b50565b60008151905061076c81610746565b92915050565b6000602082840312156107885761078761059a565b5b60006107968482850161075d565b91505092915050565b7f6275726e74206661696c65640000000000000000000000000000000000000000600082015250565b60006107d5600c83610691565b91506107e08261079f565b602082019050919050565b60006020820190508181036000830152610804816107c8565b9050919050565b60006060820190506108206000830186610570565b61082d6020830185610570565b61083a604083018461070e565b949350505050565b7f7472616e73666572206661696c65640000000000000000000000000000000000600082015250565b6000610878600f83610691565b915061088382610842565b602082019050919050565b600060208201905081810360008301526108a78161086b565b9050919050565b60006020820190506108c3600083018461070e565b92915050565b7f73656e6465722073686f756c642062652061646d696e00000000000000000000600082015250565b60006108ff601683610691565b915061090a826108c9565b602082019050919050565b6000602082019050818103600083015261092e816108f2565b905091905056fea2646970667358221220826881ce0f09ca74fb443c58d440ba7610124ed69d84cf77842f34ec907c5e3764736f6c63430008090033

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.