Source Code
Overview
S Balance
S Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SymmioFeeDistributor
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: SYMM-Core-Business-Source-License-1.1
// This contract is licensed under the SYMM Core Business Source License 1.1
// Copyright (c) 2023 Symmetry Labs AG
// For more information, see https://docs.symm.io/legal-disclaimer/license
pragma solidity >=0.8.18;
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
interface ISymmioCore {
function withdraw(uint256 amount) external;
function getCollateral() external view returns (address);
function balanceOf(address user) external view returns (uint256);
}
/// @title SymmioFeeDistributor
/// @notice This contract manages the distribution of fees from the Symmio protocol to various stakeholders
/// @dev This contract is upgradeable, pausable, and uses role-based access control
contract SymmioFeeDistributor is Initializable, PausableUpgradeable, AccessControlEnumerableUpgradeable {
using SafeERC20Upgradeable for IERC20Upgradeable;
struct Stakeholder {
address receiver; // The address of the stakeholder
uint256 share; // The share of fees allocated to the stakeholder (in 18 decimal format)
}
// Defining roles for access control
bytes32 public constant COLLECTOR_ROLE = keccak256("COLLECTOR_ROLE");
bytes32 public constant SETTER_ROLE = keccak256("SETTER_ROLE");
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant UNPAUSER_ROLE = keccak256("UNPAUSER_ROLE");
// State variables
/// @notice Address of the Symmio contract
address public symmioAddress;
/// @notice Address of the Symmio fee receiver
address public symmioReceiver;
/// @notice Share of fees allocated to Symmio (in 18 decimal format)
uint256 public symmioShare;
/// @notice Array of stakeholders and their respective shares, including Symmio as the first stakeholder
Stakeholder[] public stakeholders;
/// @notice Total share allocated to stakeholders excluding Symmio (in 18 decimal format)
uint256 private totalStakeholderShare;
// Events
event SymmioAddressUpdated(address indexed oldAddress, address indexed newAddress);
event SymmioStakeholderUpdated(address indexed oldReceiver, address indexed newReceiver, uint256 oldShare, uint256 newShare);
event StakeholdersUpdated(Stakeholder[] newStakeholders);
event FeeDistributed(address indexed receiver, uint256 amount);
event FeesClaimed(uint256 totalAmount);
// Errors
error ZeroAddress();
error InvalidShare();
error TotalSharesMustEqualOne();
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/// @notice Initializes the contract with initial parameters
/// @param admin Address of the admin who will have the DEFAULT_ADMIN_ROLE
/// @param symmioAddress_ Address of the Symmio contract
/// @param symmioReceiver_ Address of the Symmio fee receiver
/// @param symmioShare_ Share of fees allocated to Symmio (in 18 decimal format)
function initialize(
address admin,
address symmioAddress_,
address symmioReceiver_,
uint256 symmioShare_
) public initializer {
if (admin == address(0) || symmioAddress_ == address(0) || symmioReceiver_ == address(0)) revert ZeroAddress();
if (symmioShare_ > 1e18) revert InvalidShare();
__Pausable_init();
__AccessControl_init();
_grantRole(DEFAULT_ADMIN_ROLE, admin);
symmioAddress = symmioAddress_;
symmioReceiver = symmioReceiver_;
symmioShare = symmioShare_;
stakeholders.push(Stakeholder(symmioReceiver_, symmioShare_));
}
/// @notice Sets the address of the Symmio contract
/// @param symmioAddress_ New address of the Symmio contract
function setSymmioAddress(address symmioAddress_) external onlyRole(SETTER_ROLE) {
if (symmioAddress_ == address(0)) revert ZeroAddress();
address oldAddress = symmioAddress;
symmioAddress = symmioAddress_;
emit SymmioAddressUpdated(oldAddress, symmioAddress_);
}
/// @notice Updates the Symmio stakeholder details
/// @param symmioReceiver_ New address of the Symmio fee receiver
/// @param symmioShare_ New share of fees allocated to Symmio (in 18 decimal format)
function setSymmioStakeholder(address symmioReceiver_, uint256 symmioShare_) external onlyRole(SETTER_ROLE) {
if (symmioReceiver_ == address(0)) revert ZeroAddress();
if (symmioShare_ > 1e18) revert InvalidShare();
address oldReceiver = symmioReceiver;
uint256 oldShare = symmioShare;
symmioReceiver = symmioReceiver_;
symmioShare = symmioShare_;
// Update Symmio's stakeholder entry (always at index 0)
stakeholders[0] = Stakeholder(symmioReceiver_, symmioShare_);
emit SymmioStakeholderUpdated(oldReceiver, symmioReceiver_, oldShare, symmioShare_);
}
/// @notice Sets the list of stakeholders and their shares (excluding Symmio)
/// @param newStakeholders Array of new stakeholders and their shares
function setStakeholders(Stakeholder[] calldata newStakeholders) external onlyRole(MANAGER_ROLE) {
// Clear the existing stakeholders list except the first one (Symmio)
delete stakeholders;
// Re-add Symmio as the first stakeholder
stakeholders.push(Stakeholder(symmioReceiver, symmioShare));
uint256 newTotalStakeholderShare = 0;
uint256 len = newStakeholders.length;
for (uint256 i = 0; i < len; i++) {
if (newStakeholders[i].receiver == address(0)) revert ZeroAddress();
newTotalStakeholderShare += newStakeholders[i].share;
stakeholders.push(newStakeholders[i]);
}
// Ensure that the total shares (Symmio's share + other stakeholders) sum up to 1e18 (100%)
if (newTotalStakeholderShare + symmioShare != 1e18) revert TotalSharesMustEqualOne();
totalStakeholderShare = newTotalStakeholderShare;
emit StakeholdersUpdated(newStakeholders);
}
/// @notice Calculates the total claimable fee amount from the Symmio contract, adjusted for token decimals
/// @return The total claimable fee amount
function getClaimable() internal view returns (uint256) {
address collateral = ISymmioCore(symmioAddress).getCollateral();
uint8 decimals = IERC20Metadata(collateral).decimals();
uint256 balance = ISymmioCore(symmioAddress).balanceOf(address(this));
return balance / (10 ** (18 - decimals));
}
/// @notice Claims all available fees and distributes them to stakeholders
function claimAllFee() external onlyRole(COLLECTOR_ROLE) whenNotPaused {
claimFee(getClaimable());
}
/// @notice Claims a specific amount of fees and distributes them to stakeholders
/// @param amount Amount of fees to claim and distribute
function claimFee(uint256 amount) public onlyRole(COLLECTOR_ROLE) whenNotPaused {
// Ensure that the total shares sum up to 100%
if (totalStakeholderShare + symmioShare != 1e18) revert TotalSharesMustEqualOne();
address collateral = ISymmioCore(symmioAddress).getCollateral();
ISymmioCore(symmioAddress).withdraw(amount);
uint256 len = stakeholders.length;
for (uint256 i = 0; i < len; i++) {
uint256 share = (stakeholders[i].share * amount) / 1e18;
IERC20Upgradeable(collateral).safeTransfer(stakeholders[i].receiver, share);
emit FeeDistributed(stakeholders[i].receiver, share);
}
emit FeesClaimed(amount);
}
/// @notice Pauses the contract, disabling certain functions
function pause() external onlyRole(PAUSER_ROLE) whenNotPaused {
_pause();
}
/// @notice Unpauses the contract, enabling functions that were disabled during pause
function unpause() external onlyRole(UNPAUSER_ROLE) {
_unpause();
}
/// @notice Simulates claiming all fees without actually transferring tokens
/// @return holders Array of stakeholder addresses
/// @return shares Array of fee shares corresponding to each stakeholder
function dryClaimAllFee() public view returns (address[] memory holders, uint256[] memory shares) {
uint256 totalClaimable = getClaimable();
uint256 len = stakeholders.length;
holders = new address[](len);
shares = new uint256[](len);
for (uint256 i = 0; i < len; i++) {
holders[i] = stakeholders[i].receiver;
shares[i] = (stakeholders[i].share * totalClaimable) / 1e18;
}
return (holders, shares);
}
/// @notice Returns the number of stakeholders, including Symmio
/// @return The count of stakeholders
function getStakeholderCount() external view returns (uint256) {
return stakeholders.length;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;
function __AccessControlEnumerable_init() internal onlyInitializing {
}
function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerableUpgradeable).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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
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);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).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 ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.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());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
/**
* @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 v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @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 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20Upgradeable.sol";
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20PermitUpgradeable {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20Upgradeable {
using AddressUpgradeable for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20Upgradeable token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20PermitUpgradeable token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));
}
}// 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 AddressUpgradeable {
/**
* @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 (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// 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 IERC165Upgradeable {
/**
* @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 MathUpgradeable {
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 SignedMathUpgradeable {
/**
* @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/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
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 = MathUpgradeable.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(SignedMathUpgradeable.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, MathUpgradeable.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/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 EnumerableSetUpgradeable {
// 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: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}{
"metadata": {
"bytecodeHash": "none"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShare","type":"error"},{"inputs":[],"name":"TotalSharesMustEqualOne","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeeDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"FeesClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","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":[{"components":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"share","type":"uint256"}],"indexed":false,"internalType":"struct SymmioFeeDistributor.Stakeholder[]","name":"newStakeholders","type":"tuple[]"}],"name":"StakeholdersUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"SymmioAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldReceiver","type":"address"},{"indexed":true,"internalType":"address","name":"newReceiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldShare","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newShare","type":"uint256"}],"name":"SymmioStakeholderUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"COLLECTOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNPAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimAllFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"claimFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dryClaimAllFee","outputs":[{"internalType":"address[]","name":"holders","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"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":[],"name":"getStakeholderCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address","name":"admin","type":"address"},{"internalType":"address","name":"symmioAddress_","type":"address"},{"internalType":"address","name":"symmioReceiver_","type":"address"},{"internalType":"uint256","name":"symmioShare_","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"components":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"share","type":"uint256"}],"internalType":"struct SymmioFeeDistributor.Stakeholder[]","name":"newStakeholders","type":"tuple[]"}],"name":"setStakeholders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"symmioAddress_","type":"address"}],"name":"setSymmioAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"symmioReceiver_","type":"address"},{"internalType":"uint256","name":"symmioShare_","type":"uint256"}],"name":"setSymmioStakeholder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakeholders","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symmioAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symmioReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symmioShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608080604052346100c1576000549060ff8260081c1661006f575060ff80821603610034575b6040516125d090816100c78239f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a138610025565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fdfe6040608081526004908136101561001557600080fd5b600091823560e01c90816301569e3a1461189557816301ffc9a7146118225781630421d964146118035781631d6b8b72146117b1578163248a9ca3146117865781632f2ff15d146116ca57816336568abe146116385781633f4ba83a146114955781635c975abb1461147157816364298478146114485781637278b28f1461141f57816383e3f870146114005781638456cb59146112115781638a3bb6b0146110d05781639010d07c1461108f57816391d148541461104857816394a23b5614610e7f5781639ca39ae914610e44578163a2011b3f14610e09578163a217fddf14610dee578163a2b86fd014610c8d578163b3465ab91461081f578163ca15c873146107f7578163cf756fdf1461056a578163d547741f1461052b578163e63ab1e9146104f0578163ec87621c146104b5578163f667526a1461019f575063fb1bb9de1461016257600080fd5b3461019b578160031936011261019b57602090517f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a8152f35b5080fd5b83833461019b57602090816003193601126104b1578335906101bf611b5e565b6101c76122d8565b6101e260ff54670de0b6b3a764000091829160fd5490611f1b565b036104a15760fb548251635c1548fb60e01b8152906001600160a01b0390811686838a81845afa928315610497578893610468575b50803b1561045a5787908186518092632e1a7d4d60e01b8252898d8301528160249586925af1801561045e57908991610446575b505060fe5493885b85811061028757897f83db9dc084973306ecd0b0f10cb495b81dd9ddcc135eb7934d2723bcabc8f4c38a8a8a51908152a180f35b83610366868b8d848c828f8b6103028c6102b0859460018f6102a890611943565b500154611ef2565b049a8b9916956102bf8d611943565b5054166102f486519a8b928b84019563a9059cbb60e01b8752840160209093929193604081019460018060a01b031681520152565b03601f1981018a5289611e1b565b83519761030e89611db9565b8789527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564888a0152519082865af1923d1561043a573d61035961035082611f28565b93519384611e1b565b825281943d92013e6124c6565b80518b8115918215610416575b50509050156103c157906103bc917f6c461460f28af1386f23dc4c0c7f4e2e54f0db320a8edc08803e4b787f6db3258b876103ad85611943565b505416928b51908152a26122a5565b610253565b875162461bcd60e51b8152808d018b9052602a818601527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b8380929350010312610436578a0151801515810361043657808b8f610373565b8b80fd5b505091506060916124c6565b61044f90611deb565b61045a57878a61024b565b8780fd5b86513d8b823e3d90fd5b610489919350873d8911610490575b6104818183611e1b565b81019061231c565b9189610217565b503d610477565b85513d8a823e3d90fd5b8151631f27cbcd60e21b81528690fd5b8280fd5b50503461019b578160031936011261019b57602090517f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b088152f35b50503461019b578160031936011261019b57602090517f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a8152f35b919050346104b157806003193601126104b1576105679135610562600161055061192d565b93838752609760205286200154611c98565b611e69565b80f35b9050346104b15760803660031901126104b157610585611917565b61058d61192d565b6001600160a01b0360443581811692908390036107f2576064359187549560ff8760081c1615958680976107e5575b80156107ce575b1561077457829060ff19988860018b8316178d55610763575b50169081158015610759575b8015610751575b61074357670de0b6b3a764000085116107355750918493929161066f6106a9969361063a60ff8d5460081c1661062481612245565b61062d81612245565b8b60335416603355612245565b6000805260209960978b528b600020826000528b5260ff8c6000205416156106e8575b506000805260c98a528a60002061206a565b506001600160601b0360a01b91168160fb54161760fb5560fc54161760fc558060fd5585519161069e83611db9565b8252848201526121df565b6106b1578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff001984541684555160018152a138808280f35b6000805260978b528b600020826000528b5260018c60002091825416179055338160007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a43861065d565b885163040357dd60e21b8152fd5b885163d92e233d60e01b8152fd5b5085156105ef565b50828416156105e8565b61ffff1916610101178b55386105dc565b885162461bcd60e51b8152602081840152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156105c35750600160ff8916146105c3565b50600160ff8916106105bc565b600080fd5b9050346104b15760203660031901126104b157602092829135815260c9845220549051908152f35b919050346104b157602080600319360112610c895782359167ffffffffffffffff90818411610c855736602385011215610c855783850135918211610c8557602494858501948636918560061b010111610c81577f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0880600052609785528260002033600052855260ff83600020541615610adf575060fe90815488835580610a71575b5060fc5460fd5484516001600160a01b039994926108f192908b166108e683611db9565b8252888201526121df565b889289915b8683106109a457505050670de0b6b3a764000061091560fd5484611f1b565b03610996575060ff55805183815280840183905294858201949392919087905b83821061096657887fe65c633c83fef6d33e93f5fce78a7d412ad9a545453fdfcef33f49889c39d87c8989038aa180f35b9091929394958635908282168092036107f257908152868601358682015283019583019493929160010190610935565b8251631f27cbcd60e21b8152fd5b909193896109bb6109b6878a8d6122b4565b6122c4565b1615610a61576109d990886109d1878a8d6122b4565b013590611f1b565b936109e581888b6122b4565b8254600160401b811015610a4f57610a036001918281018655611943565b929092610a3e57908a828e610a1c610a379796956122c4565b85546001600160a01b031916911617845501359101556122a5565b91906108f6565b634e487b7160e01b8e528d8752858efd5b634e487b7160e01b8d5260418652848dfd5b855163d92e233d60e01b81528490fd5b6001600160ff1b0381168103610acd5782895260017f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513a91811b8201915b828110610abc5750506108c2565b8a8155600082820155600201610aae565b634e487b7160e01b8952601182528789fd5b849087610aeb33611f55565b855191610af783611dff565b60428352848301936060368637835115610c6d57603085538351600190811015610c5957607860218601536041905b808211610bee575050610bbf5750610bbb938693610ba793610b98604894610b6f9a519a856000805160206125a48339815191528d978801528251928391603789019101611d96565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611d96565b01036028810187520185611e1b565b5162461bcd60e51b81529283928301611e3d565b0390fd5b9250505081606494519362461bcd60e51b85528401528201526000805160206125848339815191526044820152fd5b9091600f81166010811015610c45576f181899199a1a9b1b9c1cb0b131b232b360811b901a610c1d8488611f44565b53881c918015610c31576000190190610b26565b8360118a634e487b7160e01b600052526000fd5b8460328b634e487b7160e01b600052526000fd5b82603289634e487b7160e01b600052526000fd5b50634e487b7160e01b600090815260328752fd5b8680fd5b8580fd5b8380fd5b50503461019b578160031936011261019b5790610ca861233b565b60fe5491610cb583612557565b92610cc285519485611e1b565b808452610cce81612557565b601f199360208681019390928601368537610ce881612557565b91610cf589519384611e1b565b818352610d0182612557565b8385019701368837855b828110610d8d57505050865196879681880191885251809152606087019390855b818110610d6d57505050858303868301525180835291810193925b828110610d5657505050500390f35b835185528695509381019392810192600101610d47565b82516001600160a01b031686528998509484019491840191600101610d2c565b80610da2610de1929b95969897999a9b611943565b50546001600160a01b0316610db7828d61256f565b52670de0b6b3a7640000610dd08460016102a885611943565b04610ddb828861256f565b526122a5565b9897969495939298610d0b565b50503461019b578160031936011261019b5751908152602090f35b50503461019b578160031936011261019b57602090517f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda8152f35b50503461019b578160031936011261019b57602090517f14cf45180c3fcf249a5a305e9657ea05c14fd4f4e1800ee0216a8213091711d28152f35b83833461019b578160031936011261019b57610ed690610e9d611b5e565b610ea56122d8565b610ead61233b565b90610eb6611b5e565b610ebe6122d8565b60ff54670de0b6b3a764000093849160fd5490611f1b565b036110395760fb548151635c1548fb60e01b8152602094916001600160a01b0390811686838a81845afa92831561049757889361101a575b50803b1561045a5787908186518092632e1a7d4d60e01b8252898d8301528160249586925af1801561045e57611007575b5060fe5493885b858110610f7a57897f83db9dc084973306ecd0b0f10cb495b81dd9ddcc135eb7934d2723bcabc8f4c38a8a8a51908152a180f35b83610f9b868b8d848c828f8b6103028c6102b0859460018f6102a890611943565b80518b8115918215610fe7575b50509050156103c15790610fe2917f6c461460f28af1386f23dc4c0c7f4e2e54f0db320a8edc08803e4b787f6db3258b876103ad85611943565b610f46565b8380929350010312610436578a0151801515810361043657808b8f610fa8565b61101390989198611deb565b9689610f3f565b611032919350873d8911610490576104818183611e1b565b9189610f0e565b51631f27cbcd60e21b81528490fd5b9050346104b157816003193601126104b1578160209360ff9261106961192d565b90358252609786528282206001600160a01b039091168252855220549151911615158152f35b9050346104b157816003193601126104b1576020926110ba9135815260c98452826024359120612052565b905491519160018060a01b039160031b1c168152f35b83833461019b578060031936011261019b576110ea611917565b90602435906110f7611993565b6001600160a01b0392831692831561120157670de0b6b3a764000083116111f15760fc5460fd54936001600160601b0360a01b868184161760fc558160fd5584519061114282611db9565b878252602082019183835260fe54156111de57899a50859060fe7f07a913db5115d91d281fb20354ed0943d75063be42595fbc0a12d106be3a954e999a9b5251167f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513a91825416179055517f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513b55835195865260208601521692a380f35b634e487b7160e01b8a5260328b5260248afd5b815163040357dd60e21b81528690fd5b815163d92e233d60e01b81528690fd5b8391503461019b578160031936011261019b577f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9081835260209160978352848420338552835260ff8585205416156112ad57837f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25884876112906122d8565b6112986122d8565b600160ff19603354161760335551338152a180f35b6112b993919333611f55565b8551916112c583611dff565b604283528483019360603686378351156113ed57603085538351906001918210156113da5790607860218601536041915b81831161136f5750505061133f57610bbb938693610ba793610b98604894610b6f9a519a856000805160206125a48339815191528d978801528251928391603789019101611d96565b50505080606493519262461bcd60e51b845283015260248201526000805160206125848339815191526044820152fd5b909192600f811660108110156113c7576f181899199a1a9b1b9c1cb0b131b232b360811b901a61139f8588611f44565b53881c9280156113b4576000190191906112f6565b634e487b7160e01b825260118952602482fd5b634e487b7160e01b835260328a52602483fd5b634e487b7160e01b815260328852602490fd5b634e487b7160e01b815260328752602490fd5b50503461019b578160031936011261019b5760209060fd549051908152f35b50503461019b578160031936011261019b5760fb5490516001600160a01b039091168152602090f35b50503461019b578160031936011261019b5760fc5490516001600160a01b039091168152602090f35b50503461019b578160031936011261019b5760209060ff6033541690519015158152f35b83833461019b578160031936011261019b577f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a9081835260209160978352818420338552835260ff82852054161561156057506033549360ff85161561152857507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa929360ff191660335551338152a180f35b82606492519162461bcd60e51b8352820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152fd5b61156d9493919433611f55565b85519161157983611dff565b604283528483019360603686378351156113ed57603085538351906001918210156113da5790607860218601536041915b8183116115f35750505061133f57610bbb938693610ba793610b98604894610b6f9a519a856000805160206125a48339815191528d978801528251928391603789019101611d96565b909192600f811660108110156113c7576f181899199a1a9b1b9c1cb0b131b232b360811b901a6116238588611f44565b53881c9280156113b4576000190191906115aa565b8391503461019b578260031936011261019b5761165361192d565b90336001600160a01b0383160361166f57906105679135611e69565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b919050346104b157806003193601126104b15761173991359060c96116ed61192d565b928086526020906097825261170760018589200154611c98565b808752609782528387206001600160a01b039095168088529482528387205460ff161561173d575b865252832061206a565b5080f35b808752609782528387208588528252838720805460ff191660011790553385827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8a80a461172f565b9050346104b15760203660031901126104b15781602093600192358152609785522001549051908152f35b8391503461019b57602036600319011261019b57359060fe5482101561180057506117db90611943565b50805460019091015491516001600160a01b0390911681526020810191909152604090f35b80fd5b50503461019b578160031936011261019b5760209060fe549051908152f35b9050346104b15760203660031901126104b157359063ffffffff60e01b82168092036104b15760209250635a05180f60e01b8214918215611867575b50519015158152f35b909150637965db0b60e01b8114908115611884575b50903861185e565b6301ffc9a760e01b1490503861187c565b9050346104b15760203660031901126104b1576118b0611917565b906118b9611993565b6001600160a01b0391821692831561190a57505060fb54826001600160601b0360a01b82161760fb55167fce33ad7b64c536bf61b27c59f5188679b6071c49001b094a023ccb6784d6e97a8380a380f35b5163d92e233d60e01b8152fd5b600435906001600160a01b03821682036107f257565b602435906001600160a01b03821682036107f257565b60fe5481101561197d5760fe60005260011b7f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513a0190600090565b634e487b7160e01b600052603260045260246000fd5b3360009081527f0ba47cfd5e746a7a77d10576777b78a793709d8d5c4bbd732c557bc9a64bb31b60209081526040808320549092907f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda9060ff16156119f85750505050565b611a0133611f55565b845191611a0d83611dff565b60428352848301936060368637835115611b4a5760308553835190600191821015611b4a5790607860218601536041915b818311611adc57505050611aac57610b6f938593611a9693611a87604894610bbb995198856000805160206125a48339815191528b978801528251928391603789019101611d96565b01036028810185520183611e1b565b5162461bcd60e51b815291829160048301611e3d565b60648486519062461bcd60e51b825280600483015260248201526000805160206125848339815191526044820152fd5b909192600f81166010811015611b36576f181899199a1a9b1b9c1cb0b131b232b360811b901a611b0c8588611f44565b5360041c928015611b2257600019019190611a3e565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b3360009081527f12aba9df56434305de3225b8d0dc80d46541ec8c143d2b18d08e23aedfbacaf660209081526040808320549092907f14cf45180c3fcf249a5a305e9657ea05c14fd4f4e1800ee0216a8213091711d29060ff1615611bc35750505050565b611bcc33611f55565b845191611bd883611dff565b60428352848301936060368637835115611b4a5760308553835190600191821015611b4a5790607860218601536041915b818311611c5257505050611aac57610b6f938593611a9693611a87604894610bbb995198856000805160206125a48339815191528b978801528251928391603789019101611d96565b909192600f81166010811015611b36576f181899199a1a9b1b9c1cb0b131b232b360811b901a611c828588611f44565b5360041c928015611b2257600019019190611c09565b600081815260209060978252604092838220338352835260ff848320541615611cc15750505050565b611cca33611f55565b845191611cd683611dff565b60428352848301936060368637835115611b4a5760308553835190600191821015611b4a5790607860218601536041915b818311611d5057505050611aac57610b6f938593611a9693611a87604894610bbb995198856000805160206125a48339815191528b978801528251928391603789019101611d96565b909192600f81166010811015611b36576f181899199a1a9b1b9c1cb0b131b232b360811b901a611d808588611f44565b5360041c928015611b2257600019019190611d07565b60005b838110611da95750506000910152565b8181015183820152602001611d99565b6040810190811067ffffffffffffffff821117611dd557604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111611dd557604052565b6080810190811067ffffffffffffffff821117611dd557604052565b90601f8019910116810190811067ffffffffffffffff821117611dd557604052565b60409160208252611e5d8151809281602086015260208686019101611d96565b601f01601f1916010190565b906040611ea79260009080825260976020528282209360018060a01b03169384835260205260ff8383205416611eaa575b815260c9602052206120ef565b50565b808252609760205282822084835260205282822060ff1981541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a4611e9a565b81810292918115918404141715611f0557565b634e487b7160e01b600052601160045260246000fd5b91908201809211611f0557565b67ffffffffffffffff8111611dd557601f01601f191660200190565b90815181101561197d570160200190565b604051906060820182811067ffffffffffffffff821117611dd557604052602a825260208201604036823782511561197d5760309053815160019081101561197d57607860218401536029905b808211611fe4575050611fb25790565b606460405162461bcd60e51b815260206004820152602060248201526000805160206125848339815191526044820152fd5b9091600f8116601081101561203d576f181899199a1a9b1b9c1cb0b131b232b360811b901a6120138486611f44565b5360041c918015612028576000190190611fa2565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b805482101561197d5760005260206000200190600090565b919060018301600090828252806020526040822054156000146120e957845494600160401b8610156120d557836120c56120ae886001604098999a01855584612052565b819391549060031b91821b91600019901b19161790565b9055549382526020522055600190565b634e487b7160e01b83526041600452602483fd5b50925050565b906001820190600092818452826020526040842054908115156000146121d857600019918083018181116121c4578254908482019182116121b05780820361217b575b505050805480156121675782019161214a8383612052565b909182549160031b1b191690555582526020526040812055600190565b634e487b7160e01b86526031600452602486fd5b61219b61218b6120ae9386612052565b90549060031b1c92839286612052565b90558652846020526040862055388080612132565b634e487b7160e01b88526011600452602488fd5b634e487b7160e01b87526011600452602487fd5b5050505090565b60fe54600160401b811015611dd5578060016121fe920160fe55611943565b91909161222f57805182546001600160a01b0319166001600160a01b03919091161782556020015160019190910155565b634e487b7160e01b600052600060045260246000fd5b1561224c57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b6000198114611f055760010190565b919081101561197d5760061b0190565b356001600160a01b03811681036107f25790565b60ff603354166122e457565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b908160209103126107f257516001600160a01b03811681036107f25790565b60fb5460408051635c1548fb60e01b81526004926001600160a01b039160209183169082818781855afa9081156124bb5790839160009161249e575b508686518096819363313ce56760e01b8352165afa92831561249357600093612458575b5090806024928551938480926370a0823160e01b8252308a8301525afa93841561244e575060009361241c575b505060ff1660120360ff81116124075760ff16604d811161240757600a0a9182156123f257500490565b601290634e487b7160e01b6000525260246000fd5b601183634e487b7160e01b6000525260246000fd5b8181949293943d8311612447575b6124348183611e1b565b810103126118005750519060ff386123c8565b503d61242a565b513d6000823e3d90fd5b8281819593953d831161248c575b6124708183611e1b565b8101031261019b57519060ff821682036118005750918161239b565b503d612466565b84513d6000823e3d90fd5b6124b59150823d8411610490576104818183611e1b565b38612377565b85513d6000823e3d90fd5b9192901561252857508151156124da575090565b3b156124e35790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b82519091501561253b5750805190602001fd5b60405162461bcd60e51b8152908190610bbb9060048301611e3d565b67ffffffffffffffff8111611dd55760051b60200190565b805182101561197d5760209160051b01019056fe537472696e67733a20686578206c656e67746820696e73756666696369656e74416363657373436f6e74726f6c3a206163636f756e7420000000000000000000a164736f6c6343000812000a
Deployed Bytecode
0x6040608081526004908136101561001557600080fd5b600091823560e01c90816301569e3a1461189557816301ffc9a7146118225781630421d964146118035781631d6b8b72146117b1578163248a9ca3146117865781632f2ff15d146116ca57816336568abe146116385781633f4ba83a146114955781635c975abb1461147157816364298478146114485781637278b28f1461141f57816383e3f870146114005781638456cb59146112115781638a3bb6b0146110d05781639010d07c1461108f57816391d148541461104857816394a23b5614610e7f5781639ca39ae914610e44578163a2011b3f14610e09578163a217fddf14610dee578163a2b86fd014610c8d578163b3465ab91461081f578163ca15c873146107f7578163cf756fdf1461056a578163d547741f1461052b578163e63ab1e9146104f0578163ec87621c146104b5578163f667526a1461019f575063fb1bb9de1461016257600080fd5b3461019b578160031936011261019b57602090517f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a8152f35b5080fd5b83833461019b57602090816003193601126104b1578335906101bf611b5e565b6101c76122d8565b6101e260ff54670de0b6b3a764000091829160fd5490611f1b565b036104a15760fb548251635c1548fb60e01b8152906001600160a01b0390811686838a81845afa928315610497578893610468575b50803b1561045a5787908186518092632e1a7d4d60e01b8252898d8301528160249586925af1801561045e57908991610446575b505060fe5493885b85811061028757897f83db9dc084973306ecd0b0f10cb495b81dd9ddcc135eb7934d2723bcabc8f4c38a8a8a51908152a180f35b83610366868b8d848c828f8b6103028c6102b0859460018f6102a890611943565b500154611ef2565b049a8b9916956102bf8d611943565b5054166102f486519a8b928b84019563a9059cbb60e01b8752840160209093929193604081019460018060a01b031681520152565b03601f1981018a5289611e1b565b83519761030e89611db9565b8789527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564888a0152519082865af1923d1561043a573d61035961035082611f28565b93519384611e1b565b825281943d92013e6124c6565b80518b8115918215610416575b50509050156103c157906103bc917f6c461460f28af1386f23dc4c0c7f4e2e54f0db320a8edc08803e4b787f6db3258b876103ad85611943565b505416928b51908152a26122a5565b610253565b875162461bcd60e51b8152808d018b9052602a818601527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b8380929350010312610436578a0151801515810361043657808b8f610373565b8b80fd5b505091506060916124c6565b61044f90611deb565b61045a57878a61024b565b8780fd5b86513d8b823e3d90fd5b610489919350873d8911610490575b6104818183611e1b565b81019061231c565b9189610217565b503d610477565b85513d8a823e3d90fd5b8151631f27cbcd60e21b81528690fd5b8280fd5b50503461019b578160031936011261019b57602090517f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b088152f35b50503461019b578160031936011261019b57602090517f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a8152f35b919050346104b157806003193601126104b1576105679135610562600161055061192d565b93838752609760205286200154611c98565b611e69565b80f35b9050346104b15760803660031901126104b157610585611917565b61058d61192d565b6001600160a01b0360443581811692908390036107f2576064359187549560ff8760081c1615958680976107e5575b80156107ce575b1561077457829060ff19988860018b8316178d55610763575b50169081158015610759575b8015610751575b61074357670de0b6b3a764000085116107355750918493929161066f6106a9969361063a60ff8d5460081c1661062481612245565b61062d81612245565b8b60335416603355612245565b6000805260209960978b528b600020826000528b5260ff8c6000205416156106e8575b506000805260c98a528a60002061206a565b506001600160601b0360a01b91168160fb54161760fb5560fc54161760fc558060fd5585519161069e83611db9565b8252848201526121df565b6106b1578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff001984541684555160018152a138808280f35b6000805260978b528b600020826000528b5260018c60002091825416179055338160007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a43861065d565b885163040357dd60e21b8152fd5b885163d92e233d60e01b8152fd5b5085156105ef565b50828416156105e8565b61ffff1916610101178b55386105dc565b885162461bcd60e51b8152602081840152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156105c35750600160ff8916146105c3565b50600160ff8916106105bc565b600080fd5b9050346104b15760203660031901126104b157602092829135815260c9845220549051908152f35b919050346104b157602080600319360112610c895782359167ffffffffffffffff90818411610c855736602385011215610c855783850135918211610c8557602494858501948636918560061b010111610c81577f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0880600052609785528260002033600052855260ff83600020541615610adf575060fe90815488835580610a71575b5060fc5460fd5484516001600160a01b039994926108f192908b166108e683611db9565b8252888201526121df565b889289915b8683106109a457505050670de0b6b3a764000061091560fd5484611f1b565b03610996575060ff55805183815280840183905294858201949392919087905b83821061096657887fe65c633c83fef6d33e93f5fce78a7d412ad9a545453fdfcef33f49889c39d87c8989038aa180f35b9091929394958635908282168092036107f257908152868601358682015283019583019493929160010190610935565b8251631f27cbcd60e21b8152fd5b909193896109bb6109b6878a8d6122b4565b6122c4565b1615610a61576109d990886109d1878a8d6122b4565b013590611f1b565b936109e581888b6122b4565b8254600160401b811015610a4f57610a036001918281018655611943565b929092610a3e57908a828e610a1c610a379796956122c4565b85546001600160a01b031916911617845501359101556122a5565b91906108f6565b634e487b7160e01b8e528d8752858efd5b634e487b7160e01b8d5260418652848dfd5b855163d92e233d60e01b81528490fd5b6001600160ff1b0381168103610acd5782895260017f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513a91811b8201915b828110610abc5750506108c2565b8a8155600082820155600201610aae565b634e487b7160e01b8952601182528789fd5b849087610aeb33611f55565b855191610af783611dff565b60428352848301936060368637835115610c6d57603085538351600190811015610c5957607860218601536041905b808211610bee575050610bbf5750610bbb938693610ba793610b98604894610b6f9a519a856000805160206125a48339815191528d978801528251928391603789019101611d96565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190611d96565b01036028810187520185611e1b565b5162461bcd60e51b81529283928301611e3d565b0390fd5b9250505081606494519362461bcd60e51b85528401528201526000805160206125848339815191526044820152fd5b9091600f81166010811015610c45576f181899199a1a9b1b9c1cb0b131b232b360811b901a610c1d8488611f44565b53881c918015610c31576000190190610b26565b8360118a634e487b7160e01b600052526000fd5b8460328b634e487b7160e01b600052526000fd5b82603289634e487b7160e01b600052526000fd5b50634e487b7160e01b600090815260328752fd5b8680fd5b8580fd5b8380fd5b50503461019b578160031936011261019b5790610ca861233b565b60fe5491610cb583612557565b92610cc285519485611e1b565b808452610cce81612557565b601f199360208681019390928601368537610ce881612557565b91610cf589519384611e1b565b818352610d0182612557565b8385019701368837855b828110610d8d57505050865196879681880191885251809152606087019390855b818110610d6d57505050858303868301525180835291810193925b828110610d5657505050500390f35b835185528695509381019392810192600101610d47565b82516001600160a01b031686528998509484019491840191600101610d2c565b80610da2610de1929b95969897999a9b611943565b50546001600160a01b0316610db7828d61256f565b52670de0b6b3a7640000610dd08460016102a885611943565b04610ddb828861256f565b526122a5565b9897969495939298610d0b565b50503461019b578160031936011261019b5751908152602090f35b50503461019b578160031936011261019b57602090517f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda8152f35b50503461019b578160031936011261019b57602090517f14cf45180c3fcf249a5a305e9657ea05c14fd4f4e1800ee0216a8213091711d28152f35b83833461019b578160031936011261019b57610ed690610e9d611b5e565b610ea56122d8565b610ead61233b565b90610eb6611b5e565b610ebe6122d8565b60ff54670de0b6b3a764000093849160fd5490611f1b565b036110395760fb548151635c1548fb60e01b8152602094916001600160a01b0390811686838a81845afa92831561049757889361101a575b50803b1561045a5787908186518092632e1a7d4d60e01b8252898d8301528160249586925af1801561045e57611007575b5060fe5493885b858110610f7a57897f83db9dc084973306ecd0b0f10cb495b81dd9ddcc135eb7934d2723bcabc8f4c38a8a8a51908152a180f35b83610f9b868b8d848c828f8b6103028c6102b0859460018f6102a890611943565b80518b8115918215610fe7575b50509050156103c15790610fe2917f6c461460f28af1386f23dc4c0c7f4e2e54f0db320a8edc08803e4b787f6db3258b876103ad85611943565b610f46565b8380929350010312610436578a0151801515810361043657808b8f610fa8565b61101390989198611deb565b9689610f3f565b611032919350873d8911610490576104818183611e1b565b9189610f0e565b51631f27cbcd60e21b81528490fd5b9050346104b157816003193601126104b1578160209360ff9261106961192d565b90358252609786528282206001600160a01b039091168252855220549151911615158152f35b9050346104b157816003193601126104b1576020926110ba9135815260c98452826024359120612052565b905491519160018060a01b039160031b1c168152f35b83833461019b578060031936011261019b576110ea611917565b90602435906110f7611993565b6001600160a01b0392831692831561120157670de0b6b3a764000083116111f15760fc5460fd54936001600160601b0360a01b868184161760fc558160fd5584519061114282611db9565b878252602082019183835260fe54156111de57899a50859060fe7f07a913db5115d91d281fb20354ed0943d75063be42595fbc0a12d106be3a954e999a9b5251167f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513a91825416179055517f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513b55835195865260208601521692a380f35b634e487b7160e01b8a5260328b5260248afd5b815163040357dd60e21b81528690fd5b815163d92e233d60e01b81528690fd5b8391503461019b578160031936011261019b577f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9081835260209160978352848420338552835260ff8585205416156112ad57837f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25884876112906122d8565b6112986122d8565b600160ff19603354161760335551338152a180f35b6112b993919333611f55565b8551916112c583611dff565b604283528483019360603686378351156113ed57603085538351906001918210156113da5790607860218601536041915b81831161136f5750505061133f57610bbb938693610ba793610b98604894610b6f9a519a856000805160206125a48339815191528d978801528251928391603789019101611d96565b50505080606493519262461bcd60e51b845283015260248201526000805160206125848339815191526044820152fd5b909192600f811660108110156113c7576f181899199a1a9b1b9c1cb0b131b232b360811b901a61139f8588611f44565b53881c9280156113b4576000190191906112f6565b634e487b7160e01b825260118952602482fd5b634e487b7160e01b835260328a52602483fd5b634e487b7160e01b815260328852602490fd5b634e487b7160e01b815260328752602490fd5b50503461019b578160031936011261019b5760209060fd549051908152f35b50503461019b578160031936011261019b5760fb5490516001600160a01b039091168152602090f35b50503461019b578160031936011261019b5760fc5490516001600160a01b039091168152602090f35b50503461019b578160031936011261019b5760209060ff6033541690519015158152f35b83833461019b578160031936011261019b577f427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a9081835260209160978352818420338552835260ff82852054161561156057506033549360ff85161561152857507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa929360ff191660335551338152a180f35b82606492519162461bcd60e51b8352820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152fd5b61156d9493919433611f55565b85519161157983611dff565b604283528483019360603686378351156113ed57603085538351906001918210156113da5790607860218601536041915b8183116115f35750505061133f57610bbb938693610ba793610b98604894610b6f9a519a856000805160206125a48339815191528d978801528251928391603789019101611d96565b909192600f811660108110156113c7576f181899199a1a9b1b9c1cb0b131b232b360811b901a6116238588611f44565b53881c9280156113b4576000190191906115aa565b8391503461019b578260031936011261019b5761165361192d565b90336001600160a01b0383160361166f57906105679135611e69565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152fd5b919050346104b157806003193601126104b15761173991359060c96116ed61192d565b928086526020906097825261170760018589200154611c98565b808752609782528387206001600160a01b039095168088529482528387205460ff161561173d575b865252832061206a565b5080f35b808752609782528387208588528252838720805460ff191660011790553385827f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8a80a461172f565b9050346104b15760203660031901126104b15781602093600192358152609785522001549051908152f35b8391503461019b57602036600319011261019b57359060fe5482101561180057506117db90611943565b50805460019091015491516001600160a01b0390911681526020810191909152604090f35b80fd5b50503461019b578160031936011261019b5760209060fe549051908152f35b9050346104b15760203660031901126104b157359063ffffffff60e01b82168092036104b15760209250635a05180f60e01b8214918215611867575b50519015158152f35b909150637965db0b60e01b8114908115611884575b50903861185e565b6301ffc9a760e01b1490503861187c565b9050346104b15760203660031901126104b1576118b0611917565b906118b9611993565b6001600160a01b0391821692831561190a57505060fb54826001600160601b0360a01b82161760fb55167fce33ad7b64c536bf61b27c59f5188679b6071c49001b094a023ccb6784d6e97a8380a380f35b5163d92e233d60e01b8152fd5b600435906001600160a01b03821682036107f257565b602435906001600160a01b03821682036107f257565b60fe5481101561197d5760fe60005260011b7f54075df80ec1ae6ac9100e1fd0ebf3246c17f5c933137af392011f4c5f61513a0190600090565b634e487b7160e01b600052603260045260246000fd5b3360009081527f0ba47cfd5e746a7a77d10576777b78a793709d8d5c4bbd732c557bc9a64bb31b60209081526040808320549092907f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda9060ff16156119f85750505050565b611a0133611f55565b845191611a0d83611dff565b60428352848301936060368637835115611b4a5760308553835190600191821015611b4a5790607860218601536041915b818311611adc57505050611aac57610b6f938593611a9693611a87604894610bbb995198856000805160206125a48339815191528b978801528251928391603789019101611d96565b01036028810185520183611e1b565b5162461bcd60e51b815291829160048301611e3d565b60648486519062461bcd60e51b825280600483015260248201526000805160206125848339815191526044820152fd5b909192600f81166010811015611b36576f181899199a1a9b1b9c1cb0b131b232b360811b901a611b0c8588611f44565b5360041c928015611b2257600019019190611a3e565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b3360009081527f12aba9df56434305de3225b8d0dc80d46541ec8c143d2b18d08e23aedfbacaf660209081526040808320549092907f14cf45180c3fcf249a5a305e9657ea05c14fd4f4e1800ee0216a8213091711d29060ff1615611bc35750505050565b611bcc33611f55565b845191611bd883611dff565b60428352848301936060368637835115611b4a5760308553835190600191821015611b4a5790607860218601536041915b818311611c5257505050611aac57610b6f938593611a9693611a87604894610bbb995198856000805160206125a48339815191528b978801528251928391603789019101611d96565b909192600f81166010811015611b36576f181899199a1a9b1b9c1cb0b131b232b360811b901a611c828588611f44565b5360041c928015611b2257600019019190611c09565b600081815260209060978252604092838220338352835260ff848320541615611cc15750505050565b611cca33611f55565b845191611cd683611dff565b60428352848301936060368637835115611b4a5760308553835190600191821015611b4a5790607860218601536041915b818311611d5057505050611aac57610b6f938593611a9693611a87604894610bbb995198856000805160206125a48339815191528b978801528251928391603789019101611d96565b909192600f81166010811015611b36576f181899199a1a9b1b9c1cb0b131b232b360811b901a611d808588611f44565b5360041c928015611b2257600019019190611d07565b60005b838110611da95750506000910152565b8181015183820152602001611d99565b6040810190811067ffffffffffffffff821117611dd557604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111611dd557604052565b6080810190811067ffffffffffffffff821117611dd557604052565b90601f8019910116810190811067ffffffffffffffff821117611dd557604052565b60409160208252611e5d8151809281602086015260208686019101611d96565b601f01601f1916010190565b906040611ea79260009080825260976020528282209360018060a01b03169384835260205260ff8383205416611eaa575b815260c9602052206120ef565b50565b808252609760205282822084835260205282822060ff1981541690553384827ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b8580a4611e9a565b81810292918115918404141715611f0557565b634e487b7160e01b600052601160045260246000fd5b91908201809211611f0557565b67ffffffffffffffff8111611dd557601f01601f191660200190565b90815181101561197d570160200190565b604051906060820182811067ffffffffffffffff821117611dd557604052602a825260208201604036823782511561197d5760309053815160019081101561197d57607860218401536029905b808211611fe4575050611fb25790565b606460405162461bcd60e51b815260206004820152602060248201526000805160206125848339815191526044820152fd5b9091600f8116601081101561203d576f181899199a1a9b1b9c1cb0b131b232b360811b901a6120138486611f44565b5360041c918015612028576000190190611fa2565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b805482101561197d5760005260206000200190600090565b919060018301600090828252806020526040822054156000146120e957845494600160401b8610156120d557836120c56120ae886001604098999a01855584612052565b819391549060031b91821b91600019901b19161790565b9055549382526020522055600190565b634e487b7160e01b83526041600452602483fd5b50925050565b906001820190600092818452826020526040842054908115156000146121d857600019918083018181116121c4578254908482019182116121b05780820361217b575b505050805480156121675782019161214a8383612052565b909182549160031b1b191690555582526020526040812055600190565b634e487b7160e01b86526031600452602486fd5b61219b61218b6120ae9386612052565b90549060031b1c92839286612052565b90558652846020526040862055388080612132565b634e487b7160e01b88526011600452602488fd5b634e487b7160e01b87526011600452602487fd5b5050505090565b60fe54600160401b811015611dd5578060016121fe920160fe55611943565b91909161222f57805182546001600160a01b0319166001600160a01b03919091161782556020015160019190910155565b634e487b7160e01b600052600060045260246000fd5b1561224c57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b6000198114611f055760010190565b919081101561197d5760061b0190565b356001600160a01b03811681036107f25790565b60ff603354166122e457565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b908160209103126107f257516001600160a01b03811681036107f25790565b60fb5460408051635c1548fb60e01b81526004926001600160a01b039160209183169082818781855afa9081156124bb5790839160009161249e575b508686518096819363313ce56760e01b8352165afa92831561249357600093612458575b5090806024928551938480926370a0823160e01b8252308a8301525afa93841561244e575060009361241c575b505060ff1660120360ff81116124075760ff16604d811161240757600a0a9182156123f257500490565b601290634e487b7160e01b6000525260246000fd5b601183634e487b7160e01b6000525260246000fd5b8181949293943d8311612447575b6124348183611e1b565b810103126118005750519060ff386123c8565b503d61242a565b513d6000823e3d90fd5b8281819593953d831161248c575b6124708183611e1b565b8101031261019b57519060ff821682036118005750918161239b565b503d612466565b84513d6000823e3d90fd5b6124b59150823d8411610490576104818183611e1b565b38612377565b85513d6000823e3d90fd5b9192901561252857508151156124da575090565b3b156124e35790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b82519091501561253b5750805190602001fd5b60405162461bcd60e51b8152908190610bbb9060048301611e3d565b67ffffffffffffffff8111611dd55760051b60200190565b805182101561197d5760209160051b01019056fe537472696e67733a20686578206c656e67746820696e73756666696369656e74416363657373436f6e74726f6c3a206163636f756e7420000000000000000000a164736f6c6343000812000a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.