Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Sponsored
Latest 10 from a total of 10 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Relay Proposal | 17030381 | 48 days 10 hrs ago | IN | 0 ETH | 0.01197376 | ||||
Relay Global Pro... | 16517068 | 120 days 13 hrs ago | IN | 0 ETH | 0.00513533 | ||||
Relay Global Pro... | 15553474 | 255 days 4 hrs ago | IN | 0 ETH | 0.00161296 | ||||
Relay Global Pro... | 15531587 | 258 days 10 hrs ago | IN | 0 ETH | 0.00328916 | ||||
Relay Global Pro... | 15513476 | 261 days 10 hrs ago | IN | 0 ETH | 0.00225598 | ||||
Relay Global Pro... | 15370062 | 284 days 9 hrs ago | IN | 0 ETH | 0.00995707 | ||||
Relay Global Pro... | 15229916 | 306 days 9 hrs ago | IN | 0 ETH | 0.00941833 | ||||
Relay Global Pro... | 15216878 | 308 days 9 hrs ago | IN | 0 ETH | 0.00145492 | ||||
Relay Proposal | 15039388 | 336 days 6 hrs ago | IN | 0 ETH | 0.00486732 | ||||
0x60806040 | 15006552 | 342 days 9 hrs ago | IN | Create: GovernanceAdmin | 0 ETH | 0.08966 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
GovernanceAdmin
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol) pragma solidity ^0.8.0; import "../Proxy.sol"; import "./ERC1967Upgrade.sol"; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. */ contract ERC1967Proxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded * function call, and allows initializating the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _upgradeToAndCall(_logic, _data, false); } /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { return ERC1967Upgrade._getImplementation(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../interfaces/draft-IERC1822.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @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. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.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 overriden 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 internall 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 overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol) pragma solidity ^0.8.0; import "../ERC1967/ERC1967Proxy.sol"; /** * @dev This contract implements a proxy that is upgradeable by an admin. * * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector * clashing], which can potentially be used in an attack, this contract uses the * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two * things that go hand in hand: * * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if * that call matches one of the admin functions exposed by the proxy itself. * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the * implementation. If the admin tries to call a function on the implementation it will fail with an error that says * "admin cannot fallback to proxy target". * * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due * to sudden errors when trying to call a function from the proxy implementation. * * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is ERC1967Proxy { /** * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. */ constructor( address _logic, address admin_, bytes memory _data ) payable ERC1967Proxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _changeAdmin(admin_); } /** * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. */ modifier ifAdmin() { if (msg.sender == _getAdmin()) { _; } else { _fallback(); } } /** * @dev Returns the current admin. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function admin() external ifAdmin returns (address admin_) { admin_ = _getAdmin(); } /** * @dev Returns the current implementation. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` */ function implementation() external ifAdmin returns (address implementation_) { implementation_ = _implementation(); } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. * * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. */ function changeAdmin(address newAdmin) external virtual ifAdmin { _changeAdmin(newAdmin); } /** * @dev Upgrade the implementation of the proxy. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeToAndCall(newImplementation, bytes(""), false); } /** * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the * proxied contract. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. */ function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin { _upgradeToAndCall(newImplementation, data, true); } /** * @dev Returns the current admin. */ function _admin() internal view virtual returns (address) { return _getAdmin(); } /** * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. */ function _beforeFallback() internal virtual override { require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target"); super._beforeFallback(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "../library/GlobalProposal.sol"; import "../interfaces/IQuorum.sol"; import "../interfaces/IWeightedValidator.sol"; import "../extensions/governance/ProposalGovernance.sol"; import "../extensions/governance/GlobalProposalGovernance.sol"; import "../extensions/TransparentUpgradeableProxyV2.sol"; contract GovernanceAdmin is AccessControlEnumerable, ProposalGovernance, GlobalProposalGovernance { using Proposal for Proposal.ProposalDetail; using GlobalProposal for GlobalProposal.GlobalProposalDetail; /// @dev Emitted when the validator contract address is updated. event ValidatorContractUpdated(address); /// @dev Emitted when the gateway contract address is updated. event GatewayContractUpdated(address); /// @dev Domain separator bytes32 public constant DOMAIN_SEPARATOR = 0xf8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b; /// @dev Relayer role hash bytes32 public constant RELAYER_ROLE = keccak256("RELAYER_ROLE"); /// @dev Validator contract address public validatorContract; /// @dev Gateway contract address public gatewayContract; modifier validContract(address _contract) { require( _contract == validatorContract || _contract == gatewayContract, "GovernanceAdmin: query for invalid contract" ); _; } modifier onlyGovernor() { require(_getWeight(msg.sender) > 0, "GovernanceAdmin: sender is not governor"); _; } modifier onlySelfCall() { require(msg.sender == address(this), "GovernanceAdmin: only allowed self-call"); _; } constructor( address _roleSetter, address _validatorContract, address _gatewayContract, address[] memory _relayers ) { require( keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,bytes32 salt)"), keccak256("GovernanceAdmin"), // name hash keccak256("1"), // version hash keccak256(abi.encode("RONIN_GOVERNANCE_ADMIN", 2020)) // salt ) ) == DOMAIN_SEPARATOR, "GovernanceAdmin: invalid domain" ); _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter); _setValidatorContract(_validatorContract); _setGatewayContract(_gatewayContract); for (uint256 _i; _i < _relayers.length; _i++) { _grantRole(RELAYER_ROLE, _relayers[_i]); } } /** * @dev See {Governance-_proposeProposal}. * * Requirements: * - The method caller is governor. * */ function propose( uint256 _chainId, address[] memory _targets, uint256[] memory _values, bytes[] memory _calldatas ) external onlyGovernor { _proposeProposal(_chainId, _targets, _values, _calldatas, msg.sender); } /** * @dev See {ProposalGovernance-_proposeProposalStructAndCastVotes}. * * Requirements: * - The method caller is governor. * */ function proposeProposalStructAndCastVotes( Proposal.ProposalDetail calldata _proposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures ) external onlyGovernor { _proposeProposalStructAndCastVotes(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender); } /** * @dev See {ProposalGovernance-_castProposalBySignatures}. */ function castProposalBySignatures( Proposal.ProposalDetail calldata _proposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures ) external { _castProposalBySignatures(_proposal, _supports, _signatures, DOMAIN_SEPARATOR); } /** * @dev See {ProposalGovernance-_relayProposal}. * * Requirements: * - The method caller is relayer. * */ function relayProposal( Proposal.ProposalDetail calldata _proposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures ) external onlyRole(RELAYER_ROLE) { _relayProposal(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender); } /** * @dev See {Governance-_proposeGlobal}. * * Requirements: * - The method caller is governor. * */ function proposeGlobal( GlobalProposal.TargetOption[] calldata _targetOptions, uint256[] memory _values, bytes[] memory _calldatas ) external onlyGovernor { _proposeGlobal(_targetOptions, _values, _calldatas, validatorContract, gatewayContract, msg.sender); } /** * @dev See {GlobalProposalGovernance-_proposeGlobalProposalStructAndCastVotes}. * * Requirements: * - The method caller is governor. * */ function proposeGlobalProposalStructAndCastVotes( GlobalProposal.GlobalProposalDetail calldata _globalProposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures ) external onlyGovernor { _proposeGlobalProposalStructAndCastVotes( _globalProposal, _supports, _signatures, DOMAIN_SEPARATOR, validatorContract, gatewayContract, msg.sender ); } /** * @dev See {GlobalProposalGovernance-_castGlobalProposalBySignatures}. */ function castGlobalProposalBySignatures( GlobalProposal.GlobalProposalDetail calldata _globalProposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures ) external { _castGlobalProposalBySignatures( _globalProposal, _supports, _signatures, DOMAIN_SEPARATOR, validatorContract, gatewayContract ); } /** * @dev See {GlobalProposalGovernance-_relayGlobalProposal}. * * Requirements: * - The method caller is relayer. * */ function relayGlobalProposal( GlobalProposal.GlobalProposalDetail calldata _globalProposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures ) external onlyRole(RELAYER_ROLE) { _relayGlobalProposal( _globalProposal, _supports, _signatures, DOMAIN_SEPARATOR, validatorContract, gatewayContract, msg.sender ); } /** * @dev Returns the voting signatures. * * @notice Does not verify whether the voter casted vote for the proposal and the returned signature can be empty. * Please consider filtering for empty signatures after calling this function. * */ function getVotingSignatures( uint256 _chainId, uint256 _round, address[] calldata _voters ) external view returns (Ballot.VoteType[] memory _supports, Signature[] memory _signatures) { ProposalVote storage _vote = vote[_chainId][_round]; address _voter; _supports = new Ballot.VoteType[](_voters.length); _signatures = new Signature[](_voters.length); for (uint256 _i; _i < _voters.length; _i++) { _voter = _voters[_i]; if (_vote.againstVoted[_voter]) { _supports[_i] = Ballot.VoteType.Against; } _signatures[_i] = vote[_chainId][_round].sig[_voter]; } } /** * @dev Returns the current implementation of `_proxy`. * * Requirements: * - This contract must be the admin of `_proxy`. * */ function getProxyImplementation(address _proxy) external view returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("implementation()")) == 0x5c60da1b (bool _success, bytes memory _returndata) = _proxy.staticcall(hex"5c60da1b"); require(_success, "GovernanceAdmin: proxy call failed"); return abi.decode(_returndata, (address)); } /** * @dev Returns the current admin of `_proxy`. * * Requirements: * - This contract must be the admin of `_proxy`. * */ function getProxyAdmin(address _proxy) external view returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("admin()")) == 0xf851a440 (bool _success, bytes memory _returndata) = _proxy.staticcall(hex"f851a440"); require(_success, "GovernanceAdmin: proxy call failed"); return abi.decode(_returndata, (address)); } /** * @dev Changes the admin of `_proxy` to `newAdmin`. * * Requirements: * - This contract must be the current admin of `_proxy`. * */ function changeProxyAdmin(address _proxy, address _newAdmin) external onlySelfCall { // bytes4(keccak256("changeAdmin(address)")) (bool _success, ) = _proxy.call(abi.encodeWithSelector(0x8f283970, _newAdmin)); require(_success, "GovernanceAdmin: change admin call failed"); } /** * @dev See `_setValidatorContract` function. * * Requirements: * - Only allowed self-call. * */ function setValidatorContract(address _validatorContract) external onlySelfCall { require(_validatorContract.code.length > 0, "GovernanceAdmin: only contracts are allowed"); _setValidatorContract(_validatorContract); } /** * @dev See `_setGatewayContract` function. * * Requirements: * - Only allowed self-call. * */ function setGatewayContract(address _gatewayContract) public onlySelfCall { require(_gatewayContract.code.length > 0, "GovernanceAdmin: only contracts are allowed"); _setGatewayContract(_gatewayContract); } /** * @dev Sets validator contract address. * * Emits the `ValidatorContractUpdated` event. * */ function _setValidatorContract(address _validatorContract) internal { validatorContract = _validatorContract; emit ValidatorContractUpdated(_validatorContract); } /** * @dev Sets gateway contract address. * * Emits the `GatewayContractUpdated` event. * */ function _setGatewayContract(address _gatewayContract) internal { gatewayContract = _gatewayContract; emit GatewayContractUpdated(_gatewayContract); } /** * @dev Override {Governance-_getMinimumVoteWeight}. */ function _getMinimumVoteWeight() internal view override returns (uint256) { (bool _success, bytes memory _returndata) = validatorContract.staticcall( abi.encodeWithSelector( // TransparentUpgradeableProxyV2.functionDelegateCall.selector, 0x4bb5274a, abi.encodeWithSelector(IQuorum.minimumVoteWeight.selector) ) ); require(_success, "GovernanceAdmin: proxy call failed"); return abi.decode(_returndata, (uint256)); } /** * @dev Override {Governance-_getTotalWeights}. */ function _getTotalWeights() internal view override returns (uint256) { (bool _success, bytes memory _returndata) = validatorContract.staticcall( abi.encodeWithSelector( // TransparentUpgradeableProxyV2.functionDelegateCall.selector, 0x4bb5274a, abi.encodeWithSelector(IWeightedValidator.totalWeights.selector) ) ); require(_success, "GovernanceAdmin: proxy call failed"); return abi.decode(_returndata, (uint256)); } /** * @dev Override {Governance-_getWeight}. */ function _getWeight(address _governor) internal view override returns (uint256) { (bool _success, bytes memory _returndata) = validatorContract.staticcall( abi.encodeWithSelector( // TransparentUpgradeableProxyV2.functionDelegateCall.selector, 0x4bb5274a, abi.encodeWithSelector(IWeightedValidator.getGovernorWeight.selector, _governor) ) ); require(_success, "GovernanceAdmin: proxy call failed"); return abi.decode(_returndata, (uint256)); } /** * @dev Override {Governance-_getWeights}. */ function _getWeights(address[] memory _governors) internal view override returns (uint256) { (bool _success, bytes memory _returndata) = validatorContract.staticcall( abi.encodeWithSelector( // TransparentUpgradeableProxyV2.functionDelegateCall.selector, 0x4bb5274a, abi.encodeWithSelector(IWeightedValidator.sumGovernorWeights.selector, _governors) ) ); require(_success, "GovernanceAdmin: proxy call failed"); return abi.decode(_returndata, (uint256)); } /** * @dev Check whether the signatures is empty. */ function _empty(Signature memory _sig) internal pure returns (bool) { return uint256(_sig.v) == 0 && uint256(_sig.r) == 0 && uint256(_sig.s) == 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; contract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy { constructor( address _logic, address admin_, bytes memory _data ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {} /** * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call. * * Requirements: * - Only the admin can call this function. * * @notice The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider * reviewing the encoded data `_data` and the method which is called before using this. * */ function functionDelegateCall(bytes memory _data) public payable ifAdmin { address _addr = _implementation(); assembly { let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0) returndatacopy(0, 0, returndatasize()) switch _result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Governance.sol"; abstract contract GlobalProposalGovernance is Governance { using Proposal for Proposal.ProposalDetail; using GlobalProposal for GlobalProposal.GlobalProposalDetail; /** * @dev Proposes and votes by signature. */ function _proposeGlobalProposalStructAndCastVotes( GlobalProposal.GlobalProposalDetail calldata _globalProposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures, bytes32 _domainSeparator, address _validatorContract, address _gatewayContract, address _creator ) internal returns (Proposal.ProposalDetail memory _proposal) { (_proposal, ) = _proposeGlobalStruct(_globalProposal, _validatorContract, _gatewayContract, _creator); bytes32 _globalProposalHash = _globalProposal.hash(); _castVotesBySignatures( _proposal, _supports, _signatures, ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)), ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against)) ); } /** * @dev Proposes a global proposal struct and casts votes by signature. */ function _castGlobalProposalBySignatures( GlobalProposal.GlobalProposalDetail calldata _globalProposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures, bytes32 _domainSeparator, address _validatorContract, address _gatewayContract ) internal { Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail( _validatorContract, _gatewayContract ); bytes32 _globalProposalHash = _globalProposal.hash(); require(vote[0][_proposal.nonce].hash == _proposal.hash(), "GovernanceAdmin: cast vote for invalid proposal"); _castVotesBySignatures( _proposal, _supports, _signatures, ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)), ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against)) ); } /** * @dev Relays voted global proposal. * * Requirements: * - The relay proposal is finalized. * */ function _relayGlobalProposal( GlobalProposal.GlobalProposalDetail calldata _globalProposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures, bytes32 _domainSeparator, address _validatorContract, address _gatewayContract, address _creator ) internal { (Proposal.ProposalDetail memory _proposal, ) = _proposeGlobalStruct( _globalProposal, _validatorContract, _gatewayContract, _creator ); bytes32 _globalProposalHash = _globalProposal.hash(); _relayVotesBySignatures( _proposal, _supports, _signatures, ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)), ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against)) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Strings.sol"; import "../../library/Proposal.sol"; import "../../library/GlobalProposal.sol"; import "../../library/Ballot.sol"; import "../../interfaces/SignatureConsumer.sol"; abstract contract Governance is SignatureConsumer { using Proposal for Proposal.ProposalDetail; using GlobalProposal for GlobalProposal.GlobalProposalDetail; enum VoteStatus { Pending, Approved, Executed, Rejected } struct ProposalVote { VoteStatus status; bytes32 hash; uint256 againstVoteWeight; // Total weight of against votes uint256 forVoteWeight; // Total weight of for votes mapping(address => bool) forVoted; mapping(address => bool) againstVoted; mapping(address => Signature) sig; } /// @dev Emitted when a proposal is created event ProposalCreated( uint256 indexed chainId, uint256 indexed round, bytes32 indexed proposalHash, Proposal.ProposalDetail proposal, address creator ); /// @dev Emitted when a proposal is created event GlobalProposalCreated( uint256 indexed round, bytes32 indexed proposalHash, Proposal.ProposalDetail proposal, bytes32 globalProposalHash, GlobalProposal.GlobalProposalDetail globalProposal, address creator ); /// @dev Emitted when the proposal is voted event ProposalVoted(bytes32 indexed proposalHash, address indexed voter, Ballot.VoteType support, uint256 weight); /// @dev Emitted when the proposal is approved event ProposalApproved(bytes32 indexed proposalHash); /// @dev Emitted when the vote is reject event ProposalRejected(bytes32 indexed proposalHash); /// @dev Emitted when the proposal is executed event ProposalExecuted(bytes32 indexed proposalHash); /// @dev Mapping from chain id => vote round /// @notice chain id = 0 for global proposal mapping(uint256 => uint256) public round; /// @dev Mapping from chain id => vote round => proposal vote mapping(uint256 => mapping(uint256 => ProposalVote)) public vote; /** * @dev Creates new round voting for the proposal `_proposalHash` of chain `_chainId`. */ function _createVotingRound(uint256 _chainId, bytes32 _proposalHash) internal returns (uint256 _round) { _round = round[_chainId]++; // Skip checking for the first ever round if (_round > 0) { require(vote[_chainId][_round].status != VoteStatus.Pending, "Governance: current proposal is not completed"); } vote[_chainId][++_round].hash = _proposalHash; } /** * @dev Proposes for a new proposal. * * Requirements: * - The chain id is not equal to 0. * * Emits the `ProposalCreated` event. * */ function _proposeProposal( uint256 _chainId, address[] memory _targets, uint256[] memory _values, bytes[] memory _calldatas, address _creator ) internal virtual returns (uint256 _round) { require(_chainId != 0, "Governance: invalid chain id"); Proposal.ProposalDetail memory _proposal = Proposal.ProposalDetail( round[_chainId] + 1, _chainId, _targets, _values, _calldatas ); _proposal.validate(); bytes32 _proposalHash = _proposal.hash(); _round = _createVotingRound(_chainId, _proposalHash); emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator); } /** * @dev Proposes proposal struct. * * Requirements: * - The chain id is not equal to 0. * - The proposal nonce is equal to the new round. * * Emits the `ProposalCreated` event. * */ function _proposeProposalStruct(Proposal.ProposalDetail memory _proposal, address _creator) internal virtual returns (uint256 _round) { uint256 _chainId = _proposal.chainId; require(_chainId != 0, "Governance: invalid chain id"); _proposal.validate(); bytes32 _proposalHash = _proposal.hash(); _round = _createVotingRound(_chainId, _proposalHash); require(_round == _proposal.nonce, "Governance: invalid proposal nonce"); emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator); } /** * @dev Proposes for a global proposal. * * Emits the `GlobalProposalCreated` event. * */ function _proposeGlobal( GlobalProposal.TargetOption[] calldata _targetOptions, uint256[] memory _values, bytes[] memory _calldatas, address _validatorContract, address _gatewayContract, address _creator ) internal virtual returns (uint256 _round) { GlobalProposal.GlobalProposalDetail memory _globalProposal = GlobalProposal.GlobalProposalDetail( round[0] + 1, _targetOptions, _values, _calldatas ); Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail( _validatorContract, _gatewayContract ); _proposal.validate(); bytes32 _proposalHash = _proposal.hash(); _round = _createVotingRound(0, _proposalHash); emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator); } /** * @dev Proposes global proposal struct. * * Requirements: * - The proposal nonce is equal to the new round. * * Emits the `GlobalProposalCreated` event. * */ function _proposeGlobalStruct( GlobalProposal.GlobalProposalDetail memory _globalProposal, address _validatorContract, address _gatewayContract, address _creator ) internal virtual returns (Proposal.ProposalDetail memory _proposal, uint256 _round) { _proposal = _globalProposal.into_proposal_detail(_validatorContract, _gatewayContract); _proposal.validate(); bytes32 _proposalHash = _proposal.hash(); _round = _createVotingRound(0, _proposalHash); require(_round == _proposal.nonce, "Governance: invalid proposal nonce"); emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator); } /** * @dev Casts vote for the proposal with data and returns whether the voting is done. * * Requirements: * - The proposal nonce is equal to the round. * - The vote is not finalized. * - The voter has not voted for the round. * * Emits the `ProposalVoted` event. Emits the `ProposalApproved`, `ProposalExecuted` or `ProposalRejected` once the * proposal is approved, executed or rejected. * */ function _castVote( Proposal.ProposalDetail memory _proposal, Ballot.VoteType _support, uint256 _minimumForVoteWeight, uint256 _minimumAgainstVoteWeight, address _voter, Signature memory _signature, uint256 _voterWeight ) internal virtual returns (bool _done) { uint256 _chainId = _proposal.chainId; uint256 _round = _proposal.nonce; ProposalVote storage _vote = vote[_chainId][_round]; require(round[_proposal.chainId] == _round, "Governance: query for invalid proposal nonce"); require(_vote.status == VoteStatus.Pending, "Governance: the vote is finalized"); if (_vote.forVoted[_voter] || _vote.againstVoted[_voter]) { revert(string(abi.encodePacked("Governance: ", Strings.toHexString(uint160(_voter), 20), " already voted"))); } _vote.sig[_voter] = _signature; emit ProposalVoted(_vote.hash, _voter, _support, _voterWeight); uint256 _forVoteWeight; uint256 _againstVoteWeight; if (_support == Ballot.VoteType.For) { _vote.forVoted[_voter] = true; _forVoteWeight = _vote.forVoteWeight += _voterWeight; } else if (_support == Ballot.VoteType.Against) { _vote.againstVoted[_voter] = true; _againstVoteWeight = _vote.againstVoteWeight += _voterWeight; } else { revert("Governance: unsupported vote type"); } if (_forVoteWeight >= _minimumForVoteWeight) { _done = true; _vote.status = VoteStatus.Approved; emit ProposalApproved(_vote.hash); if (_proposal.executable()) { _vote.status = VoteStatus.Executed; emit ProposalExecuted(_vote.hash); _proposal.execute(); } } else if (_againstVoteWeight >= _minimumAgainstVoteWeight) { _done = true; _vote.status = VoteStatus.Rejected; emit ProposalRejected(_vote.hash); } } /** * @dev Casts votes by signatures. * * @notice This method does not verify the proposal hash with the vote hash. Please consider checking it before. * */ function _castVotesBySignatures( Proposal.ProposalDetail memory _proposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures, bytes32 _forDigest, bytes32 _againstDigest ) internal { require(_supports.length > 0 && _supports.length == _signatures.length, "Governance: invalid array length"); uint256 _minimumForVoteWeight = _getMinimumVoteWeight(); uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1; address _lastSigner; address _signer; Signature memory _sig; bool _hasValidVotes; for (uint256 _i; _i < _signatures.length; _i++) { _sig = _signatures[_i]; if (_supports[_i] == Ballot.VoteType.For) { _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s); } else if (_supports[_i] == Ballot.VoteType.Against) { _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s); } else { revert("Governance: query for unsupported vote type"); } require(_lastSigner < _signer, "Governance: invalid order"); _lastSigner = _signer; uint256 _weight = _getWeight(_signer); if (_weight > 0) { _hasValidVotes = true; if ( _castVote(_proposal, _supports[_i], _minimumForVoteWeight, _minimumAgainstVoteWeight, _signer, _sig, _weight) ) { return; } } } require(_hasValidVotes, "Governance: invalid signatures"); } /** * @dev Relays votes by signatures. * * @notice Does not store the voter signature into storage. * */ function _relayVotesBySignatures( Proposal.ProposalDetail memory _proposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures, bytes32 _forDigest, bytes32 _againstDigest ) internal { require(_supports.length > 0 && _supports.length == _signatures.length, "Governance: invalid array length"); uint256 _forVoteCount; uint256 _againstVoteCount; address[] memory _forVoteSigners = new address[](_signatures.length); address[] memory _againstVoteSigners = new address[](_signatures.length); { address _signer; address _lastSigner; Ballot.VoteType _support; Signature memory _sig; for (uint256 _i; _i < _signatures.length; _i++) { _sig = _signatures[_i]; _support = _supports[_i]; if (_support == Ballot.VoteType.For) { _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s); _forVoteSigners[_forVoteCount++] = _signer; } else if (_support == Ballot.VoteType.Against) { _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s); _againstVoteSigners[_againstVoteCount++] = _signer; } else { revert("Governance: query for unsupported vote type"); } require(_lastSigner < _signer, "Governance: invalid order"); _lastSigner = _signer; } } assembly { mstore(_forVoteSigners, _forVoteCount) mstore(_againstVoteSigners, _againstVoteCount) } ProposalVote storage _vote = vote[_proposal.chainId][_proposal.nonce]; uint256 _minimumForVoteWeight = _getMinimumVoteWeight(); uint256 _totalForVoteWeight = _getWeights(_forVoteSigners); if (_totalForVoteWeight >= _minimumForVoteWeight) { require(_totalForVoteWeight > 0, "Governance: invalid vote weight"); _vote.status = VoteStatus.Approved; emit ProposalApproved(_vote.hash); if (_proposal.executable()) { _vote.status = VoteStatus.Executed; emit ProposalExecuted(_vote.hash); _proposal.execute(); } return; } uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1; uint256 _totalAgainstVoteWeight = _getWeights(_againstVoteSigners); if (_totalAgainstVoteWeight >= _minimumAgainstVoteWeight) { require(_totalAgainstVoteWeight > 0, "Governance: invalid vote weight"); _vote.status = VoteStatus.Rejected; emit ProposalRejected(_vote.hash); return; } revert("Governance: relay failed"); } /** * @dev Returns weight of the govenor. */ function _getWeight(address _governor) internal view virtual returns (uint256) {} /** * @dev Returns weight of the govenor. */ function _getWeights(address[] memory _governors) internal view virtual returns (uint256) {} /** * @dev Returns total weight from validators. */ function _getTotalWeights() internal view virtual returns (uint256) {} /** * @dev Returns minimum vote to pass a proposal. */ function _getMinimumVoteWeight() internal view virtual returns (uint256) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Governance.sol"; abstract contract ProposalGovernance is Governance { using Proposal for Proposal.ProposalDetail; /** * @dev Proposes a proposal struct and casts votes by signature. */ function _proposeProposalStructAndCastVotes( Proposal.ProposalDetail calldata _proposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures, bytes32 _domainSeparator, address _creator ) internal { _proposeProposalStruct(_proposal, _creator); bytes32 _proposalHash = _proposal.hash(); _castVotesBySignatures( _proposal, _supports, _signatures, ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)), ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against)) ); } /** * @dev Proposes a proposal struct and casts votes by signature. */ function _castProposalBySignatures( Proposal.ProposalDetail calldata _proposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures, bytes32 _domainSeparator ) internal { bytes32 _proposalHash = _proposal.hash(); require( vote[_proposal.chainId][_proposal.nonce].hash == _proposalHash, "GovernanceAdmin: cast vote for invalid proposal" ); _castVotesBySignatures( _proposal, _supports, _signatures, ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)), ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against)) ); } /** * @dev Relays voted proposal. * * Requirements: * - The relay proposal is finalized. * */ function _relayProposal( Proposal.ProposalDetail calldata _proposal, Ballot.VoteType[] calldata _supports, Signature[] calldata _signatures, bytes32 _domainSeparator, address _creator ) internal { _proposeProposalStruct(_proposal, _creator); bytes32 _proposalHash = _proposal.hash(); _relayVotesBySignatures( _proposal, _supports, _signatures, ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)), ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against)) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IQuorum { /// @dev Emitted when the threshold is updated event ThresholdUpdated( uint256 indexed nonce, uint256 indexed numerator, uint256 indexed denominator, uint256 previousNumerator, uint256 previousDenominator ); /** * @dev Returns the threshold. */ function getThreshold() external view returns (uint256 _num, uint256 _denom); /** * @dev Checks whether the `_voteWeight` passes the threshold. */ function checkThreshold(uint256 _voteWeight) external view returns (bool); /** * @dev Returns the minimum vote weight to pass the threshold. */ function minimumVoteWeight() external view returns (uint256); /** * @dev Sets the threshold. * * Requirements: * - The method caller is admin. * * Emits the `ThresholdUpdated` event. * */ function setThreshold(uint256 _numerator, uint256 _denominator) external returns (uint256 _previousNum, uint256 _previousDenom); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IQuorum.sol"; interface IWeightedValidator is IQuorum { struct WeightedValidator { address validator; address governor; uint256 weight; } /// @dev Emitted when the validators are added event ValidatorsAdded(uint256 indexed nonce, WeightedValidator[] validators); /// @dev Emitted when the validators are updated event ValidatorsUpdated(uint256 indexed nonce, WeightedValidator[] validators); /// @dev Emitted when the validators are removed event ValidatorsRemoved(uint256 indexed nonce, address[] validators); /** * @dev Returns validator weight of the validator. */ function getValidatorWeight(address _addr) external view returns (uint256); /** * @dev Returns governor weight of the governor. */ function getGovernorWeight(address _addr) external view returns (uint256); /** * @dev Returns total validator weights of the address list. */ function sumValidatorWeights(address[] calldata _addrList) external view returns (uint256 _weight); /** * @dev Returns total governor weights of the address list. */ function sumGovernorWeights(address[] calldata _addrList) external view returns (uint256 _weight); /** * @dev Returns the validator list attached with governor address and weight. */ function getValidatorInfo() external view returns (WeightedValidator[] memory _list); /** * @dev Returns the validator list. */ function getValidators() external view returns (address[] memory _validators); /** * @dev Returns the validator at `_index` position. */ function validators(uint256 _index) external view returns (WeightedValidator memory); /** * @dev Returns total of validators. */ function totalValidators() external view returns (uint256); /** * @dev Returns total weights. */ function totalWeights() external view returns (uint256); /** * @dev Adds validators. * * Requirements: * - The weights are larger than 0. * - The validators are not added. * - The method caller is admin. * * Emits the `ValidatorsAdded` event. * */ function addValidators(WeightedValidator[] calldata _validators) external; /** * @dev Updates validators. * * Requirements: * - The weights are larger than 0. * - The validators are added. * - The method caller is admin. * * Emits the `ValidatorsUpdated` event. * */ function updateValidators(WeightedValidator[] calldata _validators) external; /** * @dev Removes validators. * * Requirements: * - The validators are added. * - The method caller is admin. * * Emits the `ValidatorsRemoved` event. * */ function removeValidators(address[] calldata _validators) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface SignatureConsumer { struct Signature { uint8 v; bytes32 r; bytes32 s; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; library Ballot { using ECDSA for bytes32; enum VoteType { For, Against } // keccak256("Ballot(bytes32 proposalHash,uint8 support)"); bytes32 public constant BALLOT_TYPEHASH = 0xd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2; function hash(bytes32 _proposalHash, VoteType _support) internal pure returns (bytes32) { return keccak256(abi.encode(BALLOT_TYPEHASH, _proposalHash, _support)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "./Proposal.sol"; library GlobalProposal { using ECDSA for bytes32; enum TargetOption { ValidatorContract, GatewayContract } struct GlobalProposalDetail { // Nonce to make sure proposals are executed in order uint256 nonce; TargetOption[] targetOptions; uint256[] values; bytes[] calldatas; } // keccak256("GlobalProposalDetail(uint256 nonce,uint8[] targetOptions,uint256[] values,bytes[] calldatas)"); bytes32 public constant TYPE_HASH = 0x8c10622d37fe38aa1986961664ce56d7fc08fb17822e2161bf993b3077ef3e35; /** * @dev Returns struct hash of the proposal. */ function hash(GlobalProposalDetail memory _proposal) internal pure returns (bytes32) { bytes32 _targetsHash; bytes32 _valuesHash; bytes32 _calldatasHash; uint256[] memory _values = _proposal.values; TargetOption[] memory _targets = _proposal.targetOptions; bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length); for (uint256 _i; _i < _calldataHashList.length; _i++) { _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]); } assembly { _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32)) _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32)) _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32)) } return keccak256(abi.encode(TYPE_HASH, _proposal.nonce, _targetsHash, _valuesHash, _calldatasHash)); } /** * @dev Converts into the normal proposal. */ function into_proposal_detail( GlobalProposalDetail memory _proposal, address _validatorContract, address _gatewayContract ) internal pure returns (Proposal.ProposalDetail memory _detail) { _detail.nonce = _proposal.nonce; _detail.chainId = 0; _detail.targets = new address[](_proposal.targetOptions.length); _detail.values = _proposal.values; _detail.calldatas = _proposal.calldatas; for (uint256 _i; _i < _proposal.targetOptions.length; _i++) { if (_proposal.targetOptions[_i] == TargetOption.GatewayContract) { _detail.targets[_i] = _gatewayContract; } else if (_proposal.targetOptions[_i] == TargetOption.ValidatorContract) { _detail.targets[_i] = _validatorContract; } else { revert("GlobalProposal: unsupported target"); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; library Proposal { struct ProposalDetail { // Nonce to make sure proposals are executed in order uint256 nonce; // Value 0: all chain should run this proposal // Other values: only specifc chain has to execute uint256 chainId; address[] targets; uint256[] values; bytes[] calldatas; } string internal constant _CALL_ERROR_MESSAGE = "Proposal: call reverted without message"; // keccak256("ProposalDetail(uint256 nonce,uint256 chainId,address[] targets,uint256[] values,bytes[] calldatas)"); bytes32 public constant TYPE_HASH = 0x1f0b22dae207031fb7f9f05ebbc84b1d9360145aefb92e75009d6d320f1fc95a; /** * @dev Validates the proposal. */ function validate(ProposalDetail memory _proposal) internal pure { require( _proposal.targets.length > 0 && _proposal.targets.length == _proposal.values.length && _proposal.targets.length == _proposal.calldatas.length, "Proposal: invalid array length" ); } /** * @dev Returns struct hash of the proposal. */ function hash(ProposalDetail memory _proposal) internal pure returns (bytes32) { bytes32 _targetsHash; bytes32 _valuesHash; bytes32 _calldatasHash; uint256[] memory _values = _proposal.values; address[] memory _targets = _proposal.targets; bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length); for (uint256 _i; _i < _calldataHashList.length; _i++) { _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]); } assembly { _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32)) _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32)) _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32)) } return keccak256(abi.encode(TYPE_HASH, _proposal.nonce, _proposal.chainId, _targetsHash, _valuesHash, _calldatasHash)); } /** * @dev Returns whether the proposal is executable for the current chain. * * @notice Does not check whether the call result is successful or not. Please use `execute` instead. * */ function executable(ProposalDetail memory _proposal) internal view returns (bool _result) { return _proposal.chainId == 0 || _proposal.chainId == block.chainid; } /** * @dev Executes the proposal. */ function execute(ProposalDetail memory _proposal) internal { require(executable(_proposal), "Proposal: query for invalid chainId"); for (uint256 i = 0; i < _proposal.targets.length; ++i) { (bool _success, bytes memory _returndata) = _proposal.targets[i].call{ value: _proposal.values[i] }( _proposal.calldatas[i] ); Address.verifyCallResult(_success, _returndata, _CALL_ERROR_MESSAGE); } } }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 1000 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_roleSetter","type":"address"},{"internalType":"address","name":"_validatorContract","type":"address"},{"internalType":"address","name":"_gatewayContract","type":"address"},{"internalType":"address[]","name":"_relayers","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"GatewayContractUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"proposalHash","type":"bytes32"},{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"indexed":false,"internalType":"struct Proposal.ProposalDetail","name":"proposal","type":"tuple"},{"indexed":false,"internalType":"bytes32","name":"globalProposalHash","type":"bytes32"},{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"enum GlobalProposal.TargetOption[]","name":"targetOptions","type":"uint8[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"indexed":false,"internalType":"struct GlobalProposal.GlobalProposalDetail","name":"globalProposal","type":"tuple"},{"indexed":false,"internalType":"address","name":"creator","type":"address"}],"name":"GlobalProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"proposalHash","type":"bytes32"}],"name":"ProposalApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"chainId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"proposalHash","type":"bytes32"},{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"indexed":false,"internalType":"struct Proposal.ProposalDetail","name":"proposal","type":"tuple"},{"indexed":false,"internalType":"address","name":"creator","type":"address"}],"name":"ProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"proposalHash","type":"bytes32"}],"name":"ProposalExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"proposalHash","type":"bytes32"}],"name":"ProposalRejected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"proposalHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"enum Ballot.VoteType","name":"support","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"ProposalVoted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"ValidatorContractUpdated","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"enum GlobalProposal.TargetOption[]","name":"targetOptions","type":"uint8[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"internalType":"struct GlobalProposal.GlobalProposalDetail","name":"_globalProposal","type":"tuple"},{"internalType":"enum Ballot.VoteType[]","name":"_supports","type":"uint8[]"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct SignatureConsumer.Signature[]","name":"_signatures","type":"tuple[]"}],"name":"castGlobalProposalBySignatures","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"internalType":"struct Proposal.ProposalDetail","name":"_proposal","type":"tuple"},{"internalType":"enum Ballot.VoteType[]","name":"_supports","type":"uint8[]"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct SignatureConsumer.Signature[]","name":"_signatures","type":"tuple[]"}],"name":"castProposalBySignatures","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxy","type":"address"},{"internalType":"address","name":"_newAdmin","type":"address"}],"name":"changeProxyAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gatewayContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_proxy","type":"address"}],"name":"getProxyAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_proxy","type":"address"}],"name":"getProxyImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"uint256","name":"_round","type":"uint256"},{"internalType":"address[]","name":"_voters","type":"address[]"}],"name":"getVotingSignatures","outputs":[{"internalType":"enum Ballot.VoteType[]","name":"_supports","type":"uint8[]"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct SignatureConsumer.Signature[]","name":"_signatures","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chainId","type":"uint256"},{"internalType":"address[]","name":"_targets","type":"address[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"bytes[]","name":"_calldatas","type":"bytes[]"}],"name":"propose","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum GlobalProposal.TargetOption[]","name":"_targetOptions","type":"uint8[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"bytes[]","name":"_calldatas","type":"bytes[]"}],"name":"proposeGlobal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"enum GlobalProposal.TargetOption[]","name":"targetOptions","type":"uint8[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"internalType":"struct GlobalProposal.GlobalProposalDetail","name":"_globalProposal","type":"tuple"},{"internalType":"enum Ballot.VoteType[]","name":"_supports","type":"uint8[]"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct SignatureConsumer.Signature[]","name":"_signatures","type":"tuple[]"}],"name":"proposeGlobalProposalStructAndCastVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"internalType":"struct Proposal.ProposalDetail","name":"_proposal","type":"tuple"},{"internalType":"enum Ballot.VoteType[]","name":"_supports","type":"uint8[]"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct SignatureConsumer.Signature[]","name":"_signatures","type":"tuple[]"}],"name":"proposeProposalStructAndCastVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"enum GlobalProposal.TargetOption[]","name":"targetOptions","type":"uint8[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"internalType":"struct GlobalProposal.GlobalProposalDetail","name":"_globalProposal","type":"tuple"},{"internalType":"enum Ballot.VoteType[]","name":"_supports","type":"uint8[]"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct SignatureConsumer.Signature[]","name":"_signatures","type":"tuple[]"}],"name":"relayGlobalProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"internalType":"struct Proposal.ProposalDetail","name":"_proposal","type":"tuple"},{"internalType":"enum Ballot.VoteType[]","name":"_supports","type":"uint8[]"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct SignatureConsumer.Signature[]","name":"_signatures","type":"tuple[]"}],"name":"relayProposal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"round","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gatewayContract","type":"address"}],"name":"setGatewayContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_validatorContract","type":"address"}],"name":"setValidatorContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"validatorContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"vote","outputs":[{"internalType":"enum Governance.VoteStatus","name":"status","type":"uint8"},{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"uint256","name":"againstVoteWeight","type":"uint256"},{"internalType":"uint256","name":"forVoteWeight","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162004e2038038062004e20833981016040819052620000349162000470565b604080516020808201839052601660608301527f524f4e494e5f474f5645524e414e43455f41444d494e000000000000000000006080808401919091526107e4838501528351808403909101815260a0830184528051908201207f599a80fcaa47b95e2323ab4d34d34e0cc9feda4b843edafcc30c7bdf60ea15bf60c08401527f7e7935007966eb860f4a2ee3dcc9fd53fb3205ce2aa86b0126d4893d4d4c14b960e08401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6610100840152610120808401919091528351808403909101815261014090920190925280519101207ff8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b14620001965760405162461bcd60e51b815260206004820152601f60248201527f476f7665726e616e636541646d696e3a20696e76616c696420646f6d61696e00604482015260640160405180910390fd5b620001a360008562000234565b620001ae8362000244565b620001b98262000299565b60005b81518110156200022957620002147fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc48383815181106200020057620002006200057b565b6020026020010151620002e860201b60201c565b80620002208162000591565b915050620001bc565b5050505050620005bb565b620002408282620002e8565b5050565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906020015b60405180910390a150565b600580546001600160a01b0319166001600160a01b0383169081179091556040519081527f7f0264886136f6ac42676074e865c449ef8d885176adb0bf78f47aeb3674e9ac906020016200028e565b620002ff82826200032b60201b620010411760201c565b600082815260016020908152604090912062000326918390620010df620003cb821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000240576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003873390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620003e2836001600160a01b038416620003eb565b90505b92915050565b60008181526001830160205260408120546200043457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620003e5565b506000620003e5565b80516001600160a01b03811681146200045557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200048757600080fd5b62000492856200043d565b93506020620004a38187016200043d565b9350620004b3604087016200043d565b60608701519093506001600160401b0380821115620004d157600080fd5b818801915088601f830112620004e657600080fd5b815181811115620004fb57620004fb6200045a565b8060051b604051601f19603f830116810181811085821117156200052357620005236200045a565b60405291825284820192508381018501918b8311156200054257600080fd5b938501935b828510156200056b576200055b856200043d565b8452938501939285019262000547565b989b979a50959850505050505050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415620005b457634e487b7160e01b600052601160045260246000fd5b5060010190565b61485580620005cb6000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c806391d1485411610104578063ca15c873116100a2578063eb0cde1d11610071578063eb0cde1d14610498578063eb45b978146104ab578063eb72d5f4146104be578063f3b7dead146104d157600080fd5b8063ca15c8731461044c578063cdf64a761461045f578063d0b6cd0414610472578063d547741f1461048557600080fd5b806399439089116100de57806399439089146103bd578063a217fddf146103d0578063b384abef146103d8578063c426c2501461042b57600080fd5b806391d148541461034c578063926d7d7f1461038357806392f283c0146103aa57600080fd5b806350932cb511610171578063647ecb501161014b578063647ecb50146103005780636a35891b146103135780637eff275e146103265780639010d07c1461033957600080fd5b806350932cb5146102c75780635f844b98146102da5780635f9df13f146102ed57600080fd5b80632f2ff15d116101ad5780632f2ff15d1461025857806334d5f37b1461026d5780633644e5151461028d57806336568abe146102b457600080fd5b806301ffc9a7146101d4578063204e1c7a146101fc578063248a9ca314610227575b600080fd5b6101e76101e23660046139ce565b6104e4565b60405190151581526020015b60405180910390f35b61020f61020a366004613a0d565b610528565b6040516001600160a01b0390911681526020016101f3565b61024a610235366004613a2a565b60009081526020819052604090206001015490565b6040519081526020016101f3565b61026b610266366004613a43565b610625565b005b61024a61027b366004613a2a565b60026020526000908152604090205481565b61024a7ff8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b81565b61026b6102c2366004613a43565b610650565b61026b6102d5366004613a0d565b6106dc565b61026b6102e8366004613b04565b6107b5565b61026b6102fb366004613e0b565b61086e565b61026b61030e366004613b04565b6108ea565b61026b610321366004613e9d565b610932565b61026b610334366004613ee1565b6109c9565b61020f610347366004613f0f565b610b4e565b6101e761035a366004613a43565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61024a7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b61026b6103b8366004613f31565b610b6d565b60045461020f906001600160a01b031681565b61024a600081565b61041b6103e6366004613f0f565b60036020818152600093845260408085209091529183529120805460018201546002830154929093015460ff90911692919084565b6040516101f39493929190613fbc565b61043e610439366004613fec565b610bfa565b6040516101f392919061404f565b61024a61045a366004613a2a565b610df3565b61026b61046d366004613a0d565b610e0a565b61026b610480366004613b04565b610ee0565b61026b610493366004613a43565b610f54565b60055461020f906001600160a01b031681565b61026b6104b9366004613e9d565b610f7a565b61026b6104cc366004613e9d565b610fd4565b61020f6104df366004613a0d565b611002565b60006001600160e01b031982167f5a05180f0000000000000000000000000000000000000000000000000000000014806105225750610522826110f4565b92915050565b6000806000836001600160a01b0316604051610567907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d80600081146105a2576040519150601f19603f3d011682016040523d82523d6000602084013e6105a7565b606091505b5091509150816106095760405162461bcd60e51b815260206004820152602260248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c206661696c604482015261195960f21b60648201526084015b60405180910390fd5b8080602001905181019061061d91906140eb565b949350505050565b600082815260208190526040902060010154610641813361115b565b61064b83836111d9565b505050565b6001600160a01b03811633146106ce5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610600565b6106d882826111fb565b5050565b33301461073b5760405162461bcd60e51b815260206004820152602760248201527f476f7665726e616e636541646d696e3a206f6e6c7920616c6c6f7765642073656044820152661b198b58d85b1b60ca1b6064820152608401610600565b6000816001600160a01b03163b116107a95760405162461bcd60e51b815260206004820152602b60248201527f476f7665726e616e636541646d696e3a206f6e6c7920636f6e7472616374732060448201526a185c9948185b1b1bddd95960aa1b6064820152608401610600565b6107b28161121d565b50565b60006107c03361127f565b1161081d5760405162461bcd60e51b815260206004820152602760248201527f476f7665726e616e636541646d696e3a2073656e646572206973206e6f74206760448201526637bb32b93737b960c91b6064820152608401610600565b60045460055461086691879187918791879187917ff8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b916001600160a01b039081169116336113f7565b505050505050565b60006108793361127f565b116108d65760405162461bcd60e51b815260206004820152602760248201527f476f7665726e616e636541646d696e3a2073656e646572206973206e6f74206760448201526637bb32b93737b960c91b6064820152608401610600565b6108e38484848433611493565b5050505050565b6004546005546108e391879187918791879187917ff8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b916001600160a01b03908116911661158d565b600061093d3361127f565b1161099a5760405162461bcd60e51b815260206004820152602760248201527f476f7665726e616e636541646d696e3a2073656e646572206973206e6f74206760448201526637bb32b93737b960c91b6064820152608401610600565b6108e385858585857ff8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b3361169f565b333014610a285760405162461bcd60e51b815260206004820152602760248201527f476f7665726e616e636541646d696e3a206f6e6c7920616c6c6f7765642073656044820152661b198b58d85b1b60ca1b6064820152608401610600565b604080516001600160a01b0383811660248084019190915283518084039091018152604490920183526020820180516001600160e01b03167f8f283970000000000000000000000000000000000000000000000000000000001790529151600092851691610a9591614138565b6000604051808303816000865af19150503d8060008114610ad2576040519150601f19603f3d011682016040523d82523d6000602084013e610ad7565b606091505b505090508061064b5760405162461bcd60e51b815260206004820152602960248201527f476f7665726e616e636541646d696e3a206368616e67652061646d696e20636160448201527f6c6c206661696c656400000000000000000000000000000000000000000000006064820152608401610600565b6000828152600160205260408120610b6690836116ff565b9392505050565b6000610b783361127f565b11610bd55760405162461bcd60e51b815260206004820152602760248201527f476f7665726e616e636541646d696e3a2073656e646572206973206e6f74206760448201526637bb32b93737b960c91b6064820152608401610600565b6004546005546108e39186918691869186916001600160a01b0390811691163361170b565b600084815260036020908152604080832086845290915281206060918291908467ffffffffffffffff811115610c3257610c32613ba1565b604051908082528060200260200182016040528015610c5b578160200160208202803683370190505b5093508467ffffffffffffffff811115610c7757610c77613ba1565b604051908082528060200260200182016040528015610cc257816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610c955790505b50925060005b85811015610de757868682818110610ce257610ce2614154565b9050602002016020810190610cf79190613a0d565b6001600160a01b038116600090815260058501602052604090205490925060ff1615610d61576001858281518110610d3157610d31614154565b60200260200101906001811115610d4a57610d4a613fa6565b90816001811115610d5d57610d5d613fa6565b9052505b60008981526003602090815260408083208b845282528083206001600160a01b03861684526006018252918290208251606081018452815460ff16815260018201549281019290925260020154918101919091528451859083908110610dc957610dc9614154565b60200260200101819052508080610ddf90614180565b915050610cc8565b50505094509492505050565b600081815260016020526040812061052290611824565b333014610e695760405162461bcd60e51b815260206004820152602760248201527f476f7665726e616e636541646d696e3a206f6e6c7920616c6c6f7765642073656044820152661b198b58d85b1b60ca1b6064820152608401610600565b6000816001600160a01b03163b11610ed75760405162461bcd60e51b815260206004820152602b60248201527f476f7665726e616e636541646d696e3a206f6e6c7920636f6e7472616374732060448201526a185c9948185b1b1bddd95960aa1b6064820152608401610600565b6107b28161182e565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4610f0b813361115b565b60045460055461086691889188918891889188917ff8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b916001600160a01b03908116911633611889565b600082815260208190526040902060010154610f70813361115b565b61064b83836111fb565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4610fa5813361115b565b61086686868686867ff8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b336118e2565b6108e385858585857ff8704f8860d9e985bf6c52ec4738bd10fe31487599b36c0944f746ea09dc256b61192d565b6000806000836001600160a01b0316604051610567907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166106d8576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561109b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610b66836001600160a01b038416611a09565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061052257507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610522565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166106d857611197816001600160a01b03166014611a58565b6111a2836020611a58565b6040516020016111b392919061419b565b60408051601f198184030181529082905262461bcd60e51b825261060091600401614248565b6111e38282611041565b600082815260016020526040902061064b90826110df565b6112058282611c39565b600082815260016020526040902061064b9082611cb8565b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f7f0264886136f6ac42676074e865c449ef8d885176adb0bf78f47aeb3674e9ac906020015b60405180910390a150565b6004546040516001600160a01b0383811660248301526000928392839290911690634bb5274a907fd78392f800000000000000000000000000000000000000000000000000000000906044015b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161130d9190602401614248565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516113469190614138565b600060405180830381855afa9150503d8060008114611381576040519150601f19603f3d011682016040523d82523d6000602084013e611386565b606091505b5091509150816113e35760405162461bcd60e51b815260206004820152602260248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c206661696c604482015261195960f21b6064820152608401610600565b8080602001905181019061061d919061425b565b6114296040518060a0016040528060008152602001600081526020016060815260200160608152602001606081525090565b61143d6114358b614281565b858585611ccd565b509050600061145361144e8c614281565b611dde565b9050611485828b8b8b8b6114718c61146c896000611f32565b611f88565b6114808d61146c8a6001611f32565b611fca565b509998505050505050505050565b6000856114e25760405162461bcd60e51b815260206004820152601c60248201527f476f7665726e616e63653a20696e76616c696420636861696e206964000000006044820152606401610600565b6040805160a0810182526000888152600260205291822054819061150790600161437d565b815260200188815260200187815260200186815260200185815250905061152d816122ff565b60006115388261237e565b905061154488826124bf565b92508083897f3d53769dd1253e37ceefb20fe16fbc7ff25d98e2d0f8c4730236e18500ca9b8c858860405161157a9291906144c3565b60405180910390a4505095945050505050565b60006115a4838361159d8c614281565b91906125be565b905060006115b461144e8b614281565b90506115bf8261237e565b600080805260036020908152845182527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff905260409020600101541461166d5760405162461bcd60e51b815260206004820152602f60248201527f476f7665726e616e636541646d696e3a206361737420766f746520666f72206960448201527f6e76616c69642070726f706f73616c00000000000000000000000000000000006064820152608401610600565b611693828a8a8a8a6116848b61146c896000611f32565b6114808c61146c8a6001611f32565b50505050505050505050565b6116b16116ab886144ee565b826127bb565b5060006116c56116c0896144ee565b61237e565b90506116f56116d3896144ee565b888888886116e68961146c896000611f32565b6114808a61146c8a6001611f32565b5050505050505050565b6000610b6683836128d2565b6040805160808101909152600080805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b5490918291819061175390600161437d565b81526020018a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505050602082018a905260409091018890529091506117aa8287876125be565b90506117b5816122ff565b60006117c08261237e565b90506117cd6000826124bf565b935080847fa20592e99ff3a241c842476c0038aa65ed985d2afaf24247fb501280e3745a56846117fc87611dde565b878a60405161180e9493929190614594565b60405180910390a3505050979650505050505050565b6000610522825490565b6004805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990602001611274565b60006118976114358b614281565b50905060006118a861144e8c614281565b90506118d5828b8b8b8b6118c18c61146c896000611f32565b6118d08d61146c8a6001611f32565b6128fc565b5050505050505050505050565b6118ee6116ab886144ee565b5060006118fd6116c0896144ee565b90506116f561190b896144ee565b8888888861191e8961146c896000611f32565b6118d08a61146c8a6001611f32565b600061193b6116c0886144ee565b60208089013560009081526003825260408082208b358352909252206001015490915081146119d25760405162461bcd60e51b815260206004820152602f60248201527f476f7665726e616e636541646d696e3a206361737420766f746520666f72206960448201527f6e76616c69642070726f706f73616c00000000000000000000000000000000006064820152608401610600565b611a006119de886144ee565b878787876119f18861146c896000611f32565b6114808961146c8a6001611f32565b50505050505050565b6000818152600183016020526040812054611a5057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610522565b506000610522565b60606000611a67836002614655565b611a7290600261437d565b67ffffffffffffffff811115611a8a57611a8a613ba1565b6040519080825280601f01601f191660200182016040528015611ab4576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611aeb57611aeb614154565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611b3657611b36614154565b60200101906001600160f81b031916908160001a9053506000611b5a846002614655565b611b6590600161437d565b90505b6001811115611bea577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611ba657611ba6614154565b1a60f81b828281518110611bbc57611bbc614154565b60200101906001600160f81b031916908160001a90535060049490941c93611be381614674565b9050611b68565b508315610b665760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610600565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156106d8576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610b66836001600160a01b038416612de7565b611cff6040518060a0016040528060008152602001600081526020016060815260200160608152602001606081525090565b6000611d0c8686866125be565b9150611d17826122ff565b6000611d228361237e565b9050611d2f6000826124bf565b83519092508214611d8d5760405162461bcd60e51b815260206004820152602260248201527f476f7665726e616e63653a20696e76616c69642070726f706f73616c206e6f6e604482015261636560f01b6064820152608401610600565b80827fa20592e99ff3a241c842476c0038aa65ed985d2afaf24247fb501280e3745a5685611dba8b611dde565b8b89604051611dcc9493929190614594565b60405180910390a35094509492505050565b600080600080600085604001519050600086602001519050600087606001515167ffffffffffffffff811115611e1657611e16613ba1565b604051908082528060200260200182016040528015611e3f578160200160208202803683370190505b50905060005b8151811015611ea25788606001518181518110611e6457611e64614154565b602002602001015180519060200120828281518110611e8557611e85614154565b602090810291909101015280611e9a81614180565b915050611e45565b508151602090810281840120845182028583012083518302848401208b51604080517f8c10622d37fe38aa1986961664ce56d7fc08fb17822e2161bf993b3077ef3e3596810196909652850152606084018390526080840182905260a084018190529198509650945060c0015b604051602081830303815290604052805190602001209650505050505050919050565b604051600090611f6a907fd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2908590859060200161468b565b60405160208183030381529060405280519060200120905092915050565b6040517f190100000000000000000000000000000000000000000000000000000000000060208201526022810183905260428101829052600090606201611f6a565b8415801590611fd857508483145b6120245760405162461bcd60e51b815260206004820181905260248201527f476f7665726e616e63653a20696e76616c6964206172726179206c656e6774686044820152606401610600565b600061202e612eda565b905060008161203b613037565b61204591906146b0565b61205090600161437d565b604080516060810182526000808252602082018190529181018290529192509081906000805b898110156122a2578a8a8281811061209057612090614154565b9050606002018036038101906120a691906146c7565b925060008d8d838181106120bc576120bc614154565b90506020020160208101906120d1919061472f565b60018111156120e2576120e2613fa6565b141561210757612100898460000151856020015186604001516130a3565b93506121cd565b60018d8d8381811061211b5761211b614154565b9050602002016020810190612130919061472f565b600181111561214157612141613fa6565b141561215f57612100888460000151856020015186604001516130a3565b60405162461bcd60e51b815260206004820152602b60248201527f476f7665726e616e63653a20717565727920666f7220756e737570706f72746560448201527f6420766f746520747970650000000000000000000000000000000000000000006064820152608401610600565b836001600160a01b0316856001600160a01b03161061222e5760405162461bcd60e51b815260206004820152601960248201527f476f7665726e616e63653a20696e76616c6964206f72646572000000000000006044820152606401610600565b839450600061223c8561127f565b9050801561228f576001925061227d8f8f8f8581811061225e5761225e614154565b9050602002016020810190612273919061472f565b8a8a8989876130cb565b1561228f575050505050505050611a00565b508061229a81614180565b915050612076565b50806122f05760405162461bcd60e51b815260206004820152601e60248201527f476f7665726e616e63653a20696e76616c6964207369676e61747572657300006044820152606401610600565b50505050505050505050505050565b600081604001515111801561231d5750806060015151816040015151145b80156123325750806080015151816040015151145b6107b25760405162461bcd60e51b815260206004820152601e60248201527f50726f706f73616c3a20696e76616c6964206172726179206c656e67746800006044820152606401610600565b600080600080600085606001519050600086604001519050600087608001515167ffffffffffffffff8111156123b6576123b6613ba1565b6040519080825280602002602001820160405280156123df578160200160208202803683370190505b50905060005b8151811015612442578860800151818151811061240457612404614154565b60200260200101518051906020012082828151811061242557612425614154565b60209081029190910101528061243a81614180565b9150506123e5565b508151602090810283820120845182028583012083518302848401208b518c850151604080517f1f0b22dae207031fb7f9f05ebbc84b1d9360145aefb92e75009d6d320f1fc95a9781019790975286019190915260608501526080840183905260a0840182905260c084018190529198509650945060e001611f0f565b6000828152600260205260408120805490826124da83614180565b909155509050801561258757600083815260036020818152604080842085855290915282205460ff169081111561251357612513613fa6565b14156125875760405162461bcd60e51b815260206004820152602d60248201527f476f7665726e616e63653a2063757272656e742070726f706f73616c2069732060448201527f6e6f7420636f6d706c65746564000000000000000000000000000000000000006064820152608401610600565b600083815260036020526040812083916125a084614180565b93508381526020019081526020016000206001018190555092915050565b6125f06040518060a0016040528060008152602001600081526020016060815260200160608152602001606081525090565b8351815260006020808301919091528401515167ffffffffffffffff81111561261b5761261b613ba1565b604051908082528060200260200182016040528015612644578160200160208202803683370190505b50604080830191909152840151606080830191909152840151608082015260005b8460200151518110156127b35760018560200151828151811061268a5761268a614154565b602002602001015160018111156126a3576126a3613fa6565b14156126e55782826040015182815181106126c0576126c0614154565b60200260200101906001600160a01b031690816001600160a01b0316815250506127a1565b6000856020015182815181106126fd576126fd614154565b6020026020010151600181111561271657612716613fa6565b14156127335783826040015182815181106126c0576126c0614154565b60405162461bcd60e51b815260206004820152602260248201527f476c6f62616c50726f706f73616c3a20756e737570706f72746564207461726760448201527f65740000000000000000000000000000000000000000000000000000000000006064820152608401610600565b806127ab81614180565b915050612665565b509392505050565b6020820151600090806128105760405162461bcd60e51b815260206004820152601c60248201527f476f7665726e616e63653a20696e76616c696420636861696e206964000000006044820152606401610600565b612819846122ff565b60006128248561237e565b905061283082826124bf565b8551909350831461288e5760405162461bcd60e51b815260206004820152602260248201527f476f7665726e616e63653a20696e76616c69642070726f706f73616c206e6f6e604482015261636560f01b6064820152608401610600565b8083837f3d53769dd1253e37ceefb20fe16fbc7ff25d98e2d0f8c4730236e18500ca9b8c88886040516128c29291906144c3565b60405180910390a4505092915050565b60008260000182815481106128e9576128e9614154565b9060005260206000200154905092915050565b841580159061290a57508483145b6129565760405162461bcd60e51b815260206004820181905260248201527f476f7665726e616e63653a20696e76616c6964206172726179206c656e6774686044820152606401610600565b600080808567ffffffffffffffff81111561297357612973613ba1565b60405190808252806020026020018201604052801561299c578160200160208202803683370190505b50905060008667ffffffffffffffff8111156129ba576129ba613ba1565b6040519080825280602002602001820160405280156129e3578160200160208202803683370190505b5060408051606081018252600080825260208201819052918101829052919250908190819060005b8b811015612ba5578c8c82818110612a2557612a25614154565b905060600201803603810190612a3b91906146c7565b91508e8e82818110612a4f57612a4f614154565b9050602002016020810190612a64919061472f565b92506000836001811115612a7a57612a7a613fa6565b1415612add57612a988b8360000151846020015185604001516130a3565b945084878a612aa681614180565b9b5081518110612ab857612ab8614154565b60200260200101906001600160a01b031690816001600160a01b031681525050612b2f565b6001836001811115612af157612af1613fa6565b141561215f57612b0f8a8360000151846020015185604001516130a3565b9450848689612b1d81614180565b9a5081518110612ab857612ab8614154565b846001600160a01b0316846001600160a01b031610612b905760405162461bcd60e51b815260206004820152601960248201527f476f7665726e616e63653a20696e76616c6964206f72646572000000000000006044820152606401610600565b84935080612b9d81614180565b915050612a0b565b50505085845250508281526020808c015160009081526003825260408082208e51835290925290812090612bd7612eda565b90506000612be48561350a565b9050818110612cd25760008111612c3d5760405162461bcd60e51b815260206004820152601f60248201527f476f7665726e616e63653a20696e76616c696420766f746520776569676874006044820152606401610600565b825460ff1916600190811784558301546040517f5c819725ea53655a3b898f3df59b66489761935454e9212ca1e5ebd759953d0b90600090a2612c7f8e613557565b15612cc657825460ff1916600217835560018301546040517f7b1bcf1ccf901a11589afff5504d59fd0a53780eed2a952adade0348985139e090600090a2612cc68e613571565b50505050505050611a00565b600082612cdd613037565b612ce791906146b0565b612cf290600161437d565b90506000612cff8661350a565b9050818110612d9f5760008111612d585760405162461bcd60e51b815260206004820152601f60248201527f476f7665726e616e63653a20696e76616c696420766f746520776569676874006044820152606401610600565b845460ff1916600317855560018501546040517f55295d4ce992922fa2e5ffbf3a3dcdb367de0a15e125ace083456017fd22060f90600090a2505050505050505050611a00565b60405162461bcd60e51b815260206004820152601860248201527f476f7665726e616e63653a2072656c6179206661696c656400000000000000006044820152606401610600565b60008181526001830160205260408120548015612ed0576000612e0b6001836146b0565b8554909150600090612e1f906001906146b0565b9050818114612e84576000866000018281548110612e3f57612e3f614154565b9060005260206000200154905080876000018481548110612e6257612e62614154565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612e9557612e9561474c565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610522565b6000915050610522565b6004805460408051928352602480840182526020840180516001600160e01b03167f7de5dedd000000000000000000000000000000000000000000000000000000001790529051600093849384936001600160a01b0390911692634bb5274a92612f4692909101614248565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051612f7f9190614138565b600060405180830381855afa9150503d8060008114612fba576040519150601f19603f3d011682016040523d82523d6000602084013e612fbf565b606091505b50915091508161301c5760405162461bcd60e51b815260206004820152602260248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c206661696c604482015261195960f21b6064820152608401610600565b80806020019051810190613030919061425b565b9250505090565b6004805460408051928352602480840182526020840180516001600160e01b03167f926323d5000000000000000000000000000000000000000000000000000000001790529051600093849384936001600160a01b0390911692634bb5274a92612f4692909101614248565b60008060006130b4878787876136ed565b915091506130c1816137da565b5095945050505050565b602080880180518951600082815260038552604080822083835286528082209451825260029095529384205491929091821461316f5760405162461bcd60e51b815260206004820152602c60248201527f476f7665726e616e63653a20717565727920666f7220696e76616c696420707260448201527f6f706f73616c206e6f6e636500000000000000000000000000000000000000006064820152608401610600565b6000815460ff16600381111561318757613187613fa6565b146131fa5760405162461bcd60e51b815260206004820152602160248201527f476f7665726e616e63653a2074686520766f74652069732066696e616c697a6560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610600565b6001600160a01b038716600090815260048201602052604090205460ff168061323d57506001600160a01b038716600090815260058201602052604090205460ff165b1561326657613256876001600160a01b03166014611a58565b6040516020016111b39190614762565b6001600160a01b03871660008181526006830160209081526040918290208951815460ff191660ff909116178155908901516001808301919091558983015160029092019190915583015490517f1203f9e81c814a35f5f4cc24087b2a24c6fb7986a9f1406b68a9484882c93a23906132e2908e908a906147ce565b60405180910390a3600080808c600181111561330057613300613fa6565b141561334c576001600160a01b03891660009081526004840160205260408120805460ff1916600117905560038401805489929061333f90849061437d565b925050819055915061341a565b60018c600181111561336057613360613fa6565b14156133ac576001600160a01b03891660009081526005840160205260408120805460ff1916600117905560028401805489929061339f90849061437d565b925050819055905061341a565b60405162461bcd60e51b815260206004820152602160248201527f476f7665726e616e63653a20756e737570706f7274656420766f74652074797060448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610600565b8a82106134b457825460ff19166001908117845580840154604051919750907f5c819725ea53655a3b898f3df59b66489761935454e9212ca1e5ebd759953d0b90600090a26134688d613557565b156134af57825460ff1916600217835560018301546040517f7b1bcf1ccf901a11589afff5504d59fd0a53780eed2a952adade0348985139e090600090a26134af8d613571565b6134fa565b8981106134fa57825460ff19166003178355600180840154604051919750907f55295d4ce992922fa2e5ffbf3a3dcdb367de0a15e125ace083456017fd22060f90600090a25b5050505050979650505050505050565b600454604051600091829182916001600160a01b031690634bb5274a907f5f14a1c300000000000000000000000000000000000000000000000000000000906112cc9088906024016147e5565b600081602001516000148061052257505060200151461490565b61357a81613557565b6135ec5760405162461bcd60e51b815260206004820152602360248201527f50726f706f73616c3a20717565727920666f7220696e76616c6964206368616960448201527f6e496400000000000000000000000000000000000000000000000000000000006064820152608401610600565b60005b8160400151518110156106d8576000808360400151838151811061361557613615614154565b60200260200101516001600160a01b03168460600151848151811061363c5761363c614154565b60200260200101518560800151858151811061365a5761365a614154565b602002602001015160405161366f9190614138565b60006040518083038185875af1925050503d80600081146136ac576040519150601f19603f3d011682016040523d82523d6000602084013e6136b1565b606091505b50915091506136d982826040518060600160405280602781526020016147f960279139613995565b505050806136e690614180565b90506135ef565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561372457506000905060036137d1565b8460ff16601b1415801561373c57508460ff16601c14155b1561374d57506000905060046137d1565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156137a1573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166137ca576000600192509250506137d1565b9150600090505b94509492505050565b60008160048111156137ee576137ee613fa6565b14156137f75750565b600181600481111561380b5761380b613fa6565b14156138595760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610600565b600281600481111561386d5761386d613fa6565b14156138bb5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610600565b60038160048111156138cf576138cf613fa6565b14156139285760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610600565b600481600481111561393c5761393c613fa6565b14156107b25760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610600565b606083156139a4575081610b66565b8251156139b45782518084602001fd5b8160405162461bcd60e51b81526004016106009190614248565b6000602082840312156139e057600080fd5b81356001600160e01b031981168114610b6657600080fd5b6001600160a01b03811681146107b257600080fd5b600060208284031215613a1f57600080fd5b8135610b66816139f8565b600060208284031215613a3c57600080fd5b5035919050565b60008060408385031215613a5657600080fd5b823591506020830135613a68816139f8565b809150509250929050565b60008083601f840112613a8557600080fd5b50813567ffffffffffffffff811115613a9d57600080fd5b6020830191508360208260051b8501011115613ab857600080fd5b9250929050565b60008083601f840112613ad157600080fd5b50813567ffffffffffffffff811115613ae957600080fd5b602083019150836020606083028501011115613ab857600080fd5b600080600080600060608688031215613b1c57600080fd5b853567ffffffffffffffff80821115613b3457600080fd5b908701906080828a031215613b4857600080fd5b90955060208701359080821115613b5e57600080fd5b613b6a89838a01613a73565b90965094506040880135915080821115613b8357600080fd5b50613b9088828901613abf565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff81118282101715613bda57613bda613ba1565b60405290565b60405160a0810167ffffffffffffffff81118282101715613bda57613bda613ba1565b604051601f8201601f1916810167ffffffffffffffff81118282101715613c2c57613c2c613ba1565b604052919050565b600067ffffffffffffffff821115613c4e57613c4e613ba1565b5060051b60200190565b600082601f830112613c6957600080fd5b81356020613c7e613c7983613c34565b613c03565b82815260059290921b84018101918181019086841115613c9d57600080fd5b8286015b84811015613cc1578035613cb4816139f8565b8352918301918301613ca1565b509695505050505050565b600082601f830112613cdd57600080fd5b81356020613ced613c7983613c34565b82815260059290921b84018101918181019086841115613d0c57600080fd5b8286015b84811015613cc15780358352918301918301613d10565b6000601f8381840112613d3957600080fd5b82356020613d49613c7983613c34565b82815260059290921b85018101918181019087841115613d6857600080fd5b8287015b84811015613dff57803567ffffffffffffffff80821115613d8d5760008081fd5b818a0191508a603f830112613da25760008081fd5b85820135604082821115613db857613db8613ba1565b613dc9828b01601f19168901613c03565b92508183528c81838601011115613de05760008081fd5b8181850189850137506000908201870152845250918301918301613d6c565b50979650505050505050565b60008060008060808587031215613e2157600080fd5b84359350602085013567ffffffffffffffff80821115613e4057600080fd5b613e4c88838901613c58565b94506040870135915080821115613e6257600080fd5b613e6e88838901613ccc565b93506060870135915080821115613e8457600080fd5b50613e9187828801613d27565b91505092959194509250565b600080600080600060608688031215613eb557600080fd5b853567ffffffffffffffff80821115613ecd57600080fd5b9087019060a0828a031215613b4857600080fd5b60008060408385031215613ef457600080fd5b8235613eff816139f8565b91506020830135613a68816139f8565b60008060408385031215613f2257600080fd5b50508035926020909101359150565b60008060008060608587031215613f4757600080fd5b843567ffffffffffffffff80821115613f5f57600080fd5b613f6b88838901613a73565b90965094506020870135915080821115613f8457600080fd5b613f9088838901613ccc565b93506040870135915080821115613e8457600080fd5b634e487b7160e01b600052602160045260246000fd5b6080810160048610613fd057613fd0613fa6565b9481526020810193909352604083019190915260609091015290565b6000806000806060858703121561400257600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561402757600080fd5b61403387828801613a73565b95989497509550505050565b600281106107b2576107b2613fa6565b6040808252835182820181905260009190606090818501906020808901865b838110156140935781516140818161403f565b8552938201939082019060010161406e565b5050868303818801528751808452888201938201925060005b818110156140dc578451805160ff16855283810151848601528701518785015293820193928501926001016140ac565b50919998505050505050505050565b6000602082840312156140fd57600080fd5b8151610b66816139f8565b60005b8381101561412357818101518382015260200161410b565b83811115614132576000848401525b50505050565b6000825161414a818460208701614108565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156141945761419461416a565b5060010190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516141d3816017850160208801614108565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614210816028840160208801614108565b01602801949350505050565b60008151808452614234816020860160208601614108565b601f01601f19169290920160200192915050565b602081526000610b66602083018461421c565b60006020828403121561426d57600080fd5b5051919050565b600281106107b257600080fd5b60006080823603121561429357600080fd5b61429b613bb7565b8235815260208084013567ffffffffffffffff808211156142bb57600080fd5b9085019036601f8301126142ce57600080fd5b81356142dc613c7982613c34565b81815260059190911b830184019084810190368311156142fb57600080fd5b938501935b8285101561432257843561431381614274565b82529385019390850190614300565b8086880152505050604086013592508083111561433e57600080fd5b61434a36848801613ccc565b6040850152606086013592508083111561436357600080fd5b505061437136828601613d27565b60608301525092915050565b600082198211156143905761439061416a565b500190565b600081518084526020808501945080840160005b838110156143ce5781516001600160a01b0316875295820195908201906001016143a9565b509495945050505050565b600081518084526020808501945080840160005b838110156143ce578151875295820195908201906001016143ed565b600081518084526020808501808196508360051b8101915082860160005b8581101561445157828403895261443f84835161421c565b98850198935090840190600101614427565b5091979650505050505050565b80518252602081015160208301526000604082015160a0604085015261448760a0850182614395565b9050606083015184820360608601526144a082826143d9565b915050608083015184820360808601526144ba8282614409565b95945050505050565b6040815260006144d6604083018561445e565b90506001600160a01b03831660208301529392505050565b600060a0823603121561450057600080fd5b614508613be0565b8235815260208301356020820152604083013567ffffffffffffffff8082111561453157600080fd5b61453d36838701613c58565b6040840152606085013591508082111561455657600080fd5b61456236838701613ccc565b6060840152608085013591508082111561457b57600080fd5b5061458836828601613d27565b60808301525092915050565b6080815260006145a7608083018761445e565b602083810187905283820360408501528551825285810151608083830181905281519084018190529082019060009060a08501905b808310156146055783516145ef8161403f565b82529284019260019290920191908401906145dc565b5060408901519350848103604086015261461f81856143d9565b93505050506060860151828203606084015261463b8282614409565b93505050506144ba60608301846001600160a01b03169052565b600081600019048311821515161561466f5761466f61416a565b500290565b6000816146835761468361416a565b506000190190565b83815260208101839052606081016146a28361403f565b826040830152949350505050565b6000828210156146c2576146c261416a565b500390565b6000606082840312156146d957600080fd5b6040516060810181811067ffffffffffffffff821117156146fc576146fc613ba1565b604052823560ff8116811461471057600080fd5b8152602083810135908201526040928301359281019290925250919050565b60006020828403121561474157600080fd5b8135610b6681614274565b634e487b7160e01b600052603160045260246000fd5b7f476f7665726e616e63653a20000000000000000000000000000000000000000081526000825161479a81600c850160208701614108565b7f20616c726561647920766f746564000000000000000000000000000000000000600c939091019283015250601a01919050565b604081016147db8461403f565b9281526020015290565b602081526000610b66602083018461439556fe50726f706f73616c3a2063616c6c20726576657274656420776974686f7574206d657373616765a2646970667358221220c28eab14ff0470057da7065e328116827a2515bbd7a67e8e99e02459971528ed64736f6c634300080900330000000000000000000000002da02ac5f19ae362a4121718d990e655eb628d960000000000000000000000009ecbb8dbff5d32643fe308b399cef26d384875ba00000000000000000000000064192819ac13ef72bf6b5ae239ac672b43a9af0800000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005000000000000000000000000bb772579dfe08f7c7c73daca0a414fca4c9e57ac000000000000000000000000e5eb222996967be79468c28ba39d665fd96e8b3000000000000000000000000025c54079263cbfa7f095f7119ee8ec01d1da6534000000000000000000000000aabd1f9ba401f4c56f7717c71c4fd9369dacf7ce0000000000000000000000001fe5f98a40602fc002d57ea803c2d6951649d637
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002da02ac5f19ae362a4121718d990e655eb628d960000000000000000000000009ecbb8dbff5d32643fe308b399cef26d384875ba00000000000000000000000064192819ac13ef72bf6b5ae239ac672b43a9af0800000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005000000000000000000000000bb772579dfe08f7c7c73daca0a414fca4c9e57ac000000000000000000000000e5eb222996967be79468c28ba39d665fd96e8b3000000000000000000000000025c54079263cbfa7f095f7119ee8ec01d1da6534000000000000000000000000aabd1f9ba401f4c56f7717c71c4fd9369dacf7ce0000000000000000000000001fe5f98a40602fc002d57ea803c2d6951649d637
-----Decoded View---------------
Arg [0] : _roleSetter (address): 0x2DA02aC5f19Ae362a4121718d990e655eB628D96
Arg [1] : _validatorContract (address): 0x9EcbB8dBfF5D32643fe308B399ceF26d384875BA
Arg [2] : _gatewayContract (address): 0x64192819Ac13Ef72bF6b5AE239AC672B43a9AF08
Arg [3] : _relayers (address[]): 0xBB772579Dfe08f7C7c73daCa0A414fCA4C9e57Ac,0xE5EB222996967BE79468C28bA39D665fd96E8b30,0x25c54079263cbFA7f095F7119Ee8EC01D1Da6534,0xaaBD1f9bA401F4C56F7717c71C4fD9369Dacf7cE,0x1FE5F98A40602Fc002d57EA803C2d6951649d637
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000002da02ac5f19ae362a4121718d990e655eb628d96
Arg [1] : 0000000000000000000000009ecbb8dbff5d32643fe308b399cef26d384875ba
Arg [2] : 00000000000000000000000064192819ac13ef72bf6b5ae239ac672b43a9af08
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [5] : 000000000000000000000000bb772579dfe08f7c7c73daca0a414fca4c9e57ac
Arg [6] : 000000000000000000000000e5eb222996967be79468c28ba39d665fd96e8b30
Arg [7] : 00000000000000000000000025c54079263cbfa7f095f7119ee8ec01d1da6534
Arg [8] : 000000000000000000000000aabd1f9ba401f4c56f7717c71c4fd9369dacf7ce
Arg [9] : 0000000000000000000000001fe5f98a40602fc002d57ea803c2d6951649d637
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.