Overview
SOPH Balance
0 SOPH
SOPH Value
-More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
810584 | 7 days ago | Contract Creation | 0 SOPH |
Loading...
Loading
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 Source Code Verified (Exact Match)
Contract Name:
MerkleAirdrop
Compiler Version
v0.8.26+commit.8a97fa7a
ZkSolc Version
v1.5.6
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.26; import "contracts/s/AccessControlUpgradeable.sol"; import "contracts/s/Initializable.sol"; import "contracts/s/UUPSUpgradeable.sol"; import "contracts/utils/cryptography/MerkleProof.sol"; import "contracts/token/ERC20/utils/SafeERC20.sol"; import "contracts/token/LinearVestingWithPenalty.sol"; import "contracts/s/ISophonFarming.sol"; contract MerkleAirdrop is Initializable, AccessControlUpgradeable, UUPSUpgradeable { using SafeERC20 for IERC20; bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); ISophonFarming public SF_L2; bytes32 public merkleRoot; // Changed mapping to track claims per user per PID mapping(address => mapping(uint256 => bool)) public hasClaimed; event Claimed(address indexed account, uint256 pid); event MerkleRootUpdated(bytes32 newMerkleRoot); event SFL2AddressUpdated(address indexed oldAddress, address indexed newAddress); error AlreadyClaimed(); error InvalidMerkleProof(); error NotAuthorized(); error InvalidInputLengths(); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function unclaim(address user, uint256 id) public onlyRole(ADMIN_ROLE) { hasClaimed[user][id] = false; // Unset the boolean } function initialize(address _SF_L2) public initializer { require(_SF_L2 != address(0), "SF_L2 is zero address"); SF_L2 = ISophonFarming(_SF_L2); __AccessControl_init(); __UUPSUpgradeable_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(ADMIN_ROLE, msg.sender); } /** * @dev Sets the Merkle root for the airdrop. * @param _merkleRoot The new Merkle root. */ function setMerkleRoot(bytes32 _merkleRoot) external onlyRole(ADMIN_ROLE) { merkleRoot = _merkleRoot; emit MerkleRootUpdated(_merkleRoot); } /** * @dev Sets or updates the SF_L2 contract address. * @param _SF_L2 The address of the new SophonFarmingL2 contract. */ function setSFL2(address _SF_L2) external onlyRole(ADMIN_ROLE) { require(_SF_L2 != address(0), "Invalid address"); address oldAddress = address(SF_L2); SF_L2 = ISophonFarming(_SF_L2); emit SFL2AddressUpdated(oldAddress, _SF_L2); } function claim(address _user, address _customReceiver, uint256 _pid, ISophonFarming.UserInfo memory _userInfo, bytes32[] calldata _merkleProof) external onlyRole(ADMIN_ROLE) { _claim(_user, _customReceiver, _pid, _userInfo, _merkleProof); } /** * @dev Allows users to claim their tokens if they are part of the Merkle tree. * @param _user The address of the user that is participating. * @param _pid The pool ID that the user is participating in. * @param _userInfo The `UserInfo` struct containing the user's info. * @param _merkleProof The Merkle proof to verify the user's inclusion in the tree. */ function claim(address _user, uint256 _pid, ISophonFarming.UserInfo memory _userInfo, bytes32[] calldata _merkleProof) external { if (msg.sender != _user) revert NotAuthorized(); _claim(_user, _user, _pid, _userInfo, _merkleProof); } /** * @dev Allows users to claim multiple tokens if they are part of the Merkle tree. * @param _user The address of the user that is participating. * @param _pids An array of pool IDs that the user is participating in. * @param _userInfos An array of `UserInfo` structs containing the user's info for each pool. * @param _merkleProofs An array of Merkle proofs to verify the user's inclusion in the tree for each pool. */ function claimMultiple( address _user, uint256[] calldata _pids, ISophonFarming.UserInfo[] calldata _userInfos, bytes32[][] calldata _merkleProofs ) external { if (msg.sender != _user) revert NotAuthorized(); if (_pids.length != _userInfos.length || _userInfos.length != _merkleProofs.length) revert InvalidInputLengths(); for (uint256 i = 0; i < _pids.length; i++) { _claim(_user, _user, _pids[i], _userInfos[i], _merkleProofs[i]); } } function _claim(address _user, address _customReceiver, uint256 _pid, ISophonFarming.UserInfo memory _userInfo, bytes32[] calldata _merkleProof) internal { bool alreadyClaimed = hasClaimed[_user][_pid]; if (alreadyClaimed) revert AlreadyClaimed(); // Verify the Merkle proof. bytes32 leaf = keccak256(abi.encodePacked(_user, _pid, _userInfo.amount, _userInfo.boostAmount, _userInfo.depositAmount, _userInfo.rewardSettled, _userInfo.rewardDebt)); if (!MerkleProof.verify(_merkleProof, merkleRoot, leaf)) revert InvalidMerkleProof(); // Mark it claimed and update user info. hasClaimed[_user][_pid] = true; SF_L2.updateUserInfo(_customReceiver, _pid, _userInfo); emit Claimed(_user, _pid); } /** * @dev Allows the recovery of any ERC20 tokens sent to the contract by mistake. * @param token The address of the token to recover. * @param to The address to send the recovered tokens to. */ function rescue(IERC20 token, address to) external onlyRole(ADMIN_ROLE) { token.safeTransfer(to, token.balanceOf(address(this))); } /** * @dev Required by UUPSUpgradeable to authorize upgrades. * @param newImplementation The address of the new implementation. */ function _authorizeUpgrade(address newImplementation) internal override onlyRole(ADMIN_ROLE) {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "contracts/s/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "contracts/n/ERC165Upgradeable.sol"; import {Initializable} from "contracts/s/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @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 returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual 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 `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @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. */ 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 `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "contracts/s/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "contracts/utils/introspection/IERC165.sol"; import {Initializable} from "contracts/s/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); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "contracts/s/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. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @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() { _checkProxy(); _; } /** * @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() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing 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 notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "contracts/proxy/beacon/IBeacon.sol"; import {Address} from "contracts/utils/Address.sol"; import {StorageSlot} from "contracts/utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-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 the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @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: * ```solidity * 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(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.20; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Sorts the pair (a, b) and hashes the result. */ function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "contracts/token/ERC20/IERC20.sol"; import {IERC20Permit} from "contracts/token/ERC20/extensions/IERC20Permit.sol"; import {Address} from "contracts/utils/Address.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 SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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(IERC20 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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; import "contracts/s/Initializable.sol"; import "contracts/0/ERC20Upgradeable.sol"; import "contracts/s/AccessControlUpgradeable.sol"; import "contracts/s/UUPSUpgradeable.sol"; import "contracts/token/ERC20/utils/SafeERC20.sol"; /** * @title LinearVestingWithPenalty * @dev This contract manages multiple vesting schedules with an optional early withdrawal penalty. * Beneficiaries can have multiple schedules and release tokens according to their schedules. * The contract is upgradeable and uses role-based access control. */ contract LinearVestingWithPenalty is Initializable, ERC20Upgradeable, AccessControlUpgradeable, UUPSUpgradeable { using SafeERC20 for IERC20; struct VestingSchedule { uint256 totalAmount; // Total tokens to be vested uint256 released; // Amount of tokens released so far uint256 duration; // Duration of the vesting schedule in seconds uint256 startDate; // Start date of the vesting schedule } bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant SCHEDULE_MANAGER_ROLE = keccak256("SCHEDULE_MANAGER_ROLE"); bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE"); IERC20 public sophtoken; // The underlying token being vested address public penaltyRecipient; // Address receiving penalties uint256 public vestingStartDate; // Global vesting start date uint256 public penaltyPercentage; // Penalty percentage for early withdrawals (e.g., 50 for 50%) mapping(address => VestingSchedule[]) public vestingSchedules; // Vesting schedules per beneficiary // Events event TokensReleased(address indexed beneficiary, uint256 netAmount, uint256 penaltyAmount); event VestingScheduleAdded(address indexed beneficiary, uint256 totalAmount, uint256 duration, uint256 startDate); event VestingStartDateUpdated(uint256 newVestingStartDate); event PenaltyRecipientUpdated(address newPenaltyRecipient); event PenaltyPercentageUpdated(uint256 newPenaltyPercentage); event PenaltyPaid(address indexed beneficiary, uint256 penaltyAmount); // Custom Errors error TotalAmountMustBeGreaterThanZero(); error DurationMustBeGreaterThanZero(); error VestingHasNotStartedYet(); error VestingStartDateAlreadySet(); error VestingStartDateCannotBeInThePast(); error InvalidScheduleIndex(); error InvalidRange(); error InvalidRecipientAddress(); error PenaltyMustBeLessThanOrEqualTo100Percent(); error MismatchedArrayLengths(); error NoTokensToRelease(); error NoVestingSchedule(); /** * @dev Initializes the contract with the given token address, initial penalty recipient, and penalty percentage. * @param tokenAddress The address of the token to be vested. * @param initialPenaltyRecipient The address that will receive penalties. * @param initialPenaltyPercentage The initial penalty percentage (e.g., 50 for 50%). */ function initialize( address tokenAddress, address adminAddress, address initialPenaltyRecipient, uint256 initialPenaltyPercentage ) public initializer { if (tokenAddress == address(0) || initialPenaltyRecipient == address(0)) revert InvalidRecipientAddress(); if (initialPenaltyPercentage > 100) revert PenaltyMustBeLessThanOrEqualTo100Percent(); __ERC20_init("vesting Sophon Token", "vSOPH"); __AccessControl_init(); __UUPSUpgradeable_init(); sophtoken = IERC20(tokenAddress); penaltyRecipient = initialPenaltyRecipient; penaltyPercentage = initialPenaltyPercentage; _grantRole(DEFAULT_ADMIN_ROLE, adminAddress); _grantRole(ADMIN_ROLE, adminAddress); _grantRole(SCHEDULE_MANAGER_ROLE, adminAddress); _grantRole(UPGRADER_ROLE, adminAddress); } /** * @dev Sets the penalty recipient address. * @param newPenaltyRecipient The new penalty recipient address. */ function setPenaltyRecipient(address newPenaltyRecipient) external onlyRole(ADMIN_ROLE) { if (newPenaltyRecipient == address(0)) revert InvalidRecipientAddress(); penaltyRecipient = newPenaltyRecipient; emit PenaltyRecipientUpdated(newPenaltyRecipient); } /** * @dev Sets the penalty percentage. * @param newPenaltyPercentage The new penalty percentage (e.g., 50 for 50%). */ function setPenaltyPercentage(uint256 newPenaltyPercentage) external onlyRole(ADMIN_ROLE) { if (newPenaltyPercentage > 100) revert PenaltyMustBeLessThanOrEqualTo100Percent(); penaltyPercentage = newPenaltyPercentage; emit PenaltyPercentageUpdated(newPenaltyPercentage); } /** * @dev Sets the global vesting start date. * @param newVestingStartDate The new vesting start date. */ function setVestingStartDate(uint256 newVestingStartDate) external onlyRole(ADMIN_ROLE) { if (vestingStartDate != 0) revert VestingStartDateAlreadySet(); if (newVestingStartDate < block.timestamp) revert VestingStartDateCannotBeInThePast(); vestingStartDate = newVestingStartDate; emit VestingStartDateUpdated(newVestingStartDate); } /** * @dev Adds a vesting schedule for a beneficiary. * @param beneficiary The address of the beneficiary. * @param amount The total amount to be vested. * @param duration The duration of the vesting schedule in seconds. * @param startDate The start date of the vesting schedule. */ function addVestingSchedule( address beneficiary, uint256 amount, uint256 duration, uint256 startDate ) external onlyRole(SCHEDULE_MANAGER_ROLE) { _addVestingSchedule(beneficiary, amount, duration, startDate); } function _addVestingSchedule( address beneficiary, uint256 amount, uint256 duration, uint256 startDate ) internal { if (beneficiary == address(0)) revert InvalidRecipientAddress(); if (amount == 0) revert TotalAmountMustBeGreaterThanZero(); if (duration == 0) revert DurationMustBeGreaterThanZero(); uint256 scheduleStartDate = startDate; if (vestingStartDate != 0 && startDate <= vestingStartDate) { scheduleStartDate = vestingStartDate; } VestingSchedule memory schedule = VestingSchedule({ totalAmount: amount, released: 0, duration: duration, startDate: scheduleStartDate }); vestingSchedules[beneficiary].push(schedule); _mint(beneficiary, amount); emit VestingScheduleAdded(beneficiary, amount, duration, scheduleStartDate); } /** * @dev Adds multiple vesting schedules at once. * @param beneficiaries The addresses of the beneficiaries. * @param amounts The total amounts to be vested. * @param durations The durations of the vesting schedules in seconds. * @param startDates The start dates of the vesting schedules. */ function addMultipleVestingSchedules( address[] calldata beneficiaries, uint256[] calldata amounts, uint256[] calldata durations, uint256[] calldata startDates ) external onlyRole(SCHEDULE_MANAGER_ROLE) { if ( beneficiaries.length != amounts.length || beneficiaries.length != durations.length || beneficiaries.length != startDates.length ) revert MismatchedArrayLengths(); for (uint256 i = 0; i < beneficiaries.length; i++) { _addVestingSchedule(beneficiaries[i], amounts[i], durations[i], startDates[i]); } } /** * @dev Internal function to process and release tokens from a vesting schedule. * @param schedule The vesting schedule. * @param acceptPenalty Whether to accept an early withdrawal penalty. * @return releasedAmount The amount of tokens released. */ function _processSchedule(VestingSchedule storage schedule, bool acceptPenalty) internal returns (uint256 releasedAmount) { // this is critical part. set startDate if schedule.startDate was zero if (vestingStartDate != 0 && block.timestamp >= vestingStartDate && schedule.startDate == 0) { schedule.startDate = vestingStartDate; } if (!_hasVestingStarted(schedule)) revert VestingHasNotStartedYet(); return _releaseFromSchedule(schedule, acceptPenalty); } /** * @dev Checks if vesting has started for a schedule. * @param schedule The vesting schedule. * @return True if vesting has started, false otherwise. */ function _hasVestingStarted(VestingSchedule storage schedule) internal view returns (bool) { return schedule.startDate != 0 && block.timestamp >= schedule.startDate; } /** * @dev Releases vested tokens from specific schedules provided as an array. * @param scheduleIndices The indices of the vesting schedules. * @param acceptPenalty Whether to accept an early withdrawal penalty. */ function releaseSpecificSchedules(uint256[] calldata scheduleIndices, bool acceptPenalty) external { VestingSchedule[] storage schedules = vestingSchedules[msg.sender]; if (schedules.length == 0) revert NoVestingSchedule(); uint256 totalAmountToRelease = 0; for (uint256 i = 0; i < scheduleIndices.length; i++) { uint256 scheduleIndex = scheduleIndices[i]; if (scheduleIndex >= schedules.length) revert InvalidScheduleIndex(); VestingSchedule storage schedule = schedules[scheduleIndex]; uint256 released = _processSchedule(schedule, acceptPenalty); totalAmountToRelease += released; } if (totalAmountToRelease == 0) revert NoTokensToRelease(); } /** * @dev Releases vested tokens from a range of schedules. * @param startIndex The starting index. * @param endIndex The ending index (exclusive). * @param acceptPenalty Whether to accept an early withdrawal penalty. */ function releaseSchedulesInRange(uint256 startIndex, uint256 endIndex, bool acceptPenalty) external { VestingSchedule[] storage schedules = vestingSchedules[msg.sender]; if (schedules.length == 0) revert NoVestingSchedule(); if (startIndex >= endIndex || endIndex > schedules.length) revert InvalidRange(); uint256 totalAmountToRelease = 0; for (uint256 i = startIndex; i < endIndex; i++) { VestingSchedule storage schedule = schedules[i]; uint256 released = _processSchedule(schedule, acceptPenalty); totalAmountToRelease += released; } if (totalAmountToRelease == 0) revert NoTokensToRelease(); } /** * @dev Internal function to release tokens from a vesting schedule. * @param schedule The vesting schedule. * @param acceptPenalty Whether to accept an early withdrawal penalty. * @return releasedAmount Amount that was released */ function _releaseFromSchedule(VestingSchedule storage schedule, bool acceptPenalty) internal returns(uint256 releasedAmount) { uint256 amountToRelease = _releasableAmount(schedule); uint256 penalty = 0; schedule.released += amountToRelease; uint256 unvestedAmount = schedule.totalAmount - schedule.released; if (acceptPenalty && unvestedAmount > 0) { penalty = (unvestedAmount * penaltyPercentage) / 100; amountToRelease += unvestedAmount - penalty; // at this point schedule.released should be 100% schedule.released += unvestedAmount; _burn(msg.sender, penalty); sophtoken.safeTransfer(penaltyRecipient, penalty); emit PenaltyPaid(msg.sender, penalty); } _burn(msg.sender, amountToRelease); releasedAmount = amountToRelease; sophtoken.safeTransfer(msg.sender, amountToRelease); emit TokensReleased(msg.sender, amountToRelease, penalty); } /** * @dev Calculates the vested amount for a vesting schedule. */ function _vestedAmount(VestingSchedule storage schedule) internal view returns (uint256) { if (vestingStartDate == 0 || block.timestamp < schedule.startDate) { return 0; } uint256 effectiveStartDate = schedule.startDate; if (effectiveStartDate < vestingStartDate) { effectiveStartDate = vestingStartDate; } uint256 elapsedTime = block.timestamp - effectiveStartDate; if (elapsedTime >= schedule.duration) { return schedule.totalAmount; } else { return (schedule.totalAmount * elapsedTime) / schedule.duration; } } /** * @dev Calculates the releasable amount for a vesting schedule. * @param schedule The vesting schedule. * @return The releasable amount. */ function _releasableAmount(VestingSchedule storage schedule) internal view returns (uint256) { return _vestedAmount(schedule) - schedule.released; } /** * @dev Returns the total vested amount for a beneficiary across all schedules. * @param beneficiary The address of the beneficiary. * @return totalVestedAmount total vested amount. */ function vestedAmount(address beneficiary) external view returns (uint256 totalVestedAmount) { VestingSchedule[] storage schedules = vestingSchedules[beneficiary]; for (uint256 i = 0; i < schedules.length; i++) { totalVestedAmount += _vestedAmount(schedules[i]); } } /** * @dev Returns the total releasable amount for a beneficiary across all schedules. * @param beneficiary The address of the beneficiary. * @return totalReleasableAmount total releasable amount. */ function releasableAmount(address beneficiary) external view returns (uint256 totalReleasableAmount) { VestingSchedule[] storage schedules = vestingSchedules[beneficiary]; for (uint256 i = 0; i < schedules.length; i++) { totalReleasableAmount += _releasableAmount(schedules[i]); } } /** * @dev Returns all vesting schedules for a beneficiary. * @param beneficiary The address of the beneficiary. * @return An array of VestingSchedule structs. */ function getVestingSchedules(address beneficiary) external view returns (VestingSchedule[] memory) { return vestingSchedules[beneficiary]; } /** * @dev Returns a range of vesting schedules for a beneficiary. * @param beneficiary The address of the beneficiary. * @param start The starting index. * @param end The ending index (exclusive). * @return An array of VestingSchedule structs. */ function getVestingSchedulesInRange( address beneficiary, uint256 start, uint256 end ) external view returns (VestingSchedule[] memory) { VestingSchedule[] storage schedules = vestingSchedules[beneficiary]; if (start >= end || end > schedules.length) revert InvalidRange(); uint256 length = end - start; VestingSchedule[] memory rangeSchedules = new VestingSchedule[](length); for (uint256 i = 0; i < length; i++) { rangeSchedules[i] = schedules[start + i]; } return rangeSchedules; } /** * @dev Claims the full vested tokens for the caller from specific vesting schedules and burns the claimed vSOPH tokens. * @param scheduleIndexes The indexes of the vesting schedules to claim from. */ function claim(uint256[] calldata scheduleIndexes) external { if (vestingStartDate > block.timestamp) revert VestingHasNotStartedYet(); uint256 totalReleasable = 0; for (uint256 i = 0; i < scheduleIndexes.length; i++) { uint256 index = scheduleIndexes[i]; if (index >= vestingSchedules[msg.sender].length) revert InvalidScheduleIndex(); VestingSchedule storage schedule = vestingSchedules[msg.sender][index]; uint256 releasable = _releasableAmount(schedule); if (releasable > 0) { schedule.released += releasable; totalReleasable += releasable; } } require(totalReleasable > 0, "No tokens available for release"); _burn(msg.sender, totalReleasable); sophtoken.safeTransfer(msg.sender, totalReleasable); emit TokensReleased(msg.sender, totalReleasable, 0); } /** * @dev Returns the list of unclaimed vesting schedule indexes for the beneficiary within a specified range and their respective releasable amounts. * @param beneficiary The address of the beneficiary to check unclaimed schedules for. * @param start The starting index of the range (inclusive). * @param end The ending index of the range (exclusive). * @return indexes An array of indexes for schedules with unclaimed tokens within the specified range. * @return amounts An array of unclaimed amounts corresponding to each index within the specified range. */ function getUnclaimedSchedulesInRange( address beneficiary, uint256 start, uint256 end ) external view returns (uint256[] memory indexes, uint256[] memory amounts) { uint256 scheduleCount = vestingSchedules[beneficiary].length; require(start < end && end <= scheduleCount, "Invalid range"); // Create temporary arrays with a fixed maximum size (end - start) uint256[] memory tempIndexes = new uint256[](end - start); uint256[] memory tempAmounts = new uint256[](end - start); uint256 unclaimedCount = 0; // Single loop to collect unclaimed schedules within the range for (uint256 i = start; i < end; i++) { VestingSchedule storage schedule = vestingSchedules[beneficiary][i]; uint256 releasable = _releasableAmount(schedule); if (releasable > 0) { tempIndexes[unclaimedCount] = i; tempAmounts[unclaimedCount] = releasable; unclaimedCount++; } } // Create result arrays with exact size of unclaimed schedules indexes = new uint256[](unclaimedCount); amounts = new uint256[](unclaimedCount); // Copy collected data to result arrays for (uint256 j = 0; j < unclaimedCount; j++) { indexes[j] = tempIndexes[j]; amounts[j] = tempAmounts[j]; } return (indexes, amounts); } /** * @dev Claims the entire releasable amount for specific vesting schedule indexes with an applied penalty. * @param scheduleIndexes An array of indexes of the vesting schedules to claim from. */ function claimSpecificSchedulesWithPenalty(uint256[] calldata scheduleIndexes) external { if (vestingStartDate > block.timestamp) revert VestingHasNotStartedYet(); uint256 totalNetToUser = 0; uint256 totalPenaltyAmount = 0; for (uint256 i = 0; i < scheduleIndexes.length; i++) { uint256 index = scheduleIndexes[i]; if (index >= vestingSchedules[msg.sender].length) revert InvalidScheduleIndex(); VestingSchedule storage schedule = vestingSchedules[msg.sender][index]; // Calculate the releasable (vested) amount that must be released without penalty uint256 releasable = _releasableAmount(schedule); // Calculate the unvested amount uint256 unvestedAmount = schedule.totalAmount - schedule.released - releasable; // Calculate the penalty amount on the unvested portion uint256 penaltyAmount = (unvestedAmount * penaltyPercentage) / 100; // Calculate the net amount for the user: full releasable + (unvested - penalty) uint256 netAmountToUser = releasable + (unvestedAmount - penaltyAmount); // Accumulate amounts for total transfer totalNetToUser += netAmountToUser; totalPenaltyAmount += penaltyAmount; // Mark the entire schedule as claimed by setting released to totalAmount schedule.released = schedule.totalAmount; } require(totalNetToUser > 0, "No tokens available for release"); // Transfer the penalty amount to the penalty recipient, if any if (totalPenaltyAmount > 0) { sophtoken.safeTransfer(penaltyRecipient, totalPenaltyAmount); emit PenaltyPaid(msg.sender, totalPenaltyAmount); } // Burn the claimed vSOPH tokens equivalent to the total released amount plus penalties _burn(msg.sender, totalNetToUser + totalPenaltyAmount); // Transfer the total net amount (releasable + post-penalty unvested) to the beneficiary sophtoken.safeTransfer(msg.sender, totalNetToUser); emit TokensReleased(msg.sender, totalNetToUser, totalPenaltyAmount); } /** * @dev Rescue function to transfer stuck tokens. * @param token The token to rescue. * @param to The address to send the tokens to. */ function rescue(IERC20 token, address to) external onlyRole(ADMIN_ROLE) { if (to == address(0)) revert InvalidRecipientAddress(); token.safeTransfer(to, token.balanceOf(address(this))); } // /** // * @dev Overrides the internal _update function to transfer vesting schedules // * and enforce admin-only access through the onlyAdmin modifier. // */ // function _update(address from, address to, uint256 value) internal virtual override onlyRole(ADMIN_ROLE) { // if (to == address(0)) revert InvalidRecipientAddress(); // // except minting // if (from != address(0)) { // _transferVestingSchedules(from, to); // Streamlined transfer of schedules // } // // Call the parent _update function to maintain balance updates and event emissions // super._update(from, to, value); // } function transfer(address to, uint256 value) public virtual override onlyRole(ADMIN_ROLE) returns (bool) { super.transfer(to, value); } function transferFrom(address from, address to, uint256 value) public virtual override onlyRole(ADMIN_ROLE) returns (bool) { super.transferFrom(from, to, value); } function adminTransfer( address from, address to ) public onlyRole(ADMIN_ROLE) returns (bool) { // Transfer the specified amount of tokens uint256 amount = balanceOf(from); _transfer(from, to, amount); // Transfer all vesting schedules from 'from' to 'to' _transferVestingSchedules(from, to); return true; } /** * @dev Helper function to transfer all vesting schedules from one address to another. * @param from The address to transfer schedules from. * @param to The address to transfer schedules to. */ function _transferVestingSchedules(address from, address to) internal { VestingSchedule[] storage schedulesFrom = vestingSchedules[from]; for (uint256 i = 0; i < schedulesFrom.length; i++) { vestingSchedules[to].push(schedulesFrom[i]); } delete vestingSchedules[from]; } function _authorizeUpgrade(address newImplementation) internal override onlyRole(UPGRADER_ROLE) {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {ContextUpgradeable} from "contracts/s/ContextUpgradeable.sol"; import {IERC20Errors} from "contracts/interfaces/draft-IERC6093.sol"; import {Initializable} from "contracts/s/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors { /// @custom:storage-location erc7201:openzeppelin.storage.ERC20 struct ERC20Storage { mapping(address account => uint256) _balances; mapping(address account => mapping(address spender => uint256)) _allowances; uint256 _totalSupply; string _name; string _symbol; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00; function _getERC20Storage() private pure returns (ERC20Storage storage $) { assembly { $.slot := ERC20StorageLocation } } /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { ERC20Storage storage $ = _getERC20Storage(); $._name = name_; $._symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); return $._name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { ERC20Storage storage $ = _getERC20Storage(); return $._symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { ERC20Storage storage $ = _getERC20Storage(); return $._allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows $._totalSupply += value; } else { uint256 fromBalance = $._balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. $._balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. $._totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. $._balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { ERC20Storage storage $ = _getERC20Storage(); if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } $._allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "contracts/token/ERC20/IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.26; import "contracts/token/ERC20/IERC20.sol"; import "contracts/farm/interfaces/bridge/IBridgehub.sol"; interface ISophonFarming { // Info of each pool. struct PoolInfo { IERC20 lpToken; // Address of LP token contract. address l2Farm; // Address of the farming contract on Sophon chain uint256 amount; // total amount of LP tokens earning yield from deposits and boosts uint256 boostAmount; // total boosted value purchased by users uint256 depositAmount; // remaining deposits not applied to a boost purchases uint256 allocPoint; // How many allocation points assigned to this pool. Points to distribute per block. uint256 lastRewardBlock; // Last block number that points distribution occurs. uint256 accPointsPerShare; // Accumulated points per share. uint256 totalRewards; // Total rewards earned by the pool. string description; // Description of pool. } // Info of each user. struct UserInfo { uint256 amount; // Amount of LP tokens the user is earning yield on from deposits and boosts uint256 boostAmount; // Boosted value purchased by the user uint256 depositAmount; // remaining deposits not applied to a boost purchases uint256 rewardSettled; // rewards settled uint256 rewardDebt; // rewards debt } enum PredefinedPool { sDAI, // MakerDAO (sDAI) wstETH, // Lido (wstETH) weETH // ether.fi (weETH) } /// @notice Emitted when a new pool is added event Add(address indexed lpToken, uint256 indexed pid, uint256 allocPoint); /// @notice Emitted when a pool is updated event Set(address indexed lpToken, uint256 indexed pid, uint256 allocPoint); /// @notice Emitted when a user deposits to a pool event Deposit(address indexed user, uint256 indexed pid, uint256 depositAmount, uint256 boostAmount); /// @notice Emitted when a user withdraws from a pool event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); /// @notice Emitted when a whitelisted admin transfers points from one user to another event TransferPoints(address indexed sender, address indexed receiver, uint256 indexed pid, uint256 amount); /// @notice Emitted when a user increases the boost of an existing deposit event IncreaseBoost(address indexed user, uint256 indexed pid, uint256 boostAmount); /// @notice Emitted when all pool funds are bridged to Sophon blockchain event BridgePool(address indexed user, uint256 indexed pid, uint256 amount); /// @notice Emitted when the the revertFailedBridge function is called event RevertFailedBridge(uint256 indexed pid); /// @notice Emitted when the the updatePool function is called event PoolUpdated(uint256 indexed pid); error ZeroAddress(); error PoolExists(); error PoolDoesNotExist(); error AlreadyInitialized(); error NotFound(address lpToken); error FarmingIsStarted(); error FarmingIsEnded(); error TransferNotAllowed(); error TransferTooHigh(uint256 maxAllowed); error InvalidEndBlock(); error InvalidDeposit(); error InvalidBooster(); error InvalidPointsPerBlock(); error InvalidTransfer(); error WithdrawNotAllowed(); error WithdrawTooHigh(uint256 maxAllowed); error WithdrawIsZero(); error NothingInPool(); error NoEthSent(); error BoostTooHigh(uint256 maxAllowed); error BoostIsZero(); error BridgeInvalid(); function initialize(uint256 wstEthAllocPoint_, uint256 weEthAllocPoint_, uint256 sDAIAllocPoint_, uint256 _pointsPerBlock, uint256 _initialPoolStartBlock, uint256 _boosterMultiplier) external; function add(uint256 _allocPoint, address _lpToken, string memory _description, uint256 _poolStartBlock, uint256 _newPointsPerBlock) external returns (uint256); function addPool( uint256 _pid, IERC20 _lpToken, address _l2Farm, uint256 _amount, uint256 _boostAmount, uint256 _depositAmount, uint256 _allocPoint, uint256 _lastRewardBlock, uint256 _accPointsPerShare, uint256 _totalRewards, string memory _description, uint256 _heldProceeds) external; function set(uint256 _pid, uint256 _allocPoint, uint256 _poolStartBlock, uint256 _newPointsPerBlock) external; function poolLength() external view returns (uint256); function isFarmingEnded() external view returns (bool); function isWithdrawPeriodEnded() external view returns (bool); function setBridge(address _bridge) external; function setEndBlock(uint256 _endBlock, uint256 _withdrawalBlocks) external; function setPointsPerBlock(uint256 _pointsPerBlock) external; function setBoosterMultiplier(uint256 _boosterMultiplier) external; function pendingPoints(uint256 _pid, address _user) external view returns (uint256); function massUpdatePools() external; function updatePool(uint256 _pid) external; function deposit(uint256 _pid, uint256 _amount, uint256 _boostAmount) external; function depositDai(uint256 _amount, uint256 _boostAmount) external; function depositStEth(uint256 _amount, uint256 _boostAmount) external; function depositEth(uint256 _boostAmount, PredefinedPool predefinedPool) external payable; function depositeEth(uint256 _amount, uint256 _boostAmount) external; function depositWeth(uint256 _amount, uint256 _boostAmount, PredefinedPool predefinedPool) external; function withdraw(uint256 _pid, uint256 _withdrawAmount) external; function bridgePool(uint256 _pid, uint256 _mintValue, address sophToken) external; function bridgeUSDC(uint256 _mintValue, address _sophToken, IBridgehub _bridge) external; function revertFailedBridge(uint256 _pid) external; function increaseBoost(uint256 _pid, uint256 _boostAmount) external; function getPoolInfo() external view returns (PoolInfo[] memory); function getOptimizedUserInfo(address[] memory _users) external view returns (uint256[4][][] memory); function getPendingPoints(address[] memory _users) external view returns (uint256[][] memory); function getBlockMultiplier(uint256 _from, uint256 _to) external view returns (uint256); function getBlockNumber() external view returns (uint256); function whitelist(address userAdmin, address user) external view returns (bool); function getMaxAdditionalBoost(address _user, uint256 _pid) external view returns (uint256); function dai() external view returns (address); function sDAI() external view returns (address); function weth() external view returns (address); function stETH() external view returns (address); function wstETH() external view returns (address); function eETH() external view returns (address); function eETHLiquidityPool() external view returns (address); function weETH() external view returns (address); function MERKLE() external view returns (address); function typeToId(PredefinedPool poolType) external view returns (uint256); function heldProceeds(uint256 poolId) external view returns (uint256); function boosterMultiplier() external view returns (uint256); function pointsPerBlock() external view returns (uint256); function poolInfo(uint256 pid) external view returns (PoolInfo memory); function userInfo(uint256 pid, address user) external view returns (UserInfo memory); function totalAllocPoint() external view returns (uint256); function endBlock() external view returns (uint256); function poolExists(address pool) external view returns (bool); function endBlockForWithdrawals() external view returns (uint256); function bridge() external view returns (address); function isBridged(uint256 poolId) external view returns (bool); function setTotalAllocPoint(uint256 _totalAllocPoint) external; function transferPoints(uint256 _pid, address _sender, address _receiver, uint256 _transferAmount) external; function poolValue(uint256 pid) external view returns ( bytes32 feedHash, uint256 staleSeconds, uint256 lastValue, uint256 emissionsMultiplier ); function pendingOwner() external view returns (address); function transferOwnership(address newOwner) external; function acceptOwnership() external; function owner() external view returns (address); // onlyOwner function replaceImplementation(address impl_) external; function becomeImplementation(address proxy) external; function pendingImplementation() external returns(address); function implementation() external view returns (address); function setUsersWhitelisted(address _userAdmin, address[] memory _users, bool _isInWhitelist) external; function setL2Farm(uint256 _pid, address _l2Farm) external; function setPriceFeedData(uint256 _pid, bytes32 _newHash, uint256 _newStaleSeconds, uint256 _emissionsMultiplier) external; function updateUserInfo(address _user, uint256 _pid, UserInfo memory _userFromClaim) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; import {IL1SharedBridge} from "contracts/farm/interfaces/bridge/IL1SharedBridge.sol"; import {L2Message, L2Log, TxStatus} from "contracts/farm/interfaces/bridge/Messaging.sol"; struct L2TransactionRequestDirect { uint256 chainId; uint256 mintValue; address l2Contract; uint256 l2Value; bytes l2Calldata; uint256 l2GasLimit; uint256 l2GasPerPubdataByteLimit; bytes[] factoryDeps; address refundRecipient; } struct L2TransactionRequestTwoBridgesOuter { uint256 chainId; uint256 mintValue; uint256 l2Value; uint256 l2GasLimit; uint256 l2GasPerPubdataByteLimit; address refundRecipient; address secondBridgeAddress; uint256 secondBridgeValue; bytes secondBridgeCalldata; } struct L2TransactionRequestTwoBridgesInner { bytes32 magicValue; address l2Contract; bytes l2Calldata; bytes[] factoryDeps; bytes32 txDataHash; } interface IBridgehub { /// @notice pendingAdmin is changed /// @dev Also emitted when new admin is accepted and in this case, `newPendingAdmin` would be zero address event NewPendingAdmin(address indexed oldPendingAdmin, address indexed newPendingAdmin); /// @notice Admin changed event NewAdmin(address indexed oldAdmin, address indexed newAdmin); /// @notice Starts the transfer of admin rights. Only the current admin can propose a new pending one. /// @notice New admin can accept admin rights by calling `acceptAdmin` function. /// @param _newPendingAdmin Address of the new admin function setPendingAdmin(address _newPendingAdmin) external; /// @notice Accepts transfer of admin rights. Only pending admin can accept the role. function acceptAdmin() external; /// Getters function stateTransitionManagerIsRegistered(address _stateTransitionManager) external view returns (bool); function stateTransitionManager(uint256 _chainId) external view returns (address); function tokenIsRegistered(address _baseToken) external view returns (bool); function baseToken(uint256 _chainId) external view returns (address); function sharedBridge() external view returns (IL1SharedBridge); function getHyperchain(uint256 _chainId) external view returns (address); /// Mailbox forwarder function proveL2MessageInclusion( uint256 _chainId, uint256 _batchNumber, uint256 _index, L2Message calldata _message, bytes32[] calldata _proof ) external view returns (bool); function proveL2LogInclusion( uint256 _chainId, uint256 _batchNumber, uint256 _index, L2Log memory _log, bytes32[] calldata _proof ) external view returns (bool); function proveL1ToL2TransactionStatus( uint256 _chainId, bytes32 _l2TxHash, uint256 _l2BatchNumber, uint256 _l2MessageIndex, uint16 _l2TxNumberInBatch, bytes32[] calldata _merkleProof, TxStatus _status ) external view returns (bool); function requestL2TransactionDirect( L2TransactionRequestDirect calldata _request ) external payable returns (bytes32 canonicalTxHash); function requestL2TransactionTwoBridges( L2TransactionRequestTwoBridgesOuter calldata _request ) external payable returns (bytes32 canonicalTxHash); function l2TransactionBaseCost( uint256 _chainId, uint256 _gasPrice, uint256 _l2GasLimit, uint256 _l2GasPerPubdataByteLimit ) external view returns (uint256); //// Registry function createNewChain( uint256 _chainId, address _stateTransitionManager, address _baseToken, uint256 _salt, address _admin, bytes calldata _initData ) external returns (uint256 chainId); function addStateTransitionManager(address _stateTransitionManager) external; function removeStateTransitionManager(address _stateTransitionManager) external; function addToken(address _token) external; function setSharedBridge(address _sharedBridge) external; event NewChain(uint256 indexed chainId, address stateTransitionManager, address indexed chainGovernance); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; /// @title L1 Bridge contract interface /// @author Matter Labs /// @custom:security-contact [email protected] interface IL1SharedBridge { event LegacyDepositInitiated( uint256 indexed chainId, bytes32 indexed l2DepositTxHash, address indexed from, address to, address l1Token, uint256 amount ); event BridgehubDepositInitiated( uint256 indexed chainId, bytes32 indexed txDataHash, address indexed from, address to, address l1Token, uint256 amount ); event BridgehubDepositBaseTokenInitiated( uint256 indexed chainId, address indexed from, address l1Token, uint256 amount ); event BridgehubDepositFinalized( uint256 indexed chainId, bytes32 indexed txDataHash, bytes32 indexed l2DepositTxHash ); event WithdrawalFinalizedSharedBridge( uint256 indexed chainId, address indexed to, address indexed l1Token, uint256 amount ); event ClaimedFailedDepositSharedBridge( uint256 indexed chainId, address indexed to, address indexed l1Token, uint256 amount ); function isWithdrawalFinalized( uint256 _chainId, uint256 _l2BatchNumber, uint256 _l2MessageIndex ) external view returns (bool); function depositLegacyErc20Bridge( address _msgSender, address _l2Receiver, address _l1Token, uint256 _amount, uint256 _l2TxGasLimit, uint256 _l2TxGasPerPubdataByte, address _refundRecipient ) external payable returns (bytes32 txHash); function claimFailedDepositLegacyErc20Bridge( address _depositSender, address _l1Token, uint256 _amount, bytes32 _l2TxHash, uint256 _l2BatchNumber, uint256 _l2MessageIndex, uint16 _l2TxNumberInBatch, bytes32[] calldata _merkleProof ) external; function claimFailedDeposit( uint256 _chainId, address _depositSender, address _l1Token, uint256 _amount, bytes32 _l2TxHash, uint256 _l2BatchNumber, uint256 _l2MessageIndex, uint16 _l2TxNumberInBatch, bytes32[] calldata _merkleProof ) external; function finalizeWithdrawalLegacyErc20Bridge( uint256 _l2BatchNumber, uint256 _l2MessageIndex, uint16 _l2TxNumberInBatch, bytes calldata _message, bytes32[] calldata _merkleProof ) external returns (address l1Receiver, address l1Token, uint256 amount); function finalizeWithdrawal( uint256 _chainId, uint256 _l2BatchNumber, uint256 _l2MessageIndex, uint16 _l2TxNumberInBatch, bytes calldata _message, bytes32[] calldata _merkleProof ) external; function setEraPostDiamondUpgradeFirstBatch(uint256 _eraPostDiamondUpgradeFirstBatch) external; function setEraPostLegacyBridgeUpgradeFirstBatch(uint256 _eraPostLegacyBridgeUpgradeFirstBatch) external; function setEraLegacyBridgeLastDepositTime( uint256 _eraLegacyBridgeLastDepositBatch, uint256 _eraLegacyBridgeLastDepositTxNumber ) external; function L1_WETH_TOKEN() external view returns (address); function BRIDGE_HUB() external view returns (address); function legacyBridge() external view returns (address); function l2BridgeAddress(uint256 _chainId) external view returns (address); function depositHappened(uint256 _chainId, bytes32 _l2TxHash) external view returns (bytes32); struct L2TransactionRequestTwoBridgesInner { bytes32 magicValue; address l2Contract; bytes l2Calldata; bytes[] factoryDeps; bytes32 txDataHash; } /// data is abi encoded : /// address _l1Token, /// uint256 _amount, /// address _l2Receiver function bridgehubDeposit( uint256 _chainId, address _prevMsgSender, uint256 _l2Value, bytes calldata _data ) external payable returns (L2TransactionRequestTwoBridgesInner memory request); function bridgehubDepositBaseToken( uint256 _chainId, address _prevMsgSender, address _l1Token, uint256 _amount ) external payable; function bridgehubConfirmL2Transaction(uint256 _chainId, bytes32 _txDataHash, bytes32 _txHash) external; function receiveEth(uint256 _chainId) external payable; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; /// @dev The enum that represents the transaction execution status /// @param Failure The transaction execution failed /// @param Success The transaction execution succeeded enum TxStatus { Failure, Success } /// @dev The log passed from L2 /// @param l2ShardId The shard identifier, 0 - rollup, 1 - porter /// All other values are not used but are reserved for the future /// @param isService A boolean flag that is part of the log along with `key`, `value`, and `sender` address. /// This field is required formally but does not have any special meaning /// @param txNumberInBatch The L2 transaction number in a Batch, in which the log was sent /// @param sender The L2 address which sent the log /// @param key The 32 bytes of information that was sent in the log /// @param value The 32 bytes of information that was sent in the log // Both `key` and `value` are arbitrary 32-bytes selected by the log sender struct L2Log { uint8 l2ShardId; bool isService; uint16 txNumberInBatch; address sender; bytes32 key; bytes32 value; } /// @dev An arbitrary length message passed from L2 /// @notice Under the hood it is `L2Log` sent from the special system L2 contract /// @param txNumberInBatch The L2 transaction number in a Batch, in which the message was sent /// @param sender The address of the L2 account from which the message was passed /// @param data An arbitrary length message struct L2Message { uint16 txNumberInBatch; address sender; bytes data; } /// @dev Internal structure that contains the parameters for the writePriorityOp /// internal function. /// @param txId The id of the priority transaction. /// @param l2GasPrice The gas price for the l2 priority operation. /// @param expirationTimestamp The timestamp by which the priority operation must be processed by the operator. /// @param request The external calldata request for the priority operation. struct WritePriorityOpParams { uint256 txId; uint256 l2GasPrice; uint64 expirationTimestamp; BridgehubL2TransactionRequest request; } /// @dev Structure that includes all fields of the L2 transaction /// @dev The hash of this structure is the "canonical L2 transaction hash" and can /// be used as a unique identifier of a tx /// @param txType The tx type number, depending on which the L2 transaction can be /// interpreted differently /// @param from The sender's address. `uint256` type for possible address format changes /// and maintaining backward compatibility /// @param to The recipient's address. `uint256` type for possible address format changes /// and maintaining backward compatibility /// @param gasLimit The L2 gas limit for L2 transaction. Analog to the `gasLimit` on an /// L1 transactions /// @param gasPerPubdataByteLimit Maximum number of L2 gas that will cost one byte of pubdata /// (every piece of data that will be stored on L1 as calldata) /// @param maxFeePerGas The absolute maximum sender willing to pay per unit of L2 gas to get /// the transaction included in a Batch. Analog to the EIP-1559 `maxFeePerGas` on an L1 transactions /// @param maxPriorityFeePerGas The additional fee that is paid directly to the validator /// to incentivize them to include the transaction in a Batch. Analog to the EIP-1559 /// `maxPriorityFeePerGas` on an L1 transactions /// @param paymaster The address of the EIP-4337 paymaster, that will pay fees for the /// transaction. `uint256` type for possible address format changes and maintaining backward compatibility /// @param nonce The nonce of the transaction. For L1->L2 transactions it is the priority /// operation Id /// @param value The value to pass with the transaction /// @param reserved The fixed-length fields for usage in a future extension of transaction /// formats /// @param data The calldata that is transmitted for the transaction call /// @param signature An abstract set of bytes that are used for transaction authorization /// @param factoryDeps The set of L2 bytecode hashes whose preimages were shown on L1 /// @param paymasterInput The arbitrary-length data that is used as a calldata to the paymaster pre-call /// @param reservedDynamic The arbitrary-length field for usage in a future extension of transaction formats struct L2CanonicalTransaction { uint256 txType; uint256 from; uint256 to; uint256 gasLimit; uint256 gasPerPubdataByteLimit; uint256 maxFeePerGas; uint256 maxPriorityFeePerGas; uint256 paymaster; uint256 nonce; uint256 value; // In the future, we might want to add some // new fields to the struct. The `txData` struct // is to be passed to account and any changes to its structure // would mean a breaking change to these accounts. To prevent this, // we should keep some fields as "reserved" // It is also recommended that their length is fixed, since // it would allow easier proof integration (in case we will need // some special circuit for preprocessing transactions) uint256[4] reserved; bytes data; bytes signature; uint256[] factoryDeps; bytes paymasterInput; // Reserved dynamic type for the future use-case. Using it should be avoided, // But it is still here, just in case we want to enable some additional functionality bytes reservedDynamic; } /// @param sender The sender's address. /// @param contractAddressL2 The address of the contract on L2 to call. /// @param valueToMint The amount of base token that should be minted on L2 as the result of this transaction. /// @param l2Value The msg.value of the L2 transaction. /// @param l2Calldata The calldata for the L2 transaction. /// @param l2GasLimit The limit of the L2 gas for the L2 transaction /// @param l2GasPerPubdataByteLimit The price for a single pubdata byte in L2 gas. /// @param factoryDeps The array of L2 bytecodes that the tx depends on. /// @param refundRecipient The recipient of the refund for the transaction on L2. If the transaction fails, then /// this address will receive the `l2Value`. struct BridgehubL2TransactionRequest { address sender; address contractL2; uint256 mintValue; uint256 l2Value; bytes l2Calldata; uint256 l2GasLimit; uint256 l2GasPerPubdataByteLimit; bytes[] factoryDeps; address refundRecipient; }
{ "evmVersion": "shanghai", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "MerkleAirdrop.sol": {} }, "remappings": [ "@erc721a=./node_modules/erc721a/contracts", "@chainlink=./node_modules/@chainlink/contracts/src/v0.8", "@openzeppelin=./node_modules/@openzeppelin", "OpenZeppelin=C:/Users/tomcb/.brownie/packages/OpenZeppelin", "paulrberg=C:/Users/tomcb/.brownie/packages/paulrberg" ], "metadata": { "appendCBOR": false, "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AlreadyClaimed","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidInputLengths","type":"error"},{"inputs":[],"name":"InvalidMerkleProof","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"pid","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"MerkleRootUpdated","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":true,"internalType":"address","name":"oldAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"SFL2AddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SF_L2","outputs":[{"internalType":"contract ISophonFarming","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_customReceiver","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"boostAmount","type":"uint256"},{"internalType":"uint256","name":"depositAmount","type":"uint256"},{"internalType":"uint256","name":"rewardSettled","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"internalType":"struct ISophonFarming.UserInfo","name":"_userInfo","type":"tuple"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"boostAmount","type":"uint256"},{"internalType":"uint256","name":"depositAmount","type":"uint256"},{"internalType":"uint256","name":"rewardSettled","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"internalType":"struct ISophonFarming.UserInfo","name":"_userInfo","type":"tuple"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256[]","name":"_pids","type":"uint256[]"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"boostAmount","type":"uint256"},{"internalType":"uint256","name":"depositAmount","type":"uint256"},{"internalType":"uint256","name":"rewardSettled","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"internalType":"struct ISophonFarming.UserInfo[]","name":"_userInfos","type":"tuple[]"},{"internalType":"bytes32[][]","name":"_merkleProofs","type":"bytes32[][]"}],"name":"claimMultiple","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"hasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"_SF_L2","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"rescue","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":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_SF_L2","type":"address"}],"name":"setSFL2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unclaim","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
9c4d535b0000000000000000000000000000000000000000000000000000000000000000010002f5a1132c3be603b8450aebe776f2522e74c8359c6107c231c28ee6f1e000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x000400000000000200170000000000020000000003020019000000000701034f0000006001100270000002870210019700030000002703550002000000070355000002870010019d00000001003001900000003c0000c13d0000008003000039000000400030043f000000040020008c000007640000413d000000000107043b000000e0011002700000028e0010009c000000630000213d0000029d0010009c000000810000a13d0000029e0010009c0000025b0000213d000002a20010009c000002c70000613d000002a30010009c0000030b0000613d000002a40010009c000007640000c13d000000440020008c000007640000413d0000000401700370000000000101043b001500000001001d000002ab0010009c000007640000213d0000002401700370000000000301043b0000028a0030009c000007640000213d0000002301300039000000000021004b000007640000813d0000000404300039000000000147034f000000000101043b000002e20010009c000000360000813d0000001f05100039000002f0055001970000003f05500039000002f005500197000002dd0050009c000004bd0000a13d000002eb01000041000000000010043f0000004101000039000000040010043f000002db0100004100000a1b00010430000000a001000039000000400010043f0000000001000416000000000001004b000007640000c13d0000000001000410000000800010043f0000028802000041000000000202041a00000289002001980000044f0000c13d0000028a032001970000028a0030009c0000005b0000613d0000028a012001c70000028802000041000000000012041b0000028a01000041000000a00010043f0000000001000414000002870010009c0000028701008041000000c0011002100000028b011001c70000800d0200003900000001030000390000028c040000410a190a0a0000040f0000000100200190000007640000613d000000800100043d0000000102000039000001400000044300000160001004430000002001000039000001000010044300000120002004430000028d0100004100000a1a0001042e0000028f0010009c000000910000a13d000002900010009c000002680000213d000002940010009c0000031c0000613d000002950010009c0000032c0000613d000002960010009c000007640000c13d000000440020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b000002ab0010009c000007640000213d000000000010043f0000000201000039000000200010043f0000004002000039000000000100001900150000000703530a1909f50000040f000000150200035f0000002402200370000000000202043b000003a80000013d000002a50010009c000002820000a13d000002a60010009c000003520000613d000002a70010009c000003860000613d000002a80010009c000007640000c13d0000000001000416000000000001004b000007640000c13d0000000101000039000000000101041a000000800010043f000002c00100004100000a1a0001042e000002970010009c0000028e0000a13d000002980010009c000003950000613d000002990010009c000003b40000613d0000029a0010009c000007640000c13d000000840020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b000002ab0010009c000007640000213d0000002403700370000000000303043b0000028a0030009c000007640000213d0000002304300039000000000024004b000007640000813d0000000404300039000000000447034f000000000404043b000600000004001d0000028a0040009c000007640000213d000400240030003d000000060300002900000005033002100000000403300029000000000023004b000007640000213d0000004403700370000000000303043b000500000003001d0000028a0030009c000007640000213d00000005030000290000002303300039000000000023004b000007640000813d00000005030000290000000403300039000000000337034f000000000303043b0000028a0030009c000007640000213d000000a0043000c900000005044000290000002404400039000000000024004b000007640000213d0000006404700370000000000404043b0000028a0040009c000007640000213d0000002305400039000000000025004b000007640000813d0000000405400039000000000557034f000000000505043b0000028a0050009c000007640000213d000800240040003d00000005065002100000000806600029000000000026004b000007640000213d0000000006000411000000000016004b000005350000c13d000000060030006b000007290000c13d000000000053004b000007290000c13d000000060000006b0000049d0000613d0000000002420049000000430220008a0001006000100218000f02ab0010019b000300000002001d000202c80020019b001100000000001d0000001101000029000000050210021000000008032000290000000201000367000000000331034f000000000303043b000002c804300197000000020540014f000000020040006c0000000004000019000002c804004041000000030030006c0000000006000019000002c806008041000002c80050009c000000000406c019000000000004004b000007640000c13d0000000803300029000000000431034f000000000404043b001500000004001d0000028a0040009c000007640000213d00000020083000390000001503000029000e00050030021800000000040000310000000e0340006a000002c805300197000002c806800197000000000756013f000000000056004b0000000005000019000002c805004041000d00000008001d000000000038004b0000000003000019000002c803002041000002c80070009c000000000503c019000000000005004b000007640000c13d0000001103000029000000a0033000c900000005033000290000000004340049000000240440008a000002c90040009c000007640000213d000000a00040008c000007640000413d000000400400043d001000000004001d000002ca0040009c000000360000213d0000001005000029000000a004500039000000400040043f0000002404300039000000000441034f000000000404043b00000000064504360000004404300039000000000441034f000000000404043b000c00000006001d000000000046043500000004022000290000006404300039000000000441034f000000000404043b0000004006500039000b00000006001d0000000000460435000000000221034f000000a404300039000000000441034f0000008403300039000000000131034f000000000101043b0000006003500039000900000003001d00000000001304350000008003500039000000000104043b000a00000003001d0000000000130435000000000102043b001200000001001d0000000f01000029000000000010043f0000000201000039000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b0000001202000029000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff001001900000076d0000c13d000000100100002900000000020104330000000c0100002900000000030104330000000b010000290000000004010433000000090100002900000000050104330000000a010000290000000006010433000000400100043d000000d4071000390000000000670435000000b4061000390000000000560435000000940510003900000000004504350000007404100039000000000034043500000054031000390000000000230435000000200210003900000001030000290000000000320435000000340310003900000012040000290000000000430435000000d4030000390000000000310435000002cc0010009c000000360000213d0000010003100039000000400030043f000002870020009c000002870200804100000040022002100000000001010433000002870010009c00000287010080410000006001100210000000000121019f0000000002000414000002870020009c0000028702008041000000c002200210000000000112019f000002b4011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d0000000102000039000000000202041a000700000002001d000000000101043b0000000e020000290000003f02200039000002cd02200197000000400300043d0000000002230019001400000003001d000000000032004b000000000300003900000001030040390000028a0020009c000000360000213d0000000100300190000000360000c13d000000400020043f000000150200002900000014030000290000000002230436001300000002001d0000000e030000290000000d02300029000000000020007c000007640000213d0000000d06000029000000000062004b000001bc0000a13d00000002036003670000001304000029000000003503043c00000000045404360000002006600039000000000026004b000001b40000413d00000014020000290000000002020433001500000002001d000000150000006b000001db0000613d0000000003000019001500000003001d000000050230021000000013022000290000000002020433000000000021004b000001c90000813d000000000010043f000000200020043f0000000001000414000001cc0000013d000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b0000001503000029000000010330003900000014020000290000000002020433000000000023004b000001bf0000413d000000070010006c000007710000c13d0000000f01000029000000000010043f0000000201000039000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b0000001202000029000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000201041a000002f10220019700000001022001bf000000000021041b000000000100041a000002ac020000410000000000200443000002ab01100197001500000001001d00000004001004430000000001000414000002870010009c0000028701008041000000c001100210000002ad011001c700008002020000390a190a0f0000040f0000000100200190000007ce0000613d000000000101043b000000000001004b000007640000613d000000400400043d000000240140003900000012020000290000000000210435000002cf01000041000000000014043500000004014000390000000f02000029000000000021043500000010010000290000000001010433000000440240003900000000001204350000000c010000290000000001010433000000640240003900000000001204350000000b0100002900000000010104330000008402400039000000000012043500000009010000290000000001010433000000a40240003900000000001204350000000a010000290000000001010433000000c402400039000000000012043500000000010004140000001502000029000000040020008c000002400000613d000002870040009c000002870300004100000000030440190000004003300210000002870010009c0000028701008041000000c001100210000000000131019f000002d0011001c7001500000004001d0a190a0a0000040f00000015040000290000006003100270000102870030019d00030000000103550000000100200190000007cf0000613d0000028a0040009c000000360000213d000000400040043f00000012010000290000000000140435000002870040009c000002870400804100000040014002100000000002000414000002870020009c0000028702008041000000c002200210000000000112019f000002b9011001c70000800d020000390000000203000039000002d2040000410000000f050000290a190a0a0000040f0000000100200190000007640000613d00000011020000290000000102200039001100000002001d000000060020006c000000ea0000413d0000049d0000013d0000029f0010009c000003ba0000613d000002a00010009c000003ed0000613d000002a10010009c000007640000c13d0000000001000416000000000001004b000007640000c13d000002b701000041000000800010043f000002c00100004100000a1a0001042e000002910010009c0000040b0000613d000002920010009c0000042a0000613d000002930010009c000007640000c13d000000440020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000002401700370000000000101043b001500000001001d000002ab0010009c000007640000213d0000000401700370000000000101043b001400000001001d0a1907f70000040f0a1908260000040f000000140100002900000015020000290a1909a30000040f000000000100001900000a1a0001042e000002a90010009c000004530000613d000002aa0010009c000007640000c13d0000000001000416000000000001004b000007640000c13d000000000100041a000002ab01100197000000800010043f000002c00100004100000a1a0001042e0000029b0010009c000004640000613d0000029c0010009c000007640000c13d000001040020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b000002ab0010009c000007640000213d0000012003000039000000400030043f0000004403700370000000000303043b000000800030043f0000006403700370000000000303043b000000a00030043f0000008403700370000000000303043b000000c00030043f000000a403700370000000000303043b000000e00030043f000000c403700370000000000303043b000001000030043f000000e403700370000000000303043b0000028a0030009c000007640000213d0000002304300039000000000024004b000007640000813d0000000404300039000000000447034f000000000604043b0000028a0060009c000007640000213d000000240530003900000005036002100000000003530019000000000023004b000007640000213d0000000002000411000000000012004b000005350000c13d0000002402700370000000000302043b000000800400003900000000020100190a1908510000040f000000000100001900000a1a0001042e000000440020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b001500000001001d0000002401700370000000000101043b001400000001001d000002ab0010009c000007640000213d0000001501000029000000000010043f000002d301000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b0000000101100039000000000101041a001300000001001d000000000010043f000002d301000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b0000000002000411000002ab02200197000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff00100190000005390000c13d000002c301000041000000000010043f0000000001000411000000040010043f0000001301000029000000240010043f000002c40100004100000a1b00010430000000440020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000002401700370000000000201043b000002ab0020009c000007640000213d0000000001000411000000000012004b000004860000c13d0000000401700370000000000101043b0a1909a30000040f000000000100001900000a1a0001042e0000000001000416000000000001004b000007640000c13d000000c001000039000000400010043f0000000501000039000000800010043f000002c502000041000000a00020043f0000002003000039000000c00030043f000000e00010043f000001000020043f000001050000043f000002c60100004100000a1a0001042e000000240020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b001500000001001d000002ab0010009c000007640000213d0000000001000411000002ab01100197000000000010043f000002b601000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff001001900000047e0000613d0000001506000029000000000006004b0000051d0000c13d000000400100043d0000004402100039000002c203000041000000000032043500000024021000390000000f03000039000004b20000013d000001240020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b001500000001001d000002ab0010009c000007640000213d0000002401700370000000000101043b001400000001001d000002ab0010009c000007640000213d0000012001000039000000400010043f0000006401700370000000000101043b000000800010043f0000008401700370000000000101043b000000a00010043f000000a401700370000000000101043b000000c00010043f000000c401700370000000000101043b000000e00010043f000000e401700370000000000101043b000001000010043f0000010401700370000000000101043b0000028a0010009c000007640000213d00000004011000390a1907dc0000040f001300000001001d001200000002001d0a1908090000040f00000044010000390000000201100367000000000301043b000000800400003900000015010000290000001402000029000000130500002900000012060000290a1908510000040f000000000100001900000a1a0001042e000000240020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b0a1907f70000040f000000400200043d0000000000120435000002870020009c00000287020080410000004001200210000002d9011001c700000a1a0001042e000000440020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000002401700370000000000101043b001500000001001d000002ab0010009c000007640000213d0000000401700370000000000101043b000000000010043f000002d301000041000000200010043f000000400200003900000000010000190a1909f50000040f0000001502000029000000000020043f000000200010043f000000000100001900000040020000390a1909f50000040f000000000101041a000000ff001001900000000001000039000000010100c039000000800010043f000002c00100004100000a1a0001042e0000000001000416000000000001004b000007640000c13d000000800000043f000002c00100004100000a1a0001042e000000440020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b001500000001001d000002ab0010009c000007640000213d0000002401700370000000000101043b001400000001001d000002ab0010009c000007640000213d0000000001000411000002ab01100197000000000010043f000002b601000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c70000801002000039001300000003001d0a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff001001900000047e0000613d0000001501000029000002ab02100197000000400b00043d000002da0100004100000000001b04350000000401b00039000000000300041000000000003104350000000001000414000000040020008c001500000002001d000005850000c13d0000000103000031000000200030008c00000020040000390000000004034019000005b10000013d0000000001000416000000000001004b000007640000c13d000002d60100004100000000001004430000000001000412000000040010044300000024000004430000000001000414000002870010009c0000028701008041000000c001100210000002d7011001c700008005020000390a190a0f0000040f0000000100200190000007ce0000613d000000000101043b000002ab011001970000000002000410000000000012004b000005190000c13d000000400100043d000002d8020000410000000000210435000002870010009c00000287010080410000004001100210000002d9011001c700000a1a0001042e000000440020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b001500000001001d000002ab0010009c000007640000213d0a1908090000040f0000001501000029000000000010043f0000000201000039000000200010043f000000400200003900000000010000190a1909f50000040f00000024020000390000000202200367000000000202043b000000000020043f000000200010043f000000000100001900000040020000390a1909f50000040f000000000301041a000002f102300197000000000021041b000000000100001900000a1a0001042e000000240020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b001500000001001d000002ab0010009c000007640000213d0000028801000041000000000401041a00000289034001970000028a014001980000049f0000613d000000010010008c0000044f0000c13d001300000004001d001400000003001d000002ac010000410000000000100443000000000100041000000004001004430000000001000414000002870010009c0000028701008041000000c001100210000002ad011001c700008002020000390a190a0f0000040f0000000100200190000007ce0000613d000000000101043b000000000001004b00000014030000290000001304000029000004a10000613d000002bf01000041000000000010043f000002bb0100004100000a1b00010430000000240020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b000002ed00100198000007640000c13d000002ee0010009c00000000020000390000000102006039000002ef0010009c00000001022061bf000000800020043f000002c00100004100000a1a0001042e000000240020008c000007640000413d0000000001000416000000000001004b000007640000c13d0000000401700370000000000101043b001500000001001d0000000001000411000002ab01100197000000000010043f000002b601000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff001001900000048a0000c13d000002c301000041000000000010043f0000000001000411000000040010043f000002b701000041000000240010043f000002c40100004100000a1b00010430000002ec01000041000000000010043f000002bb0100004100000a1b0001043000000001030000390000001502000029000000000023041b000000400100043d0000000000210435000002870010009c000002870100804100000040011002100000000002000414000002870020009c0000028702008041000000c002200210000000000112019f000002b9011001c70000800d02000039000002d5040000410a190a0a0000040f0000000100200190000007640000613d000000000100001900000a1a0001042e000000000003004b0000044f0000c13d000002ae0140019700000001021001bf000002af01400197000002b0011001c7000000000003004b000000000102c0190000028802000041000000000012041b0000001504000029000000000004004b0000052b0000c13d000000400100043d0000004402100039000002bc030000410000000000320435000000240210003900000015030000390000000000320435000002bd020000410000000000210435000000040210003900000020030000390000000000320435000002870010009c00000287010080410000004001100210000002be011001c700000a1b000104300000008005500039000000400050043f000000800010043f00000000031300190000002403300039000000000023004b000007640000213d0000002002400039000000000327034f000002f0041001980000001f0510018f000000a002400039000004d00000613d000000a006000039000000000703034f000000007807043c0000000006860436000000000026004b000004cc0000c13d000000000005004b000004dd0000613d000000000343034f0000000304500210000000000502043300000000054501cf000000000545022f000000000303043b0000010004400089000000000343022f00000000034301cf000000000353019f0000000000320435000000a0011000390000000000010435000002d60100004100000000001004430000000001000412000000040010044300000024000004430000000001000414000002870010009c0000028701008041000000c001100210000002d7011001c700008005020000390a190a0f0000040f0000000100200190000007ce0000613d000000000101043b000002ab011001970000000002000410000000000012004b000005190000613d000002d802000041000000000202041a000002ab02200197000000000012004b000005190000c13d0000000001000411000002ab01100197000000000010043f000002b601000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff001001900000047e0000613d000000400200043d000002e301000041001400000002001d000000000012043500000000010004140000001502000029000000040020008c000006d60000c13d0000000001000415000000170110008a00000005011002100000000103000031000000200030008c00000020040000390000000004034019000007040000013d000002ea01000041000000000010043f000002bb0100004100000a1b00010430000000000100041a000002b102100197000000000262019f000000000020041b0000000002000414000002ab05100197000002870020009c0000028702008041000000c001200210000002b4011001c70000800d020000390000000303000039000002c1040000410000049a0000013d000000000200041a000002b102200197000000000242019f000000000020041b0000028900100198000005d70000c13d000002ba01000041000000000010043f000002bb0100004100000a1b00010430000002d401000041000000000010043f000002bb0100004100000a1b000104300000001501000029000000000010043f000002d301000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b0000001402000029000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff001001900000049d0000c13d0000001501000029000000000010043f000002d301000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b0000001402000029000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000201041a000002f10220019700000001022001bf000000000021041b0000000001000414000002870010009c0000028701008041000000c001100210000002b4011001c70000800d020000390000000403000039000002b5040000410000001505000029000000140600002900000000070004110a190a0a0000040f00000001002001900000049d0000c13d000007640000013d0000028700b0009c000002870300004100000000030b40190000004003300210000002870010009c0000028701008041000000c001100210000000000131019f000002db011001c700120000000b001d0a190a0f0000040f000000120b00002900000060031002700000028703300197000000200030008c000000200400003900000000040340190000001f0640018f000000200740019000000000057b0019000005a00000613d000000000801034f00000000090b0019000000008a08043c0000000009a90436000000000059004b0000059c0000c13d000000000006004b000005ad0000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000100000003001f00030000000103550000000100200190000006510000613d0000001f01400039000000600210018f0000000001b20019000000000021004b000000000200003900000001020040390000028a0010009c000000360000213d0000000100200190000000360000c13d000000400010043f000000200030008c000007640000413d00000000020b0433000000440410003900000000002404350000002002100039000002dc04000041000000000042043500000024041000390000001405000029000000000054043500000044040000390000000000410435000002dd0010009c000000360000213d0000008004100039001400000004001d000000400040043f000000000401043300000000010004140000001505000029000000040050008c0000066f0000c13d0000028a0030009c000000360000213d0000000102000039000006860000013d001400000003001d0000000001000411000002ab01100197001500000001001d000000000010043f000002b201000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff001001900000060b0000c13d0000001501000029000000000010043f000002b201000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000201041a000002f10220019700000001022001bf000000000021041b0000000001000414000002870010009c0000028701008041000000c001100210000002b4011001c70000800d020000390000000403000039000002b5040000410000000005000019000000150600002900000000070004110a190a0a0000040f0000000100200190000007640000613d0000001501000029000000000010043f000002b601000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000101041a000000ff001001900000063c0000c13d0000001501000029000000000010043f000002b601000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000007640000613d000000000101043b000000000201041a000002f10220019700000001022001bf000000000021041b0000000001000414000002870010009c0000028701008041000000c001100210000002b4011001c70000800d020000390000000403000039000002b504000041000002b705000041000000150600002900000000070004110a190a0a0000040f0000000100200190000007640000613d000000140000006b0000049d0000c13d0000028801000041000000000201041a000002b802200197000000000021041b0000000103000039000000400100043d0000000000310435000002870010009c000002870100804100000040011002100000000002000414000002870020009c0000028702008041000000c002200210000000000112019f000002b9011001c70000800d020000390000028c040000410000049a0000013d0000001f0530018f000002d106300198000000400200043d00000000046200190000065c0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b000006580000c13d000000000005004b000006690000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001404350000006001300210000002870020009c00000287020080410000004002200210000000000112019f00000a1b00010430000002870020009c00000287020080410000004002200210000002870040009c00000287040080410000006003400210000000000223019f000002870010009c0000028701008041000000c001100210000000000112019f00000015020000290a190a0a0000040f000000010220018f00030000000103550000006001100270000102870010019d0000028703100198000006840000c13d001400600000003d000006ae0000013d000000400100043d001400000001001d0000001f01300039000002de011001970000003f01100039000002df041001970000001401400029000000000041004b000000000400003900000001040040390000028a0010009c000000360000213d0000000100400190000000360000c13d000000400010043f00000014010000290000000005310436000002f0043001980000001f0330018f001300000005001d00000000014500190000000305000367000006a10000613d000000000605034f0000001307000029000000006806043c0000000007870436000000000017004b0000069d0000c13d000000000003004b000006ae0000613d000000000445034f0000000303300210000000000501043300000000053501cf000000000535022f000000000404043b0000010003300089000000000434022f00000000033401cf000000000353019f000000000031043500000014010000290000000001010433000000000002004b000006b80000c13d000000000001004b000006cd0000c13d000002e701000041000000000010043f000002bb0100004100000a1b00010430000000000001004b0000001302000029000007320000c13d000002ac010000410000000000100443000000150100002900000004001004430000000001000414000002870010009c0000028701008041000000c001100210000002ad011001c700008002020000390a190a0f0000040f0000000100200190000007ce0000613d000000000101043b000000000001004b0000072d0000c13d000002e1010000410000073f0000013d0000001302000029000002870020009c00000287020080410000004002200210000002870010009c00000287010080410000006001100210000000000121019f00000a1b000104300000001402000029000002870020009c00000287020080410000004002200210000002870010009c0000028701008041000000c001100210000000000121019f000002bb011001c700000015020000290a190a0f0000040f00000060031002700000028703300197000000200030008c000000200400003900000000040340190000001f0640018f00000020074001900000001405700029000006f00000613d000000000801034f0000001409000029000000008a08043c0000000009a90436000000000059004b000006ec0000c13d000000000006004b000006fd0000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000100000003001f00030000000103550000000001000415000000160110008a00000005011002100000000100200190000007270000613d0000001f02400039000000600420018f0000001402400029000000000042004b000000000400003900000001040040390000028a0020009c000000360000213d0000000100400190000000360000c13d000000400020043f000000200030008c000007640000413d000000140200002900000000020204330000000501100270000000000102001f000002d80020009c000007440000c13d000002ac010000410000000000100443000000150100002900000004001004430000000001000414000002870010009c0000028701008041000000c001100210000002ad011001c700008002020000390a190a0f0000040f0000000100200190000007ce0000613d000000000101043b000000000001004b000007490000c13d000002e9010000410000073f0000013d000002c701000041000000000010043f000002bb0100004100000a1b0001043000000014010000290000000001010433000000000001004b00000013020000290000049d0000613d000002c90010009c000007640000213d000000200010008c000007640000413d0000000001020433000000000001004b0000000002000039000000010200c039000000000021004b000007640000c13d000000000001004b0000049d0000c13d000002e001000041000000000010043f0000001501000029000000040010043f000002db0100004100000a1b00010430000002e401000041000000000010043f000000040020043f000002db0100004100000a1b00010430000002d801000041000000000201041a000002b1022001970000001505000029000000000252019f000000000021041b0000000001000414000002870010009c0000028701008041000000c001100210000002b4011001c70000800d020000390000000203000039000002e5040000410a190a0a0000040f0000000100200190000007640000613d000000800100043d000000000001004b000007660000c13d0000000001000416000000000001004b0000049d0000613d000002e801000041000000000010043f000002bb0100004100000a1b00010430000000000100001900000a1b0001043000000000020004140000001503000029000000040030008c000007750000c13d00000001020000390000000104000031000007840000013d000002cb01000041000000000010043f000002bb0100004100000a1b00010430000002ce01000041000000000010043f000002bb0100004100000a1b00010430000002870010009c00000287010080410000006001100210000002870020009c0000028702008041000000c002200210000000000112019f000002e6011001c700000015020000290a190a140000040f000000010220018f00030000000103550000006001100270000102870010019d0000028704100197000000000004004b000007910000c13d000000600100003900000080030000390000000001010433000000000002004b000007bb0000c13d000000000001004b000006b40000613d000002870030009c00000287030080410000004002300210000006d10000013d0000028a0040009c000000360000213d0000001f01400039000002f0011001970000003f01100039000002f003100197000000400100043d0000000003310019000000000013004b000000000500003900000001050040390000028a0030009c000000360000213d0000000100500190000000360000c13d000000400030043f0000000003410436000002f0054001980000001f0640018f00000000045300190000000307000367000007ad0000613d000000000807034f0000000009030019000000008a08043c0000000009a90436000000000049004b000007a90000c13d000000000006004b000007880000613d000000000557034f0000000306600210000000000704043300000000076701cf000000000767022f000000000505043b0000010006600089000000000565022f00000000056501cf000000000575019f0000000000540435000007880000013d000000000001004b0000049d0000c13d000002ac010000410000000000100443000000150100002900000004001004430000000001000414000002870010009c0000028701008041000000c001100210000002ad011001c700008002020000390a190a0f0000040f0000000100200190000007ce0000613d000000000101043b000000000001004b0000049d0000c13d000006cb0000013d000000000001042f00000287033001970000001f0530018f000002d106300198000000400200043d00000000046200190000065c0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b000007d70000c13d0000065c0000013d0000001f03100039000000000023004b0000000004000019000002c804004041000002c805200197000002c803300197000000000653013f000000000053004b0000000003000019000002c803002041000002c80060009c000000000304c019000000000003004b000007f50000613d0000000203100367000000000303043b0000028a0030009c000007f50000213d000000050430021000000020011000390000000004410019000000000024004b000007f50000213d0000000002030019000000000001042d000000000100001900000a1b00010430000000000010043f000002d301000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000008070000613d000000000101043b0000000101100039000000000101041a000000000001042d000000000100001900000a1b000104300000000001000411000002ab01100197000000000010043f000002b601000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f00000001002001900000081c0000613d000000000101043b000000000101041a000000ff001001900000081e0000613d000000000001042d000000000100001900000a1b00010430000002c301000041000000000010043f0000000001000411000000040010043f000002b701000041000000240010043f000002c40100004100000a1b000104300001000000000002000100000001001d000000000010043f000002d301000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000008470000613d000000000101043b0000000002000411000002ab02200197000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000008470000613d000000000101043b000000000101041a000000ff00100190000008490000613d000000000001042d000000000100001900000a1b00010430000002c301000041000000000010043f0000000001000411000000040010043f0000000101000029000000240010043f000002c40100004100000a1b00010430000d000000000002000d00000006001d000900000005001d000800000004001d000a00000003001d000600000002001d000c00000001001d000002ab01100197000700000001001d000000000010043f0000000201000039000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009730000613d000000000101043b0000000a02000029000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009730000613d000000000101043b000000000101041a000000ff001001900000097b0000c13d00000008010000290000000032010434000000800610003900000060051000390000004001100039000100000003001d0000000003030433000200000001001d0000000004010433000300000005001d0000000005050433000400000006001d0000000006060433000000400100043d000000d4071000390000000000670435000000b40610003900000000005604350000009405100039000000000045043500000074041000390000000000340435000000540310003900000000002304350000000c0200002900000060032002100000002002100039000000000032043500000034031000390000000a040000290000000000430435000000d4030000390000000000310435000002f20010009c000009750000813d0000010003100039000000400030043f000002870020009c000002870200804100000040022002100000000001010433000002870010009c00000287010080410000006001100210000000000121019f0000000002000414000002870020009c0000028702008041000000c002200210000000000112019f000002b4011001c700008010020000390a190a0f0000040f0000000100200190000009730000613d0000000102000039000000000202041a000500000002001d000000000101043b0000000d020000290000028a0020009c000009750000213d0000000d0200002900000005022002100000003f03200039000002cd03300197000000400400043d0000000003340019000c00000004001d000000000043004b000000000400003900000001040040390000028a0030009c000009750000213d0000000100400190000009750000c13d000000400030043f0000000d030000290000000c040000290000000003340436000b00000003001d0000000902200029000000000020007c000009730000213d0000000906000029000000000062004b000008d80000a13d00000002036003670000000b04000029000000003503043c00000000045404360000002006600039000000000026004b000008d00000413d0000000c020000290000000002020433000d00000002001d0000000d0000006b000008f70000613d0000000003000019000d00000003001d00000005023002100000000b022000290000000002020433000000000021004b000008e50000813d000000000010043f000000200020043f0000000001000414000008e80000013d000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009730000613d0000000d03000029000000000101043b00000001033000390000000c020000290000000002020433000000000023004b000008db0000413d000000050010006c0000097f0000c13d0000000701000029000000000010043f0000000201000039000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009730000613d000000000101043b0000000a02000029000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009730000613d000000000101043b000000000201041a000002f10220019700000001022001bf000000000021041b000000000100041a000002ac020000410000000000200443000002ab01100197000d00000001001d00000004001004430000000001000414000002870010009c0000028701008041000000c001100210000002ad011001c700008002020000390a190a0f0000040f0000000100200190000009830000613d000000000101043b000000000001004b000009730000613d000000400400043d00000024014000390000000a020000290000000000210435000002cf0100004100000000001404350000000601000029000002ab011001970000000402400039000000000012043500000008010000290000000001010433000000440240003900000000001204350000000101000029000000000101043300000064024000390000000000120435000000020100002900000000010104330000008402400039000000000012043500000003010000290000000001010433000000a402400039000000000012043500000004010000290000000001010433000000c402400039000000000012043500000000010004140000000d02000029000000040020008c0000095d0000613d000002870040009c000002870300004100000000030440190000004003300210000002870010009c0000028701008041000000c001100210000000000131019f000002d0011001c7000d00000004001d0a190a0a0000040f0000000d040000290000006003100270000102870030019d00030000000103550000000100200190000009840000613d0000028a0040009c000009750000213d000000400040043f0000000a010000290000000000140435000002870040009c000002870400804100000040014002100000000002000414000002870020009c0000028702008041000000c002200210000000000112019f000002b9011001c70000800d020000390000000203000039000002d20400004100000007050000290a190a0a0000040f0000000100200190000009730000613d000000000001042d000000000100001900000a1b00010430000002eb01000041000000000010043f0000004101000039000000040010043f000002db0100004100000a1b00010430000002cb01000041000000000010043f000002bb0100004100000a1b00010430000002ce01000041000000000010043f000002bb0100004100000a1b00010430000000000001042f00000287033001970000001f0530018f000002d106300198000000400200043d0000000004620019000009900000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b0000098c0000c13d000000000005004b0000099d0000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001404350000006001300210000002870020009c00000287020080410000004002200210000000000112019f00000a1b000104300002000000000002000100000002001d000200000001001d000000000010043f000002d301000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009f20000613d000000000101043b0000000102000029000002ab02200197000100000002001d000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009f20000613d000000000101043b000000000101041a000000ff00100190000009f10000613d0000000201000029000000000010043f000002d301000041000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009f20000613d000000000101043b0000000102000029000000000020043f000000200010043f0000000001000414000002870010009c0000028701008041000000c001100210000002b3011001c700008010020000390a190a0f0000040f0000000100200190000009f20000613d000000000101043b000000000201041a000002f102200197000000000021041b0000000001000414000002870010009c0000028701008041000000c001100210000002b4011001c70000800d0200003900000004030000390000000007000411000002f304000041000000020500002900000001060000290a190a0a0000040f0000000100200190000009f20000613d000000000001042d000000000100001900000a1b00010430000000000001042f000002870010009c00000287010080410000004001100210000002870020009c00000287020080410000006002200210000000000112019f0000000002000414000002870020009c0000028702008041000000c002200210000000000112019f000002b4011001c700008010020000390a190a0f0000040f000000010020019000000a080000613d000000000101043b000000000001042d000000000100001900000a1b0001043000000a0d002104210000000102000039000000000001042d0000000002000019000000000001042d00000a12002104230000000102000039000000000001042d0000000002000019000000000001042d00000a17002104250000000102000039000000000001042d0000000002000019000000000001042d00000a190000043200000a1a0001042e00000a1b0001043000000000000000000000000000000000000000000000000000000000fffffffff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a000000000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff0200000000000000000000000000000000000020000000a00000000000000000c7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d20000000200000000000000000000000000000080000001000000000000000000000000000000000000000000000000000000000000000000000000007cb6475800000000000000000000000000000000000000000000000000000000ad3cb1cb00000000000000000000000000000000000000000000000000000000bffe84c100000000000000000000000000000000000000000000000000000000bffe84c200000000000000000000000000000000000000000000000000000000c4d66de800000000000000000000000000000000000000000000000000000000d547741f00000000000000000000000000000000000000000000000000000000ad3cb1cc00000000000000000000000000000000000000000000000000000000ade93a0300000000000000000000000000000000000000000000000000000000b29310960000000000000000000000000000000000000000000000000000000091d148530000000000000000000000000000000000000000000000000000000091d1485400000000000000000000000000000000000000000000000000000000a217fddf00000000000000000000000000000000000000000000000000000000aa78c578000000000000000000000000000000000000000000000000000000007cb647590000000000000000000000000000000000000000000000000000000081d1266f000000000000000000000000000000000000000000000000000000002f2ff15c000000000000000000000000000000000000000000000000000000004fdf5d1c000000000000000000000000000000000000000000000000000000004fdf5d1d0000000000000000000000000000000000000000000000000000000052d1902d0000000000000000000000000000000000000000000000000000000075b238fc000000000000000000000000000000000000000000000000000000002f2ff15d0000000000000000000000000000000000000000000000000000000036568abe000000000000000000000000000000000000000000000000000000004f1ef28600000000000000000000000000000000000000000000000000000000235e357d00000000000000000000000000000000000000000000000000000000235e357e00000000000000000000000000000000000000000000000000000000248a9ca3000000000000000000000000000000000000000000000000000000002eb4a7ab0000000000000000000000000000000000000000000000000000000001ffc9a70000000000000000000000000000000000000000000000000000000016fbb7cc000000000000000000000000ffffffffffffffffffffffffffffffffffffffff1806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b830200000200000000000000000000000000000024000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000010000000000000001ffffffffffffffffffffffff0000000000000000000000000000000000000000b7db2dd08fcb62d0c9e08c51941cae53c267786a0b75803fb7960902fc8ef97d020000000000000000000000000000000000004000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0db16e88c42fd4e48df2dd6a2eabd6bc9aec654ec170056b470819f8892cc6431ca49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775ffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff0200000000000000000000000000000000000020000000000000000000000000d7e6bcf800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000053465f4c32206973207a65726f2061646472657373000000000000000000000008c379a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000f92ee8a90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000008000000000000000003baf12ae04c9a8a21efb00529d76b37895ddf15602b1ab560319c42abd8a603f496e76616c696420616464726573730000000000000000000000000000000000e2517d3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044000000000000000000000000352e302e300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000c00000000000000000c6ec87560000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000ffffffffffffff5f646cf55800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fffffffffffffeff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0b05e92fa00000000000000000000000000000000000000000000000000000000e198a8630000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e400000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffe0d8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800ea8e4eb50000000000000000000000000000000000000000000000000000000090004c04698bc3322499a575ed3752dd4abf33e0a7294c06a787a0fe01bea941310ab089e4439a4c15d089f94afb7896ff553aecb10793d0ab882de59d99a32e0200000200000000000000000000000000000044000000000000000000000000360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc000000000000000000000000000000000000002000000000000000000000000070a08231000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff7f000000000000000000000000000000000000000000000001ffffffffffffffe0000000000000000000000000000000000000000000000003ffffffffffffffe05274afe7000000000000000000000000000000000000000000000000000000009996b31500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000052d1902d00000000000000000000000000000000000000000000000000000000aa1d49a400000000000000000000000000000000000000000000000000000000bc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b0000000000000000000000000000000000000000000000a000000000000000001425ea4200000000000000000000000000000000000000000000000000000000b398979f000000000000000000000000000000000000000000000000000000004c9c8ce300000000000000000000000000000000000000000000000000000000e07c8dba000000000000000000000000000000000000000000000000000000004e487b71000000000000000000000000000000000000000000000000000000006697b2320000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff01ffc9a7000000000000000000000000000000000000000000000000000000007965db0b00000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000ffffffffffffff00f6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.