Source Code
Overview
S Balance
More Info
ContractCreator
Multichain Info
N/A
Latest 12 from a total of 12 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
Amount
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set Threshold | 9951467 | 7 days ago | IN | 0 S | 0.00073225 | ||||
| Set Threshold | 7551909 | 37 days ago | IN | 0 S | 0.0001161 | ||||
| Set Threshold | 7551904 | 37 days ago | IN | 0 S | 0.0001161 | ||||
| Set Threshold | 5003705 | 70 days ago | IN | 0 S | 0.00027011 | ||||
| Set Threshold | 5003704 | 70 days ago | IN | 0 S | 0.0001161 | ||||
| Set Threshold | 4955010 | 71 days ago | IN | 0 S | 0.0001931 | ||||
| Grant Role | 3892266 | 86 days ago | IN | 0 S | 0.00011141 | ||||
| Set Threshold | 2158081 | 109 days ago | IN | 0 S | 0.00011609 | ||||
| Set Threshold | 1721141 | 115 days ago | IN | 0 S | 0.00042423 | ||||
| Set Threshold | 1721134 | 115 days ago | IN | 0 S | 0.00044304 | ||||
| Grant Role | 1719033 | 115 days ago | IN | 0 S | 0.00013021 | ||||
| Grant Role | 1718992 | 115 days ago | IN | 0 S | 0.00013022 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | Amount | ||
|---|---|---|---|---|---|---|
| 7070479 | 44 days ago | 0 S | ||||
| 7070479 | 44 days ago | 0 S | ||||
| 7070479 | 44 days ago | 0 S | ||||
| 7070027 | 44 days ago | 0 S | ||||
| 7070027 | 44 days ago | 0 S | ||||
| 7070027 | 44 days ago | 0 S | ||||
| 6527602 | 50 days ago | 0 S | ||||
| 6527602 | 50 days ago | 0 S | ||||
| 6527602 | 50 days ago | 0 S | ||||
| 6527228 | 51 days ago | 0 S | ||||
| 6527228 | 51 days ago | 0 S | ||||
| 6527228 | 51 days ago | 0 S | ||||
| 6525800 | 51 days ago | 0 S | ||||
| 6525800 | 51 days ago | 0 S | ||||
| 6525800 | 51 days ago | 0 S | ||||
| 5894931 | 59 days ago | 0 S | ||||
| 5894931 | 59 days ago | 0 S | ||||
| 5894931 | 59 days ago | 0 S | ||||
| 5893606 | 59 days ago | 0 S | ||||
| 5893606 | 59 days ago | 0 S | ||||
| 5893606 | 59 days ago | 0 S | ||||
| 5893273 | 59 days ago | 0 S | ||||
| 5893273 | 59 days ago | 0 S | ||||
| 5893273 | 59 days ago | 0 S | ||||
| 5891548 | 59 days ago | 0 S |
Loading...
Loading
Contract Name:
Receiver
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
import "../interfaces/IReceiver.sol";
contract Receiver is IReceiver, AccessControlEnumerable {
using Address for address;
using EnumerableSet for EnumerableSet.AddressSet;
using EnumerableMap for EnumerableMap.Bytes32ToUintMap;
/// @dev bridge role id
bytes32 public constant RECEIVER_ROLE = keccak256("RECEIVER_ROLE");
/// @dev operator role id
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
/// @dev hash -> receiver's addresses from where hash received
mapping(bytes32 => EnumerableSet.AddressSet) internal _receivesCount;
/// @dev hash -> data
mapping(bytes32 => bytes) public payload;
/// @dev protocol -> threshold
EnumerableMap.Bytes32ToUintMap private _threshold;
/// @dev hash -> execute status
mapping(bytes32 => bool) public executedData;
/// @dev receivers count
uint8 public receiversCount;
event ThresholdSet(bytes32[] sender, uint64[] chainIdFrom, uint8[] threshold);
event ReceiverCountSet(uint8 receiverCount);
event RequestExecuted(bytes32 requestId);
event Received(address receiver, bytes32 requestId, bool isHash);
constructor() {
_grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
receiversCount = 1;
}
/**
* @notice Sets multiple sender's threshold. Must be the same on the sender's side.
*
* @param sender The protocol contract addresses;
* @param chainIdFrom The chain id from for the given contract addresses.
* @param threshold_ The thresholds for the given contract addresses.
*/
function setThreshold(bytes32[] memory sender, uint64[] memory chainIdFrom, uint8[] memory threshold_) external onlyRole(OPERATOR_ROLE) {
uint8 length = uint8(sender.length);
require(length == threshold_.length, "Receiver: wrong count");
require(length == chainIdFrom.length, "Receiver: wrong count");
for (uint8 i; i < length; ++i) {
require(threshold_[i] >= 1, "Receiver: wrong threshold");
require(threshold_[i] <= receiversCount, "Receiver: wrong threshold");
_threshold.set(_packKey(sender[i], chainIdFrom[i]), threshold_[i]);
}
emit ThresholdSet(sender, chainIdFrom, threshold_);
}
/**
* @notice Sets enabled bridges count.
*
* @param receiversCount_ The bridges count.
*/
function setReceiversCount(uint8 receiversCount_) external onlyRole(OPERATOR_ROLE) {
require(receiversCount_ >= 1, "Receiver: wrong receivers count");
uint256 thresholdLength_ = thresholdLength();
uint8 threshold_;
for(uint32 i; i < thresholdLength_; ++i) {
(, threshold_) = thresholdAt(i);
require(threshold_ <= receiversCount_, "Receiver: threshold bigger than receiversCount");
}
receiversCount = receiversCount_;
emit ReceiverCountSet(receiversCount_);
}
/**
* @notice Get threshold for given address.
*
* @param sender sender address
*/
function getThreshold(bytes32 sender, uint64 chainIdFrom) public view returns (uint8) {
(bool exists, uint256 value) = _threshold.tryGet(_packKey(sender, chainIdFrom));
require(exists, "Receiver: Threshold not set");
return uint8(value);
}
/**
* @notice Get threshold at index.
*
* @param index index
*/
function thresholdAt(uint256 index) public view returns (bytes32, uint8) {
(bytes32 key, uint256 value) = _threshold.at(index);
return (key, uint8(value));
}
function thresholdLength() public view returns (uint256) {
return _threshold.length();
}
/**
* @dev Receive full data.
*
* @param sender Source sender
* @param receivedData Received data
*/
function receiveData(bytes32 sender, uint64 chainIdFrom, bytes memory receivedData, bytes32 requestId) external onlyRole(RECEIVER_ROLE) {
uint8 threshold_ = getThreshold(sender, chainIdFrom);
require(threshold_ > 0, "Receiver: threshold is not set");
bytes32 hashKey = _generateHashKey(keccak256(receivedData), sender, requestId);
if(!_receivesCount[hashKey].contains(msg.sender)) {
_receivesCount[hashKey].add(msg.sender);
}
uint256 targetThreshold = getThreshold(sender, chainIdFrom);
if(targetThreshold == 1) {
uint256 currentThreshold = _receivesCount[hashKey].length();
_execute(currentThreshold, targetThreshold, receivedData, hashKey, requestId);
} else {
if (payload[hashKey].length == 0) {
payload[hashKey] = receivedData;
}
}
emit Received(msg.sender, requestId, false);
}
/**
* @dev Receive hash of data
*
* @param sender Source sender
* @param receivedHash Received hash
*/
function receiveHash(bytes32 sender, uint64 chainIdFrom, bytes32 receivedHash, bytes32 requestId) external onlyRole(RECEIVER_ROLE) {
uint8 threshold_ = getThreshold(sender, chainIdFrom);
require(threshold_ > 0, "Receiver: threshold is not set");
bytes32 hashKey = _generateHashKey(receivedHash, sender, requestId);
require(!_receivesCount[hashKey].contains(msg.sender), "Receiver: already received");
_receivesCount[hashKey].add(msg.sender);
emit Received(msg.sender, requestId, true);
}
/**
* @dev Execute if enough threshold
*
* @param hash_ hash
* @param sender_ source chain bridge caller
* @param requestId_ request id
*/
function execute(bytes32 hash_, bytes32 sender_, uint64 chainIdFrom, bytes32 requestId_) public {
bytes32 hashKey = _generateHashKey(hash_, sender_, requestId_);
bytes memory receivedData = payload[hashKey];
require(receivedData.length != 0, "Receiver: data not received");
if (!_execute(_receivesCount[hashKey].length(), getThreshold(sender_, chainIdFrom), receivedData, hashKey, requestId_)) {
revert("Receiver: not executed");
}
}
/**
* @dev Returns list of receivers
*
* @param hash_ hash
* @param sender_ sender address
* @param requestId_ request id
*/
function hashReceivers(bytes32 hash_, bytes32 sender_, bytes32 requestId_) public view returns (address[] memory) {
bytes32 hashKey = _generateHashKey(hash_, sender_, requestId_);
return _receivesCount[hashKey].values();
}
/**
* @dev Make threshold check and after two calls to executor contract. First for check, second for execute.
*
* @param currentThreshold current threshold
* @param targetThreshold target threshold
* @param receivedData data, which fill be decoded and executed
* @param hashKey hash key consisting of hash, protocol and requestId
*/
function _execute(
uint256 currentThreshold,
uint256 targetThreshold,
bytes memory receivedData,
bytes32 hashKey,
bytes32 requestId
) internal returns(bool) {
require(executedData[hashKey] == false, "Receiver: already executed");
if (currentThreshold >= targetThreshold) {
if (receivedData.length == 0) {
return false;
}
executedData[hashKey] = true;
(
bytes memory data,
bytes memory check,
uint256 nonce,
bytes32 executor_
) = abi.decode(receivedData, (bytes, bytes, uint256, bytes32));
address executor = address(uint160(uint256(executor_)));
bytes memory result = executor.functionCall(check);
require(abi.decode(result, (bool)), "Receiver: check failed");
executor.functionCall(data, "Receiver: receive failed");
_eraseEnumerableSet(_receivesCount[hashKey]);
delete _receivesCount[hashKey];
delete payload[hashKey];
emit RequestExecuted(requestId);
return true;
}
}
function _eraseEnumerableSet(EnumerableSet.AddressSet storage set) internal {
for (uint256 i = set.length(); i > 0; i--) {
set.remove(set.at(i - 1));
}
}
function _generateHashKey(bytes32 hash_, bytes32 sender_, bytes32 requestId_) internal pure returns(bytes32) {
return keccak256(abi.encode(hash_, sender_, requestId_));
}
function _packKey(bytes32 sender_, uint64 chainId_) internal pure returns(bytes32) {
return keccak256(abi.encode(sender_, chainId_));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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:
*
* ```solidity
* 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}:
*
* ```solidity
* 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. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
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);
_;
}
/**
* @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 `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @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(account),
" 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.
*
* May emit a {RoleGranted} event.
*/
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.
*
* May emit a {RoleRevoked} event.
*/
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`.
*
* May emit a {RoleRevoked} event.
*/
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.
*
* May emit a {RoleGranted} event.
*
* [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.
*
* May emit a {RoleGranted} event.
*/
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.
*
* May emit a {RoleRevoked} event.
*/
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.9.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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-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/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 (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableMap.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.
pragma solidity ^0.8.0;
import "./EnumerableSet.sol";
/**
* @dev Library for managing an enumerable variant of Solidity's
* https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
* type.
*
* Maps have the following properties:
*
* - Entries are added, removed, and checked for existence in constant time
* (O(1)).
* - Entries are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
* ```
*
* The following map types are supported:
*
* - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
* - `address -> uint256` (`AddressToUintMap`) since v4.6.0
* - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
* - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
* - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableMap.
* ====
*/
library EnumerableMap {
using EnumerableSet for EnumerableSet.Bytes32Set;
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses private functions, and user-facing
// implementations (such as Uint256ToAddressMap) are just wrappers around
// the underlying Map.
// This means that we can only create new EnumerableMaps for types that fit
// in bytes32.
struct Bytes32ToBytes32Map {
// Storage of keys
EnumerableSet.Bytes32Set _keys;
mapping(bytes32 => bytes32) _values;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {
map._values[key] = value;
return map._keys.add(key);
}
/**
* @dev Removes a key-value pair from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
delete map._values[key];
return map._keys.remove(key);
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
return map._keys.contains(key);
}
/**
* @dev Returns the number of key-value pairs in the map. O(1).
*/
function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
return map._keys.length();
}
/**
* @dev Returns the key-value pair stored at position `index` in the map. O(1).
*
* Note that there are no guarantees on the ordering of entries inside the
* array, and it may change when more entries are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {
bytes32 key = map._keys.at(index);
return (key, map._values[key]);
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
bytes32 value = map._values[key];
if (value == bytes32(0)) {
return (contains(map, key), bytes32(0));
} else {
return (true, value);
}
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
return value;
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
Bytes32ToBytes32Map storage map,
bytes32 key,
string memory errorMessage
) internal view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || contains(map, key), errorMessage);
return value;
}
/**
* @dev Return the an array containing all the keys
*
* 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) {
return map._keys.values();
}
// UintToUintMap
struct UintToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {
return set(map._inner, bytes32(key), bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {
return remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {
return contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. 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(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (uint256(key), uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(key)));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(key), errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(UintToUintMap storage map) internal view returns (uint256[] memory) {
bytes32[] memory store = keys(map._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintToAddressMap
struct UintToAddressMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
return contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToAddressMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (uint256(key), address(uint160(uint256(value))));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
return (success, address(uint160(uint256(value))));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
return address(uint160(uint256(get(map._inner, bytes32(key)))));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
UintToAddressMap storage map,
uint256 key,
string memory errorMessage
) internal view returns (address) {
return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));
}
/**
* @dev Return the an array containing all the keys
*
* 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) {
bytes32[] memory store = keys(map._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressToUintMap
struct AddressToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) {
return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(AddressToUintMap storage map, address key) internal returns (bool) {
return remove(map._inner, bytes32(uint256(uint160(key))));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(AddressToUintMap storage map, address key) internal view returns (bool) {
return contains(map._inner, bytes32(uint256(uint160(key))));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(AddressToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. 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(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (address(uint160(uint256(key))), uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(AddressToUintMap storage map, address key) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(uint256(uint160(key)))));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
AddressToUintMap storage map,
address key,
string memory errorMessage
) internal view returns (uint256) {
return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(AddressToUintMap storage map) internal view returns (address[] memory) {
bytes32[] memory store = keys(map._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// Bytes32ToUintMap
struct Bytes32ToUintMap {
Bytes32ToBytes32Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {
return set(map._inner, key, bytes32(value));
}
/**
* @dev Removes a value from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {
return remove(map._inner, key);
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) {
return contains(map._inner, key);
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
return length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the map. 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(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {
(bytes32 key, bytes32 value) = at(map._inner, index);
return (key, uint256(value));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
(bool success, bytes32 value) = tryGet(map._inner, key);
return (success, uint256(value));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
return uint256(get(map._inner, key));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(
Bytes32ToUintMap storage map,
bytes32 key,
string memory errorMessage
) internal view returns (uint256) {
return uint256(get(map._inner, key, errorMessage));
}
/**
* @dev Return the an array containing all the keys
*
* 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) {
bytes32[] memory store = keys(map._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
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.
*
* ```solidity
* 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.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
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) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// 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;
/// @solidity memory-safe-assembly
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 in 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;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
interface IReceiver {
function receiveData(bytes32 sender, uint64 chainIdFrom, bytes memory receivedData, bytes32 requestId) external;
function receiveHash(bytes32 sender, uint64 chainIdFrom, bytes32 receivedHash, bytes32 requestId) external;
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"isHash","type":"bool"}],"name":"Received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"receiverCount","type":"uint8"}],"name":"ReceiverCountSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"RequestExecuted","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":"bytes32[]","name":"sender","type":"bytes32[]"},{"indexed":false,"internalType":"uint64[]","name":"chainIdFrom","type":"uint64[]"},{"indexed":false,"internalType":"uint8[]","name":"threshold","type":"uint8[]"}],"name":"ThresholdSet","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RECEIVER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash_","type":"bytes32"},{"internalType":"bytes32","name":"sender_","type":"bytes32"},{"internalType":"uint64","name":"chainIdFrom","type":"uint64"},{"internalType":"bytes32","name":"requestId_","type":"bytes32"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"executedData","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"chainIdFrom","type":"uint64"}],"name":"getThreshold","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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":"bytes32","name":"hash_","type":"bytes32"},{"internalType":"bytes32","name":"sender_","type":"bytes32"},{"internalType":"bytes32","name":"requestId_","type":"bytes32"}],"name":"hashReceivers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"payload","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"chainIdFrom","type":"uint64"},{"internalType":"bytes","name":"receivedData","type":"bytes"},{"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"receiveData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"chainIdFrom","type":"uint64"},{"internalType":"bytes32","name":"receivedHash","type":"bytes32"},{"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"receiveHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"receiversCount","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","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":"uint8","name":"receiversCount_","type":"uint8"}],"name":"setReceiversCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"sender","type":"bytes32[]"},{"internalType":"uint64[]","name":"chainIdFrom","type":"uint64[]"},{"internalType":"uint8[]","name":"threshold_","type":"uint8[]"}],"name":"setThreshold","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":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"thresholdAt","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"thresholdLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b506200001f60003362000032565b6008805460ff1916600117905562000170565b6200003e82826200005d565b6000828152600160205260409020620000589082620000fe565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000fa576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000b93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600062000115836001600160a01b0384166200011e565b90505b92915050565b6000818152600183016020526040812054620001675750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000118565b50600062000118565b61247b80620001806000396000f3fe608060405234801561001057600080fd5b506004361061014c5760003560e01c806391d14854116100c3578063ca15c8731161007c578063ca15c87314610337578063d547741f1461034a578063e314214d1461035d578063e9feaf0614610365578063f137538b14610378578063f5b541a61461038b57600080fd5b806391d14854146102af5780639d5e3c9d146102c25780639e17403b146102d55780639f165a87146102fc578063a217fddf1461031c578063c1d8212d1461032457600080fd5b80632f4c1eec116101155780632f4c1eec146101f5578063360ed9c21461021f57806336568abe1461023e5780633f73016f1461025157806358fe64ee146102715780639010d07c1461028457600080fd5b80622809bd1461015157806301ffc9a714610189578063164aa5c31461019c578063248a9ca3146101b15780632f2ff15d146101e2575b600080fd5b61017461015f366004611aa0565b60076020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b610174610197366004611ab9565b6103b2565b6101af6101aa366004611af9565b6103dd565b005b6101d46101bf366004611aa0565b60009081526020819052604090206001015490565b604051908152602001610180565b6101af6101f0366004611b14565b610559565b610208610203366004611aa0565b610583565b6040805192835260ff909116602083015201610180565b60085461022c9060ff1681565b60405160ff9091168152602001610180565b6101af61024c366004611b14565b61059f565b61026461025f366004611b50565b61061d565b6040516101809190611b7c565b6101af61027f366004611be1565b61064f565b610297610292366004611c1c565b6107b1565b6040516001600160a01b039091168152602001610180565b6101746102bd366004611b14565b6107d0565b6101af6102d0366004611c3e565b6107f9565b6101d47f7a97506be97703960d71e3a118f1850a50b01da6957110e8293eacb08d8c606081565b61030f61030a366004611aa0565b610972565b6040516101809190611ccb565b6101d4600081565b61022c610332366004611cde565b610a0c565b6101d4610345366004611aa0565b610a7f565b6101af610358366004611b14565b610a96565b6101d4610abb565b6101af610373366004611e49565b610acc565b6101af610386366004611f4e565b610d49565b6101d47f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b60006001600160e01b03198216635a05180f60e01b14806103d757506103d782610eed565b92915050565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92961040781610f22565b60018260ff1610156104605760405162461bcd60e51b815260206004820152601f60248201527f52656365697665723a2077726f6e672072656365697665727320636f756e740060448201526064015b60405180910390fd5b600061046a610abb565b90506000805b828163ffffffff16101561050d5761048d8163ffffffff16610583565b92505060ff80861690831611156104fd5760405162461bcd60e51b815260206004820152602e60248201527f52656365697665723a207468726573686f6c6420626967676572207468616e2060448201526d1c9958d95a5d995c9cd0dbdd5b9d60921b6064820152608401610457565b61050681612001565b9050610470565b506008805460ff191660ff86169081179091556040519081527fad69f39a472e811a67d908edb2289cef7e7c483f98be25cd00456eeb3ffd0c2a9060200160405180910390a150505050565b60008281526020819052604090206001015461057481610f22565b61057e8383610f2f565b505050565b6000808080610593600486610f51565b90969095509350505050565b6001600160a01b038116331461060f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610457565b6106198282610f6f565b5050565b6060600061062c858585610f91565b600081815260026020526040902090915061064690610fc8565b95945050505050565b7f7a97506be97703960d71e3a118f1850a50b01da6957110e8293eacb08d8c606061067981610f22565b60006106858686610a0c565b905060008160ff16116106da5760405162461bcd60e51b815260206004820152601e60248201527f52656365697665723a207468726573686f6c64206973206e6f742073657400006044820152606401610457565b60006106e7858886610f91565b60008181526002602052604090209091506107029033610fd5565b1561074f5760405162461bcd60e51b815260206004820152601a60248201527f52656365697665723a20616c72656164792072656365697665640000000000006044820152606401610457565b60008181526002602052604090206107679033610ff7565b50604080513381526020810186905260018183015290517f05a8cf3f8b7b63de36cba6657ba54e06272d840f8a36a13a9f9d46721bca06a19181900360600190a150505050505050565b60008281526001602052604081206107c9908361100c565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610806858584610f91565b60008181526003602052604081208054929350909161082490612024565b80601f016020809104026020016040519081016040528092919081815260200182805461085090612024565b801561089d5780601f106108725761010080835404028352916020019161089d565b820191906000526020600020905b81548152906001019060200180831161088057829003601f168201915b5050505050905080516000036108f55760405162461bcd60e51b815260206004820152601b60248201527f52656365697665723a2064617461206e6f7420726563656976656400000000006044820152606401610457565b60008281526002602052604090206109259061091090611018565b61091a8787610a0c565b60ff16838587611022565b61096a5760405162461bcd60e51b8152602060048201526016602482015275149958d95a5d995c8e881b9bdd08195e1958dd5d195960521b6044820152606401610457565b505050505050565b6003602052600090815260409020805461098b90612024565b80601f01602080910402602001604051908101604052809291908181526020018280546109b790612024565b8015610a045780601f106109d957610100808354040283529160200191610a04565b820191906000526020600020905b8154815290600101906020018083116109e757829003601f168201915b505050505081565b6000806000610a26610a1e8686611225565b60049061126b565b9150915081610a775760405162461bcd60e51b815260206004820152601b60248201527f52656365697665723a205468726573686f6c64206e6f742073657400000000006044820152606401610457565b949350505050565b60008181526001602052604081206103d790611018565b600082815260208190526040902060010154610ab181610f22565b61057e8383610f6f565b6000610ac7600461127a565b905090565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929610af681610f22565b8351825160ff821614610b435760405162461bcd60e51b8152602060048201526015602482015274149958d95a5d995c8e881ddc9bdb99c818dbdd5b9d605a1b6044820152606401610457565b83518160ff1614610b8e5760405162461bcd60e51b8152602060048201526015602482015274149958d95a5d995c8e881ddc9bdb99c818dbdd5b9d605a1b6044820152606401610457565b60005b8160ff168160ff161015610d06576001848260ff1681518110610bb657610bb661205e565b602002602001015160ff161015610c0b5760405162461bcd60e51b8152602060048201526019602482015278149958d95a5d995c8e881ddc9bdb99c81d1a1c995cda1bdb19603a1b6044820152606401610457565b600854845160ff918216918691908416908110610c2a57610c2a61205e565b602002602001015160ff161115610c7f5760405162461bcd60e51b8152602060048201526019602482015278149958d95a5d995c8e881ddc9bdb99c81d1a1c995cda1bdb19603a1b6044820152606401610457565b610cf5610cc4878360ff1681518110610c9a57610c9a61205e565b6020026020010151878460ff1681518110610cb757610cb761205e565b6020026020010151611225565b858360ff1681518110610cd957610cd961205e565b602002602001015160ff1660046112859092919063ffffffff16565b50610cff81612074565b9050610b91565b507fb3a8c333726ed3eddc241dca233e7a10992b103dcbdddf41ca3b65cbfb604e35858585604051610d3a939291906120d1565b60405180910390a15050505050565b7f7a97506be97703960d71e3a118f1850a50b01da6957110e8293eacb08d8c6060610d7381610f22565b6000610d7f8686610a0c565b905060008160ff1611610dd45760405162461bcd60e51b815260206004820152601e60248201527f52656365697665723a207468726573686f6c64206973206e6f742073657400006044820152606401610457565b6000610de885805190602001208886610f91565b6000818152600260205260409020909150610e039033610fd5565b610e21576000818152600260205260409020610e1f9033610ff7565b505b6000610e2d8888610a0c565b60ff16905080600103610e67576000828152600260205260408120610e5190611018565b9050610e60818389868a611022565b5050610ea3565b60008281526003602052604090208054610e8090612024565b9050600003610ea3576000828152600360205260409020610ea187826121af565b505b604080513381526020810187905260008183015290517f05a8cf3f8b7b63de36cba6657ba54e06272d840f8a36a13a9f9d46721bca06a19181900360600190a15050505050505050565b60006001600160e01b03198216637965db0b60e01b14806103d757506301ffc9a760e01b6001600160e01b03198316146103d7565b610f2c8133611292565b50565b610f3982826112eb565b600082815260016020526040902061057e9082610ff7565b6000808080610f60868661136f565b909450925050505b9250929050565b610f79828261139a565b600082815260016020526040902061057e90826113ff565b6040805160208082019590955280820193909352606080840192909252805180840390920182526080909201909152805191012090565b606060006107c983611414565b6001600160a01b038116600090815260018301602052604081205415156107c9565b60006107c9836001600160a01b038416611470565b60006107c983836114bf565b60006103d7825490565b60008281526007602052604081205460ff16156110815760405162461bcd60e51b815260206004820152601a60248201527f52656365697665723a20616c72656164792065786563757465640000000000006044820152606401610457565b84861061064657835160000361109957506000610646565b60008381526007602090815260408220805460ff1916600117905585518291829182916110cc918a018101908a016122b4565b929650909450925090508060006110ec6001600160a01b038316866114e9565b9050808060200190518101906111029190612328565b6111475760405162461bcd60e51b8152602060048201526016602482015275149958d95a5d995c8e8818da1958dac819985a5b195960521b6044820152606401610457565b60408051808201909152601881527f52656365697665723a2072656365697665206661696c656400000000000000006020820152611191906001600160a01b03841690889061152d565b5060008981526002602052604090206111a99061153c565b60008981526002602052604081209081816111c48282611a33565b50505060008a81526003602052604081206111e0925090611a51565b6040518881527fe2a752598b97815acff854b1d0b6d5c7f33b848bcbb541df9b760382872824679060200160405180910390a15060019b9a5050505050505050505050565b6000828260405160200161124d92919091825267ffffffffffffffff16602082015260400190565b60405160208183030381529060405280519060200120905092915050565b6000808080610f608686611582565b60006103d7826115bc565b6000610a778484846115c7565b61129c82826107d0565b610619576112a9816115e4565b6112b48360206115f6565b6040516020016112c592919061234a565b60408051601f198184030181529082905262461bcd60e51b825261045791600401611ccb565b6112f582826107d0565b610619576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561132b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000808061137d858561100c565b600081815260029690960160205260409095205494959350505050565b6113a482826107d0565b15610619576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006107c9836001600160a01b038416611792565b60608160000180548060200260200160405190810160405280929190818152602001828054801561146457602002820191906000526020600020905b815481526020019060010190808311611450575b50505050509050919050565b60008181526001830160205260408120546114b7575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103d7565b5060006103d7565b60008260000182815481106114d6576114d661205e565b9060005260206000200154905092915050565b60606107c9838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250611885565b6060610a778484600085611885565b600061154782611018565b90505b80156106195761156f6115686115616001846123bf565b849061100c565b83906113ff565b508061157a816123d2565b91505061154a565b60008181526002830160205260408120548190806115b1576115a48585611960565b925060009150610f689050565b600192509050610f68565b60006103d782611018565b60008281526002840160205260408120829055610a77848461196c565b60606103d76001600160a01b03831660145b606060006116058360026123e9565b611610906002612400565b67ffffffffffffffff81111561162857611628611d0a565b6040519080825280601f01601f191660200182016040528015611652576020820181803683370190505b509050600360fc1b8160008151811061166d5761166d61205e565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061169c5761169c61205e565b60200101906001600160f81b031916908160001a90535060006116c08460026123e9565b6116cb906001612400565b90505b6001811115611743576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106116ff576116ff61205e565b1a60f81b8282815181106117155761171561205e565b60200101906001600160f81b031916908160001a90535060049490941c9361173c816123d2565b90506116ce565b5083156107c95760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610457565b6000818152600183016020526040812054801561187b5760006117b66001836123bf565b85549091506000906117ca906001906123bf565b905081811461182f5760008660000182815481106117ea576117ea61205e565b906000526020600020015490508087600001848154811061180d5761180d61205e565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061184057611840612413565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103d7565b60009150506103d7565b6060824710156118e65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610457565b600080866001600160a01b031685876040516119029190612429565b60006040518083038185875af1925050503d806000811461193f576040519150601f19603f3d011682016040523d82523d6000602084013e611944565b606091505b509150915061195587838387611978565b979650505050505050565b60006107c983836119f1565b60006107c98383611470565b606083156119e75782516000036119e0576001600160a01b0385163b6119e05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610457565b5081610a77565b610a778383611a09565b600081815260018301602052604081205415156107c9565b815115611a195781518083602001fd5b8060405162461bcd60e51b81526004016104579190611ccb565b5080546000825590600052602060002090810190610f2c9190611a87565b508054611a5d90612024565b6000825580601f10611a6d575050565b601f016020900490600052602060002090810190610f2c91905b5b80821115611a9c5760008155600101611a88565b5090565b600060208284031215611ab257600080fd5b5035919050565b600060208284031215611acb57600080fd5b81356001600160e01b0319811681146107c957600080fd5b803560ff81168114611af457600080fd5b919050565b600060208284031215611b0b57600080fd5b6107c982611ae3565b60008060408385031215611b2757600080fd5b8235915060208301356001600160a01b0381168114611b4557600080fd5b809150509250929050565b600080600060608486031215611b6557600080fd5b505081359360208301359350604090920135919050565b6020808252825182820181905260009190848201906040850190845b81811015611bbd5783516001600160a01b031683529284019291840191600101611b98565b50909695505050505050565b803567ffffffffffffffff81168114611af457600080fd5b60008060008060808587031215611bf757600080fd5b84359350611c0760208601611bc9565b93969395505050506040820135916060013590565b60008060408385031215611c2f57600080fd5b50508035926020909101359150565b60008060008060808587031215611c5457600080fd5b8435935060208501359250611c6b60408601611bc9565b9396929550929360600135925050565b60005b83811015611c96578181015183820152602001611c7e565b50506000910152565b60008151808452611cb7816020860160208601611c7b565b601f01601f19169290920160200192915050565b6020815260006107c96020830184611c9f565b60008060408385031215611cf157600080fd5b82359150611d0160208401611bc9565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d4957611d49611d0a565b604052919050565b600067ffffffffffffffff821115611d6b57611d6b611d0a565b5060051b60200190565b600082601f830112611d8657600080fd5b81356020611d9b611d9683611d51565b611d20565b82815260059290921b84018101918181019086841115611dba57600080fd5b8286015b84811015611ddc57611dcf81611bc9565b8352918301918301611dbe565b509695505050505050565b600082601f830112611df857600080fd5b81356020611e08611d9683611d51565b82815260059290921b84018101918181019086841115611e2757600080fd5b8286015b84811015611ddc57611e3c81611ae3565b8352918301918301611e2b565b600080600060608486031215611e5e57600080fd5b833567ffffffffffffffff80821115611e7657600080fd5b818601915086601f830112611e8a57600080fd5b81356020611e9a611d9683611d51565b82815260059290921b8401810191818101908a841115611eb957600080fd5b948201945b83861015611ed757853582529482019490820190611ebe565b97505087013592505080821115611eed57600080fd5b611ef987838801611d75565b93506040860135915080821115611f0f57600080fd5b50611f1c86828701611de7565b9150509250925092565b600067ffffffffffffffff821115611f4057611f40611d0a565b50601f01601f191660200190565b60008060008060808587031215611f6457600080fd5b84359350611f7460208601611bc9565b9250604085013567ffffffffffffffff811115611f9057600080fd5b8501601f81018713611fa157600080fd5b8035611faf611d9682611f26565b818152886020838501011115611fc457600080fd5b81602084016020830137600091810160200191909152949793965093946060013593505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681810361201a5761201a611feb565b6001019392505050565b600181811c9082168061203857607f821691505b60208210810361205857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600060ff821660ff810361208a5761208a611feb565b60010192915050565b600081518084526020808501945080840160005b838110156120c657815160ff16875295820195908201906001016120a7565b509495945050505050565b606080825284519082018190526000906020906080840190828801845b8281101561210a578151845292840192908401906001016120ee565b5050508381038285015285518082528683019183019060005b8181101561214957835167ffffffffffffffff1683529284019291840191600101612123565b5050848103604086015261215d8187612093565b98975050505050505050565b601f82111561057e57600081815260208120601f850160051c810160208610156121905750805b601f850160051c820191505b8181101561096a5782815560010161219c565b815167ffffffffffffffff8111156121c9576121c9611d0a565b6121dd816121d78454612024565b84612169565b602080601f83116001811461221257600084156121fa5750858301515b600019600386901b1c1916600185901b17855561096a565b600085815260208120601f198616915b8281101561224157888601518255948401946001909101908401612222565b508582101561225f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082601f83011261228057600080fd5b815161228e611d9682611f26565b8181528460208386010111156122a357600080fd5b610a77826020830160208701611c7b565b600080600080608085870312156122ca57600080fd5b845167ffffffffffffffff808211156122e257600080fd5b6122ee8883890161226f565b9550602087015191508082111561230457600080fd5b506123118782880161226f565b604087015160609097015195989097509350505050565b60006020828403121561233a57600080fd5b815180151581146107c957600080fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612382816017850160208801611c7b565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516123b3816028840160208801611c7b565b01602801949350505050565b818103818111156103d7576103d7611feb565b6000816123e1576123e1611feb565b506000190190565b80820281158282048414176103d7576103d7611feb565b808201808211156103d7576103d7611feb565b634e487b7160e01b600052603160045260246000fd5b6000825161243b818460208701611c7b565b919091019291505056fea2646970667358221220eb930b5dbbc9eb92386dc1fafef8a3d23b4bc7f7add065cc18c3744586b7351064736f6c63430008140033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061014c5760003560e01c806391d14854116100c3578063ca15c8731161007c578063ca15c87314610337578063d547741f1461034a578063e314214d1461035d578063e9feaf0614610365578063f137538b14610378578063f5b541a61461038b57600080fd5b806391d14854146102af5780639d5e3c9d146102c25780639e17403b146102d55780639f165a87146102fc578063a217fddf1461031c578063c1d8212d1461032457600080fd5b80632f4c1eec116101155780632f4c1eec146101f5578063360ed9c21461021f57806336568abe1461023e5780633f73016f1461025157806358fe64ee146102715780639010d07c1461028457600080fd5b80622809bd1461015157806301ffc9a714610189578063164aa5c31461019c578063248a9ca3146101b15780632f2ff15d146101e2575b600080fd5b61017461015f366004611aa0565b60076020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b610174610197366004611ab9565b6103b2565b6101af6101aa366004611af9565b6103dd565b005b6101d46101bf366004611aa0565b60009081526020819052604090206001015490565b604051908152602001610180565b6101af6101f0366004611b14565b610559565b610208610203366004611aa0565b610583565b6040805192835260ff909116602083015201610180565b60085461022c9060ff1681565b60405160ff9091168152602001610180565b6101af61024c366004611b14565b61059f565b61026461025f366004611b50565b61061d565b6040516101809190611b7c565b6101af61027f366004611be1565b61064f565b610297610292366004611c1c565b6107b1565b6040516001600160a01b039091168152602001610180565b6101746102bd366004611b14565b6107d0565b6101af6102d0366004611c3e565b6107f9565b6101d47f7a97506be97703960d71e3a118f1850a50b01da6957110e8293eacb08d8c606081565b61030f61030a366004611aa0565b610972565b6040516101809190611ccb565b6101d4600081565b61022c610332366004611cde565b610a0c565b6101d4610345366004611aa0565b610a7f565b6101af610358366004611b14565b610a96565b6101d4610abb565b6101af610373366004611e49565b610acc565b6101af610386366004611f4e565b610d49565b6101d47f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92981565b60006001600160e01b03198216635a05180f60e01b14806103d757506103d782610eed565b92915050565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92961040781610f22565b60018260ff1610156104605760405162461bcd60e51b815260206004820152601f60248201527f52656365697665723a2077726f6e672072656365697665727320636f756e740060448201526064015b60405180910390fd5b600061046a610abb565b90506000805b828163ffffffff16101561050d5761048d8163ffffffff16610583565b92505060ff80861690831611156104fd5760405162461bcd60e51b815260206004820152602e60248201527f52656365697665723a207468726573686f6c6420626967676572207468616e2060448201526d1c9958d95a5d995c9cd0dbdd5b9d60921b6064820152608401610457565b61050681612001565b9050610470565b506008805460ff191660ff86169081179091556040519081527fad69f39a472e811a67d908edb2289cef7e7c483f98be25cd00456eeb3ffd0c2a9060200160405180910390a150505050565b60008281526020819052604090206001015461057481610f22565b61057e8383610f2f565b505050565b6000808080610593600486610f51565b90969095509350505050565b6001600160a01b038116331461060f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610457565b6106198282610f6f565b5050565b6060600061062c858585610f91565b600081815260026020526040902090915061064690610fc8565b95945050505050565b7f7a97506be97703960d71e3a118f1850a50b01da6957110e8293eacb08d8c606061067981610f22565b60006106858686610a0c565b905060008160ff16116106da5760405162461bcd60e51b815260206004820152601e60248201527f52656365697665723a207468726573686f6c64206973206e6f742073657400006044820152606401610457565b60006106e7858886610f91565b60008181526002602052604090209091506107029033610fd5565b1561074f5760405162461bcd60e51b815260206004820152601a60248201527f52656365697665723a20616c72656164792072656365697665640000000000006044820152606401610457565b60008181526002602052604090206107679033610ff7565b50604080513381526020810186905260018183015290517f05a8cf3f8b7b63de36cba6657ba54e06272d840f8a36a13a9f9d46721bca06a19181900360600190a150505050505050565b60008281526001602052604081206107c9908361100c565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610806858584610f91565b60008181526003602052604081208054929350909161082490612024565b80601f016020809104026020016040519081016040528092919081815260200182805461085090612024565b801561089d5780601f106108725761010080835404028352916020019161089d565b820191906000526020600020905b81548152906001019060200180831161088057829003601f168201915b5050505050905080516000036108f55760405162461bcd60e51b815260206004820152601b60248201527f52656365697665723a2064617461206e6f7420726563656976656400000000006044820152606401610457565b60008281526002602052604090206109259061091090611018565b61091a8787610a0c565b60ff16838587611022565b61096a5760405162461bcd60e51b8152602060048201526016602482015275149958d95a5d995c8e881b9bdd08195e1958dd5d195960521b6044820152606401610457565b505050505050565b6003602052600090815260409020805461098b90612024565b80601f01602080910402602001604051908101604052809291908181526020018280546109b790612024565b8015610a045780601f106109d957610100808354040283529160200191610a04565b820191906000526020600020905b8154815290600101906020018083116109e757829003601f168201915b505050505081565b6000806000610a26610a1e8686611225565b60049061126b565b9150915081610a775760405162461bcd60e51b815260206004820152601b60248201527f52656365697665723a205468726573686f6c64206e6f742073657400000000006044820152606401610457565b949350505050565b60008181526001602052604081206103d790611018565b600082815260208190526040902060010154610ab181610f22565b61057e8383610f6f565b6000610ac7600461127a565b905090565b7f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929610af681610f22565b8351825160ff821614610b435760405162461bcd60e51b8152602060048201526015602482015274149958d95a5d995c8e881ddc9bdb99c818dbdd5b9d605a1b6044820152606401610457565b83518160ff1614610b8e5760405162461bcd60e51b8152602060048201526015602482015274149958d95a5d995c8e881ddc9bdb99c818dbdd5b9d605a1b6044820152606401610457565b60005b8160ff168160ff161015610d06576001848260ff1681518110610bb657610bb661205e565b602002602001015160ff161015610c0b5760405162461bcd60e51b8152602060048201526019602482015278149958d95a5d995c8e881ddc9bdb99c81d1a1c995cda1bdb19603a1b6044820152606401610457565b600854845160ff918216918691908416908110610c2a57610c2a61205e565b602002602001015160ff161115610c7f5760405162461bcd60e51b8152602060048201526019602482015278149958d95a5d995c8e881ddc9bdb99c81d1a1c995cda1bdb19603a1b6044820152606401610457565b610cf5610cc4878360ff1681518110610c9a57610c9a61205e565b6020026020010151878460ff1681518110610cb757610cb761205e565b6020026020010151611225565b858360ff1681518110610cd957610cd961205e565b602002602001015160ff1660046112859092919063ffffffff16565b50610cff81612074565b9050610b91565b507fb3a8c333726ed3eddc241dca233e7a10992b103dcbdddf41ca3b65cbfb604e35858585604051610d3a939291906120d1565b60405180910390a15050505050565b7f7a97506be97703960d71e3a118f1850a50b01da6957110e8293eacb08d8c6060610d7381610f22565b6000610d7f8686610a0c565b905060008160ff1611610dd45760405162461bcd60e51b815260206004820152601e60248201527f52656365697665723a207468726573686f6c64206973206e6f742073657400006044820152606401610457565b6000610de885805190602001208886610f91565b6000818152600260205260409020909150610e039033610fd5565b610e21576000818152600260205260409020610e1f9033610ff7565b505b6000610e2d8888610a0c565b60ff16905080600103610e67576000828152600260205260408120610e5190611018565b9050610e60818389868a611022565b5050610ea3565b60008281526003602052604090208054610e8090612024565b9050600003610ea3576000828152600360205260409020610ea187826121af565b505b604080513381526020810187905260008183015290517f05a8cf3f8b7b63de36cba6657ba54e06272d840f8a36a13a9f9d46721bca06a19181900360600190a15050505050505050565b60006001600160e01b03198216637965db0b60e01b14806103d757506301ffc9a760e01b6001600160e01b03198316146103d7565b610f2c8133611292565b50565b610f3982826112eb565b600082815260016020526040902061057e9082610ff7565b6000808080610f60868661136f565b909450925050505b9250929050565b610f79828261139a565b600082815260016020526040902061057e90826113ff565b6040805160208082019590955280820193909352606080840192909252805180840390920182526080909201909152805191012090565b606060006107c983611414565b6001600160a01b038116600090815260018301602052604081205415156107c9565b60006107c9836001600160a01b038416611470565b60006107c983836114bf565b60006103d7825490565b60008281526007602052604081205460ff16156110815760405162461bcd60e51b815260206004820152601a60248201527f52656365697665723a20616c72656164792065786563757465640000000000006044820152606401610457565b84861061064657835160000361109957506000610646565b60008381526007602090815260408220805460ff1916600117905585518291829182916110cc918a018101908a016122b4565b929650909450925090508060006110ec6001600160a01b038316866114e9565b9050808060200190518101906111029190612328565b6111475760405162461bcd60e51b8152602060048201526016602482015275149958d95a5d995c8e8818da1958dac819985a5b195960521b6044820152606401610457565b60408051808201909152601881527f52656365697665723a2072656365697665206661696c656400000000000000006020820152611191906001600160a01b03841690889061152d565b5060008981526002602052604090206111a99061153c565b60008981526002602052604081209081816111c48282611a33565b50505060008a81526003602052604081206111e0925090611a51565b6040518881527fe2a752598b97815acff854b1d0b6d5c7f33b848bcbb541df9b760382872824679060200160405180910390a15060019b9a5050505050505050505050565b6000828260405160200161124d92919091825267ffffffffffffffff16602082015260400190565b60405160208183030381529060405280519060200120905092915050565b6000808080610f608686611582565b60006103d7826115bc565b6000610a778484846115c7565b61129c82826107d0565b610619576112a9816115e4565b6112b48360206115f6565b6040516020016112c592919061234a565b60408051601f198184030181529082905262461bcd60e51b825261045791600401611ccb565b6112f582826107d0565b610619576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561132b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000808061137d858561100c565b600081815260029690960160205260409095205494959350505050565b6113a482826107d0565b15610619576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006107c9836001600160a01b038416611792565b60608160000180548060200260200160405190810160405280929190818152602001828054801561146457602002820191906000526020600020905b815481526020019060010190808311611450575b50505050509050919050565b60008181526001830160205260408120546114b7575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103d7565b5060006103d7565b60008260000182815481106114d6576114d661205e565b9060005260206000200154905092915050565b60606107c9838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250611885565b6060610a778484600085611885565b600061154782611018565b90505b80156106195761156f6115686115616001846123bf565b849061100c565b83906113ff565b508061157a816123d2565b91505061154a565b60008181526002830160205260408120548190806115b1576115a48585611960565b925060009150610f689050565b600192509050610f68565b60006103d782611018565b60008281526002840160205260408120829055610a77848461196c565b60606103d76001600160a01b03831660145b606060006116058360026123e9565b611610906002612400565b67ffffffffffffffff81111561162857611628611d0a565b6040519080825280601f01601f191660200182016040528015611652576020820181803683370190505b509050600360fc1b8160008151811061166d5761166d61205e565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061169c5761169c61205e565b60200101906001600160f81b031916908160001a90535060006116c08460026123e9565b6116cb906001612400565b90505b6001811115611743576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106116ff576116ff61205e565b1a60f81b8282815181106117155761171561205e565b60200101906001600160f81b031916908160001a90535060049490941c9361173c816123d2565b90506116ce565b5083156107c95760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610457565b6000818152600183016020526040812054801561187b5760006117b66001836123bf565b85549091506000906117ca906001906123bf565b905081811461182f5760008660000182815481106117ea576117ea61205e565b906000526020600020015490508087600001848154811061180d5761180d61205e565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061184057611840612413565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103d7565b60009150506103d7565b6060824710156118e65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610457565b600080866001600160a01b031685876040516119029190612429565b60006040518083038185875af1925050503d806000811461193f576040519150601f19603f3d011682016040523d82523d6000602084013e611944565b606091505b509150915061195587838387611978565b979650505050505050565b60006107c983836119f1565b60006107c98383611470565b606083156119e75782516000036119e0576001600160a01b0385163b6119e05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610457565b5081610a77565b610a778383611a09565b600081815260018301602052604081205415156107c9565b815115611a195781518083602001fd5b8060405162461bcd60e51b81526004016104579190611ccb565b5080546000825590600052602060002090810190610f2c9190611a87565b508054611a5d90612024565b6000825580601f10611a6d575050565b601f016020900490600052602060002090810190610f2c91905b5b80821115611a9c5760008155600101611a88565b5090565b600060208284031215611ab257600080fd5b5035919050565b600060208284031215611acb57600080fd5b81356001600160e01b0319811681146107c957600080fd5b803560ff81168114611af457600080fd5b919050565b600060208284031215611b0b57600080fd5b6107c982611ae3565b60008060408385031215611b2757600080fd5b8235915060208301356001600160a01b0381168114611b4557600080fd5b809150509250929050565b600080600060608486031215611b6557600080fd5b505081359360208301359350604090920135919050565b6020808252825182820181905260009190848201906040850190845b81811015611bbd5783516001600160a01b031683529284019291840191600101611b98565b50909695505050505050565b803567ffffffffffffffff81168114611af457600080fd5b60008060008060808587031215611bf757600080fd5b84359350611c0760208601611bc9565b93969395505050506040820135916060013590565b60008060408385031215611c2f57600080fd5b50508035926020909101359150565b60008060008060808587031215611c5457600080fd5b8435935060208501359250611c6b60408601611bc9565b9396929550929360600135925050565b60005b83811015611c96578181015183820152602001611c7e565b50506000910152565b60008151808452611cb7816020860160208601611c7b565b601f01601f19169290920160200192915050565b6020815260006107c96020830184611c9f565b60008060408385031215611cf157600080fd5b82359150611d0160208401611bc9565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d4957611d49611d0a565b604052919050565b600067ffffffffffffffff821115611d6b57611d6b611d0a565b5060051b60200190565b600082601f830112611d8657600080fd5b81356020611d9b611d9683611d51565b611d20565b82815260059290921b84018101918181019086841115611dba57600080fd5b8286015b84811015611ddc57611dcf81611bc9565b8352918301918301611dbe565b509695505050505050565b600082601f830112611df857600080fd5b81356020611e08611d9683611d51565b82815260059290921b84018101918181019086841115611e2757600080fd5b8286015b84811015611ddc57611e3c81611ae3565b8352918301918301611e2b565b600080600060608486031215611e5e57600080fd5b833567ffffffffffffffff80821115611e7657600080fd5b818601915086601f830112611e8a57600080fd5b81356020611e9a611d9683611d51565b82815260059290921b8401810191818101908a841115611eb957600080fd5b948201945b83861015611ed757853582529482019490820190611ebe565b97505087013592505080821115611eed57600080fd5b611ef987838801611d75565b93506040860135915080821115611f0f57600080fd5b50611f1c86828701611de7565b9150509250925092565b600067ffffffffffffffff821115611f4057611f40611d0a565b50601f01601f191660200190565b60008060008060808587031215611f6457600080fd5b84359350611f7460208601611bc9565b9250604085013567ffffffffffffffff811115611f9057600080fd5b8501601f81018713611fa157600080fd5b8035611faf611d9682611f26565b818152886020838501011115611fc457600080fd5b81602084016020830137600091810160200191909152949793965093946060013593505050565b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681810361201a5761201a611feb565b6001019392505050565b600181811c9082168061203857607f821691505b60208210810361205857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600060ff821660ff810361208a5761208a611feb565b60010192915050565b600081518084526020808501945080840160005b838110156120c657815160ff16875295820195908201906001016120a7565b509495945050505050565b606080825284519082018190526000906020906080840190828801845b8281101561210a578151845292840192908401906001016120ee565b5050508381038285015285518082528683019183019060005b8181101561214957835167ffffffffffffffff1683529284019291840191600101612123565b5050848103604086015261215d8187612093565b98975050505050505050565b601f82111561057e57600081815260208120601f850160051c810160208610156121905750805b601f850160051c820191505b8181101561096a5782815560010161219c565b815167ffffffffffffffff8111156121c9576121c9611d0a565b6121dd816121d78454612024565b84612169565b602080601f83116001811461221257600084156121fa5750858301515b600019600386901b1c1916600185901b17855561096a565b600085815260208120601f198616915b8281101561224157888601518255948401946001909101908401612222565b508582101561225f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082601f83011261228057600080fd5b815161228e611d9682611f26565b8181528460208386010111156122a357600080fd5b610a77826020830160208701611c7b565b600080600080608085870312156122ca57600080fd5b845167ffffffffffffffff808211156122e257600080fd5b6122ee8883890161226f565b9550602087015191508082111561230457600080fd5b506123118782880161226f565b604087015160609097015195989097509350505050565b60006020828403121561233a57600080fd5b815180151581146107c957600080fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612382816017850160208801611c7b565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516123b3816028840160208801611c7b565b01602801949350505050565b818103818111156103d7576103d7611feb565b6000816123e1576123e1611feb565b506000190190565b80820281158282048414176103d7576103d7611feb565b808201808211156103d7576103d7611feb565b634e487b7160e01b600052603160045260246000fd5b6000825161243b818460208701611c7b565b919091019291505056fea2646970667358221220eb930b5dbbc9eb92386dc1fafef8a3d23b4bc7f7add065cc18c3744586b7351064736f6c63430008140033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.