Contract Address Details
contract
proxy
0x358Fe4Be9C9831E026fc5d0FD075F92349BCF9c2
Sponsored:
Transactions
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Read Proxy
Write Contract
Write Proxy
- Contract name:
- EternalStorageProxy
- Optimization enabled
- true
- Compiler version
- v0.4.26+commit.4563c3fc
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2023-10-02T01:59:58.678791Z
Constructor Arguments
0x000000000000000000000000a5970fe034859f34afc3eda7ef38b04eb863ae1d0000000000000000000000003e0ea49698c81e7ba52c8844731f6ba128f4e539
Arg [0] (address) : 0xa5970fe034859f34afc3eda7ef38b04eb863ae1d
Arg [1] (address) : 0x3e0ea49698c81e7ba52c8844731f6ba128f4e539
Contract source code
// File: contracts/eternal-storage/EternalStorage.sol
pragma solidity ^0.4.24;
/**
* @title EternalStorage
* @author LiorRabin
* @dev This contract holds all the necessary state variables to carry out the storage of any contract and to support the upgrade functionality.
*/
contract EternalStorage {
// Version number of the current implementation
uint256 internal version;
// Address of the current implementation
address internal implementation;
// Storage mappings
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;
mapping(bytes32 => uint256[]) internal uintArrayStorage;
mapping(bytes32 => string[]) internal stringArrayStorage;
mapping(bytes32 => address[]) internal addressArrayStorage;
mapping(bytes32 => bytes[]) internal bytesArrayStorage;
mapping(bytes32 => bool[]) internal boolArrayStorage;
mapping(bytes32 => int256[]) internal intArrayStorage;
mapping(bytes32 => bytes32[]) internal bytes32ArrayStorage;
function isInitialized() public view returns(bool) {
return boolStorage[keccak256(abi.encodePacked("isInitialized"))];
}
function setInitialized(bool _status) internal {
boolStorage[keccak256(abi.encodePacked("isInitialized"))] = _status;
}
}
// File: contracts/eternal-storage/EternalStorageProxy.sol
pragma solidity ^0.4.24;
/**
* @title EternalStorageProxy
* @author LiorRabin
* @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 authorization control functionalities
*/
contract EternalStorageProxy is EternalStorage {
/**
* @dev This event will be emitted every time the implementation gets upgraded
* @param version representing the version number of the upgraded implementation
* @param implementation representing the address of the upgraded implementation
*/
event Upgraded(uint256 version, address indexed implementation);
/**
* @dev This event will be emitted when ownership is renounces
* @param previousOwner address which is renounced from ownership
*/
event OwnershipRenounced(address indexed previousOwner);
/**
* @dev This event will be emitted when ownership is transferred
* @param previousOwner address which represents the previous owner
* @param newOwner address which represents the new owner
*/
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev This modifier verifies that msg.sender is the ProxyStorage contract
*/
modifier onlyProxyStorage() {
require(msg.sender == getProxyStorage());
_;
}
/**
* @dev This modifier verifies that msg.sender is the owner of the contract
*/
modifier onlyOwner() {
require(msg.sender == getOwner());
_;
}
/**
* @dev Constructor
* @param _proxyStorage address representing the ProxyStorage contract
* @param _implementation address representing the implementation contract
*/
constructor(address _proxyStorage, address _implementation) public {
require(_implementation != address(0));
if (_proxyStorage != address(0)) {
_setProxyStorage(_proxyStorage);
} else {
_setProxyStorage(address(this));
}
_setImplementation(_implementation);
_setOwner(msg.sender);
}
/**
* @dev Fallback function allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns
*/
// solhint-disable no-complex-fallback, no-inline-assembly
function() payable public {
address _impl = getImplementation();
require(_impl != address(0));
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, _impl, 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) }
}
}
// solhint-enable no-complex-fallback, no-inline-assembly
/**
* @dev Allows ProxyStorage contract (only) to upgrade the current implementation.
* @param _newImplementation representing the address of the new implementation to be set.
*/
function upgradeTo(address _newImplementation) public onlyProxyStorage returns(bool) {
if (_newImplementation == address(0)) return false;
if (getImplementation() == _newImplementation) return false;
uint256 _newVersion = getVersion() + 1;
_setVersion(_newVersion);
_setImplementation(_newImplementation);
emit Upgraded(_newVersion, _newImplementation);
return true;
}
/**
* @dev Allows the current owner to relinquish ownership.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(getOwner());
_setOwner(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 {
require(_newOwner != address(0));
emit OwnershipTransferred(getOwner(), _newOwner);
_setOwner(_newOwner);
}
function getOwner() public view returns(address) {
return addressStorage[keccak256(abi.encodePacked("owner"))];
}
function _setOwner(address _owner) private {
addressStorage[keccak256(abi.encodePacked("owner"))] = _owner;
}
function getVersion() public view returns(uint256) {
return version;
}
function _setVersion(uint256 _newVersion) private {
version = _newVersion;
}
function getImplementation() public view returns(address) {
return implementation;
}
function _setImplementation(address _newImplementation) private {
implementation = _newImplementation;
}
function getProxyStorage() public view returns(address) {
return addressStorage[keccak256(abi.encodePacked("proxyStorage"))];
}
function _setProxyStorage(address _proxyStorage) private {
addressStorage[keccak256(abi.encodePacked("proxyStorage"))] = _proxyStorage;
}
}
Contract ABI
[{"type":"constructor","inputs":[{"type":"address","name":"_proxyStorage"},{"type":"address","name":"_implementation"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":""}],"name":"getImplementation","inputs":[],"constant":true},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":""}],"name":"getOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":""}],"name":"getProxyStorage","inputs":[],"constant":true},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":""}],"name":"getVersion","inputs":[],"constant":true},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":""}],"name":"isInitialized","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"_newOwner"}],"constant":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":""}],"name":"upgradeTo","inputs":[{"type":"address","name":"_newImplementation"}],"constant":false},{"type":"event","name":"OwnershipRenounced","inputs":[{"type":"address","name":"previousOwner","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"uint256","name":"version","indexed":false},{"type":"address","name":"implementation","indexed":true}],"anonymous":false},{"type":"fallback"}]
Contract Creation Code
0x608060405234801561001057600080fd5b506040516040806108db833981016040528051602090910151600160a060020a038116151561003e57600080fd5b600160a060020a038216156100645761005f826401000000006100a1810204565b610076565b610076306401000000006100a1810204565b61008881640100000000610171810204565b61009a33640100000000610193810204565b5050610206565b806004600060405160200180807f70726f787953746f726167650000000000000000000000000000000000000000815250600c0190506040516020818303038152906040526040518082805190602001908083835b602083106101155780518252601f1990920191602091820191016100f6565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000208054600160a060020a031916600160a060020a03959095169490941790935550505050565b60018054600160a060020a031916600160a060020a0392909216919091179055565b806004600060405160200180807f6f776e65720000000000000000000000000000000000000000000000000000008152506005019050604051602081830303815290604052604051808280519060200190808383602083106101155780518252601f1990920191602091820191016100f6565b6106c6806102156000396000f30060806040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630d8e6e2c81146100d25780633659cfe6146100f9578063392e53cd1461012e578063715018a614610143578063893d20e81461015a578063aaf10f421461018b578063ec15a5e6146101a0578063f2fde38b146101b5575b60006100976101d6565b9050600160a060020a03811615156100ae57600080fd5b3660008037600080366000845af43d6000803e8080156100cd573d6000f35b3d6000fd5b3480156100de57600080fd5b506100e76101e5565b60408051918252519081900360200190f35b34801561010557600080fd5b5061011a600160a060020a03600435166101eb565b604080519115158252519081900360200190f35b34801561013a57600080fd5b5061011a6102b6565b34801561014f57600080fd5b5061015861036e565b005b34801561016657600080fd5b5061016f6103d3565b60408051600160a060020a039092168252519081900360200190f35b34801561019757600080fd5b5061016f6101d6565b3480156101ac57600080fd5b5061016f610491565b3480156101c157600080fd5b50610158600160a060020a0360043516610505565b600154600160a060020a031690565b60005490565b6000806101f6610491565b600160a060020a0316331461020a57600080fd5b600160a060020a038316151561022357600091506102b0565b82600160a060020a03166102356101d6565b600160a060020a0316141561024d57600091506102b0565b6102556101e5565b600101905061026381610589565b61026c8361058e565b604080518281529051600160a060020a038516917f4289d6195cf3c2d2174adf98d0e19d4d2d08887995b99cb7b100e7ffe795820e919081900360200190a2600191505b50919050565b60006006600060405160200180807f6973496e697469616c697a656400000000000000000000000000000000000000815250600d0190506040516020818303038152906040526040518082805190602001908083835b6020831061032b5780518252601f19909201916020918201910161030c565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205460ff16949350505050565b6103766103d3565b600160a060020a0316331461038a57600080fd5b6103926103d3565b600160a060020a03167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26103d160006105bd565b565b60006004600060405160200180807f6f776e657200000000000000000000000000000000000000000000000000000081525060050190506040516020818303038152906040526040518082805190602001908083835b602083106104485780518252601f199092019160209182019101610429565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002054600160a060020a0316949350505050565b60006004600060405160200180807f70726f787953746f726167650000000000000000000000000000000000000000815250600c019050604051602081830303815290604052604051808280519060200190808383602083106104485780518252601f199092019160209182019101610429565b61050d6103d3565b600160a060020a0316331461052157600080fd5b600160a060020a038116151561053657600080fd5b80600160a060020a03166105486103d3565b600160a060020a03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3610586816105bd565b50565b600055565b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b806004600060405160200180807f6f776e657200000000000000000000000000000000000000000000000000000081525060050190506040516020818303038152906040526040518082805190602001908083835b602083106106315780518252601f199092019160209182019101610612565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039590951694909417909355505050505600a165627a7a72305820f4416296485a3f71a48dda88ce8128683c8d17cbc70da0bb70aca8575af7400c0029000000000000000000000000a5970fe034859f34afc3eda7ef38b04eb863ae1d0000000000000000000000003e0ea49698c81e7ba52c8844731f6ba128f4e539
Deployed ByteCode
0x60806040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630d8e6e2c81146100d25780633659cfe6146100f9578063392e53cd1461012e578063715018a614610143578063893d20e81461015a578063aaf10f421461018b578063ec15a5e6146101a0578063f2fde38b146101b5575b60006100976101d6565b9050600160a060020a03811615156100ae57600080fd5b3660008037600080366000845af43d6000803e8080156100cd573d6000f35b3d6000fd5b3480156100de57600080fd5b506100e76101e5565b60408051918252519081900360200190f35b34801561010557600080fd5b5061011a600160a060020a03600435166101eb565b604080519115158252519081900360200190f35b34801561013a57600080fd5b5061011a6102b6565b34801561014f57600080fd5b5061015861036e565b005b34801561016657600080fd5b5061016f6103d3565b60408051600160a060020a039092168252519081900360200190f35b34801561019757600080fd5b5061016f6101d6565b3480156101ac57600080fd5b5061016f610491565b3480156101c157600080fd5b50610158600160a060020a0360043516610505565b600154600160a060020a031690565b60005490565b6000806101f6610491565b600160a060020a0316331461020a57600080fd5b600160a060020a038316151561022357600091506102b0565b82600160a060020a03166102356101d6565b600160a060020a0316141561024d57600091506102b0565b6102556101e5565b600101905061026381610589565b61026c8361058e565b604080518281529051600160a060020a038516917f4289d6195cf3c2d2174adf98d0e19d4d2d08887995b99cb7b100e7ffe795820e919081900360200190a2600191505b50919050565b60006006600060405160200180807f6973496e697469616c697a656400000000000000000000000000000000000000815250600d0190506040516020818303038152906040526040518082805190602001908083835b6020831061032b5780518252601f19909201916020918201910161030c565b51815160209384036101000a600019018019909216911617905260408051929094018290039091208652850195909552929092016000205460ff16949350505050565b6103766103d3565b600160a060020a0316331461038a57600080fd5b6103926103d3565b600160a060020a03167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26103d160006105bd565b565b60006004600060405160200180807f6f776e657200000000000000000000000000000000000000000000000000000081525060050190506040516020818303038152906040526040518082805190602001908083835b602083106104485780518252601f199092019160209182019101610429565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528501959095529290920160002054600160a060020a0316949350505050565b60006004600060405160200180807f70726f787953746f726167650000000000000000000000000000000000000000815250600c019050604051602081830303815290604052604051808280519060200190808383602083106104485780518252601f199092019160209182019101610429565b61050d6103d3565b600160a060020a0316331461052157600080fd5b600160a060020a038116151561053657600080fd5b80600160a060020a03166105486103d3565b600160a060020a03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3610586816105bd565b50565b600055565b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b806004600060405160200180807f6f776e657200000000000000000000000000000000000000000000000000000081525060050190506040516020818303038152906040526040518082805190602001908083835b602083106106315780518252601f199092019160209182019101610612565b51815160209384036101000a60001901801990921691161790526040805192909401829003909120865285019590955292909201600020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039590951694909417909355505050505600a165627a7a72305820f4416296485a3f71a48dda88ce8128683c8d17cbc70da0bb70aca8575af7400c0029