Address Contract Verified
Address
0x85B78AcA6Deae198fBF201c82DAF6Ca21942acc6
Balance
0 ETH
Nonce
1
Code Size
1781 bytes
Creator
0x5b2A5d1A...7d8F at tx 0xd068ff98...d4996e
Proxy
EIP-1967 Proxy Implementation: 0xC0297a0E...c3df
Indexed Transactions
0
Contract Bytecode
1781 bytes
0x6080604052600436106100705760003560e01c80635c60da1b1161004e5780635c60da1b146100e35780638da5cb5b14610114578063cf7a1d7714610129578063f851a4401461011457610070565b806313af4035146100905780633659cfe6146100b05780634f1ef286146100d0575b61008e6100896000805160206106a08339815191525490565b61013c565b005b34801561009c57600080fd5b5061008e6100ab366004610513565b610160565b3480156100bc57600080fd5b5061008e6100cb366004610513565b610174565b61008e6100de36600461057e565b610185565b3480156100ef57600080fd5b506100f8610206565b6040516001600160a01b03909116815260200160405180910390f35b34801561012057600080fd5b506100f8610223565b61008e6101373660046105d1565b61023b565b3660008037600080366000845af43d6000803e80801561015b573d6000f35b3d6000fd5b610168610339565b610171816103c2565b50565b61017c610339565b6101718161042d565b61018d610339565b6101968361042d565b6000836001600160a01b031683836040516101b2929190610632565b600060405180830381855af49150503d80600081146101ed576040519150601f19603f3d011682016040523d82523d6000602084013e6101f2565b606091505b505090508061020057600080fd5b50505050565b600061021e6000805160206106a08339815191525490565b905090565b600061021e6000805160206106808339815191525490565b610243610339565b600061025b6000805160206106a08339815191525490565b6001600160a01b03161461026e57600080fd5b61029960017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd610642565b6000805160206106a0833981519152146102b5576102b5610669565b6102be8461042d565b8015610330576000846001600160a01b031683836040516102e0929190610632565b600060405180830381855af49150503d806000811461031b576040519150601f19603f3d011682016040523d82523d6000602084013e610320565b606091505b505090508061032e57600080fd5b505b610200836103c2565b600080516020610680833981519152546001600160a01b0316336001600160a01b0316146103c05760405162461bcd60e51b815260206004820152602960248201527f4f537761703a204f6e6c79206f776e65722063616e2063616c6c207468697320604482015268333ab731ba34b7b71760b91b60648201526084015b60405180910390fd5b565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f96000805160206106808339815191525490565b604080516001600160a01b03928316815291841660208301520160405180910390a160008051602061068083398151915255565b6000816001600160a01b03163b116104ad5760405162461bcd60e51b815260206004820152603b60248201527f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f60448201527f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000060648201526084016103b7565b6000805160206106a08339815191528181556040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a25050565b80356001600160a01b038116811461050e57600080fd5b919050565b60006020828403121561052557600080fd5b61052e826104f7565b9392505050565b60008083601f84011261054757600080fd5b50813567ffffffffffffffff81111561055f57600080fd5b60208301915083602082850101111561057757600080fd5b9250929050565b60008060006040848603121561059357600080fd5b61059c846104f7565b9250602084013567ffffffffffffffff8111156105b857600080fd5b6105c486828701610535565b9497909650939450505050565b600080600080606085870312156105e757600080fd5b6105f0856104f7565b93506105fe602086016104f7565b9250604085013567ffffffffffffffff81111561061a57600080fd5b61062687828801610535565b95989497509550505050565b8183823760009101908152919050565b8181038181111561066357634e487b7160e01b600052601160045260246000fd5b92915050565b634e487b7160e01b600052600160045260246000fdfeb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca26469706673582212201f42a0484b8434dfafe85cafe14955d2810e67646ca0094940ec97c34ce2d59564736f6c63430008170033
Verified Source Code Full Match
Compiler: v0.8.23+commit.f704f362
EVM: paris
Optimization: Yes (200 runs)
Proxy.sol 148 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
import {Ownable} from "./Ownable.sol";
/**
* @title Proxy
* @dev Based on Origin Protocol InitializeGovernedUpgradeabilityProxy
* https://github.com/OriginProtocol/origin-dollar/blob/master/contracts/contracts/proxies/InitializeGovernedUpgradeabilityProxy.sol
* @author Origin Protocol Inc
*/
contract Proxy is Ownable {
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Contract initializer with Owner enforcement
* @param _logic Address of the initial implementation.
* @param _initOwner Address of the initial Owner.
* @param _data Data to send as msg.data to the implementation to initialize
* the proxied contract.
* It should include the signature and the parameters of the function to be
* called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call
* to proxied contract will be skipped.
*/
function initialize(address _logic, address _initOwner, bytes calldata _data) public payable onlyOwner {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_upgradeTo(_logic);
if (_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
_setOwner(_initOwner);
}
/**
* @return The address of the proxy admin/it's also the owner.
*/
function admin() external view returns (address) {
return _owner();
}
/**
* @return The address of the implementation.
*/
function implementation() external view returns (address) {
return _implementation();
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external onlyOwner {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable onlyOwner {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback() external payable {
_delegate(_implementation());
}
/**
* @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 _impl Address to delegate.
*/
function _delegate(address _impl) internal {
// solhint-disable-next-line no-inline-assembly
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()) }
}
}
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
require(newImplementation.code.length > 0, "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
emit Upgraded(newImplementation);
}
}
Ownable.sol 48 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
contract Ownable {
// keccak256(“eip1967.proxy.admin”) - per EIP 1967
bytes32 internal constant OWNER_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
event AdminChanged(address previousAdmin, address newAdmin);
constructor() {
assert(OWNER_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setOwner(msg.sender);
}
function owner() external view returns (address) {
return _owner();
}
function setOwner(address newOwner) external onlyOwner {
_setOwner(newOwner);
}
function _owner() internal view returns (address ownerOut) {
bytes32 position = OWNER_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
ownerOut := sload(position)
}
}
function _setOwner(address newOwner) internal {
emit AdminChanged(_owner(), newOwner);
bytes32 position = OWNER_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(position, newOwner)
}
}
function _onlyOwner() internal view {
require(msg.sender == _owner(), "OSwap: Only owner can call this function.");
}
modifier onlyOwner() {
_onlyOwner();
_;
}
}
Read Contract
admin 0xf851a440 → address
implementation 0x5c60da1b → address
owner 0x8da5cb5b → address
Write Contract 4 functions
These functions modify contract state and require a wallet transaction to execute.
initialize 0xcf7a1d77
address _logic
address _initOwner
bytes _data
setOwner 0x13af4035
address newOwner
upgradeTo 0x3659cfe6
address newImplementation
upgradeToAndCall 0x4f1ef286
address newImplementation
bytes data
Token Balances (2)
View Transfers →Recent Transactions
No transactions found for this address