Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
EternalStorageProxy
Compiler Version
v0.4.24+commit.e67f0147
Optimization Enabled:
Yes with 200 runs
Other Settings:
constantinople EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity 0.4.24; import "./EternalStorage.sol"; import "./OwnedUpgradeabilityProxy.sol"; /** * @title EternalStorageProxy * @dev This proxy holds the storage of the token contract and delegates every call to the current implementation set. * Besides, it allows to upgrade the token's behaviour towards further implementations, and provides basic * authorization control functionalities */ // solhint-disable-next-line no-empty-blocks contract EternalStorageProxy is EternalStorage, OwnedUpgradeabilityProxy {}
pragma solidity 0.4.24; /** * @title EternalStorage * @dev This contract holds all the necessary state variables to carry out the storage of any contract. */ contract EternalStorage { mapping(bytes32 => uint256) internal uintStorage; mapping(bytes32 => string) internal stringStorage; mapping(bytes32 => address) internal addressStorage; mapping(bytes32 => bytes) internal bytesStorage; mapping(bytes32 => bool) internal boolStorage; mapping(bytes32 => int256) internal intStorage; }
pragma solidity 0.4.24; import "./UpgradeabilityProxy.sol"; import "./UpgradeabilityOwnerStorage.sol"; /** * @title OwnedUpgradeabilityProxy * @dev This contract combines an upgradeability proxy with basic authorization control functionalities */ contract OwnedUpgradeabilityProxy is UpgradeabilityOwnerStorage, UpgradeabilityProxy { /** * @dev Event to show ownership has been transferred * @param previousOwner representing the address of the previous owner * @param newOwner representing the address of the new owner */ event ProxyOwnershipTransferred(address previousOwner, address newOwner); /** * @dev the constructor sets the original owner of the contract to the sender account. */ constructor() public { setUpgradeabilityOwner(msg.sender); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyUpgradeabilityOwner() { require(msg.sender == upgradeabilityOwner(), "msg.sender must be upgradeabilityOwner"); /* solcov ignore next */ _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferProxyOwnership(address newOwner) external onlyUpgradeabilityOwner { require(newOwner != address(0), "new owner must not be zero address"); emit ProxyOwnershipTransferred(upgradeabilityOwner(), newOwner); setUpgradeabilityOwner(newOwner); } /** * @dev Allows the upgradeability owner to upgrade the current version of the proxy. * @param version representing the version name of the new implementation to be set. * @param implementation representing the address of the new implementation to be set. */ function upgradeTo(uint256 version, address implementation) public onlyUpgradeabilityOwner { _upgradeTo(version, implementation); } /** * @dev Allows the upgradeability owner to upgrade the current version of the proxy and call the new implementation * to initialize whatever is needed through a low level call. * @param version representing the version name of the new implementation to be set. * @param implementation representing the address of the new implementation to be set. * @param data represents the msg.data to bet sent in the low level call. This parameter may include the function * signature of the implementation to be called with the needed payload */ function upgradeToAndCall( uint256 version, address implementation, bytes data ) external payable onlyUpgradeabilityOwner { upgradeTo(version, implementation); // solhint-disable-next-line avoid-call-value require(address(this).call.value(msg.value)(data), "upgradeToAndCall fail"); } }
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/AddressUtils.sol"; import "./Proxy.sol"; import "./UpgradeabilityStorage.sol"; /** * @title UpgradeabilityProxy * @dev This contract represents a proxy where the implementation address to which it will delegate can be upgraded */ contract UpgradeabilityProxy is Proxy, UpgradeabilityStorage { /** * @dev This event will be emitted every time the implementation gets upgraded * @param version representing the version name of the upgraded implementation * @param implementation representing the address of the upgraded implementation */ event Upgraded(uint256 version, address indexed implementation); /** * @dev Upgrades the implementation address * @param version representing the version name of the new implementation to be set * @param implementation representing the address of the new implementation to be set */ function _upgradeTo(uint256 version, address implementation) internal { require(_implementation != implementation, "new implementation must be different!"); // This additional check verifies that provided implementation is at least a contract require(AddressUtils.isContract(implementation), "new implementation must be a contract"); // This additional check guarantees that new version will be at least greater than the privios one, // so it is impossible to reuse old versions, or use the last version twice require(version > _version, "new version must be greater"); _version = version; _implementation = implementation; emit Upgraded(version, implementation); } }
pragma solidity 0.4.24; /** * @title UpgradeabilityOwnerStorage * @dev This contract keeps track of the upgradeability owner */ contract UpgradeabilityOwnerStorage { // Owner of the contract address internal _upgradeabilityOwner; /** * @dev Tells the address of the owner * @return the address of the owner */ function upgradeabilityOwner() public view returns (address) { return _upgradeabilityOwner; } /** * @dev Sets the address of the owner */ function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal { _upgradeabilityOwner = newUpgradeabilityOwner; } }
pragma solidity ^0.4.24; /** * Utility library of inline functions on addresses */ library AddressUtils { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param _addr address to check * @return whether the target address is a contract */ function isContract(address _addr) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solium-disable-next-line security/no-inline-assembly assembly { size := extcodesize(_addr) } return size > 0; } }
pragma solidity 0.4.24; /** * @title Proxy * @dev Gives the possibility to delegate any call to a foreign implementation. */ contract Proxy { /** * @dev Tells the address of the implementation where every call will be delegated. * @return address of the implementation to which it will be delegated */ /* solcov ignore next */ function implementation() public view returns (address); /** * @dev Fallback function allowing to perform a delegatecall to the given implementation. * This function will return whatever the implementation call returns */ function() public payable { // solhint-disable-previous-line no-complex-fallback address _impl = implementation(); require(_impl != address(0), "implementation must not be zero address"); assembly { /* 0x40 is the "free memory slot", meaning a pointer to next slot of empty memory. mload(0x40) loads the data in the free memory slot, so `ptr` is a pointer to the next slot of empty memory. It's needed because we're going to write the return data of delegatecall to the free memory slot. */ let ptr := mload(0x40) /* `calldatacopy` is copy calldatasize bytes from calldata First argument is the destination to which data is copied(ptr) Second argument specifies the start position of the copied data. Since calldata is sort of its own unique location in memory, 0 doesn't refer to 0 in memory or 0 in storage - it just refers to the zeroth byte of calldata. That's always going to be the zeroth byte of the function selector. Third argument, calldatasize, specifies how much data will be copied. calldata is naturally calldatasize bytes long (same thing as msg.data.length) */ calldatacopy(ptr, 0, calldatasize) /* delegatecall params explained: gas: the amount of gas to provide for the call. `gas` is an Opcode that gives us the amount of gas still available to execution _impl: address of the contract to delegate to ptr: to pass copied data calldatasize: loads the size of `bytes memory data`, same as msg.data.length 0, 0: These are for the `out` and `outsize` params. Because the output could be dynamic, these are set to 0, 0 so the output data will not be written to memory. The output data will be read using `returndatasize` and `returdatacopy` instead. result: This will be 0 if the call fails and 1 if it succeeds */ let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0) /* */ /* ptr current points to the value stored at 0x40, because we assigned it like ptr := mload(0x40). Because we use 0x40 as a free memory pointer, we want to make sure that the next time we want to allocate memory, we aren't overwriting anything important. So, by adding ptr and returndatasize, we get a memory location beyond the end of the data we will be copying to ptr. We place this in at 0x40, and any reads from 0x40 will now read from free memory */ mstore(0x40, add(ptr, returndatasize)) /* `returndatacopy` is an Opcode that copies the last return data to a slot. `ptr` is the slot it will copy to, 0 means copy from the beginning of the return data, and size is the amount of data to copy. `returndatasize` is an Opcode that gives us the size of the last return data. In this case, that is the size of the data returned from delegatecall */ returndatacopy(ptr, 0, returndatasize) /* if `result` is 0, revert. if `result` is 1, return `size` amount of data from `ptr`. This is the data that was copied to `ptr` from the delegatecall return data */ switch result case 0 { revert(ptr, returndatasize) } default { return(ptr, returndatasize) } } } }
pragma solidity 0.4.24; /** * @title UpgradeabilityStorage * @dev This contract holds all the necessary state variables to support the upgrade functionality */ contract UpgradeabilityStorage { // Version name of the current implementation uint256 internal _version; // Address of the current implementation address internal _implementation; /** * @dev Tells the version name of the current implementation * @return uint256 representing the name of the current version */ function version() external view returns (uint256) { return _version; } /** * @dev Tells the address of the current implementation * @return address of the current implementation */ function implementation() public view returns (address) { return _implementation; } }
{ "remappings": [ "openzeppelin-solidity/=lib/openzeppelin-solidity/", "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "constantinople", "libraries": {} }
[{"constant":false,"inputs":[{"name":"version","type":"uint256"},{"name":"implementation","type":"address"}],"name":"upgradeTo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"implementation","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"upgradeabilityOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"version","type":"uint256"},{"name":"implementation","type":"address"},{"name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferProxyOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"previousOwner","type":"address"},{"indexed":false,"name":"newOwner","type":"address"}],"name":"ProxyOwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"version","type":"uint256"},{"indexed":true,"name":"implementation","type":"address"}],"name":"Upgraded","type":"event"}]
Contract Creation Code
60806040526100133361001860201b60201c565b61003a565b60068054600160a060020a031916600160a060020a0392909216919091179055565b610771806100496000396000f30060806040526004361061005b5760003560e01c63ffffffff1680633ad06d161461011757806354fd4d501461013d5780635c60da1b146101645780636fde820214610195578063a9c45fcb146101aa578063f1739cae146101ce575b60006100656101ef565b9050600160a060020a03811615156100ed576040805160e560020a62461bcd02815260206004820152602760248201527f696d706c656d656e746174696f6e206d757374206e6f74206265207a65726f2060448201527f6164647265737300000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60405136600082376000803683855af43d82016040523d6000833e808015610113573d83f35b3d83fd5b34801561012357600080fd5b5061013b600435600160a060020a03602435166101fe565b005b34801561014957600080fd5b50610152610299565b60408051918252519081900360200190f35b34801561017057600080fd5b506101796101ef565b60408051600160a060020a039092168252519081900360200190f35b3480156101a157600080fd5b5061017961029f565b61013b600480359060248035600160a060020a0316916044359182019101356102ae565b3480156101da57600080fd5b5061013b600160a060020a03600435166103d2565b600854600160a060020a031690565b61020661029f565b600160a060020a0316331461028b576040805160e560020a62461bcd02815260206004820152602660248201527f6d73672e73656e646572206d75737420626520757067726164656162696c697460448201527f794f776e65720000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b610295828261053c565b5050565b60075490565b600654600160a060020a031690565b6102b661029f565b600160a060020a0316331461033b576040805160e560020a62461bcd02815260206004820152602660248201527f6d73672e73656e646572206d75737420626520757067726164656162696c697460448201527f794f776e65720000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b61034584846101fe565b30600160a060020a03163483836040518083838082843782019150509250505060006040518083038185875af19250505015156103cc576040805160e560020a62461bcd02815260206004820152601560248201527f75706772616465546f416e6443616c6c206661696c0000000000000000000000604482015290519081900360640190fd5b50505050565b6103da61029f565b600160a060020a0316331461045f576040805160e560020a62461bcd02815260206004820152602660248201527f6d73672e73656e646572206d75737420626520757067726164656162696c697460448201527f794f776e65720000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03811615156104e5576040805160e560020a62461bcd02815260206004820152602260248201527f6e6577206f776e6572206d757374206e6f74206265207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b7f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd961050e61029f565b60408051600160a060020a03928316815291841660208301528051918290030190a16105398161070e565b50565b600854600160a060020a03828116911614156105c8576040805160e560020a62461bcd02815260206004820152602560248201527f6e657720696d706c656d656e746174696f6e206d75737420626520646966666560448201527f72656e7421000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6105d18161073d565b151561064d576040805160e560020a62461bcd02815260206004820152602560248201527f6e657720696d706c656d656e746174696f6e206d757374206265206120636f6e60448201527f7472616374000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60075482116106a6576040805160e560020a62461bcd02815260206004820152601b60248201527f6e65772076657273696f6e206d75737420626520677265617465720000000000604482015290519081900360640190fd5b600782905560088054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911681179091556040805184815290517f4289d6195cf3c2d2174adf98d0e19d4d2d08887995b99cb7b100e7ffe795820e9181900360200190a25050565b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000903b11905600a165627a7a72305820804cb25d43628e3a01c5d3e479920720482ea5e01533dc7ee74e474bf66059f30029
Deployed Bytecode
0x60806040526004361061005b5760003560e01c63ffffffff1680633ad06d161461011757806354fd4d501461013d5780635c60da1b146101645780636fde820214610195578063a9c45fcb146101aa578063f1739cae146101ce575b60006100656101ef565b9050600160a060020a03811615156100ed576040805160e560020a62461bcd02815260206004820152602760248201527f696d706c656d656e746174696f6e206d757374206e6f74206265207a65726f2060448201527f6164647265737300000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60405136600082376000803683855af43d82016040523d6000833e808015610113573d83f35b3d83fd5b34801561012357600080fd5b5061013b600435600160a060020a03602435166101fe565b005b34801561014957600080fd5b50610152610299565b60408051918252519081900360200190f35b34801561017057600080fd5b506101796101ef565b60408051600160a060020a039092168252519081900360200190f35b3480156101a157600080fd5b5061017961029f565b61013b600480359060248035600160a060020a0316916044359182019101356102ae565b3480156101da57600080fd5b5061013b600160a060020a03600435166103d2565b600854600160a060020a031690565b61020661029f565b600160a060020a0316331461028b576040805160e560020a62461bcd02815260206004820152602660248201527f6d73672e73656e646572206d75737420626520757067726164656162696c697460448201527f794f776e65720000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b610295828261053c565b5050565b60075490565b600654600160a060020a031690565b6102b661029f565b600160a060020a0316331461033b576040805160e560020a62461bcd02815260206004820152602660248201527f6d73672e73656e646572206d75737420626520757067726164656162696c697460448201527f794f776e65720000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b61034584846101fe565b30600160a060020a03163483836040518083838082843782019150509250505060006040518083038185875af19250505015156103cc576040805160e560020a62461bcd02815260206004820152601560248201527f75706772616465546f416e6443616c6c206661696c0000000000000000000000604482015290519081900360640190fd5b50505050565b6103da61029f565b600160a060020a0316331461045f576040805160e560020a62461bcd02815260206004820152602660248201527f6d73672e73656e646572206d75737420626520757067726164656162696c697460448201527f794f776e65720000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03811615156104e5576040805160e560020a62461bcd02815260206004820152602260248201527f6e6577206f776e6572206d757374206e6f74206265207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b7f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd961050e61029f565b60408051600160a060020a03928316815291841660208301528051918290030190a16105398161070e565b50565b600854600160a060020a03828116911614156105c8576040805160e560020a62461bcd02815260206004820152602560248201527f6e657720696d706c656d656e746174696f6e206d75737420626520646966666560448201527f72656e7421000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6105d18161073d565b151561064d576040805160e560020a62461bcd02815260206004820152602560248201527f6e657720696d706c656d656e746174696f6e206d757374206265206120636f6e60448201527f7472616374000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60075482116106a6576040805160e560020a62461bcd02815260206004820152601b60248201527f6e65772076657273696f6e206d75737420626520677265617465720000000000604482015290519081900360640190fd5b600782905560088054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911681179091556040805184815290517f4289d6195cf3c2d2174adf98d0e19d4d2d08887995b99cb7b100e7ffe795820e9181900360200190a25050565b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000903b11905600a165627a7a72305820804cb25d43628e3a01c5d3e479920720482ea5e01533dc7ee74e474bf66059f30029
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.