Transactions
Token Transfers
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- MigrationCE
- Optimization enabled
- true
- Compiler version
- v0.8.19+commit.7dd6d404
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-09-26T15:33:02.228094Z
Contract source code
// SPDX-License-Identifier: No License (None) pragma solidity 0.8.19; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/ownership/Ownable.sol * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the * build/artifacts folder) as well as the vanilla Ownable implementation from an openzeppelin version. */ contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor () { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @return the address of the owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(),"Not Owner"); _; } /** * @return true if `msg.sender` is the owner of the contract. */ function isOwner() public view returns (bool) { return msg.sender == _owner; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0),"Zero address not allowed"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } interface IERC223 { function mint(address _to, uint256 _amount) external; function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function burnFrom(address sender, uint256 amount) external returns (bool); function transfer(address recipient, uint256 amount) external; function balanceOf(address account) external view returns (uint256); } contract MigrationCE is Ownable { address constant public CLOE = address(0x1eAa43544dAa399b87EEcFcC6Fa579D5ea4A6187); address constant public CE = address(0x3986E815F87feA74910F7aDeAcD1cE7f172E1df0); uint256 public cloeRate = 30000; // rate in percentage with 2 decimals. CE amount = CLOE amount * cloeRate / 10000 bool public isPause; uint256 public totalCEMinted; uint256 public totalCLOEMigrated; event Migrate(address user, uint256 CLOEAmount, uint256 CEAmount); modifier migrationAllowed() { require(!isPause, "Migration is paused"); _; } function tokenReceived(address, uint, bytes memory) external pure returns(bytes4) { revert("not allowed"); } function migrateCLOE(address user, uint256 amount) external migrationAllowed { IERC223(CLOE).transferFrom(msg.sender, address(this), amount); uint256 ceAmount = amount * cloeRate / 10000; totalCLOEMigrated += amount; totalCEMinted += ceAmount; IERC223(CE).mint(msg.sender, ceAmount); emit Migrate(user, amount, ceAmount); } function setPause(bool pause) external onlyOwner { isPause = pause; } // rate in percentage with 2 decimals. CE amount = CLOE amount * cloeRate / 10000 function setCloeRate(uint256 _cloeRate) external onlyOwner { cloeRate = _cloeRate; } // Rescue tokens event Rescue(address _token, uint256 _amount); function rescueTokens(address _token) external onlyOwner { uint256 _amount; if (_token == address(0)) { _amount = address(this).balance; safeTransferETH(msg.sender, _amount); } else { _amount = IERC223(_token).balanceOf(address(this)); safeTransfer(_token, msg.sender, _amount); } emit Rescue(_token, _amount); } function safeTransfer(address token, address to, uint value) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call( abi.encodeWithSelector(0xa9059cbb, to, value) ); require( success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: TRANSFER_FAILED" ); } function safeTransferETH(address to, uint value) internal { (bool success,) = to.call{value:value}(new bytes(0)); require(success, 'TransferHelper: ETH_TRANSFER_FAILED'); } }
Contract ABI
[{"type":"event","name":"Migrate","inputs":[{"type":"address","name":"user","internalType":"address","indexed":false},{"type":"uint256","name":"CLOEAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"CEAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Rescue","inputs":[{"type":"address","name":"_token","internalType":"address","indexed":false},{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"CE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"CLOE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"cloeRate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOwner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isPause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"migrateCLOE","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescueTokens","inputs":[{"type":"address","name":"_token","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCloeRate","inputs":[{"type":"uint256","name":"_cloeRate","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPause","inputs":[{"type":"bool","name":"pause","internalType":"bool"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"tokenReceived","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalCEMinted","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalCLOEMigrated","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405261753060015534801561001657600080fd5b50600080546001600160a01b0319163390811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3610bc8806100656000396000f3fe608060405234801561001057600080fd5b50600436106100f45760003560e01c80638943ec0211610097578063bedb86fb11610066578063bedb86fb14610201578063ce067c8614610214578063f2fde38b14610227578063ff0938a71461023a57600080fd5b80638943ec021461019c5780638b50e446146101c85780638da5cb5b146101d15780638f32d59b146101e257600080fd5b8063314de7c3116100d3578063314de7c31461015d57806351d91243146101665780635eb325eb14610179578063715018a61461019457600080fd5b8062ae3bf8146100f95780631a5057d51461010e5780632da49d1614610146575b600080fd5b61010c610107366004610931565b610247565b005b610129733986e815f87fea74910f7adeacd1ce7f172e1df081565b6040516001600160a01b0390911681526020015b60405180910390f35b61014f60045481565b60405190815260200161013d565b61014f60015481565b61010c610174366004610953565b610356565b610129731eaa43544daa399b87eecfcc6fa579d5ea4a618781565b61010c610385565b6101af6101aa366004610982565b6103f9565b6040516001600160e01b0319909116815260200161013d565b61014f60035481565b6000546001600160a01b0316610129565b6000546001600160a01b031633145b604051901515815260200161013d565b61010c61020f366004610a5b565b610432565b61010c610222366004610a78565b61046f565b61010c610235366004610931565b610645565b6002546101f19060ff1681565b6000546001600160a01b0316331461027a5760405162461bcd60e51b815260040161027190610aa2565b60405180910390fd5b60006001600160a01b03821661029b575047610296338261067b565b610310565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa1580156102df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103039190610ac5565b9050610310823383610749565b604080516001600160a01b0384168152602081018390527f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af2910160405180910390a15050565b6000546001600160a01b031633146103805760405162461bcd60e51b815260040161027190610aa2565b600155565b6000546001600160a01b031633146103af5760405162461bcd60e51b815260040161027190610aa2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b6044820152600090606401610271565b6000546001600160a01b0316331461045c5760405162461bcd60e51b815260040161027190610aa2565b6002805460ff1916911515919091179055565b60025460ff16156104b85760405162461bcd60e51b8152602060048201526013602482015272135a59dc985d1a5bdb881a5cc81c185d5cd959606a1b6044820152606401610271565b6040516323b872dd60e01b815233600482015230602482015260448101829052731eaa43544daa399b87eecfcc6fa579d5ea4a6187906323b872dd906064016020604051808303816000875af1158015610516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053a9190610ade565b5060006127106001548361054e9190610b11565b6105589190610b2e565b9050816004600082825461056c9190610b50565b9250508190555080600360008282546105859190610b50565b90915550506040516340c10f1960e01b815233600482015260248101829052733986e815f87fea74910f7adeacd1ce7f172e1df0906340c10f1990604401600060405180830381600087803b1580156105dd57600080fd5b505af11580156105f1573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690529081018490527fd44a6dd2bfac4f6bc02d116d96aa12c24e8580626b95cb6a2f543f18cb61bd4c9250606001905060405180910390a1505050565b6000546001600160a01b0316331461066f5760405162461bcd60e51b815260040161027190610aa2565b61067881610864565b50565b604080516000808252602082019092526001600160a01b0384169083906040516106a59190610b63565b60006040518083038185875af1925050503d80600081146106e2576040519150601f19603f3d011682016040523d82523d6000602084013e6106e7565b606091505b50509050806107445760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960448201526213115160ea1b6064820152608401610271565b505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916107a59190610b63565b6000604051808303816000865af19150503d80600081146107e2576040519150601f19603f3d011682016040523d82523d6000602084013e6107e7565b606091505b50915091508180156108115750805115806108115750808060200190518101906108119190610ade565b61085d5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610271565b5050505050565b6001600160a01b0381166108ba5760405162461bcd60e51b815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f77656400000000000000006044820152606401610271565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b80356001600160a01b038116811461092c57600080fd5b919050565b60006020828403121561094357600080fd5b61094c82610915565b9392505050565b60006020828403121561096557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561099757600080fd5b6109a084610915565b925060208401359150604084013567ffffffffffffffff808211156109c457600080fd5b818601915086601f8301126109d857600080fd5b8135818111156109ea576109ea61096c565b604051601f8201601f19908116603f01168101908382118183101715610a1257610a1261096c565b81604052828152896020848701011115610a2b57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b801515811461067857600080fd5b600060208284031215610a6d57600080fd5b813561094c81610a4d565b60008060408385031215610a8b57600080fd5b610a9483610915565b946020939093013593505050565b6020808252600990820152682737ba1027bbb732b960b91b604082015260600190565b600060208284031215610ad757600080fd5b5051919050565b600060208284031215610af057600080fd5b815161094c81610a4d565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610b2857610b28610afb565b92915050565b600082610b4b57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610b2857610b28610afb565b6000825160005b81811015610b845760208186018101518583015201610b6a565b50600092019182525091905056fea26469706673582212204ff9274ce99707acfe885ebfdc141a10ee0eb2df1d703e5945c3d0ef5c84218864736f6c63430008130033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100f45760003560e01c80638943ec0211610097578063bedb86fb11610066578063bedb86fb14610201578063ce067c8614610214578063f2fde38b14610227578063ff0938a71461023a57600080fd5b80638943ec021461019c5780638b50e446146101c85780638da5cb5b146101d15780638f32d59b146101e257600080fd5b8063314de7c3116100d3578063314de7c31461015d57806351d91243146101665780635eb325eb14610179578063715018a61461019457600080fd5b8062ae3bf8146100f95780631a5057d51461010e5780632da49d1614610146575b600080fd5b61010c610107366004610931565b610247565b005b610129733986e815f87fea74910f7adeacd1ce7f172e1df081565b6040516001600160a01b0390911681526020015b60405180910390f35b61014f60045481565b60405190815260200161013d565b61014f60015481565b61010c610174366004610953565b610356565b610129731eaa43544daa399b87eecfcc6fa579d5ea4a618781565b61010c610385565b6101af6101aa366004610982565b6103f9565b6040516001600160e01b0319909116815260200161013d565b61014f60035481565b6000546001600160a01b0316610129565b6000546001600160a01b031633145b604051901515815260200161013d565b61010c61020f366004610a5b565b610432565b61010c610222366004610a78565b61046f565b61010c610235366004610931565b610645565b6002546101f19060ff1681565b6000546001600160a01b0316331461027a5760405162461bcd60e51b815260040161027190610aa2565b60405180910390fd5b60006001600160a01b03821661029b575047610296338261067b565b610310565b6040516370a0823160e01b81523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa1580156102df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103039190610ac5565b9050610310823383610749565b604080516001600160a01b0384168152602081018390527f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af2910160405180910390a15050565b6000546001600160a01b031633146103805760405162461bcd60e51b815260040161027190610aa2565b600155565b6000546001600160a01b031633146103af5760405162461bcd60e51b815260040161027190610aa2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b6044820152600090606401610271565b6000546001600160a01b0316331461045c5760405162461bcd60e51b815260040161027190610aa2565b6002805460ff1916911515919091179055565b60025460ff16156104b85760405162461bcd60e51b8152602060048201526013602482015272135a59dc985d1a5bdb881a5cc81c185d5cd959606a1b6044820152606401610271565b6040516323b872dd60e01b815233600482015230602482015260448101829052731eaa43544daa399b87eecfcc6fa579d5ea4a6187906323b872dd906064016020604051808303816000875af1158015610516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053a9190610ade565b5060006127106001548361054e9190610b11565b6105589190610b2e565b9050816004600082825461056c9190610b50565b9250508190555080600360008282546105859190610b50565b90915550506040516340c10f1960e01b815233600482015260248101829052733986e815f87fea74910f7adeacd1ce7f172e1df0906340c10f1990604401600060405180830381600087803b1580156105dd57600080fd5b505af11580156105f1573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690529081018490527fd44a6dd2bfac4f6bc02d116d96aa12c24e8580626b95cb6a2f543f18cb61bd4c9250606001905060405180910390a1505050565b6000546001600160a01b0316331461066f5760405162461bcd60e51b815260040161027190610aa2565b61067881610864565b50565b604080516000808252602082019092526001600160a01b0384169083906040516106a59190610b63565b60006040518083038185875af1925050503d80600081146106e2576040519150601f19603f3d011682016040523d82523d6000602084013e6106e7565b606091505b50509050806107445760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960448201526213115160ea1b6064820152608401610271565b505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916107a59190610b63565b6000604051808303816000865af19150503d80600081146107e2576040519150601f19603f3d011682016040523d82523d6000602084013e6107e7565b606091505b50915091508180156108115750805115806108115750808060200190518101906108119190610ade565b61085d5760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610271565b5050505050565b6001600160a01b0381166108ba5760405162461bcd60e51b815260206004820152601860248201527f5a65726f2061646472657373206e6f7420616c6c6f77656400000000000000006044820152606401610271565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b80356001600160a01b038116811461092c57600080fd5b919050565b60006020828403121561094357600080fd5b61094c82610915565b9392505050565b60006020828403121561096557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561099757600080fd5b6109a084610915565b925060208401359150604084013567ffffffffffffffff808211156109c457600080fd5b818601915086601f8301126109d857600080fd5b8135818111156109ea576109ea61096c565b604051601f8201601f19908116603f01168101908382118183101715610a1257610a1261096c565b81604052828152896020848701011115610a2b57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b801515811461067857600080fd5b600060208284031215610a6d57600080fd5b813561094c81610a4d565b60008060408385031215610a8b57600080fd5b610a9483610915565b946020939093013593505050565b6020808252600990820152682737ba1027bbb732b960b91b604082015260600190565b600060208284031215610ad757600080fd5b5051919050565b600060208284031215610af057600080fd5b815161094c81610a4d565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610b2857610b28610afb565b92915050565b600082610b4b57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610b2857610b28610afb565b6000825160005b81811015610b845760208186018101518583015201610b6a565b50600092019182525091905056fea26469706673582212204ff9274ce99707acfe885ebfdc141a10ee0eb2df1d703e5945c3d0ef5c84218864736f6c63430008130033