Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x065f18da5dfec301f4f5666552bf8a5fb058ae0794dd060f3589f15811bcef40 | 0x60a06040 | 30577242 | 147 days 23 hrs ago | 0x7a34b2f0da5ea35b5117cac735e99ba0e2aceecd | IN | Create: BufferManager | 0 MATIC | 0.005636791406 |
[ Download CSV Export ]
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
BufferManager
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 0 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.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 "../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: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(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(uint160(account), 20), " 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. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @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/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 (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @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 (last updated v4.6.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] * ``` * 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. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = _setInitializedVersion(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. * * `initializer` is equivalent to `reinitializer(1)`, so 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. * * 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. */ modifier reinitializer(uint8 version) { bool isTopLevelCall = _setInitializedVersion(version); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _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. */ function _disableInitializers() internal virtual { _setInitializedVersion(type(uint8).max); } function _setInitializedVersion(uint8 version) private returns (bool) { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level // of initializers, because in other contexts the contract may have been reentered. if (_initializing) { require( version == 1 && !AddressUpgradeable.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else { require(_initialized < version, "Initializable: contract is already initialized"); _initialized = version; return true; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate that the this implementation remains valid after an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @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 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../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 Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { 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 v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @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.6.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 v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.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; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } 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)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } 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"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../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; } /** * @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 "../../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 v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableMap.sol) pragma solidity ^0.8.0; import "./EnumerableSetUpgradeable.sol"; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * The following map types are supported: * * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0 * - `bytes32 -> bytes32` (`Bytes32ToBytes32`) since v4.6.0 */ library EnumerableMapUpgradeable { using EnumerableSetUpgradeable for EnumerableSetUpgradeable.Bytes32Set; // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct Bytes32ToBytes32Map { // Storage of keys EnumerableSetUpgradeable.Bytes32Set _keys; mapping(bytes32 => bytes32) _values; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value ) internal returns (bool) { map._values[key] = value; return map._keys.add(key); } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { delete map._values[key]; return map._keys.remove(key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { return map._keys.contains(key); } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { return map._keys.length(); } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) { bytes32 key = map._keys.at(index); return (key, map._values[key]); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (contains(map, key), bytes32(0)); } else { return (true, value); } } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key"); return value; } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function get( Bytes32ToBytes32Map storage map, bytes32 key, string memory errorMessage ) internal view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || contains(map, key), errorMessage); return value; } // UintToAddressMap struct UintToAddressMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( UintToAddressMap storage map, uint256 key, address value ) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( UintToAddressMap storage map, uint256 key, string memory errorMessage ) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage)))); } // AddressToUintMap struct AddressToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( AddressToUintMap storage map, address key, uint256 value ) internal returns (bool) { return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(AddressToUintMap storage map, address key) internal returns (bool) { return remove(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(AddressToUintMap storage map, address key) internal view returns (bool) { return contains(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns the number of elements in the map. O(1). */ function length(AddressToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the 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(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (address(uint160(uint256(key))), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key)))); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(AddressToUintMap storage map, address key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( AddressToUintMap storage map, address key, string memory errorMessage ) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library 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) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/interfaces/IERC20MetadataUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableMapUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "../../../interfaces/ILiquidityHandler.sol"; import "../../../interfaces/IHandlerAdapter.sol"; import "../../../interfaces/IVoteExecutorSlave.sol"; import "../../../interfaces/ISpokePool.sol"; import "../../../interfaces/ICallProxy.sol"; contract BufferManager is Initializable, PausableUpgradeable, AccessControlUpgradeable, UUPSUpgradeable { using AddressUpgradeable for address; using SafeERC20Upgradeable for IERC20Upgradeable; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; event Bridge( address distributor, address originToken, address EthToken, uint256 amount, uint64 relayerFeePct, uint256[] directions, uint256[] percentage ); bool public upgradeStatus; // address of the DepositDistributor on mainnet address public distributor; address public slave; // address of the anycall contract on polygon address public anycall; // adress of the Across bridge contract to initiate the swap address public spokepool; address public gnosis; uint256 public epochDuration; // bridge settings uint256 public lastExecuted; uint256 public bridgeInterval; uint64 public relayerFeePct; bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE"); bytes32 public constant GELATO = keccak256("GELATO"); bytes32 public constant SWAPPER = keccak256("SWAPPER"); // liquidity handler ILiquidityHandler public handler; mapping(address => Epoch[]) public ibAlluoToEpoch; mapping(address => address) public ibAlluoToAdapter; mapping(address => uint256) public ibAlluoToMaxRefillPerEpoch; mapping(address => address) public tokenToEth; mapping(address => uint256) public tokenToMinBridge; // EnumerableSet of currently supported IBAlluo EnumerableSetUpgradeable.AddressSet private activeIbAlluos; // Data used to prevent draining the gnosis by setting a relevant limit to be used struct Epoch { uint256 startTime; uint256 refilledPerEpoch; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} /** * @dev * param _epochDuration Value for refill function to work properly * param _bridgeGenesis Unix timestamp declaring a starting point for counter * param _bridgeInterval Min time to pass between bridging (Unix timestamp) * param _gnosis Gnosis Multisig * param _gelato Gelato executor address * param _spokepool Address of the SpokePool Polygon contract of Accross Protocol Bridge * param _anycall Address of the Multichain Anycall contract * param _distributor Address of the DepositDistritor contract on mainnet, which receives the bridged funds */ function initialize( uint256 _epochDuration, uint256 _brigeGenesis, uint256 _bridgeInterval, address _gnosis, address _spokepool, address _anycall, address _distributor ) public initializer { __Pausable_init(); __AccessControl_init(); __UUPSUpgradeable_init(); epochDuration = _epochDuration; distributor = _distributor; lastExecuted = _brigeGenesis; bridgeInterval = _bridgeInterval; spokepool = _spokepool; anycall = _anycall; gnosis = _gnosis; _grantRole(DEFAULT_ADMIN_ROLE, _gnosis); _grantRole(UPGRADER_ROLE, _gnosis); _grantRole(GELATO, _gnosis); _grantRole(SWAPPER, _gnosis); } /** * @notice Initiates transfer only if adapter is filled, there are no queued withdrawals and * balance of this contract exceeds the minimum required mark * @dev Function checker for gelato, after the balance crosses the threshold initates the swap function * @dev Checks minimumBridging amout, attempts to reffil the adapters * @return canExec Bool, if true - initiates the call by gelato * @return execPayload Data to be called by gelato */ function checkerBridge() external view returns (bool canExec, bytes memory execPayload) { for (uint256 i; i < activeIbAlluos.length(); i++) { (address iballuo, address token, uint256 amount) = getValues(i); if (adapterRequiredRefill(iballuo) == 0 && canBridge(token, amount)) { canExec = true; execPayload = abi.encodeWithSelector( BufferManager.swap.selector, amount, token, iballuo ); break; } } return (canExec, execPayload); } /** * @dev Triggers GELATO to refill buffer * @dev Checks buffer balance, balance of the gnosis and compares if he can execute the refill * @return canExec bool, serves as a flag for gelato * @return execPayload encoded call to refillBuffer with correct values */ function checkerRefill() external view returns (bool canExec, bytes memory execPayload) { for (uint256 i; i < activeIbAlluos.length(); i++) { (address iballuo, address token,) = getValues(i); if (canRefill(iballuo, token)) { canExec = true; execPayload = abi.encodeWithSelector( BufferManager.refillBuffer.selector, iballuo ); break; } } return (canExec, execPayload); } /** * @notice Function is called by gelato when checker flags it. Can only be called by * either Gelato or Multisig * @dev Bridges assets using Across Bridge by UMA Protocol (Source: https://across.to/) * @dev Bridges data for liquidity direction using Multichain AnyCallV6 * @param amount Amount of the funds to be transferred * @param originToken Address of the token to be bridged */ function swap( uint256 amount, address originToken ) external onlyRole(SWAPPER) { require( canBridge(originToken, amount), "Buffer: <minAmount or <bridgeInterval" ); IERC20Upgradeable(originToken).approve(spokepool, amount); lastExecuted = block.timestamp; ISpokePool(spokepool).deposit( distributor, originToken, amount, 1, relayerFeePct, uint32(block.timestamp) ); address tokenEth = tokenToEth[originToken]; ( uint256[] memory direction, uint256[] memory percentage ) = IVoteExecutorSlave(slave).getEntries(); ICallProxy(anycall).anyCall( // address of the collector contract on mainnet distributor, abi.encode(direction, percentage, tokenEth, amount), address(0), 1, // 0 flag to pay fee on destination chain 0 ); emit Bridge( distributor, originToken, tokenEth, amount, relayerFeePct, direction, percentage ); } /** * @dev Function serves as a leverage to tackle a scenario in which previously set up fee was insufficient * for funds to go. Only called manually by multisig. * @param newRelayerFeePct Relayer fee Pct to be updated * @param depositId ID of the deposit to be sped up, needs to be accessed from the event emitted by * the swap call * @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated * relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the * EIP-1271 standard. */ function speedUp( uint64 newRelayerFeePct, uint32 depositId, bytes memory depositorSignature ) external onlyRole(DEFAULT_ADMIN_ROLE) { ISpokePool(spokepool).speedUpDeposit( address(this), newRelayerFeePct, depositId, depositorSignature ); } /** * @dev Function checks if IBAlluos respective adapter has queued withdrawals * @param _ibAlluo Address of the IBAlluo pool * @return isAdapterPendingWithdrawal bool - true if there is a pending withdrawal on correspoding to an IBAlluo pool adapter */ function isAdapterPendingWithdrawal( address _ibAlluo ) public view returns (bool) { (, , uint256 totalWithdrawalAmount, ) = handler .ibAlluoToWithdrawalSystems(_ibAlluo); if (totalWithdrawalAmount > 0) { return true; } return false; } /** * @notice Function checks the amount of asset that needs to be transferred for an adapter to be filled * @param _ibAlluo Address of an IBAlluo contract, which corresponding adapter is to be filled * @return requiredRefill Amount to be refilled with 18 decimals */ function adapterRequiredRefill( address _ibAlluo ) public view returns (uint256) { uint256 expectedAmount = handler.getExpectedAdapterAmount(_ibAlluo, 0); uint256 actualAmount = handler.getAdapterAmount(_ibAlluo); if (actualAmount >= expectedAmount) { return 0; } uint256 difference = expectedAmount - actualAmount; if ((difference * 10000) / expectedAmount <= 500) { return 0; } return difference; } /** * @dev Function returns relevant refill settings by IBAlluo address * @param _ibAlluo address of the IBAlluo * @return Epoch struct with settings */ function _confirmEpoch(address _ibAlluo) internal returns (Epoch storage) { Epoch[] storage relevantEpochs = ibAlluoToEpoch[_ibAlluo]; Epoch storage lastEpoch = relevantEpochs[relevantEpochs.length - 1]; uint256 deadline = lastEpoch.startTime + epochDuration; if (block.timestamp > deadline) { uint256 cycles = (block.timestamp - deadline) / epochDuration; if (cycles != 0) { uint256 newStartTime = lastEpoch.startTime + (cycles * epochDuration); Epoch memory newEpoch = Epoch(newStartTime, 0); ibAlluoToEpoch[_ibAlluo].push(newEpoch); } } Epoch storage finalEpoch = relevantEpochs[relevantEpochs.length - 1]; return finalEpoch; } /** * @notice adapterRequiredRefill() and deposit() operate with 18 decimals, so balances need to be adjusted * @dev Refills corresponding IBAlluo adapter with prior checks and triggers executing queued withdrawals on the adapter * @dev First checks if buffer has enough funds to refill adapter. If not - checks if funds on buffer and gnosis multisig * together are enough to satisfy adapters. Uses all the available funds in buffer, takes rest from gnosis. * @dev After successful refill calls deposit() on corresponding adapter, instructing to leave all the funds in pool. * If there are any queued withdrawals on adapter - satisfies them * @param _ibAlluo address of corresponding IBAlluo */ function refillBuffer( address _ibAlluo ) external onlyRole(GELATO) returns (bool) { uint256 totalAmount = adapterRequiredRefill(_ibAlluo); require(totalAmount > 0, "No refill required"); address adapterAddress = ibAlluoToAdapter[_ibAlluo]; address bufferToken = IHandlerAdapter(adapterAddress).getCoreTokens(); uint256 decDif = 18 - IERC20MetadataUpgradeable(bufferToken).decimals(); uint256 bufferBalance = IERC20Upgradeable(bufferToken).balanceOf( address(this) ); uint256 gnosisBalance = IERC20Upgradeable(bufferToken).balanceOf( gnosis ); bufferBalance = bufferBalance * 10 ** decDif; gnosisBalance = gnosisBalance * 10 ** decDif; // 2 percent on top to be safe against pricefeed and lp slippage totalAmount += totalAmount * 200 / 10000; if (bufferBalance < totalAmount) { if (totalAmount < bufferBalance + gnosisBalance) { refillGnosis(totalAmount, bufferBalance, bufferToken, _ibAlluo, adapterAddress, decDif); return true; } else { return false; } } else { IERC20Upgradeable(bufferToken).transfer(adapterAddress, totalAmount / 10 ** decDif); IHandlerAdapter(adapterAddress).deposit(bufferToken, totalAmount, totalAmount); if (isAdapterPendingWithdrawal(_ibAlluo)) { handler.satisfyAdapterWithdrawals(_ibAlluo); } return true; } } /** * @notice All the amounts are 18 decimals * @dev Internal function called by refillBuffer() in a scenario of using gnosis funds to execute the refill * @param totalAmount Required amount to fully refill the adapter * @param bufferBalance Amount of the asset on buffer * @param bufferToken Address of the token used to refill * @param ibAlluo Address of the ibAlluo binded to the adapter * @param adapterAddress Address of the adapter to be refilled * @param decDif Decimal difference, see notice in refillBuffer() for details */ function refillGnosis( uint256 totalAmount, uint256 bufferBalance, address bufferToken, address ibAlluo, address adapterAddress, uint256 decDif) internal { uint256 gnosisAmount = totalAmount - bufferBalance; Epoch storage currentEpoch = _confirmEpoch(ibAlluo); require( ibAlluoToMaxRefillPerEpoch[ibAlluo] >= currentEpoch.refilledPerEpoch + gnosisAmount, "Cumulative refills exceeds limit" ); currentEpoch.refilledPerEpoch += totalAmount; IERC20Upgradeable(bufferToken).transferFrom( gnosis, adapterAddress, gnosisAmount / 10 ** decDif ); if (gnosisAmount != totalAmount) { IERC20Upgradeable(bufferToken).transfer( adapterAddress, bufferBalance / 10 ** decDif ); } IHandlerAdapter(adapterAddress).deposit( bufferToken, totalAmount, totalAmount ); if (isAdapterPendingWithdrawal(ibAlluo)) { handler.satisfyAdapterWithdrawals(ibAlluo); } } /** * @dev View function to trigger bridging * @param token Token to bridge * @param amount Amount to bridge */ function canBridge( address token, uint256 amount ) public view returns (bool) { if (amount >= tokenToMinBridge[token] && block.timestamp >= lastExecuted + bridgeInterval) { return true; } return false; } /** * @dev View function to trigger refillBuffer * @param _iballuo Address of the IBAlluo * @param token Address of the correspondin primary token of the pool */ function canRefill( address _iballuo, address token ) public view returns (bool) { uint256 balance = IERC20Upgradeable(token).balanceOf(address(this)); uint256 decDif = 18 - IERC20MetadataUpgradeable(token).decimals(); uint256 gnosisBalance = IERC20Upgradeable(token).balanceOf(gnosis); balance = balance * 10 ** decDif; gnosisBalance = gnosisBalance * 10 ** decDif; uint256 refill = adapterRequiredRefill(_iballuo); if (refill > 0 && refill < gnosisBalance + balance) { return true; } return false; } /** * @dev Internal function for readabilty of checker functions * @param i Index in a loop in checkerRefill and checkerBridge */ function getValues(uint256 i) internal view returns(address, address, uint256) { address iballuo = activeIbAlluos.at(i); address token = IHandlerAdapter(ibAlluoToAdapter[iballuo]).getCoreTokens(); uint256 amount = IERC20Upgradeable(token).balanceOf(address(this)); return(iballuo, token, amount); } /** * @notice Initialize function faces stack too deep error, due to too many arguments. Used to safely set-up/upgrage * iballuos and corresponding settings * @param _activeIbAlluos Array of IBAlluo contract supported for bridging * @param _ibAlluoAdapters Array of corresponding Adapters * @param _tokensEth Addresses of the same tokens on mainnet * @param _minBridgeAmount Min amount of asset to trigget bridging for each of the iballuo * @param _maxRefillPerEpoch Max value of asset for an adapter to be filled in span of a predefined interval */ function initializeValues( address _handler, address[] memory _activeIbAlluos, address[] memory _ibAlluoAdapters, address[] memory _tokensEth, uint256[] memory _minBridgeAmount, uint256[] memory _maxRefillPerEpoch, uint256 _epochDuration ) public onlyRole(DEFAULT_ADMIN_ROLE) { handler = ILiquidityHandler(_handler); for (uint256 i; i < _activeIbAlluos.length; i++) { activeIbAlluos.add(_activeIbAlluos[i]); ibAlluoToAdapter[_activeIbAlluos[i]] = _ibAlluoAdapters[i]; address token = IHandlerAdapter(_ibAlluoAdapters[i]).getCoreTokens(); tokenToMinBridge[token] = _minBridgeAmount[i]; tokenToEth[token] = _tokensEth[i]; ibAlluoToMaxRefillPerEpoch[_activeIbAlluos[i]] = _maxRefillPerEpoch[ i ]; epochDuration = _epochDuration; Epoch memory newEpoch = Epoch(block.timestamp, 0); ibAlluoToEpoch[_activeIbAlluos[i]].push(newEpoch); } } /* ========== ADMIN CONFIGURATION ========== */ /** * @dev Admin function to change bridge interval * @param _bridgeInterval interval in seconds, to put limitations for an amount to be bridged */ function changeBridgeInterval(uint256 _bridgeInterval) external onlyRole(DEFAULT_ADMIN_ROLE) { bridgeInterval = _bridgeInterval; } /** * @dev Admin function to set minimum amount for each token that will serve as threshold to trigger bridging * @param _token Address of the token * @param _minAmount Minimum amount to allow bridging */ function setMinBridgeAmount(address _token, uint256 _minAmount) external onlyRole(DEFAULT_ADMIN_ROLE) { tokenToMinBridge[_token] = _minAmount; } /** * @dev Admin function to manually set relayersFeePct for bridging * @param _relayerFeePct relayerFeePct in uint64 */ function setRelayerFeePct(uint64 _relayerFeePct) external onlyRole(DEFAULT_ADMIN_ROLE) { relayerFeePct = _relayerFeePct; } /** * @dev Admin function to change the address of VoteExecutorSlave contract * @param _slave Address of the VoteExecutorSlave contract */ function setVoteExecutorSlave(address _slave) external onlyRole(DEFAULT_ADMIN_ROLE) { slave = _slave; } /** * @dev Admin function to set anycall contract address * @param _anycall Address of the anycall contract */ function setAnycall(address _anycall) external onlyRole(DEFAULT_ADMIN_ROLE) { anycall = _anycall; } /** * @dev Admin function to set Distributor contract address * @param _distributor Address of the Distributor contract on ETH mainnet */ function setDistributor(address _distributor) external onlyRole(DEFAULT_ADMIN_ROLE) { distributor = _distributor; } /** * @notice Needed for bridging * @dev Admin function to change the address of the respective token on Mainnet * @param _token address of the token on Polygon * @param _tokenEth address of the same token on Mainnet */ function setEthToken( address _token, address _tokenEth ) external onlyRole(DEFAULT_ADMIN_ROLE) { tokenToEth[_token] = _tokenEth; } /** * @dev Admin function for setting max amount an adapter can be refilled per interval * @param _ibAlluo address of the IBAlluo of the respective adapter * @param _maxRefillPerEpoch max amount to be refilled */ function setMaxRefillPerEpoch( address _ibAlluo, uint256 _maxRefillPerEpoch ) external onlyRole(DEFAULT_ADMIN_ROLE) { ibAlluoToMaxRefillPerEpoch[_ibAlluo] = _maxRefillPerEpoch; } /** * @dev Admin function for setting the aforementioned interval * @param _epochDuration time of the epoch in seconds */ function setEpochDuration( uint256 _epochDuration ) external onlyRole(DEFAULT_ADMIN_ROLE) { epochDuration = _epochDuration; } /** * @notice Function is called by gnosis * @dev Adds IBAlluo pool to the list of active pools * @param ibAlluo Address of the IBAlluo pool to be added */ function addIBAlluoPool( address ibAlluo, address adapter ) external onlyRole(DEFAULT_ADMIN_ROLE) { require(!activeIbAlluos.contains(ibAlluo), "Already active"); activeIbAlluos.add(ibAlluo); ibAlluoToAdapter[ibAlluo] = adapter; } /** * @notice Funtion is called by gnosis * @dev Removes IBAlluo pool from the list of active pools * @param ibAlluo Address of the IBAlluo pool to be removed */ function removeIBAlluoPool( address ibAlluo ) external onlyRole(DEFAULT_ADMIN_ROLE) returns (bool) { bool removed; for (uint256 i = 0; i < activeIbAlluos.length(); i++) { if (activeIbAlluos.at(i) == ibAlluo) { activeIbAlluos.remove(activeIbAlluos.at(i)); ibAlluoToAdapter[ibAlluo] = address(0); removed = true; } } return removed; } function changeUpgradeStatus( bool _status ) external onlyRole(DEFAULT_ADMIN_ROLE) { upgradeStatus = _status; } function _authorizeUpgrade( address newImplementation ) internal override onlyRole(UPGRADER_ROLE) { require(upgradeStatus, "Manager: Upgrade not allowed"); upgradeStatus = false; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; interface ICallProxy { function anyCall( address _to, bytes calldata _data, address _fallback, uint256 _toChainID, uint256 _flags ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; interface IHandlerAdapter { function deposit( address _token, uint256 fullAmount, uint256 leaveInPool ) external; function withdraw(address _user, address _token, uint256 _amount) external; function getAdapterAmount() external view returns (uint256); function getCoreTokens() external view returns (address primaryToken); function setSlippage(uint64 _newSlippage) external; function setWallet(address _newWallet) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/access/IAccessControl.sol"; interface ILiquidityHandler is IAccessControl { function adapterIdsToAdapterInfo( uint256 ) external view returns ( string memory name, uint256 percentage, address adapterAddress, bool status ); function changeAdapterStatus(uint256 _id, bool _status) external; function changeUpgradeStatus(bool _status) external; function deposit(address _token, uint256 _amount) external; function deposit( address _token, uint256 _amount, address _targetToken ) external; function getActiveAdapters() external view returns ( ILiquidityHandlerStructs.AdapterInfo[] memory, address[] memory ); function getAdapterAmount(address _ibAlluo) external view returns (uint256); function getAdapterId(address _ibAlluo) external view returns (uint256); function getAllAdapters() external view returns ( ILiquidityHandlerStructs.AdapterInfo[] memory, address[] memory ); function getExpectedAdapterAmount( address _ibAlluo, uint256 _newAmount ) external view returns (uint256); function getIbAlluoByAdapterId( uint256 _adapterId ) external view returns (address); function getLastAdapterIndex() external view returns (uint256); function getListOfIbAlluos() external view returns (address[] memory); function getWithdrawal( address _ibAlluo, uint256 _id ) external view returns (ILiquidityHandlerStructs.Withdrawal memory); function ibAlluoToWithdrawalSystems( address ) external view returns ( uint256 lastWithdrawalRequest, uint256 lastSatisfiedWithdrawal, uint256 totalWithdrawalAmount, bool resolverTrigger ); function isUserWaiting( address _ibAlluo, address _user ) external view returns (bool); function pause() external; function paused() external view returns (bool); function removeTokenByAddress( address _address, address _to, uint256 _amount ) external; function satisfyAdapterWithdrawals(address _ibAlluo) external; function satisfyAllWithdrawals() external; function setAdapter( uint256 _id, string memory _name, uint256 _percentage, address _adapterAddress, bool _status ) external; function setIbAlluoToAdapterId( address _ibAlluo, uint256 _adapterId ) external; function supportsInterface(bytes4 interfaceId) external view returns (bool); function upgradeStatus() external view returns (bool); function withdraw(address _user, address _token, uint256 _amount) external; function withdraw( address _user, address _token, uint256 _amount, address _outputToken ) external; function getAdapterCoreTokensFromIbAlluo( address _ibAlluo ) external view returns (address); } interface ILiquidityHandlerStructs { struct AdapterInfo { string name; uint256 percentage; address adapterAddress; bool status; } struct Withdrawal { address user; address token; uint256 amount; uint256 time; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; interface ISpokePool { function deposit( address recipient, address originToken, uint256 amount, uint256 destinationChainId, uint64 relayerFeePct, uint32 quoteTimestamp ) external payable; function speedUpDeposit( address depositor, uint64 newRelayerFeePct, uint32 depositId, bytes memory depositorSignature ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; interface IVoteExecutorSlave { struct Entry { uint256 directionId; uint256 percent; } function getEntries() external returns (uint256[] memory, uint256[] memory); }
{ "optimizer": { "enabled": true, "runs": 0 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"distributor","type":"address"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"EthToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"relayerFeePct","type":"uint64"},{"indexed":false,"internalType":"uint256[]","name":"directions","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"percentage","type":"uint256[]"}],"name":"Bridge","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":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GELATO","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SWAPPER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ibAlluo","type":"address"}],"name":"adapterRequiredRefill","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"ibAlluo","type":"address"},{"internalType":"address","name":"adapter","type":"address"}],"name":"addIBAlluoPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"anycall","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"canBridge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_iballuo","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"canRefill","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bridgeInterval","type":"uint256"}],"name":"changeBridgeInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_status","type":"bool"}],"name":"changeUpgradeStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkerBridge","outputs":[{"internalType":"bool","name":"canExec","type":"bool"},{"internalType":"bytes","name":"execPayload","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkerRefill","outputs":[{"internalType":"bool","name":"canExec","type":"bool"},{"internalType":"bytes","name":"execPayload","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochDuration","outputs":[{"internalType":"uint256","name":"","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":[],"name":"gnosis","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[],"name":"handler","outputs":[{"internalType":"contract ILiquidityHandler","name":"","type":"address"}],"stateMutability":"view","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":"","type":"address"}],"name":"ibAlluoToAdapter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"ibAlluoToEpoch","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"refilledPerEpoch","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ibAlluoToMaxRefillPerEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epochDuration","type":"uint256"},{"internalType":"uint256","name":"_brigeGenesis","type":"uint256"},{"internalType":"uint256","name":"_bridgeInterval","type":"uint256"},{"internalType":"address","name":"_gnosis","type":"address"},{"internalType":"address","name":"_spokepool","type":"address"},{"internalType":"address","name":"_anycall","type":"address"},{"internalType":"address","name":"_distributor","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_handler","type":"address"},{"internalType":"address[]","name":"_activeIbAlluos","type":"address[]"},{"internalType":"address[]","name":"_ibAlluoAdapters","type":"address[]"},{"internalType":"address[]","name":"_tokensEth","type":"address[]"},{"internalType":"uint256[]","name":"_minBridgeAmount","type":"uint256[]"},{"internalType":"uint256[]","name":"_maxRefillPerEpoch","type":"uint256[]"},{"internalType":"uint256","name":"_epochDuration","type":"uint256"}],"name":"initializeValues","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ibAlluo","type":"address"}],"name":"isAdapterPendingWithdrawal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastExecuted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ibAlluo","type":"address"}],"name":"refillBuffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"relayerFeePct","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"ibAlluo","type":"address"}],"name":"removeIBAlluoPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_anycall","type":"address"}],"name":"setAnycall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_distributor","type":"address"}],"name":"setDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epochDuration","type":"uint256"}],"name":"setEpochDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_tokenEth","type":"address"}],"name":"setEthToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ibAlluo","type":"address"},{"internalType":"uint256","name":"_maxRefillPerEpoch","type":"uint256"}],"name":"setMaxRefillPerEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"setMinBridgeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_relayerFeePct","type":"uint64"}],"name":"setRelayerFeePct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_slave","type":"address"}],"name":"setVoteExecutorSlave","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slave","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"newRelayerFeePct","type":"uint64"},{"internalType":"uint32","name":"depositId","type":"uint32"},{"internalType":"bytes","name":"depositorSignature","type":"bytes"}],"name":"speedUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spokepool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"originToken","type":"address"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenToEth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenToMinBridge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"upgradeStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b5060006200002460016200008b565b905080156200003d576000805461ff0019166101001790555b801562000084576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5062000195565b60008054610100900460ff1615620000f4578160ff166001148015620000c45750620000c2306200013860201b620021a01760201c565b155b620000ec5760405162461bcd60e51b8152600401620000e39062000147565b60405180910390fd5b506000919050565b60005460ff8084169116106200011e5760405162461bcd60e51b8152600401620000e39062000147565b506000805460ff191660ff92909216919091179055600190565b6001600160a01b03163b151590565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b608051613e3d620001cd60003960008181610ead01528181610eed01528181610fa501528181610fe5015261105d0152613e3d6000f3fe60806040526004361061025a5760003560e01c806301ffc9a71461025f5780630810cf22146102945780630a971d81146102b65780630fc65407146102d6578063163e691c146102f65780631c15ff771461032f5780631f8bd1441461035457806320412d72146103745780632143d033146103a2578063238c8aad146103b9578063248a9ca3146103e75780632f2ff15d1461040757806330024dfe146104275780633095634a1461044757806331b36b3d14610467578063324e92931461048a57806336568abe146104bf5780633659cfe6146104df578063365ba6ce146104ff5780633d5302ae146105365780633fcdc0d714610556578063430a5df71461058d5780634f1ef286146105ae5780634ff0876a146105c157806352d1902d146105d8578063547cde5e146105ed5780635ac3a79f1461060d5780635c975abb1461062d578063700d85ae1461064557806375619ab5146106675780637895876f14610687578063877721af1461069c5780638d18138c146106bc5780638ee43fec146106dc57806391d14854146106fc578063a217fddf1461071c578063b8e637e314610731578063bfe1092814610752578063c80916d414610778578063cb1a4da3146107a0578063cbcfeb0a146107c0578063cc5e8fe8146107e0578063d3986f081461080e578063d4c7161f1461082e578063d4d543c51461084e578063d547741f14610869578063d701f52314610889578063d9043056146108a9578063e1506695146108c9578063ec347594146108e9578063eff557a71461090a578063f101c9831461092c578063f72c0d8b1461094c575b600080fd5b34801561026b57600080fd5b5061027f61027a3660046130d9565b61096e565b60405190151581526020015b60405180910390f35b3480156102a057600080fd5b506102b46102af366004613123565b6109a5565b005b3480156102c257600080fd5b506102b46102d1366004613166565b6109ce565b3480156102e257600080fd5b506102b46102f1366004613181565b6109fd565b34801561030257600080fd5b5061013554610317906001600160401b031681565b6040516001600160401b03909116815260200161028b565b34801561033b57600080fd5b506103466101335481565b60405190815260200161028b565b34801561036057600080fd5b5061034661036f3660046131fc565b610b4d565b34801561038057600080fd5b5061034661038f3660046131fc565b61013a6020526000908152604090205481565b3480156103ae57600080fd5b506103466101345481565b3480156103c557600080fd5b50610131546103da906001600160a01b031681565b60405161028b9190613219565b3480156103f357600080fd5b5061034661040236600461322d565b610c9d565b34801561041357600080fd5b506102b4610422366004613246565b610cb2565b34801561043357600080fd5b506102b461044236600461322d565b610cd3565b34801561045357600080fd5b5061027f610462366004613123565b610ce5565b34801561047357600080fd5b5061047c610d35565b60405161028b9291906132ce565b34801561049657600080fd5b506104aa6104a5366004613123565b610de2565b6040805192835260208301919091520161028b565b3480156104cb57600080fd5b506102b46104da366004613246565b610e1f565b3480156104eb57600080fd5b506102b46104fa3660046131fc565b610ea2565b34801561050b57600080fd5b506103da61051a3660046131fc565b610137602052600090815260409020546001600160a01b031681565b34801561054257600080fd5b506102b46105513660046131fc565b610f6b565b34801561056257600080fd5b506103da6105713660046131fc565b610139602052600090815260409020546001600160a01b031681565b34801561059957600080fd5b50610130546103da906001600160a01b031681565b6102b46105bc36600461339e565b610f9a565b3480156105cd57600080fd5b506103466101325481565b3480156105e457600080fd5b50610346611050565b3480156105f957600080fd5b506102b46106083660046133ed565b6110fe565b34801561061957600080fd5b506102b461062836600461350d565b611139565b34801561063957600080fd5b5060335460ff1661027f565b34801561065157600080fd5b50610346600080516020613de883398151915281565b34801561067357600080fd5b506102b46106823660046131fc565b611445565b34801561069357600080fd5b5061047c61147a565b3480156106a857600080fd5b5061027f6106b73660046131fc565b61153d565b3480156106c857600080fd5b506102b46106d73660046131fc565b61198c565b3480156106e857600080fd5b506102b46106f73660046135f8565b6119bb565b34801561070857600080fd5b5061027f610717366004613246565b611a2b565b34801561072857600080fd5b50610346600081565b34801561073d57600080fd5b5061012f546103da906001600160a01b031681565b34801561075e57600080fd5b5061012d546103da9061010090046001600160a01b031681565b34801561078457600080fd5b50610135546103da90600160401b90046001600160a01b031681565b3480156107ac57600080fd5b506102b46107bb36600461322d565b611a56565b3480156107cc57600080fd5b506102b46107db3660046133ed565b611a68565b3480156107ec57600080fd5b506103466107fb3660046131fc565b6101386020526000908152604090205481565b34801561081a57600080fd5b506102b4610829366004613246565b611afa565b34801561083a57600080fd5b5061027f6108493660046131fc565b611e2f565b34801561085a57600080fd5b5061012d5461027f9060ff1681565b34801561087557600080fd5b506102b4610884366004613246565b611ed5565b34801561089557600080fd5b506102b46108a436600461366e565b611ef1565b3480156108b557600080fd5b5061027f6108c43660046131fc565b611f11565b3480156108d557600080fd5b5061027f6108e43660046133ed565b611fa3565b3480156108f557600080fd5b5061012e546103da906001600160a01b031681565b34801561091657600080fd5b50610346600080516020613d8183398151915281565b34801561093857600080fd5b506102b4610947366004613123565b612177565b34801561095857600080fd5b50610346600080516020613d6183398151915281565b60006001600160e01b03198216637965db0b60e01b148061099f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006109b0816121af565b506001600160a01b03909116600090815261013a6020526040902055565b60006109d9816121af565b5061013580546001600160401b0319166001600160401b0392909216919091179055565b6000610a0960016121b9565b90508015610a21576000805461ff0019166101001790555b610a2961224d565b610a3161227e565b610a3961227e565b61013288905561012d8054610100600160a81b0319166101006001600160a01b03858116919091029190911790915561013388905561013487905561013080546001600160a01b03199081168784161790915561012f805482168684161790556101318054909116918716919091179055610ab56000866122a5565b610acd600080516020613d61833981519152866122a5565b610ae5600080516020613d81833981519152866122a5565b610afd600080516020613de8833981519152866122a5565b8015610b43576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b61013554604051637971bae560e11b81526000918291600160401b9091046001600160a01b03169063f2e375ca90610b8b908690859060040161368b565b602060405180830381865afa158015610ba8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcc91906136a4565b610135546040516337491c4f60e11b8152919250600091600160401b9091046001600160a01b031690636e92389e90610c09908790600401613219565b602060405180830381865afa158015610c26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4a91906136a4565b9050818110610c5d575060009392505050565b6000610c6982846136d3565b90506101f483610c7b836127106136ea565b610c859190613709565b11610c9557506000949350505050565b949350505050565b60009081526097602052604090206001015490565b610cbb82610c9d565b610cc4816121af565b610cce83836122a5565b505050565b6000610cde816121af565b5061013255565b6001600160a01b038216600090815261013a60205260408120548210801590610d1f57506101345461013354610d1b919061372b565b4210155b15610d2c5750600161099f565b50600092915050565b6000606060005b610d4761013b61232b565b811015610ddd57600080610d5a83612335565b5091509150610d698282611fa3565b15610dc8576040516001955063877721af60e01b90610d8c908490602401613219565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091529350610ddd915050565b50508080610dd590613743565b915050610d3c565b509091565b6101366020528160005260406000208181548110610dff57600080fd5b600091825260209091206002909102018054600190910154909250905082565b6001600160a01b0381163314610e945760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610e9e8282612445565b5050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610eeb5760405162461bcd60e51b8152600401610e8b9061375e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610f1d6124ac565b6001600160a01b031614610f435760405162461bcd60e51b8152600401610e8b90613798565b610f4c816124c8565b60408051600080825260208201909252610f6891839190612541565b50565b6000610f76816121af565b5061012f80546001600160a01b0319166001600160a01b0392909216919091179055565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610fe35760405162461bcd60e51b8152600401610e8b9061375e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110156124ac565b6001600160a01b03161461103b5760405162461bcd60e51b8152600401610e8b90613798565b611044826124c8565b610e9e82826001612541565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146110eb5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c6044820152771b1959081d1a1c9bdd59da0819195b1959d85d1958d85b1b60421b6064820152608401610e8b565b50600080516020613da183398151915290565b6000611109816121af565b506001600160a01b0391821660009081526101396020526040902080546001600160a01b03191691909216179055565b6000611144816121af565b6101358054600160401b600160e01b031916600160401b6001600160a01b038b160217905560005b875181101561143a576111a388828151811061118a5761118a6137d2565b602002602001015161013b6126ac90919063ffffffff16565b508681815181106111b6576111b66137d2565b602002602001015161013760008a84815181106111d5576111d56137d2565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055506000878281518110611235576112356137d2565b60200260200101516001600160a01b0316636157eb966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561127a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129e91906137e8565b90508582815181106112b2576112b26137d2565b602002602001015161013a6000836001600160a01b03166001600160a01b03168152602001908152602001600020819055508682815181106112f6576112f66137d2565b60200260200101516101396000836001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555084828151811061135a5761135a6137d2565b602002602001015161013860008b8581518110611379576113796137d2565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508361013281905550600060405180604001604052804281526020016000815250905061013660008b85815181106113de576113de6137d2565b6020908102919091018101516001600160a01b031682528181019290925260400160009081208054600181810183559183529183902084516002909302019182559290910151910155508061143281613743565b91505061116c565b505050505050505050565b6000611450816121af565b5061012d80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000606060005b61148c61013b61232b565b811015610ddd5760008060006114a184612335565b9250925092506114b083610b4d565b1580156114c257506114c28282610ce5565b15611527576040805160248101929092526001600160a01b039283166044830152929091166064808301919091528251808303909101815260849091019091526020810180516001600160e01b0316631a730de160e31b179052600193509150509091565b505050808061153590613743565b915050611481565b6000600080516020613d81833981519152611557816121af565b600061156284610b4d565b9050600081116115a95760405162461bcd60e51b8152602060048201526012602482015271139bc81c99599a5b1b081c995c5d5a5c995960721b6044820152606401610e8b565b6001600160a01b038085166000908152610137602090815260408083205481516330abf5cb60e11b815291519416938492636157eb9692600480820193918290030181865afa158015611600573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162491906137e8565b90506000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611666573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168a9190613805565b611695906012613828565b60ff1690506000826001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016116c89190613219565b602060405180830381865afa1580156116e5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170991906136a4565b610131546040516370a0823160e01b81529192506000916001600160a01b03868116926370a08231926117429290911690600401613219565b602060405180830381865afa15801561175f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061178391906136a4565b905061179083600a61392f565b61179a90836136ea565b91506117a783600a61392f565b6117b190826136ea565b90506127106117c18760c86136ea565b6117cb9190613709565b6117d5908761372b565b95508582101561181c576117e9818361372b565b86101561180d576117fe8683868c89886126c8565b60019750505050505050611986565b60009750505050505050611986565b6001600160a01b03841663a9059cbb8661183786600a61392f565b611841908a613709565b6040518363ffffffff1660e01b815260040161185e92919061368b565b6020604051808303816000875af115801561187d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a1919061393b565b50604051630efe6a8b60e01b81526001600160a01b03861690630efe6a8b906118d29087908a908190600401613958565b600060405180830381600087803b1580156118ec57600080fd5b505af1158015611900573d6000803e3d6000fd5b5050505061190d89611f11565b156117fe57610135546040516396f1382160e01b8152600160401b9091046001600160a01b0316906396f1382190611949908c90600401613219565b600060405180830381600087803b15801561196357600080fd5b505af1158015611977573d6000803e3d6000fd5b50505050600197505050505050505b50919050565b6000611997816121af565b5061012e80546001600160a01b0319166001600160a01b0392909216919091179055565b60006119c6816121af565b6101305460405163e282d5b960e01b81526001600160a01b039091169063e282d5b9906119fd903090889088908890600401613979565b600060405180830381600087803b158015611a1757600080fd5b505af1158015610b43573d6000803e3d6000fd5b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611a61816121af565b5061013455565b6000611a73816121af565b611a7f61013b8461298b565b15611abd5760405162461bcd60e51b815260206004820152600e60248201526d416c72656164792061637469766560901b6044820152606401610e8b565b611ac961013b846126ac565b50506001600160a01b0391821660009081526101376020526040902080546001600160a01b03191691909216179055565b600080516020613de8833981519152611b12816121af565b611b1c8284610ce5565b611b765760405162461bcd60e51b815260206004820152602560248201527f4275666665723a203c6d696e416d6f756e74206f72203c627269646765496e74604482015264195c9d985b60da1b6064820152608401610e8b565b6101305460405163095ea7b360e01b81526001600160a01b038481169263095ea7b392611bab9290911690879060040161368b565b6020604051808303816000875af1158015611bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bee919061393b565b50426101338190556101305461012d5461013554604051630924512f60e31b81526001600160a01b0361010090930483166004820152868316602482015260448101889052600160648201526001600160401b03909116608482015263ffffffff90931660a4840152169063492289789060c401600060405180830381600087803b158015611c7c57600080fd5b505af1158015611c90573d6000803e3d6000fd5b5050506001600160a01b03808416600090815261013960205260408082205461012e5482516317be85c360e01b8152925191851695509293849316916317be85c39160048083019286929190829003018183875af1158015611cf6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d1e9190810190613a1d565b61012f5461012d546040519395509193506001600160a01b039081169263bd45c4e792610100900490911690611d5e908690869089908d90602001613ab1565b6040516020818303038152906040526000600160006040518663ffffffff1660e01b8152600401611d93959493929190613af3565b600060405180830381600087803b158015611dad57600080fd5b505af1158015611dc1573d6000803e3d6000fd5b505061012d54610135546040517f8cd19855172f79b649919cafcdeb37d17aa75198b4f4a4415796a64690e24f299450611e1f93506101009092046001600160a01b031691899188918c916001600160401b03169089908990613b31565b60405180910390a1505050505050565b600080611e3b816121af565b6000805b611e4a61013b61232b565b811015611ecd576001600160a01b038516611e6761013b836129a0565b6001600160a01b03161415611ebb57611e8e611e8561013b836129a0565b61013b906129ac565b506001600160a01b03851660009081526101376020526040902080546001600160a01b0319169055600191505b80611ec581613743565b915050611e3f565b509392505050565b611ede82610c9d565b611ee7816121af565b610cce8383612445565b6000611efc816121af565b5061012d805460ff1916911515919091179055565b610135546040516305ff325160e01b81526000918291600160401b9091046001600160a01b0316906305ff325190611f4d908690600401613219565b608060405180830381865afa158015611f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8e9190613b9b565b5092505081159050610d2c5750600192915050565b600080826001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611fd29190613219565b602060405180830381865afa158015611fef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201391906136a4565b90506000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120799190613805565b612084906012613828565b610131546040516370a0823160e01b815260ff9290921692506000916001600160a01b03878116926370a08231926120c29290911690600401613219565b602060405180830381865afa1580156120df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061210391906136a4565b905061211082600a61392f565b61211a90846136ea565b925061212782600a61392f565b61213190826136ea565b9050600061213e87610b4d565b90506000811180156121585750612155848361372b565b81105b1561216a57600194505050505061099f565b5060009695505050505050565b6000612182816121af565b506001600160a01b0390911660009081526101386020526040902055565b6001600160a01b03163b151590565b610f6881336129c1565b60008054610100900460ff1615612207578160ff1660011480156121e357506121e1306121a0565b155b6121ff5760405162461bcd60e51b8152600401610e8b90613bdc565b506000919050565b60005460ff80841691161061222e5760405162461bcd60e51b8152600401610e8b90613bdc565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff166122745760405162461bcd60e51b8152600401610e8b90613c2a565b61227c612a25565b565b600054610100900460ff1661227c5760405162461bcd60e51b8152600401610e8b90613c2a565b6122af8282611a2b565b610e9e5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122e73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061099f825490565b600080808061234661013b866129a0565b6001600160a01b038082166000908152610137602090815260408083205481516330abf5cb60e11b8152915195965092949290931692636157eb9692600480830193928290030181865afa1580156123a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c691906137e8565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016123f69190613219565b602060405180830381865afa158015612413573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243791906136a4565b929791965091945092505050565b61244f8282611a2b565b15610e9e5760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600080516020613da1833981519152546001600160a01b031690565b600080516020613d618339815191526124e0816121af565b61012d5460ff166125325760405162461bcd60e51b815260206004820152601c60248201527b13585b9859d95c8e88155c19dc985919481b9bdd08185b1b1bddd95960221b6044820152606401610e8b565b505061012d805460ff19169055565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff161561257457610cce83612a58565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156125ce575060408051601f3d908101601f191682019092526125cb918101906136a4565b60015b6126315760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610e8b565b600080516020613da183398151915281146126a05760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610e8b565b50610cce838383612af2565b60006126c1836001600160a01b038416612b1d565b9392505050565b60006126d486886136d3565b905060006126e185612b67565b90508181600101546126f3919061372b565b6001600160a01b03861660009081526101386020526040902054101561275b5760405162461bcd60e51b815260206004820181905260248201527f43756d756c617469766520726566696c6c732065786365656473206c696d69746044820152606401610e8b565b8781600101600082825461276f919061372b565b9091555050610131546001600160a01b03808816916323b872dd91168661279787600a61392f565b6127a19087613709565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af11580156127f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612819919061393b565b508782146128a8576001600160a01b03861663a9059cbb8561283c86600a61392f565b612846908b613709565b6040518363ffffffff1660e01b815260040161286392919061368b565b6020604051808303816000875af1158015612882573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a6919061393b565b505b604051630efe6a8b60e01b81526001600160a01b03851690630efe6a8b906128d89089908c908190600401613958565b600060405180830381600087803b1580156128f257600080fd5b505af1158015612906573d6000803e3d6000fd5b5050505061291385611f11565b15610b4357610135546040516396f1382160e01b8152600160401b9091046001600160a01b0316906396f138219061294f908890600401613219565b600060405180830381600087803b15801561296957600080fd5b505af115801561297d573d6000803e3d6000fd5b505050505050505050505050565b60006126c1836001600160a01b038416612c9e565b60006126c18383612cb6565b60006126c1836001600160a01b038416612ce0565b6129cb8282611a2b565b610e9e576129e3816001600160a01b03166014612dd3565b6129ee836020612dd3565b6040516020016129ff929190613c75565b60408051601f198184030181529082905262461bcd60e51b8252610e8b91600401613ce4565b600054610100900460ff16612a4c5760405162461bcd60e51b8152600401610e8b90613c2a565b6033805460ff19169055565b612a61816121a0565b612ac35760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610e8b565b600080516020613da183398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612afb83612f6e565b600082511180612b085750805b15610cce57612b178383612fae565b50505050565b6000612b298383612c9e565b612b5f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561099f565b50600061099f565b6001600160a01b038116600090815261013660205260408120805482908290612b92906001906136d3565b81548110612ba257612ba26137d2565b906000526020600020906002020190506000610132548260000154612bc7919061372b565b905080421115612c615761013254600090612be283426136d3565b612bec9190613709565b90508015612c5f5760006101325482612c0591906136ea565b8454612c11919061372b565b604080518082018252918252600060208084018281526001600160a01b038c168352610136825292822080546001818101835591845291909220935160029091029093019283559051910155505b505b82546000908490612c74906001906136d3565b81548110612c8457612c846137d2565b600091825260209091206002909102019695505050505050565b60009081526001919091016020526040902054151590565b6000826000018281548110612ccd57612ccd6137d2565b9060005260206000200154905092915050565b60008181526001830160205260408120548015612dc9576000612d046001836136d3565b8554909150600090612d18906001906136d3565b9050818114612d7d576000866000018281548110612d3857612d386137d2565b9060005260206000200154905080876000018481548110612d5b57612d5b6137d2565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612d8e57612d8e613cf7565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061099f565b600091505061099f565b60606000612de28360026136ea565b612ded90600261372b565b6001600160401b03811115612e0457612e046132e9565b6040519080825280601f01601f191660200182016040528015612e2e576020820181803683370190505b509050600360fc1b81600081518110612e4957612e496137d2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612e7857612e786137d2565b60200101906001600160f81b031916908160001a9053506000612e9c8460026136ea565b612ea790600161372b565b90505b6001811115612f1f576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612edb57612edb6137d2565b1a60f81b828281518110612ef157612ef16137d2565b60200101906001600160f81b031916908160001a90535060049490941c93612f1881613d0d565b9050612eaa565b5083156126c15760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610e8b565b612f7781612a58565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060612fb9836121a0565b6130145760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610e8b565b600080846001600160a01b03168460405161302f9190613d24565b600060405180830381855af49150503d806000811461306a576040519150601f19603f3d011682016040523d82523d6000602084013e61306f565b606091505b50915091506130978282604051806060016040528060278152602001613dc1602791396130a0565b95945050505050565b606083156130af5750816126c1565b8251156130bf5782518084602001fd5b8160405162461bcd60e51b8152600401610e8b9190613ce4565b6000602082840312156130eb57600080fd5b81356001600160e01b0319811681146126c157600080fd5b6001600160a01b0381168114610f6857600080fd5b803561224881613103565b6000806040838503121561313657600080fd5b823561314181613103565b946020939093013593505050565b80356001600160401b038116811461224857600080fd5b60006020828403121561317857600080fd5b6126c18261314f565b600080600080600080600060e0888a03121561319c57600080fd5b87359650602088013595506040880135945060608801356131bc81613103565b935060808801356131cc81613103565b925060a08801356131dc81613103565b915060c08801356131ec81613103565b8091505092959891949750929550565b60006020828403121561320e57600080fd5b81356126c181613103565b6001600160a01b0391909116815260200190565b60006020828403121561323f57600080fd5b5035919050565b6000806040838503121561325957600080fd5b82359150602083013561326b81613103565b809150509250929050565b60005b83811015613291578181015183820152602001613279565b83811115612b175750506000910152565b600081518084526132ba816020860160208601613276565b601f01601f19169290920160200192915050565b8215158152604060208201526000610c9560408301846132a2565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613327576133276132e9565b604052919050565b600082601f83011261334057600080fd5b81356001600160401b03811115613359576133596132e9565b61336c601f8201601f19166020016132ff565b81815284602083860101111561338157600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156133b157600080fd5b82356133bc81613103565b915060208301356001600160401b038111156133d757600080fd5b6133e38582860161332f565b9150509250929050565b6000806040838503121561340057600080fd5b823561340b81613103565b9150602083013561326b81613103565b60006001600160401b03821115613434576134346132e9565b5060051b60200190565b600082601f83011261344f57600080fd5b8135602061346461345f8361341b565b6132ff565b82815260059290921b8401810191818101908684111561348357600080fd5b8286015b848110156134a757803561349a81613103565b8352918301918301613487565b509695505050505050565b600082601f8301126134c357600080fd5b813560206134d361345f8361341b565b82815260059290921b840181019181810190868411156134f257600080fd5b8286015b848110156134a757803583529183019183016134f6565b600080600080600080600060e0888a03121561352857600080fd5b61353188613118565b965060208801356001600160401b038082111561354d57600080fd5b6135598b838c0161343e565b975060408a013591508082111561356f57600080fd5b61357b8b838c0161343e565b965060608a013591508082111561359157600080fd5b61359d8b838c0161343e565b955060808a01359150808211156135b357600080fd5b6135bf8b838c016134b2565b945060a08a01359150808211156135d557600080fd5b506135e28a828b016134b2565b92505060c0880135905092959891949750929550565b60008060006060848603121561360d57600080fd5b6136168461314f565b9250602084013563ffffffff8116811461362f57600080fd5b915060408401356001600160401b0381111561364a57600080fd5b6136568682870161332f565b9150509250925092565b8015158114610f6857600080fd5b60006020828403121561368057600080fd5b81356126c181613660565b6001600160a01b03929092168252602082015260400190565b6000602082840312156136b657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156136e5576136e56136bd565b500390565b6000816000190483118215151615613704576137046136bd565b500290565b60008261372657634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561373e5761373e6136bd565b500190565b6000600019821415613757576137576136bd565b5060010190565b6020808252602c90820152600080516020613d4183398151915260408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c90820152600080516020613d4183398151915260408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156137fa57600080fd5b81516126c181613103565b60006020828403121561381757600080fd5b815160ff811681146126c157600080fd5b600060ff821660ff841680821015613842576138426136bd565b90039392505050565b600181815b8085111561388657816000190482111561386c5761386c6136bd565b8085161561387957918102915b93841c9390800290613850565b509250929050565b60008261389d5750600161099f565b816138aa5750600061099f565b81600181146138c057600281146138ca576138e6565b600191505061099f565b60ff8411156138db576138db6136bd565b50506001821b61099f565b5060208310610133831016604e8410600b8410161715613909575081810a61099f565b613913838361384b565b8060001904821115613927576139276136bd565b029392505050565b60006126c1838361388e565b60006020828403121561394d57600080fd5b81516126c181613660565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b03851681526001600160401b038416602082015263ffffffff831660408201526080606082018190526000906139b8908301846132a2565b9695505050505050565b600082601f8301126139d357600080fd5b815160206139e361345f8361341b565b82815260059290921b84018101918181019086841115613a0257600080fd5b8286015b848110156134a75780518352918301918301613a06565b60008060408385031215613a3057600080fd5b82516001600160401b0380821115613a4757600080fd5b613a53868387016139c2565b93506020850151915080821115613a6957600080fd5b506133e3858286016139c2565b600081518084526020808501945080840160005b83811015613aa657815187529582019590820190600101613a8a565b509495945050505050565b608081526000613ac46080830187613a76565b8281036020840152613ad68187613a76565b6001600160a01b0395909516604084015250506060015292915050565b600060018060a01b03808816835260a06020840152613b1560a08401886132a2565b9516604083015250606081019290925260809091015292915050565b6001600160a01b038881168252878116602083015286166040820152606081018590526001600160401b038416608082015260e060a08201819052600090613b7b90830185613a76565b82810360c0840152613b8d8185613a76565b9a9950505050505050505050565b60008060008060808587031215613bb157600080fd5b8451935060208501519250604085015191506060850151613bd181613660565b939692955090935050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613ca7816017850160208801613276565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613cd8816028840160208801613276565b01602801949350505050565b6020815260006126c160208301846132a2565b634e487b7160e01b600052603160045260246000fd5b600081613d1c57613d1c6136bd565b506000190190565b60008251613d36818460208701613276565b919091019291505056fe46756e6374696f6e206d7573742062652063616c6c6564207468726f75676820189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e38e81cee32eed7d8f4f15cd1d324edf5fe36cbe57fae18180879d4bdc265ceb30360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564d2761b102bda9831f4af400cc824b8cecb9cc5c1c85c51acb1479db9735fbfc6a2646970667358221220558e22133380902eca7cf7a28fbd48e1b0dafec4ef29b35b80b2924a4f3a449564736f6c634300080b0033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|