Transactions
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Read Proxy
Write Contract
Write Proxy
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- OracleProxy
- Optimization enabled
- true
- Compiler version
- v0.4.26+commit.4563c3fc
- Optimization runs
- 200
- EVM Version
- byzantium
- Verified at
- 2023-04-19T10:20:54.634674Z
Contract source code
// File: contracts/components/Proxy.sol /* Copyright 2019 Wanchain Foundation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // _ _ _ // __ ____ _ _ __ ___| |__ __ _(_)_ __ __| | _____ __ // \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / / // \ V V / (_| | | | | (__| | | | (_| | | | | | (_| | __/\ V / // \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/ // // pragma solidity ^0.4.24; /** * Math operations with safety checks */ contract Proxy { event Upgraded(address indexed implementation); address internal _implementation; function implementation() public view returns (address) { return _implementation; } function () external payable { address _impl = _implementation; require(_impl != address(0), "implementation contract not set"); 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) } } } } // File: contracts/lib/BasicStorageLib.sol pragma solidity ^0.4.24; library BasicStorageLib { struct UintData { mapping(bytes => mapping(bytes => uint)) _storage; } struct BoolData { mapping(bytes => mapping(bytes => bool)) _storage; } struct AddressData { mapping(bytes => mapping(bytes => address)) _storage; } struct BytesData { mapping(bytes => mapping(bytes => bytes)) _storage; } struct StringData { mapping(bytes => mapping(bytes => string)) _storage; } /* uintStorage */ function setStorage(UintData storage self, bytes memory key, bytes memory innerKey, uint value) internal { self._storage[key][innerKey] = value; } function getStorage(UintData storage self, bytes memory key, bytes memory innerKey) internal view returns (uint) { return self._storage[key][innerKey]; } function delStorage(UintData storage self, bytes memory key, bytes memory innerKey) internal { delete self._storage[key][innerKey]; } /* boolStorage */ function setStorage(BoolData storage self, bytes memory key, bytes memory innerKey, bool value) internal { self._storage[key][innerKey] = value; } function getStorage(BoolData storage self, bytes memory key, bytes memory innerKey) internal view returns (bool) { return self._storage[key][innerKey]; } function delStorage(BoolData storage self, bytes memory key, bytes memory innerKey) internal { delete self._storage[key][innerKey]; } /* addressStorage */ function setStorage(AddressData storage self, bytes memory key, bytes memory innerKey, address value) internal { self._storage[key][innerKey] = value; } function getStorage(AddressData storage self, bytes memory key, bytes memory innerKey) internal view returns (address) { return self._storage[key][innerKey]; } function delStorage(AddressData storage self, bytes memory key, bytes memory innerKey) internal { delete self._storage[key][innerKey]; } /* bytesStorage */ function setStorage(BytesData storage self, bytes memory key, bytes memory innerKey, bytes memory value) internal { self._storage[key][innerKey] = value; } function getStorage(BytesData storage self, bytes memory key, bytes memory innerKey) internal view returns (bytes memory) { return self._storage[key][innerKey]; } function delStorage(BytesData storage self, bytes memory key, bytes memory innerKey) internal { delete self._storage[key][innerKey]; } /* stringStorage */ function setStorage(StringData storage self, bytes memory key, bytes memory innerKey, string memory value) internal { self._storage[key][innerKey] = value; } function getStorage(StringData storage self, bytes memory key, bytes memory innerKey) internal view returns (string memory) { return self._storage[key][innerKey]; } function delStorage(StringData storage self, bytes memory key, bytes memory innerKey) internal { delete self._storage[key][innerKey]; } } // File: contracts/components/BasicStorage.sol pragma solidity ^0.4.24; contract BasicStorage { /************************************************************ ** ** VARIABLES ** ************************************************************/ //// basic variables using BasicStorageLib for BasicStorageLib.UintData; using BasicStorageLib for BasicStorageLib.BoolData; using BasicStorageLib for BasicStorageLib.AddressData; using BasicStorageLib for BasicStorageLib.BytesData; using BasicStorageLib for BasicStorageLib.StringData; BasicStorageLib.UintData internal uintData; BasicStorageLib.BoolData internal boolData; BasicStorageLib.AddressData internal addressData; BasicStorageLib.BytesData internal bytesData; BasicStorageLib.StringData internal stringData; } // File: contracts/oracle/OracleStorage.sol pragma solidity 0.4.26; contract OracleStorage is BasicStorage { /************************************************************ ** ** STRUCTURE DEFINATIONS ** ************************************************************/ struct StoremanGroupConfig { uint deposit; uint[2] chain; uint[2] curve; bytes gpk1; bytes gpk2; uint startTime; uint endTime; uint8 status; bool isDebtClean; } /************************************************************ ** ** VARIABLES ** ************************************************************/ /// @notice symbol -> price, mapping(bytes32 => uint) public mapPrices; /// @notice smgId -> StoremanGroupConfig mapping(bytes32 => StoremanGroupConfig) public mapStoremanGroupConfig; /// @notice owner and admin have the authority of admin address public admin; } // File: contracts/components/Owned.sol /* Copyright 2019 Wanchain Foundation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // _ _ _ // __ ____ _ _ __ ___| |__ __ _(_)_ __ __| | _____ __ // \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / / // \ V V / (_| | | | | (__| | | | (_| | | | | | (_| | __/\ V / // \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/ // // pragma solidity ^0.4.24; /// @dev `Owned` is a base level contract that assigns an `owner` that can be /// later changed contract Owned { event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @dev `owner` is the only address that can call a function with this /// modifier modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } address public owner; /// @notice The Constructor assigns the message sender to be `owner` constructor() public { owner = msg.sender; } address public newOwner; function transferOwner(address _newOwner) public onlyOwner { require(_newOwner != address(0), "New owner is the zero address"); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } /// @notice `owner` can step down and assign some other address to this role /// @param _newOwner The address of the new owner. 0x0 can be used to create /// an unowned neutral vault, however that cannot be undone function changeOwner(address _newOwner) public onlyOwner { newOwner = _newOwner; } function acceptOwnership() public { if (msg.sender == newOwner) { owner = newOwner; } } function renounceOwnership() public onlyOwner { owner = address(0); } } // File: contracts/oracle/OracleProxy.sol /* Copyright 2019 Wanchain Foundation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // _ _ _ // __ ____ _ _ __ ___| |__ __ _(_)_ __ __| | _____ __ // \ \ /\ / / _` | '_ \ / __| '_ \ / _` | | '_ \@/ _` |/ _ \ \ / / // \ V V / (_| | | | | (__| | | | (_| | | | | | (_| | __/\ V / // \_/\_/ \__,_|_| |_|\___|_| |_|\__,_|_|_| |_|\__,_|\___| \_/ // // pragma solidity 0.4.26; contract OracleProxy is OracleStorage, Owned, Proxy { /** * * MANIPULATIONS * */ /// @notice function for setting or upgrading OracleDelegate address by owner /// @param impl OracleDelegate contract address function upgradeTo(address impl) public onlyOwner { require(impl != address(0), "Cannot upgrade to invalid address"); require(impl != _implementation, "Cannot upgrade to the same implementation"); _implementation = impl; emit Upgraded(impl); } }
Contract ABI
[{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"impl"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"deposit"},{"type":"bytes","name":"gpk1"},{"type":"bytes","name":"gpk2"},{"type":"uint256","name":"startTime"},{"type":"uint256","name":"endTime"},{"type":"uint8","name":"status"},{"type":"bool","name":"isDebtClean"}],"name":"mapStoremanGroupConfig","inputs":[{"type":"bytes32","name":""}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwner","inputs":[{"type":"address","name":"_newOwner"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"implementation","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"renounceOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"acceptOwnership","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"changeOwner","inputs":[{"type":"address","name":"_newOwner"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"mapPrices","inputs":[{"type":"bytes32","name":""}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"newOwner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"admin","inputs":[],"constant":true},{"type":"fallback","stateMutability":"payable","payable":true},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false}]
Contract Creation Code
0x608060405260088054600160a060020a03191633179055610979806100256000396000f3006080604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633659cfe681146101365780634af72234146101595780634fb2e45d1461027c5780635c60da1b1461029d578063715018a6146102ce57806379ba5097146102e35780638da5cb5b146102f8578063a6f9dae11461030d578063ba54a0e81461032e578063d4ee1d9014610358578063f851a4401461036d575b600a54600160a060020a0316801515610111576040805160e560020a62461bcd02815260206004820152601f60248201527f696d706c656d656e746174696f6e20636f6e7472616374206e6f742073657400604482015290519081900360640190fd5b60405136600082376000803683855af43d806000843e818015610132578184f35b8184fd5b34801561014257600080fd5b50610157600160a060020a0360043516610382565b005b34801561016557600080fd5b5061017160043561053b565b6040518088815260200180602001806020018781526020018681526020018560ff1660ff16815260200184151515158152602001838103835289818151815260200191508051906020019080838360005b838110156101da5781810151838201526020016101c2565b50505050905090810190601f1680156102075780820380516001836020036101000a031916815260200191505b5083810382528851815288516020918201918a019080838360005b8381101561023a578181015183820152602001610222565b50505050905090810190601f1680156102675780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b34801561028857600080fd5b50610157600160a060020a0360043516610693565b3480156102a957600080fd5b506102b26107ac565b60408051600160a060020a039092168252519081900360200190f35b3480156102da57600080fd5b506101576107bb565b3480156102ef57600080fd5b5061015761082a565b34801561030457600080fd5b506102b261086f565b34801561031957600080fd5b50610157600160a060020a036004351661087e565b34801561033a57600080fd5b506103466004356108fd565b60408051918252519081900360200190f35b34801561036457600080fd5b506102b261090f565b34801561037957600080fd5b506102b261091e565b600854600160a060020a031633146103d2576040805160e560020a62461bcd028152602060048201526009602482015260008051602061092e833981519152604482015290519081900360640190fd5b600160a060020a0381161515610458576040805160e560020a62461bcd02815260206004820152602160248201527f43616e6e6f74207570677261646520746f20696e76616c69642061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600a54600160a060020a03828116911614156104e4576040805160e560020a62461bcd02815260206004820152602960248201527f43616e6e6f74207570677261646520746f207468652073616d6520696d706c6560448201527f6d656e746174696f6e0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600a805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60066020908152600091825260409182902080546005820180548551601f60026000196101006001861615020190931692909204918201869004860281018601909652808652919492939091908301828280156105d95780601f106105ae576101008083540402835291602001916105d9565b820191906000526020600020905b8154815290600101906020018083116105bc57829003601f168201915b5050505060068301805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529495949350908301828280156106695780601f1061063e57610100808354040283529160200191610669565b820191906000526020600020905b81548152906001019060200180831161064c57829003601f168201915b50505050600783015460088401546009909401549293909290915060ff8082169161010090041687565b600854600160a060020a031633146106e3576040805160e560020a62461bcd028152602060048201526009602482015260008051602061092e833981519152604482015290519081900360640190fd5b600160a060020a0381161515610743576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f2061646472657373000000604482015290519081900360640190fd5b600854604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600a54600160a060020a031690565b600854600160a060020a0316331461080b576040805160e560020a62461bcd028152602060048201526009602482015260008051602061092e833981519152604482015290519081900360640190fd5b6008805473ffffffffffffffffffffffffffffffffffffffff19169055565b600954600160a060020a031633141561086d576009546008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600854600160a060020a031681565b600854600160a060020a031633146108ce576040805160e560020a62461bcd028152602060048201526009602482015260008051602061092e833981519152604482015290519081900360640190fd5b6009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60056020526000908152604090205481565b600954600160a060020a031681565b600754600160a060020a03168156004e6f74206f776e65720000000000000000000000000000000000000000000000a165627a7a72305820ac9c30f0da628fa1f3e7ba31c37a2142d126de328d7e956f6576c91b6ab284cf0029
Deployed ByteCode
0x6080604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633659cfe681146101365780634af72234146101595780634fb2e45d1461027c5780635c60da1b1461029d578063715018a6146102ce57806379ba5097146102e35780638da5cb5b146102f8578063a6f9dae11461030d578063ba54a0e81461032e578063d4ee1d9014610358578063f851a4401461036d575b600a54600160a060020a0316801515610111576040805160e560020a62461bcd02815260206004820152601f60248201527f696d706c656d656e746174696f6e20636f6e7472616374206e6f742073657400604482015290519081900360640190fd5b60405136600082376000803683855af43d806000843e818015610132578184f35b8184fd5b34801561014257600080fd5b50610157600160a060020a0360043516610382565b005b34801561016557600080fd5b5061017160043561053b565b6040518088815260200180602001806020018781526020018681526020018560ff1660ff16815260200184151515158152602001838103835289818151815260200191508051906020019080838360005b838110156101da5781810151838201526020016101c2565b50505050905090810190601f1680156102075780820380516001836020036101000a031916815260200191505b5083810382528851815288516020918201918a019080838360005b8381101561023a578181015183820152602001610222565b50505050905090810190601f1680156102675780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b34801561028857600080fd5b50610157600160a060020a0360043516610693565b3480156102a957600080fd5b506102b26107ac565b60408051600160a060020a039092168252519081900360200190f35b3480156102da57600080fd5b506101576107bb565b3480156102ef57600080fd5b5061015761082a565b34801561030457600080fd5b506102b261086f565b34801561031957600080fd5b50610157600160a060020a036004351661087e565b34801561033a57600080fd5b506103466004356108fd565b60408051918252519081900360200190f35b34801561036457600080fd5b506102b261090f565b34801561037957600080fd5b506102b261091e565b600854600160a060020a031633146103d2576040805160e560020a62461bcd028152602060048201526009602482015260008051602061092e833981519152604482015290519081900360640190fd5b600160a060020a0381161515610458576040805160e560020a62461bcd02815260206004820152602160248201527f43616e6e6f74207570677261646520746f20696e76616c69642061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600a54600160a060020a03828116911614156104e4576040805160e560020a62461bcd02815260206004820152602960248201527f43616e6e6f74207570677261646520746f207468652073616d6520696d706c6560448201527f6d656e746174696f6e0000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600a805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60066020908152600091825260409182902080546005820180548551601f60026000196101006001861615020190931692909204918201869004860281018601909652808652919492939091908301828280156105d95780601f106105ae576101008083540402835291602001916105d9565b820191906000526020600020905b8154815290600101906020018083116105bc57829003601f168201915b5050505060068301805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529495949350908301828280156106695780601f1061063e57610100808354040283529160200191610669565b820191906000526020600020905b81548152906001019060200180831161064c57829003601f168201915b50505050600783015460088401546009909401549293909290915060ff8082169161010090041687565b600854600160a060020a031633146106e3576040805160e560020a62461bcd028152602060048201526009602482015260008051602061092e833981519152604482015290519081900360640190fd5b600160a060020a0381161515610743576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f2061646472657373000000604482015290519081900360640190fd5b600854604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600a54600160a060020a031690565b600854600160a060020a0316331461080b576040805160e560020a62461bcd028152602060048201526009602482015260008051602061092e833981519152604482015290519081900360640190fd5b6008805473ffffffffffffffffffffffffffffffffffffffff19169055565b600954600160a060020a031633141561086d576009546008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600854600160a060020a031681565b600854600160a060020a031633146108ce576040805160e560020a62461bcd028152602060048201526009602482015260008051602061092e833981519152604482015290519081900360640190fd5b6009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60056020526000908152604090205481565b600954600160a060020a031681565b600754600160a060020a03168156004e6f74206f776e65720000000000000000000000000000000000000000000000a165627a7a72305820ac9c30f0da628fa1f3e7ba31c37a2142d126de328d7e956f6576c91b6ab284cf0029