编译器
0.4.24+commit.e67f0147
文件 1 的 7:CoinJuheStorageProxy.sol
pragma solidity 0.4.24;
import "./EternalStorage.sol";
import "./OwnedUpgradeabilityProxy.sol";
contract CoinJuheStorageProxy is EternalStorage, OwnedUpgradeabilityProxy {}
文件 2 的 7:EternalStorage.sol
pragma solidity 0.4.24;
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;
}
文件 3 的 7:OwnedUpgradeabilityProxy.sol
pragma solidity 0.4.24;
import './UpgradeabilityProxy.sol';
import './UpgradeabilityOwnerStorage.sol';
contract OwnedUpgradeabilityProxy is UpgradeabilityOwnerStorage, UpgradeabilityProxy {
event ProxyOwnershipTransferred(address previousOwner, address newOwner);
constructor() public {
setUpgradeabilityOwner(msg.sender);
}
modifier onlyProxyOwner() {
require(msg.sender == proxyOwner());
_;
}
function proxyOwner() public view returns (address) {
return upgradeabilityOwner();
}
function transferProxyOwnership(address newOwner) public onlyProxyOwner {
require(newOwner != address(0));
setUpgradeabilityOwner(newOwner);
emit ProxyOwnershipTransferred(proxyOwner(), newOwner);
}
function upgradeTo(string version, address implementation) public onlyProxyOwner {
_upgradeTo(version, implementation);
}
function upgradeToAndCall(string version, address implementation, bytes data) payable public onlyProxyOwner {
upgradeTo(version, implementation);
require(address(this).call.value(msg.value)(data));
}
}
文件 4 的 7:Proxy.sol
pragma solidity 0.4.24;
contract Proxy {
function implementation() public view returns (address);
function () payable public {
address _impl = implementation();
require(_impl != address(0));
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0)
let size := returndatasize
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
}
文件 5 的 7:UpgradeabilityOwnerStorage.sol
pragma solidity 0.4.24;
contract UpgradeabilityOwnerStorage {
address private _upgradeabilityOwner;
function upgradeabilityOwner() public view returns (address) {
return _upgradeabilityOwner;
}
function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
_upgradeabilityOwner = newUpgradeabilityOwner;
}
}
文件 6 的 7:UpgradeabilityProxy.sol
pragma solidity 0.4.24;
import './Proxy.sol';
import './UpgradeabilityStorage.sol';
contract UpgradeabilityProxy is Proxy, UpgradeabilityStorage {
event Upgraded(string version, address indexed implementation);
function _upgradeTo(string version, address implementation) internal {
require(_implementation != implementation);
_version = version;
_implementation = implementation;
emit Upgraded(version, implementation);
}
}
文件 7 的 7:UpgradeabilityStorage.sol
pragma solidity 0.4.24;
contract UpgradeabilityStorage {
string internal _version;
address internal _implementation;
function version() public view returns (string) {
return _version;
}
function implementation() public view returns (address) {
return _implementation;
}
}
{
"compilationTarget": {
"CoinJuheStorageProxy.sol": "CoinJuheStorageProxy"
},
"evmVersion": "byzantium",
"libraries": {},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"constant":true,"inputs":[],"name":"proxyOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"version","type":"string"},{"name":"implementation","type":"address"}],"name":"upgradeTo","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"string"},{"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":"string"},{"indexed":true,"name":"implementation","type":"address"}],"name":"Upgraded","type":"event"}]