Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
- Contract name:
- ERC1538Proxy
- Optimization enabled
- true
- Compiler version
- v0.6.4+commit.1dca32f3
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2023-04-21T14:56:10.727356Z
Constructor Arguments
0x0000000000000000000000000f3b4536cc9a3f5604d0d55559675d513aa8106f
Arg [0] (address) : 0x0f3b4536cc9a3f5604d0d55559675d513aa8106f
Contract source code
/** *Submitted for verification at Etherscan.io on 2020-06-03 */ pragma solidity ^0.6.0; /** * @title Proxy * @dev Implements delegation of calls to other contracts, with proper * forwarding of return values and bubbling of failures. * It defines a fallback function that delegates all calls to the address * returned by the abstract _implementation() internal function. */ abstract contract Proxy { /** * @dev Receive function. * Implemented entirely in `_fallback`. */ receive() external payable virtual { _fallback(); } /** * @dev Fallback function. * Implemented entirely in `_fallback`. */ fallback() external payable { _fallback(); } /** * @return impl The Address of the implementation. */ function _implementation() internal virtual view returns (address impl); /** * @dev Delegates execution to an implementation contract. * This is a low level function that doesn't return to its internal call site. * It will return to the external caller whatever the implementation returns. * @param implementation Address to delegate. */ function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev Function that is run as the first thing in the fallback function. * Can be redefined in derived contracts to add functionality. * Redefinitions must call super._willFallback(). */ function _willFallback() internal virtual { } /** * @dev fallback implementation. * Extracted to enable manual triggering. */ function _fallback() internal { _willFallback(); _delegate(_implementation()); } } interface IERC1538 { event CommitMessage(string message); event FunctionUpdate(bytes4 indexed functionId, address indexed oldDelegate, address indexed newDelegate, string functionSignature); } /* * @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 GSN 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. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @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. */ 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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view 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 { emit OwnershipTransferred(_owner, address(0)); _owner = 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 { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal virtual { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } library LibSet_bytes4 { struct set { bytes4[] values; mapping(bytes4 => uint256) indexes; } function length(set storage _set) internal view returns (uint256) { return _set.values.length; } function at(set storage _set, uint256 _index) internal view returns (bytes4 ) { return _set.values[_index - 1]; } function indexOf(set storage _set, bytes4 _value) internal view returns (uint256) { return _set.indexes[_value]; } function contains(set storage _set, bytes4 _value) internal view returns (bool) { return indexOf(_set, _value) != 0; } function content(set storage _set) internal view returns (bytes4[] memory) { return _set.values; } function add(set storage _set, bytes4 _value) internal returns (bool) { if (contains(_set, _value)) { return false; } _set.values.push(_value); _set.indexes[_value] = _set.values.length; return true; } function remove(set storage _set, bytes4 _value) internal returns (bool) { if (!contains(_set, _value)) { return false; } uint256 i = indexOf(_set, _value); uint256 last = length(_set); if (i != last) { bytes4 swapValue = _set.values[last - 1]; _set.values[i - 1] = swapValue; _set.indexes[swapValue] = i; } delete _set.indexes[_value]; _set.values.pop(); return true; } function clear(set storage _set) internal returns (bool) { for (uint256 i = _set.values.length; i > 0; --i) { delete _set.indexes[_set.values[i-1]]; } _set.values = new bytes4[](0); return true; } } library LibMap2_bytes4_address_bytes { using LibSet_bytes4 for LibSet_bytes4.set; struct map { LibSet_bytes4.set keyset; mapping(bytes4 => address) values1; mapping(bytes4 => bytes) values2; } function length(map storage _map) internal view returns (uint256) { return _map.keyset.length(); } function value1(map storage _map, bytes4 _key) internal view returns (address ) { return _map.values1[_key]; } function value2(map storage _map, bytes4 _key) internal view returns (bytes memory) { return _map.values2[_key]; } function keyAt(map storage _map, uint256 _index) internal view returns (bytes4 ) { return _map.keyset.at(_index); } function at(map storage _map, uint256 _index) internal view returns (bytes4 , address , bytes memory) { bytes4 key = keyAt(_map, _index); return (key, value1(_map, key), value2(_map, key)); } function indexOf(map storage _map, bytes4 _key) internal view returns (uint256) { return _map.keyset.indexOf(_key); } function contains(map storage _map, bytes4 _key) internal view returns (bool) { return _map.keyset.contains(_key); } function keys(map storage _map) internal view returns (bytes4[] memory) { return _map.keyset.content(); } function set( map storage _map, bytes4 _key, address _value1, bytes memory _value2) internal returns (bool) { _map.keyset.add(_key); _map.values1[_key] = _value1; _map.values2[_key] = _value2; return true; } function del(map storage _map, bytes4 _key) internal returns (bool) { _map.keyset.remove(_key); delete _map.values1[_key]; delete _map.values2[_key]; return true; } function clear(map storage _map) internal returns (bool) { for (uint256 i = _map.keyset.length(); i > 0; --i) { bytes4 key = keyAt(_map, i); delete _map.values1[key]; delete _map.values2[key]; } _map.keyset.clear(); return true; } } contract ERC1538Store is Ownable { using LibMap2_bytes4_address_bytes for LibMap2_bytes4_address_bytes.map; LibMap2_bytes4_address_bytes.map internal m_funcs; } contract ERC1538Core is IERC1538, ERC1538Store { bytes4 constant internal RECEIVE = 0xd217fcc6; // bytes4(keccak256("receive")); bytes4 constant internal FALLBACK = 0xb32cdf4d; // bytes4(keccak256("fallback")); event CommitMessage(string message); event FunctionUpdate(bytes4 indexed functionId, address indexed oldDelegate, address indexed newDelegate, string functionSignature); function _setFunc(string memory funcSignature, address funcDelegate) internal { bytes4 funcId = bytes4(keccak256(bytes(funcSignature))); if (funcId == RECEIVE ) { funcId = bytes4(0x00000000); } if (funcId == FALLBACK) { funcId = bytes4(0xFFFFFFFF); } address oldDelegate = m_funcs.value1(funcId); if (funcDelegate == oldDelegate) // No change → skip { return; } else if (funcDelegate == address(0)) // Delete { m_funcs.del(funcId); } else // Set / Update { m_funcs.set(funcId, funcDelegate, bytes(funcSignature)); } emit FunctionUpdate(funcId, oldDelegate, funcDelegate, funcSignature); } } contract ERC1538Proxy is ERC1538Core, Proxy { constructor(address _erc1538Delegate) public { _transferOwnership(msg.sender); _setFunc("updateContract(address,string,string)", _erc1538Delegate); emit CommitMessage("Added ERC1538 updateContract function at contract creation"); } function _implementation() internal override view returns (address) { address delegateFunc = m_funcs.value1(msg.sig); if (delegateFunc != address(0)) { return delegateFunc; } else { return m_funcs.value1(0xFFFFFFFF); } } }
Contract ABI
[{"type":"constructor","inputs":[{"type":"address","name":"_erc1538Delegate","internalType":"address"}]},{"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":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"event","name":"CommitMessage","inputs":[{"type":"string","name":"message","indexed":false}],"anonymous":false},{"type":"event","name":"FunctionUpdate","inputs":[{"type":"bytes4","name":"functionId","indexed":true},{"type":"address","name":"oldDelegate","indexed":true},{"type":"address","name":"newDelegate","indexed":true},{"type":"string","name":"functionSignature","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false},{"type":"receive"},{"type":"fallback"}]
Contract Creation Code
0x60806040523480156200001157600080fd5b5060405162000f9338038062000f93833981810160405260208110156200003757600080fd5b505160006200004e6001600160e01b036200011c16565b600080546001600160a01b0319166001600160a01b03831690811782556040519293509160008051602062000f39833981519152908290a3506200009b336001600160e01b036200012116565b620000c960405180606001604052806025815260200162000f1460259139826001600160e01b03620001b216565b7faa1c0a0a78cec2470f9652e5d29540752e7a64d70f926933cebf13afaeda45de60405180806020018281038252603a81526020018062000f59603a913960400191505060405180910390a15062000788565b335b90565b6001600160a01b038116620001685760405162461bcd60e51b815260040180806020018281038252602681526020018062000eee6026913960400191505060405180910390fd5b600080546040516001600160a01b038085169392169160008051602062000f3983398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b815160208301206001600160e01b0319811663690bfe6360e11b1415620001d7575060005b6001600160e01b0319811663b32cdf4d60e01b1415620001fc57506001600160e01b03195b6000620002198260016200035260201b6200033a1790919060201c565b9050806001600160a01b0316836001600160a01b031614156200023e5750506200034e565b6001600160a01b0383166200026f57620002688260016200037e60201b620003661790919060201c565b5062000290565b6200028e8284866001620003e760201b620003c017909392919060201c565b505b826001600160a01b0316816001600160a01b0316836001600160e01b0319167f3234040ce3bd4564874e44810f198910133a1b24c4e84aac87edbf6b458f5353876040518080602001828103825283818151815260200191508051906020019080838360005b8381101562000310578181015183820152602001620002f6565b50505050905090810190601f1680156200033e5780820380516001836020036101000a031916815260200191505b509250505060405180910390a450505b5050565b6001600160e01b0319811660009081526002830160205260409020546001600160a01b03165b92915050565b60006200039d82846000016200046360201b6200042d1790919060201c565b506001600160e01b031982166000908152600284016020908152604080832080546001600160a01b0319169055600386019091528120620003de916200069b565b50600192915050565b6000620004068486600001620005d160201b620005741790919060201c565b506001600160e01b031984166000908152600286016020908152604080832080546001600160a01b0319166001600160a01b03881617905560038801825290912083516200045792850190620006e6565b50600195945050505050565b60006200047a83836001600160e01b036200065716565b620004885750600062000378565b60006200049f84846001600160e01b036200067716565b90506000620004b7856001600160e01b036200069716565b90508082146200056f576000856000016001830381548110620004d657fe5b90600052602060002090600891828204019190066004029054906101000a900460e01b9050808660000160018503815481106200050f57fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908360e01c021790555082866001016000836001600160e01b0319166001600160e01b031916815260200190815260200160002081905550505b6001600160e01b03198416600090815260018601602052604081205584548590806200059757fe5b600082815260209020600860001990920191820401805463ffffffff600460078516026101000a0219169055905550600191505092915050565b6000620005e883836001600160e01b036200065716565b15620005f75750600062000378565b50815460018082018455600084815260208082206008850401805463ffffffff60079096166004026101000a958602191660e087901c959095029490941790935584546001600160e01b0319909416815293810190915260409092205590565b60006200066e83836001600160e01b036200067716565b15159392505050565b6001600160e01b0319166000908152600191909101602052604090205490565b5490565b50805460018160011615610100020316600290046000825580601f10620006c35750620006e3565b601f016020900490600052602060002090810190620006e391906200076b565b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200072957805160ff191683800117855562000759565b8280016001018555821562000759579182015b82811115620007595782518255916020019190600101906200073c565b50620007679291506200076b565b5090565b6200011e91905b8082111562000767576000815560010162000772565b61075680620007986000396000f3fe6080604052600436106100385760003560e01c8063715018a61461004f5780638da5cb5b14610064578063f2fde38b1461009557610047565b36610047576100456100c8565b005b6100456100c8565b34801561005b57600080fd5b506100456100e2565b34801561007057600080fd5b50610079610196565b604080516001600160a01b039092168252519081900360200190f35b3480156100a157600080fd5b50610045600480360360208110156100b857600080fd5b50356001600160a01b03166101a6565b6100d06100e0565b6100e06100db61021c565b610272565b565b6100ea610296565b6000546001600160a01b0390811691161461014c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03165b90565b6101ae610296565b6000546001600160a01b03908116911614610210576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102198161029a565b50565b60008061023b60016001600160e01b031983351663ffffffff61033a16565b90506001600160a01b038116156102535790506101a3565b61026660016001600160e01b031961033a565b9150506101a3565b5090565b3660008037600080366000845af43d6000803e808015610291573d6000f35b3d6000fd5b3390565b6001600160a01b0381166102df5760405162461bcd60e51b81526004018080602001828103825260268152602001806106fb6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160e01b0319811660009081526002830160205260409020546001600160a01b03165b92915050565b6000610378838363ffffffff61042d16565b506001600160e01b031982166000908152600284016020908152604080832080546001600160a01b03191690556003860190915281206103b791610626565b50600192915050565b60006103d2858563ffffffff61057416565b506001600160e01b031984166000908152600286016020908152604080832080546001600160a01b0319166001600160a01b03881617905560038801825290912083516104219285019061066a565b50600195945050505050565b600061043983836105ed565b61044557506000610360565b60006104518484610602565b9050600061045e85610622565b905080821461051357600085600001600183038154811061047b57fe5b90600052602060002090600891828204019190066004029054906101000a900460e01b9050808660000160018503815481106104b357fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908360e01c021790555082866001016000836001600160e01b0319166001600160e01b031916815260200190815260200160002081905550505b6001600160e01b031984166000908152600186016020526040812055845485908061053a57fe5b600082815260209020600860001990920191820401805463ffffffff600460078516026101000a0219169055905550600191505092915050565b600061058083836105ed565b1561058d57506000610360565b50815460018082018455600084815260208082206008850401805463ffffffff60079096166004026101000a958602191660e087901c959095029490941790935584546001600160e01b0319909416815293810190915260409092205590565b60006105f98383610602565b15159392505050565b6001600160e01b0319166000908152600191909101602052604090205490565b5490565b50805460018160011615610100020316600290046000825580601f1061064c5750610219565b601f01602090049060005260206000209081019061021991906106e0565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106106ab57805160ff19168380011785556106d8565b828001600101855582156106d8579182015b828111156106d85782518255916020019190600101906106bd565b5061026e9291505b6101a391905b8082111561026e57600081556001016106e656fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220d24d03da5c0af07060348adaf9368c37562adf7d53e06b4ebe9ac4a638db4a7f64736f6c634300060400334f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373757064617465436f6e747261637428616464726573732c737472696e672c737472696e67298be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e04164646564204552433135333820757064617465436f6e74726163742066756e6374696f6e20617420636f6e7472616374206372656174696f6e0000000000000000000000000f3b4536cc9a3f5604d0d55559675d513aa8106f
Deployed ByteCode
0x6080604052600436106100385760003560e01c8063715018a61461004f5780638da5cb5b14610064578063f2fde38b1461009557610047565b36610047576100456100c8565b005b6100456100c8565b34801561005b57600080fd5b506100456100e2565b34801561007057600080fd5b50610079610196565b604080516001600160a01b039092168252519081900360200190f35b3480156100a157600080fd5b50610045600480360360208110156100b857600080fd5b50356001600160a01b03166101a6565b6100d06100e0565b6100e06100db61021c565b610272565b565b6100ea610296565b6000546001600160a01b0390811691161461014c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03165b90565b6101ae610296565b6000546001600160a01b03908116911614610210576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102198161029a565b50565b60008061023b60016001600160e01b031983351663ffffffff61033a16565b90506001600160a01b038116156102535790506101a3565b61026660016001600160e01b031961033a565b9150506101a3565b5090565b3660008037600080366000845af43d6000803e808015610291573d6000f35b3d6000fd5b3390565b6001600160a01b0381166102df5760405162461bcd60e51b81526004018080602001828103825260268152602001806106fb6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160e01b0319811660009081526002830160205260409020546001600160a01b03165b92915050565b6000610378838363ffffffff61042d16565b506001600160e01b031982166000908152600284016020908152604080832080546001600160a01b03191690556003860190915281206103b791610626565b50600192915050565b60006103d2858563ffffffff61057416565b506001600160e01b031984166000908152600286016020908152604080832080546001600160a01b0319166001600160a01b03881617905560038801825290912083516104219285019061066a565b50600195945050505050565b600061043983836105ed565b61044557506000610360565b60006104518484610602565b9050600061045e85610622565b905080821461051357600085600001600183038154811061047b57fe5b90600052602060002090600891828204019190066004029054906101000a900460e01b9050808660000160018503815481106104b357fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908360e01c021790555082866001016000836001600160e01b0319166001600160e01b031916815260200190815260200160002081905550505b6001600160e01b031984166000908152600186016020526040812055845485908061053a57fe5b600082815260209020600860001990920191820401805463ffffffff600460078516026101000a0219169055905550600191505092915050565b600061058083836105ed565b1561058d57506000610360565b50815460018082018455600084815260208082206008850401805463ffffffff60079096166004026101000a958602191660e087901c959095029490941790935584546001600160e01b0319909416815293810190915260409092205590565b60006105f98383610602565b15159392505050565b6001600160e01b0319166000908152600191909101602052604090205490565b5490565b50805460018160011615610100020316600290046000825580601f1061064c5750610219565b601f01602090049060005260206000209081019061021991906106e0565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106106ab57805160ff19168380011785556106d8565b828001600101855582156106d8579182015b828111156106d85782518255916020019190600101906106bd565b5061026e9291505b6101a391905b8082111561026e57600081556001016106e656fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220d24d03da5c0af07060348adaf9368c37562adf7d53e06b4ebe9ac4a638db4a7f64736f6c63430006040033