Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0xad05dc8c16879906fb373a4b931addfa54311bef19080bd5ecd92017d87df0a5 | Swap | (pending) | 9 days ago | IN | 0 ETH | (Pending) | |||
Swap | 21399378 | 10 days ago | IN | 0 ETH | 0.0006594 | ||||
Swap | 21399008 | 10 days ago | IN | 0 ETH | 0.00065633 | ||||
Swap | 21398983 | 10 days ago | IN | 0 ETH | 0.00074942 | ||||
Swap | 21398957 | 10 days ago | IN | 0 ETH | 0.00075309 | ||||
Swap | 21398942 | 10 days ago | IN | 0 ETH | 0.000678 | ||||
Swap | 21398909 | 10 days ago | IN | 0 ETH | 0.00076942 | ||||
Swap | 21392049 | 11 days ago | IN | 0 ETH | 0.00083837 | ||||
Swap | 21382995 | 12 days ago | IN | 0 ETH | 0.00143853 | ||||
Swap | 21371112 | 14 days ago | IN | 0 ETH | 0.00172424 | ||||
Swap | 21367028 | 15 days ago | IN | 0 ETH | 0.00227532 | ||||
Swap | 21364196 | 15 days ago | IN | 0 ETH | 0.00079723 | ||||
Swap | 21363749 | 15 days ago | IN | 0 ETH | 0.00088446 | ||||
Swap | 21356170 | 16 days ago | IN | 0 ETH | 0.00093223 | ||||
Swap | 21349136 | 17 days ago | IN | 0 ETH | 0.00127238 | ||||
Swap | 21343148 | 18 days ago | IN | 0 ETH | 0.0012218 | ||||
Swap | 21338951 | 18 days ago | IN | 0 ETH | 0.00229393 | ||||
Swap | 21335582 | 19 days ago | IN | 0 ETH | 0.00278772 | ||||
Swap | 21307203 | 23 days ago | IN | 0 ETH | 0.00080714 | ||||
Swap | 21295675 | 24 days ago | IN | 0 ETH | 0.00108716 | ||||
Swap | 21265200 | 29 days ago | IN | 0 ETH | 0.00161977 | ||||
Swap | 21244183 | 32 days ago | IN | 0 ETH | 0.00159319 | ||||
Swap | 21225293 | 34 days ago | IN | 0 ETH | 0.00125174 | ||||
Swap | 21194661 | 39 days ago | IN | 0 ETH | 0.00208131 | ||||
Swap | 21149812 | 45 days ago | IN | 0 ETH | 0.00092276 |
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
Contract Source Code (Solidity Standard Json-Input format)
//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; } }
// 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); }
// 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; } }
// 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); } }
// 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; } }
{ "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"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
Loading...
Loading
Loading...
Loading
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.