Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 15298287 | 890 days ago | IN | 0 ETH | 0.00026157 |
Loading...
Loading
Contract Name:
GMSwap
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// 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); } }
// 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); } }
// 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); }
// 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; } }
{ "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "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":"_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"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051610cab380380610cab83398101604081905261002f916100d5565b61003833610069565b600180546001600160a01b039384166001600160a01b03199182161790915560028054929093169116179055610107565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100d057600080fd5b919050565b600080604083850312156100e7578182fd5b6100f0836100b9565b91506100fe602084016100b9565b90509250929050565b610b95806101166000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80638119c065116100665780638119c065146100f257806381c61090146100fa5780638da5cb5b1461012d578063f2fde38b1461013e578063f3acae3a1461015157600080fd5b806306b091f91461009857806307127168146100ad5780636854171d146100c0578063715018a6146100ea575b600080fd5b6100ab6100a6366004610982565b610162565b005b6100ab6100bb36600461094c565b61032d565b6001546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100ab610382565b6100ab6103b8565b61011d61010836600461092b565b60036020526000908152604090205460ff1681565b60405190151581526020016100e1565b6000546001600160a01b03166100cd565b6100ab61014c36600461092b565b610824565b6002546001600160a01b03166100cd565b6000546001600160a01b031633146101955760405162461bcd60e51b815260040161018c90610a00565b60405180910390fd5b8181610217576040516370a0823160e01b81523060048201526001600160a01b038216906370a082319060240160206040518083038186803b1580156101da57600080fd5b505afa1580156101ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021291906109c7565b610219565b815b9150600082116102865760405162461bcd60e51b815260206004820152603260248201527f6d616b65207375726520746865726520697320612062616c616e636520617661604482015271696c61626c6520746f20776974686472617760701b606482015260840161018c565b806001600160a01b031663a9059cbb6102a76000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b1580156102ef57600080fd5b505af1158015610303573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032791906109ab565b50505050565b6000546001600160a01b031633146103575760405162461bcd60e51b815260040161018c90610a00565b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146103ac5760405162461bcd60e51b815260040161018c90610a00565b6103b660006108bf565b565b3360009081526003602052604090205460ff16156104185760405162461bcd60e51b815260206004820152601960248201527f616c7265616479207377617070656420563120666f7220563200000000000000604482015260640161018c565b33600081815260036020526040808220805460ff191660019081179091555490516370a0823160e01b8152600481019390935290916001600160a01b03909116906370a082319060240160206040518083038186803b15801561047a57600080fd5b505afa15801561048e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b291906109c7565b9050600081116105045760405162461bcd60e51b815260206004820152601d60248201527f796f7520646f206e6f74206861766520616e7920563120746f6b656e73000000604482015260640161018c565b6001546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b15801561054957600080fd5b505afa15801561055d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058191906109df565b61058c90600a610a98565b600260009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156105da57600080fd5b505afa1580156105ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061291906109df565b61061d90600a610a98565b6106279084610b45565b6106319190610a35565b6002546040516370a0823160e01b815230600482015291925082916001600160a01b03909116906370a082319060240160206040518083038186803b15801561067957600080fd5b505afa15801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b191906109c7565b10156107105760405162461bcd60e51b815260206004820152602860248201527f6e6f7420656e6f756768205632206c697175696469747920746f20636f6d706c604482015267065746520737761760c41b606482015260840161018c565b6001546040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03909116906323b872dd90606401602060405180830381600087803b15801561076257600080fd5b505af1158015610776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079a91906109ab565b5060025460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156107e757600080fd5b505af11580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f91906109ab565b505050565b6000546001600160a01b0316331461084e5760405162461bcd60e51b815260040161018c90610a00565b6001600160a01b0381166108b35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161018c565b6108bc816108bf565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461092657600080fd5b919050565b60006020828403121561093c578081fd5b6109458261090f565b9392505050565b6000806040838503121561095e578081fd5b6109678361090f565b9150602083013561097781610b7a565b809150509250929050565b60008060408385031215610994578182fd5b61099d8361090f565b946020939093013593505050565b6000602082840312156109bc578081fd5b815161094581610b7a565b6000602082840312156109d8578081fd5b5051919050565b6000602082840312156109f0578081fd5b815160ff81168114610945578182fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082610a5057634e487b7160e01b81526012600452602481fd5b500490565b600181815b80851115610a90578160001904821115610a7657610a76610b64565b80851615610a8357918102915b93841c9390800290610a5a565b509250929050565b600061094560ff841683600082610ab157506001610b3f565b81610abe57506000610b3f565b8160018114610ad45760028114610ade57610afa565b6001915050610b3f565b60ff841115610aef57610aef610b64565b50506001821b610b3f565b5060208310610133831016604e8410600b8410161715610b1d575081810a610b3f565b610b278383610a55565b8060001904821115610b3b57610b3b610b64565b0290505b92915050565b6000816000190483118215151615610b5f57610b5f610b64565b500290565b634e487b7160e01b600052601160045260246000fd5b80151581146108bc57600080fdfea164736f6c6343000804000a000000000000000000000000bc7250c8c3eca1dfc1728620af835fca489bfdf3000000000000000000000000bd9aa7aa06e277fca38ad0e152453ed3c7f17f99
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638119c065116100665780638119c065146100f257806381c61090146100fa5780638da5cb5b1461012d578063f2fde38b1461013e578063f3acae3a1461015157600080fd5b806306b091f91461009857806307127168146100ad5780636854171d146100c0578063715018a6146100ea575b600080fd5b6100ab6100a6366004610982565b610162565b005b6100ab6100bb36600461094c565b61032d565b6001546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100ab610382565b6100ab6103b8565b61011d61010836600461092b565b60036020526000908152604090205460ff1681565b60405190151581526020016100e1565b6000546001600160a01b03166100cd565b6100ab61014c36600461092b565b610824565b6002546001600160a01b03166100cd565b6000546001600160a01b031633146101955760405162461bcd60e51b815260040161018c90610a00565b60405180910390fd5b8181610217576040516370a0823160e01b81523060048201526001600160a01b038216906370a082319060240160206040518083038186803b1580156101da57600080fd5b505afa1580156101ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021291906109c7565b610219565b815b9150600082116102865760405162461bcd60e51b815260206004820152603260248201527f6d616b65207375726520746865726520697320612062616c616e636520617661604482015271696c61626c6520746f20776974686472617760701b606482015260840161018c565b806001600160a01b031663a9059cbb6102a76000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401602060405180830381600087803b1580156102ef57600080fd5b505af1158015610303573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032791906109ab565b50505050565b6000546001600160a01b031633146103575760405162461bcd60e51b815260040161018c90610a00565b6001600160a01b03919091166000908152600360205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146103ac5760405162461bcd60e51b815260040161018c90610a00565b6103b660006108bf565b565b3360009081526003602052604090205460ff16156104185760405162461bcd60e51b815260206004820152601960248201527f616c7265616479207377617070656420563120666f7220563200000000000000604482015260640161018c565b33600081815260036020526040808220805460ff191660019081179091555490516370a0823160e01b8152600481019390935290916001600160a01b03909116906370a082319060240160206040518083038186803b15801561047a57600080fd5b505afa15801561048e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b291906109c7565b9050600081116105045760405162461bcd60e51b815260206004820152601d60248201527f796f7520646f206e6f74206861766520616e7920563120746f6b656e73000000604482015260640161018c565b6001546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b15801561054957600080fd5b505afa15801561055d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058191906109df565b61058c90600a610a98565b600260009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156105da57600080fd5b505afa1580156105ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061291906109df565b61061d90600a610a98565b6106279084610b45565b6106319190610a35565b6002546040516370a0823160e01b815230600482015291925082916001600160a01b03909116906370a082319060240160206040518083038186803b15801561067957600080fd5b505afa15801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b191906109c7565b10156107105760405162461bcd60e51b815260206004820152602860248201527f6e6f7420656e6f756768205632206c697175696469747920746f20636f6d706c604482015267065746520737761760c41b606482015260840161018c565b6001546040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03909116906323b872dd90606401602060405180830381600087803b15801561076257600080fd5b505af1158015610776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079a91906109ab565b5060025460405163a9059cbb60e01b8152336004820152602481018390526001600160a01b039091169063a9059cbb90604401602060405180830381600087803b1580156107e757600080fd5b505af11580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f91906109ab565b505050565b6000546001600160a01b0316331461084e5760405162461bcd60e51b815260040161018c90610a00565b6001600160a01b0381166108b35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161018c565b6108bc816108bf565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461092657600080fd5b919050565b60006020828403121561093c578081fd5b6109458261090f565b9392505050565b6000806040838503121561095e578081fd5b6109678361090f565b9150602083013561097781610b7a565b809150509250929050565b60008060408385031215610994578182fd5b61099d8361090f565b946020939093013593505050565b6000602082840312156109bc578081fd5b815161094581610b7a565b6000602082840312156109d8578081fd5b5051919050565b6000602082840312156109f0578081fd5b815160ff81168114610945578182fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082610a5057634e487b7160e01b81526012600452602481fd5b500490565b600181815b80851115610a90578160001904821115610a7657610a76610b64565b80851615610a8357918102915b93841c9390800290610a5a565b509250929050565b600061094560ff841683600082610ab157506001610b3f565b81610abe57506000610b3f565b8160018114610ad45760028114610ade57610afa565b6001915050610b3f565b60ff841115610aef57610aef610b64565b50506001821b610b3f565b5060208310610133831016604e8410600b8410161715610b1d575081810a610b3f565b610b278383610a55565b8060001904821115610b3b57610b3b610b64565b0290505b92915050565b6000816000190483118215151615610b5f57610b5f610b64565b500290565b634e487b7160e01b600052601160045260246000fd5b80151581146108bc57600080fdfea164736f6c6343000804000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bc7250c8c3eca1dfc1728620af835fca489bfdf3000000000000000000000000bd9aa7aa06e277fca38ad0e152453ed3c7f17f99
-----Decoded View---------------
Arg [0] : _v1 (address): 0xBC7250C8c3eCA1DfC1728620aF835FCa489bFdf3
Arg [1] : _v2 (address): 0xbd9AA7AA06E277fca38ad0e152453Ed3c7f17F99
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000bc7250c8c3eca1dfc1728620af835fca489bfdf3
Arg [1] : 000000000000000000000000bd9aa7aa06e277fca38ad0e152453ed3c7f17f99
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.