Address Contract Verified
Address
0x6527322D93E3F8e46Ff0de3f7b24A800C2ec59f9
Balance
0 ETH
Nonce
1
Code Size
4215 bytes
Creator
0x0eC16ef9...08f5 at tx 0x70b6bda8...284e0d
Indexed Transactions
0
Contract Bytecode
4215 bytes
0x6080604052600436106100cb5760003560e01c80634f1ef286116100745780637180c8ca1161004e5780637180c8ca1461020a578063a6f9dae11461022a578063cb6629d31461024a576100da565b80634f1ef286146101c25780635c40f6f4146101d55780635c60da1b146101f5576100da565b80633659cfe6116100a55780633659cfe6146101665780634555d5c91461018657806346fbf68e146101a2576100da565b8063025313a2146100e257806307eddd4714610121578063200d2ed214610141576100da565b366100da576100d861026a565b005b6100d861026a565b3480156100ee57600080fd5b506100f76102a4565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012d57600080fd5b506100d861013c366004610e87565b6102d3565b34801561014d57600080fd5b506101566103d4565b6040519015158152602001610118565b34801561017257600080fd5b506100d8610181366004610eba565b6103fe565b34801561019257600080fd5b5060405160028152602001610118565b3480156101ae57600080fd5b506101566101bd366004610eba565b6104b5565b6100d86101d0366004610f0b565b6104c6565b3480156101e157600080fd5b506100d86101f0366004610feb565b61057f565b34801561020157600080fd5b506100f761068a565b34801561021657600080fd5b506100d8610225366004610e87565b6106b4565b34801561023657600080fd5b506100d8610245366004610eba565b6107a4565b34801561025657600080fd5b50610156610265366004610eba565b6108d3565b6102726108de565b6102a261029d7f84f92e9efe723882a563880a3e2fa9ae9a1db2611adcbe80e6bd878486aff51e5490565b61094c565b565b60006102ce7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd7815490565b905090565b7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd7815473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103745760405162461bcd60e51b815260206004820152601360248201527f50726f78793a206973206e6f74206f776e65720000000000000000000000000060448201526064015b60405180910390fd5b61037e8282610975565b8173ffffffffffffffffffffffffffffffffffffffff167fafc2cdf3c383617daadeb72a12063c4ba556eeaa26890160ffd77900e1925257826040516103c8911515815260200190565b60405180910390a25050565b60006102ce7f1400e57c855c9b8af53b65ba9c4c3680496a2facf3cb863c7d0ca088bbc89f7d5490565b7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd7815473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061045d575061045d33610a5b565b6104a95760405162461bcd60e51b815260206004820152601f60248201527f50726f78793a206973206e6f74206f776e6572206f7220757067726164657200604482015260640161036b565b6104b281610afd565b50565b60006104c082610b4a565b92915050565b7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd7815473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610525575061052533610a5b565b6105715760405162461bcd60e51b815260206004820152601f60248201527f50726f78793a206973206e6f74206f776e6572206f7220757067726164657200604482015260640161036b565b61057b8282610bae565b5050565b7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd7815473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806105de57506105de33610b4a565b61062a5760405162461bcd60e51b815260206004820152601d60248201527f50726f78793a206973206e6f74206f776e6572206f7220706175736572000000604482015260640161036b565b610652817f1400e57c855c9b8af53b65ba9c4c3680496a2facf3cb863c7d0ca088bbc89f7d55565b60405181151581527f8939c08109a5d8d76bb72a1a22bd59c7ba7e81fe6dcfd41644887fc9ab07d8289060200160405180910390a150565b60006102ce7f84f92e9efe723882a563880a3e2fa9ae9a1db2611adcbe80e6bd878486aff51e5490565b7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd7815473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107505760405162461bcd60e51b815260206004820152601360248201527f50726f78793a206973206e6f74206f776e657200000000000000000000000000604482015260640161036b565b61075a8282610c76565b8173ffffffffffffffffffffffffffffffffffffffff167fd34f4aa5f94a385f2fa0ca25e5f01c6f331018f35c3d43a7b8057a86704de3df826040516103c8911515815260200190565b7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd7815473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108405760405162461bcd60e51b815260206004820152601360248201527f50726f78793a206973206e6f74206f776e657200000000000000000000000000604482015260640161036b565b600061086a7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd7815490565b905061087582610d3c565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c60405160405180910390a35050565b60006104c082610a5b565b7f1400e57c855c9b8af53b65ba9c4c3680496a2facf3cb863c7d0ca088bbc89f7d546102a25760405162461bcd60e51b815260206004820152601a60248201527f50726f78793a2070726f7879206973206e6f7420616374697665000000000000604482015260640161036b565b3660008037600080366000845af43d6000803e80801561096b573d6000f35b3d6000fd5b505050565b73ffffffffffffffffffffffffffffffffffffffff82166109d85760405162461bcd60e51b815260206004820152601e60248201527f50726f78793a206163636f756e742063616e206e6f74206265207a65726f0000604482015260640161036b565b60007f9de98e870c89d1135e77618f88cf80ad4ce8a3a50f9fe21edfb7dd02f321801a83604051602001610a3b92919091825260601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602082015260340190565b604051602081830303815290604052805190602001209050818155505050565b6000807f9de98e870c89d1135e77618f88cf80ad4ce8a3a50f9fe21edfb7dd02f321801a83604051602001610abf92919091825260601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602082015260340190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120549392505050565b610b0681610dc3565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6000807f1deb16af3c96961b83c983977e0f6ff4136fa28250dbabaa4808c7433a9edf7883604051602001610abf92919091825260601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602082015260340190565b610bb782610afd565b80511561057b5760008273ffffffffffffffffffffffffffffffffffffffff1682604051610be59190611006565b600060405180830381855af49150503d8060008114610c20576040519150601f19603f3d011682016040523d82523d6000602084013e610c25565b606091505b50509050806109705760405162461bcd60e51b815260206004820152601a60248201527f50726f78793a2064656c656761746543616c6c206661696c6564000000000000604482015260640161036b565b73ffffffffffffffffffffffffffffffffffffffff8216610cd95760405162461bcd60e51b815260206004820152601e60248201527f50726f78793a206163636f756e742063616e206e6f74206265207a65726f0000604482015260640161036b565b60007f1deb16af3c96961b83c983977e0f6ff4136fa28250dbabaa4808c7433a9edf7883604051602001610a3b92919091825260601b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602082015260340190565b73ffffffffffffffffffffffffffffffffffffffff8116610d9f5760405162461bcd60e51b815260206004820152601e60248201527f50726f78793a206163636f756e742063616e206e6f74206265207a65726f0000604482015260640161036b565b7fcac960375e7e3e1927ba0980937375d7ee1873cdefd60716f508c770004bd78155565b60008173ffffffffffffffffffffffffffffffffffffffff163b11610e2a5760405162461bcd60e51b815260206004820152601d60248201527f50726f78793a206e6f74206120636f6e74726163742061646472657373000000604482015260640161036b565b7f84f92e9efe723882a563880a3e2fa9ae9a1db2611adcbe80e6bd878486aff51e55565b803573ffffffffffffffffffffffffffffffffffffffff81168114610e7257600080fd5b919050565b80358015158114610e7257600080fd5b60008060408385031215610e9a57600080fd5b610ea383610e4e565b9150610eb160208401610e77565b90509250929050565b600060208284031215610ecc57600080fd5b610ed582610e4e565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060408385031215610f1e57600080fd5b610f2783610e4e565b9150602083013567ffffffffffffffff80821115610f4457600080fd5b818501915085601f830112610f5857600080fd5b813581811115610f6a57610f6a610edc565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610fb057610fb0610edc565b81604052828152886020848701011115610fc957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600060208284031215610ffd57600080fd5b610ed582610e77565b6000825160005b81811015611027576020818601810151858301520161100d565b81811115611036576000828501525b50919091019291505056fea2646970667358221220815a61c08c9b1c8a5e1a2fb3682acc9970160edef4445d1d489393a9f2603c3364736f6c63430008090033
Verified Source Code Full Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (10000 runs)
Proxy.sol 242 lines
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/Proxy.sol";
import "./interface/IERC897Proxy.sol";
contract HSKProxy is Proxy, IERC897Proxy {
bytes32 internal constant IMPLEMENTATION_SLOT = keccak256("hsk.proxy.implementation");
bytes32 internal constant STATUS_SLOT = keccak256("hsk.proxy.status");
bytes32 internal constant OWNER_SLOT = keccak256("hsk.proxy.owner");
bytes32 internal constant UPGRADER_SLOT_TAG = keccak256("hsk.proxy.upgraderTag");
bytes32 internal constant PAUSER_SLOT_TAG = keccak256("hsk.proxy.pauserTag");
/// @dev Emitted when the administration has been transferred.
event OwnerChanged(address indexed previousOwner, address indexed newOwner);
/// @dev Emitted when the upgrader is updated.
event SetUpgrader(address indexed account, bool enable);
/// @dev Emitted when the pauser is updated.
event SetPauser(address indexed account, bool enable);
/// @dev Emitted when the implementation is upgraded.
event Upgraded(address indexed implementation);
/// @dev Proxy status is updated.
event StatusUpdated(bool status);
modifier onlyOwner() {
require(msg.sender == _owner(), "Proxy: is not owner");
_;
}
modifier canUpgrade() {
require(msg.sender == _owner() || _isUpgrader(msg.sender), "Proxy: is not owner or upgrader");
_;
}
modifier canPause() {
require(msg.sender == _owner() || _isPauser(msg.sender), "Proxy: is not owner or pauser");
_;
}
constructor(address _impl, address _implOwner, address _proxyOwner) {
_upgradeToAndCall(_impl, abi.encodeWithSelector(bytes4(keccak256("init(address)")), _implOwner));
_setOwner(_proxyOwner);
_setStatus(true);
}
function _implementation() internal view override returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
function _beforeFallback() internal view override {
require(_status(), "Proxy: proxy is not active");
}
/// @dev Sets the implementation address of the proxy.
/// @param _impl Address of the new implementation.
function _setImplementation(address _impl) internal {
require(_impl.code.length > 0, "Proxy: not a contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, _impl)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/// @dev Upgrade the implementation of the proxy and call a function on the new implementation.
/// @param _impl Address of the new implementation.
/// @param data Data to send as msg.data in the low level call.
function _upgradeToAndCall(address _impl, bytes memory data) internal {
_upgradeTo(_impl);
if (data.length > 0) {
// solhint-disable-next-line avoid-low-level-calls
(bool ok, ) = _impl.delegatecall(data);
require(ok, "Proxy: delegateCall failed");
}
}
/// @dev Return proxy status
function _status() internal view returns (bool active) {
bytes32 slot = STATUS_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
active := sload(slot)
}
}
/// @dev Set proxy status
function _setStatus(bool active) internal {
bytes32 slot = STATUS_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, active)
}
}
/// @dev Return the owner slot.
function _owner() internal view returns (address account) {
bytes32 slot = OWNER_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
account := sload(slot)
}
}
/// @dev Return the upgrader slot.
function _isUpgrader(address account) internal view returns (bool enable) {
bytes32 slot = keccak256(abi.encodePacked(UPGRADER_SLOT_TAG, account));
// solhint-disable-next-line no-inline-assembly
assembly {
enable := sload(slot)
}
}
/// @dev Return the pauser slot.
function _isPauser(address account) internal view returns (bool enable) {
bytes32 slot = keccak256(abi.encodePacked(PAUSER_SLOT_TAG, account));
// solhint-disable-next-line no-inline-assembly
assembly {
enable := sload(slot)
}
}
/// @dev Set new owner
function _setOwner(address account) internal {
require(account != address(0), "Proxy: account can not be zero");
bytes32 slot = OWNER_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, account)
}
}
function _setUpgrader(address account, bool enable) internal {
require(account != address(0), "Proxy: account can not be zero");
bytes32 slot = keccak256(abi.encodePacked(UPGRADER_SLOT_TAG, account));
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, enable)
}
}
function _setPauser(address account, bool enable) internal {
require(account != address(0), "Proxy: account can not be zero");
bytes32 slot = keccak256(abi.encodePacked(PAUSER_SLOT_TAG, account));
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, enable)
}
}
/// @dev Perform implementation upgrade
function upgradeTo(address _impl) external canUpgrade {
_upgradeTo(_impl);
}
/// @dev Perform implementation upgrade with additional setup call.
function upgradeToAndCall(address _impl, bytes memory data) external payable canUpgrade {
_upgradeToAndCall(_impl, data);
}
/// @dev Get proxy status.
function status() external view returns (bool) {
return _status();
}
/// @dev Pause or unpause proxy.
function setStatus(bool active) external canPause {
_setStatus(active);
emit StatusUpdated(active);
}
/// @dev Returns the current owner.
function proxyOwner() external view returns (address) {
return _owner();
}
/// @dev eturns if the current account is upgrader.
function isUpgrader(address account) external view returns (bool) {
return _isUpgrader(account);
}
/// @dev Returns if the current account is pauser.
function isPauser(address account) external view returns (bool) {
return _isPauser(account);
}
/// @dev Changes the owner of the proxy.
function changeOwner(address _newOwner) external onlyOwner {
address _oldOwner = _owner();
_setOwner(_newOwner);
emit OwnerChanged(_oldOwner, _newOwner);
}
/// @dev Set upgrader.
function setUpgrader(address account, bool enable) external onlyOwner {
_setUpgrader(account, enable);
emit SetUpgrader(account, enable);
}
/// @dev Set pauser.
function setPauser(address account, bool enable) external onlyOwner {
_setPauser(account, enable);
emit SetPauser(account, enable);
}
///////////////////////// ERC897Proxy methods ////////////////////////
/// @dev See in IERC897Proxy.
function implementation() external view override returns (address) {
return _implementation();
}
/// @dev See in IERC897Proxy.
function proxyType() external pure override returns (uint256) {
// upgradable
return 2;
}
}
IERC897Proxy.sol 11 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
/// @dev Interface of EIP-897 delegate proxy.
interface IERC897Proxy {
/// @dev Checking the proxy type is the way to check whether a contract is a proxy at all.
function proxyType() external pure returns (uint256 proxyTypeId);
/// @dev The returned code address is the address the proxy would delegate calls to at that moment in time.
function implementation() external view returns (address codeAddr);
}
Proxy.sol 86 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
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(), implementation, 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 This is a virtual function that should be overridden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overridden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}
Read Contract
implementation 0x5c60da1b → address
isPauser 0x46fbf68e → bool
isUpgrader 0xcb6629d3 → bool
proxyOwner 0x025313a2 → address
proxyType 0x4555d5c9 → uint256
status 0x200d2ed2 → bool
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
changeOwner 0xa6f9dae1
address _newOwner
setPauser 0x7180c8ca
address account
bool enable
setStatus 0x5c40f6f4
bool active
setUpgrader 0x07eddd47
address account
bool enable
upgradeTo 0x3659cfe6
address _impl
upgradeToAndCall 0x4f1ef286
address _impl
bytes data
Recent Transactions
No transactions found for this address