Source Code
Overview
HYPE Balance
HYPE Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | ||||
|---|---|---|---|---|---|---|---|
| 25618599 | 28 mins ago | 0 HYPE | |||||
| 25618599 | 28 mins ago | 0 HYPE | |||||
| 25618599 | 28 mins ago | 0 HYPE | |||||
| 25613906 | 1 hr ago | 0 HYPE | |||||
| 25613906 | 1 hr ago | 0 HYPE | |||||
| 25613906 | 1 hr ago | 0 HYPE | |||||
| 25613536 | 1 hr ago | 0 HYPE | |||||
| 25613536 | 1 hr ago | 0 HYPE | |||||
| 25613536 | 1 hr ago | 0 HYPE | |||||
| 25609101 | 3 hrs ago | 0 HYPE | |||||
| 25609101 | 3 hrs ago | 0 HYPE | |||||
| 25609101 | 3 hrs ago | 0 HYPE | |||||
| 25606163 | 3 hrs ago | 0 HYPE | |||||
| 25606163 | 3 hrs ago | 0 HYPE | |||||
| 25606163 | 3 hrs ago | 0 HYPE | |||||
| 25575581 | 12 hrs ago | 0 HYPE | |||||
| 25575581 | 12 hrs ago | 0 HYPE | |||||
| 25575581 | 12 hrs ago | 0 HYPE | |||||
| 25554733 | 17 hrs ago | 0 HYPE | |||||
| 25554733 | 17 hrs ago | 0 HYPE | |||||
| 25480856 | 38 hrs ago | 0 HYPE | |||||
| 25480856 | 38 hrs ago | 0 HYPE | |||||
| 25480856 | 38 hrs ago | 0 HYPE | |||||
| 25406575 | 2 days ago | 0 HYPE | |||||
| 25406575 | 2 days ago | 0 HYPE |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ManagedNFTManagerUpgradeable
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 2000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.19;
import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {IVotingEscrow} from "../core/interfaces/IVotingEscrow.sol";
import {IManagedNFTStrategy} from "./interfaces/IManagedNFTStrategy.sol";
import {IManagedNFTManager} from "./interfaces/IManagedNFTManager.sol";
/**
* @title Managed NFT Manager Upgradeable
* @dev Manages the lifecycle and access control for NFTs used in a managed strategy, leveraging governance and escrow functionalities.
* This contract serves as the central point for managing NFTs, their attachments to strategies, and authorized user interactions.
*/
contract ManagedNFTManagerUpgradeable is IManagedNFTManager, AccessControlUpgradeable {
/**
* @dev Error indicating an unauthorized access attempt.
*/
error AccessDenied();
/**
* @dev Error indicating an operation attempted on a managed NFT that is currently disabled.
*/
error ManagedNFTIsDisabled();
/**
* @dev Error indicating that a required attachment action was not found or is missing.
*/
error NotAttached();
/**
* @dev Error indicating that the specified token ID does not correspond to a managed NFT.
*/
error NotManagedNFT();
/**
* @dev Error indicating an attempt to reattach an NFT that is already attached to a managed token.
*/
error AlreadyAttached();
/**
* @dev Error indicating a mismatch or incorrect association between user NFTs and managed tokens.
*/
error IncorrectUserNFT();
error AddressZero();
/**
* @notice Error thrown when a provided detachment-lock duration exceeds the allowed maximum.
* @param value The duration (in seconds) that was requested to be set.
* @param max The maximum allowed duration (in seconds).
*/
error DetachmentLockDurationTooLong(uint256 value, uint256 max);
/**
* @dev Represents the state and association of a user's NFT within the management system.
* @notice Stores details about an NFT's attachment status, which managed token it's linked to, and any associated amounts.
*/
struct TokenInfo {
bool isAttached; // Indicates if the NFT is currently attached to a managed strategy.
uint256 attachedManagedTokenId; // The ID of the managed token to which this NFT is attached.
uint256 amount; // The amount associated with this NFT in the context of the managed strategy.
}
/**
* @dev Holds management details about a token within the managed NFT system.
* @notice Keeps track of a managed token's operational status and authorized users.
*/
struct ManagedTokenInfo {
bool isManaged; // True if the token is recognized as a managed token.
bool isDisabled; // Indicates if the token is currently disabled and not operational.
address authorizedUser; // Address authorized to perform restricted operations for this managed token.
}
/**
* @dev Role identifier for administrative functions within the NFT management context.
*/
bytes32 public constant MANAGED_NFT_ADMIN = keccak256("MANAGED_NFT_ADMIN");
/**
* @notice Address of the Voting Escrow contract managing voting and staking mechanisms.
*/
address public override votingEscrow;
/**
* @notice Address of the Voter contract responsible for handling governance actions related to managed NFTs.
*/
address public override voter;
/**
* @notice Tracks detailed information about individual tokens.
*/
mapping(uint256 => TokenInfo) public tokensInfo;
/**
* @notice Maintains management state for managed tokens.
*/
mapping(uint256 => ManagedTokenInfo) public managedTokensInfo;
/**
* @notice Tracks whitelisting status of NFTs to control their eligibility within the system.
*/
mapping(uint256 => bool) public override isWhitelistedNFT;
/**
* @notice Retrieves the strategy flags for a given strategy.
*/
mapping(address => uint8) public override getStrategyFlags;
/**
* @notice Default duration (in seconds) of the lock window that prevents detaching/withdrawing after epoch start.
* @dev Strategies should read this value as the baseline window unless an explicit per-strategy override applies.
*/
uint256 public override defaultDetachmentLockDuration;
/**
* @notice Upper bound for the default detachment-lock duration: 6 days.
* @dev Used as a hard cap in {setDefaultDetachmentLockDuration}.
*/
uint256 internal constant _MAX_DETACHMENT_LOCK_DURATION = 6 days;
/**
* @dev Ensures that the function can only be called by the designated voter address.
*/
modifier onlyVoter() {
if (_msgSender() != voter) {
revert AccessDenied();
}
_;
}
/**
* @dev Ensures that the function can only be called by the designated voting escrow address.
*/
modifier onlyVotingEscrow() {
if (_msgSender() != votingEscrow) {
revert AccessDenied();
}
_;
}
/**
* @dev Constructor that disables initialization on implementation.
*/
constructor() {
_disableInitializers();
}
/**
* @notice Initializes the Managed NFT Manager contract
* @param votingEscrow_ The address of the voting escrow contract
* @param voter_ The address of the voter contract
*/
function initialize(address votingEscrow_, address voter_) external initializer {
__AccessControl_init();
_checkAddressZero(votingEscrow_);
_checkAddressZero(voter_);
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(MANAGED_NFT_ADMIN, msg.sender);
votingEscrow = votingEscrow_;
voter = voter_;
}
/**
* @notice Set the default duration (in seconds) of the detachment/withdrawal lock window for strategies.
* @dev
* - The new duration must not exceed {MAX_DETACHMENT_LOCK_DURATION}.
* - Updates the public state variable {defaultDetachmentLockDuration}.
* - Emits {SetDefaultDetachmentLockDuration} on success.
* @param newDuration_ The new default lock duration, in seconds.
*/
function setDefaultDetachmentLockDuration(uint256 newDuration_)
external
onlyRole(DEFAULT_ADMIN_ROLE)
{
if (newDuration_ > _MAX_DETACHMENT_LOCK_DURATION) {
revert DetachmentLockDurationTooLong(newDuration_, _MAX_DETACHMENT_LOCK_DURATION);
}
uint256 old = defaultDetachmentLockDuration;
defaultDetachmentLockDuration = newDuration_;
emit SetDefaultDetachmentLockDuration(old, newDuration_);
}
/**
* @notice Creates a managed NFT and attaches it to a strategy
* @param strategy_ The strategy to which the managed NFT will be attached
*/
function createManagedNFT(address strategy_) external onlyRole(MANAGED_NFT_ADMIN) returns (uint256 managedTokenId) {
managedTokenId = IVotingEscrow(votingEscrow).createManagedNFT(strategy_);
managedTokensInfo[managedTokenId] = ManagedTokenInfo(true, false, address(0));
IManagedNFTStrategy(strategy_).attachManagedNFT(managedTokenId);
emit CreateManagedNFT(msg.sender, strategy_, managedTokenId);
}
/**
* @notice Updates the strategy flags for a specific strategy.
* @dev Sets the flags for the given strategy and emits the `SetStrategyFlags` event.
* This function can only be called by an account with the `MANAGED_NFT_ADMIN` role.
* @param strategy_ The address of the strategy to update.
* @param flags_ The new flags to assign to the strategy.
* @custom:emits SetStrategyFlags
* - When the strategy flags are updated, this event is emitted with the new flags and the strategy address.
* @custom:requirements
* - The caller must have the `MANAGED_NFT_ADMIN` role.
*/
function setStrategyFlags(address strategy_, uint8 flags_) external onlyRole(MANAGED_NFT_ADMIN) {
getStrategyFlags[strategy_] = flags_;
emit SetStrategyFlags(strategy_, flags_);
}
/**
* @notice Authorizes a user for a specific managed token ID
* @param managedTokenId_ The token ID to authorize
* @param authorizedUser_ The user being authorized
*/
function setAuthorizedUser(uint256 managedTokenId_, address authorizedUser_) external onlyRole(MANAGED_NFT_ADMIN) {
if (!managedTokensInfo[managedTokenId_].isManaged) {
revert NotManagedNFT();
}
managedTokensInfo[managedTokenId_].authorizedUser = authorizedUser_;
emit SetAuthorizedUser(managedTokenId_, authorizedUser_);
}
/**
* @notice Toggles the disabled state of a managed NFT
* @param managedTokenId_ The ID of the managed token to toggle
* @dev Enables or disables a managed token to control its operational status, with an event emitted for state change.
*/
function toggleDisableManagedNFT(uint256 managedTokenId_) external onlyRole(MANAGED_NFT_ADMIN) {
if (!managedTokensInfo[managedTokenId_].isManaged) {
revert NotManagedNFT();
}
bool isDisable = !managedTokensInfo[managedTokenId_].isDisabled;
managedTokensInfo[managedTokenId_].isDisabled = isDisable;
emit ToggleDisableManagedNFT(msg.sender, managedTokenId_, isDisable);
}
/**
* @notice Handles the deposit of tokens to an NFT attached to a managed token.
* @dev Called by the Voting Escrow contract when tokens are deposited to an NFT that is attached to a managed NFT.
* The function verifies the token is attached, checks if it is disabled, and updates the token's state.
* @param tokenId_ The token ID of the user's NFT.
* @param amount_ The amount of tokens to deposit.
* @custom:error IncorrectUserNFT Thrown if the provided token ID is not attached or if it is a managed token itself.
* @custom:error ManagedNFTIsDisabled Thrown if the managed token is currently disabled.
*/
function onDepositToAttachedNFT(uint256 tokenId_, uint256 amount_) external onlyVotingEscrow {
if (!tokensInfo[tokenId_].isAttached || managedTokensInfo[tokenId_].isManaged) {
revert IncorrectUserNFT();
}
uint256 managedTokenId = tokensInfo[tokenId_].attachedManagedTokenId;
if (managedTokensInfo[managedTokenId].isDisabled) {
revert ManagedNFTIsDisabled();
}
tokensInfo[tokenId_].amount += amount_;
IManagedNFTStrategy(IVotingEscrow(votingEscrow).ownerOf(managedTokenId)).onAttach(tokenId_, amount_);
}
/**
* @notice Handler for attaching to a managed NFT
* @param tokenId_ The token ID of the user's NFT
* @param managedTokenId_ The managed token ID to attach to
*/
function onAttachToManagedNFT(uint256 tokenId_, uint256 managedTokenId_) external onlyVoter {
ManagedTokenInfo memory managedTokenInfo = managedTokensInfo[managedTokenId_];
if (!managedTokenInfo.isManaged) {
revert NotManagedNFT();
}
if (managedTokenInfo.isDisabled) {
revert ManagedNFTIsDisabled();
}
if (managedTokensInfo[tokenId_].isManaged || tokensInfo[tokenId_].isAttached) {
revert IncorrectUserNFT();
}
uint256 userBalance = IVotingEscrow(votingEscrow).onAttachToManagedNFT(tokenId_, managedTokenId_);
tokensInfo[tokenId_] = TokenInfo(true, managedTokenId_, userBalance);
IManagedNFTStrategy(IVotingEscrow(votingEscrow).ownerOf(managedTokenId_)).onAttach(tokenId_, userBalance);
}
/**
* @notice Handler for detaching from a managed NFT
* @param tokenId_ The token ID of the user's NFT
*/
function onDettachFromManagedNFT(uint256 tokenId_) external onlyVoter {
TokenInfo memory tokenInfo = tokensInfo[tokenId_];
if (!tokenInfo.isAttached) {
revert NotAttached();
}
assert(tokenInfo.attachedManagedTokenId != 0);
uint256 lockedRewards = IManagedNFTStrategy(IVotingEscrow(votingEscrow).ownerOf(tokenInfo.attachedManagedTokenId)).onDettach(
tokenId_,
tokenInfo.amount
);
IVotingEscrow(votingEscrow).onDettachFromManagedNFT(tokenId_, tokenInfo.attachedManagedTokenId, tokenInfo.amount + lockedRewards);
delete tokensInfo[tokenId_];
}
/**
* @notice Sets or unsets an NFT as whitelisted
* @param tokenId_ The token ID of the NFT
* @param isWhitelisted_ True if whitelisting, false otherwise
*/
function setWhitelistedNFT(uint256 tokenId_, bool isWhitelisted_) external onlyRole(MANAGED_NFT_ADMIN) {
isWhitelistedNFT[tokenId_] = isWhitelisted_;
emit SetWhitelistedNFT(tokenId_, isWhitelisted_);
}
/**
* @notice Retrieves the managed token ID attached to a specific user NFT.
* @dev Returns the managed token ID to which the user's NFT is currently attached.
* @param tokenId_ The token ID of the user's NFT.
* @return The ID of the managed token to which the NFT is attached.
*/
function getAttachedManagedTokenId(uint256 tokenId_) external view returns (uint256) {
return tokensInfo[tokenId_].attachedManagedTokenId;
}
/**
* @notice Checks if a specific user NFT is currently attached to a managed token.
* @dev Returns true if the user's NFT is attached to any managed token.
* @param tokenId_ The token ID of the user's NFT.
* @return True if the NFT is attached, false otherwise.
*/
function isAttachedNFT(uint256 tokenId_) external view returns (bool) {
return tokensInfo[tokenId_].isAttached;
}
/**
* @notice Determines if a managed token is currently disabled.
* @dev Checks the disabled status of a managed token to prevent operations during maintenance or shutdown periods.
* @param managedTokenId_ The ID of the managed token.
* @return True if the managed token is disabled, false otherwise.
*/
function isDisabledNFT(uint256 managedTokenId_) external view returns (bool) {
return managedTokensInfo[managedTokenId_].isDisabled;
}
/**
* @notice Checks if a given address has administrative privileges.
* @dev Determines whether an address holds the MANAGED_NFT_ADMIN role, granting administrative capabilities.
* @param account_ The address to check for administrative privileges.
* @return True if the address has administrative privileges, false otherwise.
*/
function isAdmin(address account_) external view returns (bool) {
return account_ == address(this) || super.hasRole(MANAGED_NFT_ADMIN, account_);
}
/**
* @notice Checks if a user is authorized to interact with a specific managed token.
* @dev Determines whether an address is the designated authorized user for a managed token.
* @param managedTokenId_ The ID of the managed token.
* @param account_ The address to verify authorization.
* @return True if the address is authorized, false otherwise.
*/
function isAuthorized(uint256 managedTokenId_, address account_) external view returns (bool) {
return managedTokensInfo[managedTokenId_].authorizedUser == account_;
}
/**
* @notice Determines if a token ID corresponds to a managed NFT within the system.
* @dev Checks the management status of a token ID to validate its inclusion in managed operations.
* @param managedTokenId_ The ID of the token to check.
* @return True if the token is a managed NFT, false otherwise.
*/
function isManagedNFT(uint256 managedTokenId_) external view override returns (bool) {
return managedTokensInfo[managedTokenId_].isManaged;
}
/**
* @dev Checked provided address on zero value, throw AddressZero error in case when addr_ is zero
*
* @param addr_ The address which will checked on zero
*/
function _checkAddressZero(address addr_) internal pure {
if (addr_ == address(0)) {
revert AddressZero();
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(account),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMathUpgradeable {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
/**
* @title IVotingEscrow
* @notice Interface for Voting Escrow, allowing users to lock tokens in exchange for veNFTs that are used in governance and other systems.
*/
interface IVotingEscrow is IERC721Upgradeable {
/**
* @notice Enum representing the types of deposits that can be made.
* @dev Defines the context in which a deposit is made:
* - `DEPOSIT_FOR_TYPE`: Regular deposit for an existing lock.
* - `CREATE_LOCK_TYPE`: Creating a new lock.
* - `INCREASE_UNLOCK_TIME`: Increasing the unlock time for an existing lock.
* - `MERGE_TYPE`: Merging two locks together.
*/
enum DepositType {
DEPOSIT_FOR_TYPE,
CREATE_LOCK_TYPE,
INCREASE_UNLOCK_TIME,
MERGE_TYPE
}
/**
* @notice Structure representing the state of a token.
* @dev This includes information about the lock, voting status, attachment status,
* the block of the last transfer, and the index (epoch) of its latest checkpoint.
* @param locked The locked balance (amount + end timestamp + permanent status) of the token.
* @param isVoted Whether the token has been used to vote in the current epoch.
* @param isAttached Whether the token is attached to a managed NFT.
* @param lastTranferBlock The block number of the last transfer.
* @param pointEpoch The epoch (checkpoint index) for the token’s most recent voting power change.
*/
struct TokenState {
LockedBalance locked;
bool isVoted;
bool isAttached;
uint256 lastTranferBlock;
uint256 pointEpoch;
}
/**
* @notice Structure representing a locked balance.
* @dev Contains the amount locked, the end timestamp of the lock, and whether the lock is permanent.
* @param amount The amount of tokens locked (signed integer for slope calculations).
* @param end The timestamp when the lock ends (0 if permanently locked).
* @param isPermanentLocked Whether the lock is permanent (no unlock time).
*/
struct LockedBalance {
int128 amount;
uint256 end;
bool isPermanentLocked;
}
/**
* @notice Structure representing a point in time for calculating voting power.
* @dev Used for slope/bias math across epochs.
* @param bias The bias of the lock, representing the remaining voting power.
* @param slope The rate at which voting power (bias) decays over time.
* @param ts The timestamp of the checkpoint.
* @param blk The block number of the checkpoint.
* @param permanent The permanently locked amount at this checkpoint.
*/
struct Point {
int128 bias;
int128 slope; // -dweight / dt
uint256 ts;
uint256 blk; // block
int128 permanent;
}
/**
* @notice Emitted when a boost is applied to a token's lock.
* @param tokenId The ID of the token that received the boost.
* @param value The amount of tokens used as a boost.
*/
event Boost(uint256 indexed tokenId, uint256 value);
/**
* @notice Emitted when a deposit is made into a lock.
* @param provider The address of the entity making the deposit.
* @param tokenId The ID of the token associated with the deposit.
* @param value The amount of tokens deposited.
* @param locktime The time (timestamp) until which the lock is extended.
* @param deposit_type The type of deposit (see {DepositType}).
* @param ts The timestamp when the deposit was made.
*/
event Deposit(address indexed provider, uint256 tokenId, uint256 value, uint256 indexed locktime, DepositType deposit_type, uint256 ts);
/**
* @notice Emitted when tokens are deposited to an attached NFT.
* @param provider The address of the user making the deposit.
* @param tokenId The ID of the NFT receiving the deposit.
* @param managedTokenId The ID of the managed token receiving the voting power.
* @param value The amount of tokens deposited.
*/
event DepositToAttachedNFT(address indexed provider, uint256 tokenId, uint256 managedTokenId, uint256 value);
/**
* @notice Emitted when a withdrawal is made from a lock.
* @param provider The address of the entity making the withdrawal.
* @param tokenId The ID of the token associated with the withdrawal.
* @param value The amount of tokens withdrawn.
* @param ts The timestamp when the withdrawal occurred.
*/
event Withdraw(address indexed provider, uint256 tokenId, uint256 value, uint256 ts);
/**
* @notice Emitted when the merging process of two veNFT locks is initiated.
* @param tokenFromId The ID of the token being merged from.
* @param tokenToId The ID of the token being merged into.
*/
event MergeInit(uint256 tokenFromId, uint256 tokenToId);
/**
* @notice Emitted when two veNFT locks are successfully merged.
* @param provider The address of the entity initiating the merge.
* @param tokenIdFrom The ID of the token being merged from.
* @param tokenIdTo The ID of the token being merged into.
*/
event Merge(address indexed provider, uint256 tokenIdFrom, uint256 tokenIdTo);
/**
* @notice Emitted when the total supply of voting power changes.
* @param prevSupply The previous total supply of voting power.
* @param supply The new total supply of voting power.
*/
event Supply(uint256 prevSupply, uint256 supply);
/**
* @notice Emitted when an address associated with the contract is updated.
* @param key The key representing the contract being updated.
* @param value The new address of the contract.
*/
event UpdateAddress(string key, address indexed value);
/**
* @notice Emitted when a token is permanently locked by a user.
* @param sender The address of the user who initiated the lock.
* @param tokenId The ID of the token that has been permanently locked.
*/
event LockPermanent(address indexed sender, uint256 indexed tokenId);
/**
* @notice Emitted when a token is unlocked from a permanent lock state by a user.
* @param sender The address of the user who initiated the unlock.
* @param tokenId The ID of the token that has been unlocked from its permanent state.
*/
event UnlockPermanent(address indexed sender, uint256 indexed tokenId);
/**
* @notice Emitted when a veNEST NFT lock is burned and the underlying NEST is released for use in bribes.
* @param sender The address which initiated the burn-to-bribes operation.
* @param tokenId The identifier of the veNEST NFT that was burned.
* @param value The amount of NEST tokens released from the burned lock.
*/
event BurnToBribes(address indexed sender, uint256 indexed tokenId, uint256 value);
/**
* @notice Returns the address of the token used in voting escrow.
* @return The address of the token contract.
*/
function token() external view returns (address);
/**
* @notice Returns the address of the voter contract.
* @return The address of the voter.
*/
function voter() external view returns (address);
/**
* @notice Checks if the specified address is approved or the owner of the given token.
* @param sender The address to check.
* @param tokenId The ID of the token to check.
* @return True if `sender` is approved or the owner of `tokenId`, otherwise false.
*/
function isApprovedOrOwner(address sender, uint256 tokenId) external view returns (bool);
/**
* @notice Checks if a specific NFT token is transferable.
* @dev In the current implementation, this function always returns `true`,
* meaning the contract does not enforce non-transferability at code level.
* @param tokenId_ The ID of the NFT to check.
* @return bool Always returns true in the current version.
*/
function isTransferable(uint256 tokenId_) external view returns (bool);
/**
* @notice Retrieves the state of a specific NFT.
* @param tokenId_ The ID of the NFT to query.
* @return The current {TokenState} of the specified NFT.
*/
function getNftState(uint256 tokenId_) external view returns (TokenState memory);
/**
* @notice Returns the total supply of voting power at the current block timestamp.
* @return The total supply of voting power.
*/
function votingPowerTotalSupply() external view returns (uint256);
/**
* @notice Returns the balance of a veNFT at the current block timestamp.
* @dev Balance is determined by the lock’s slope and bias at this moment.
* @param tokenId_ The ID of the veNFT to query.
* @return The current voting power (balance) of the veNFT.
*/
function balanceOfNFT(uint256 tokenId_) external view returns (uint256);
/**
* @notice Returns the balance of a veNFT at the current block timestamp, ignoring ownership changes.
* @dev This function is similar to {balanceOfNFT} but does not zero out the balance
* if the token was transferred in the same block.
* @param tokenId_ The ID of the veNFT to query.
* @return The current voting power (balance) of the veNFT.
*/
function balanceOfNftIgnoreOwnershipChange(uint256 tokenId_) external view returns (uint256);
/**
* @notice Updates the address of a specified contract.
* @param key_ The key representing the contract.
* @param value_ The new address of the contract.
* @dev Reverts with `InvalidAddressKey` if the key does not match any known setting.
* Emits an {UpdateAddress} event on success.
*/
function updateAddress(string memory key_, address value_) external;
/**
* @notice Hooks the voting state for a specified NFT.
* @dev Only callable by the voter contract. Used to mark a veNFT as having voted or not.
* @param tokenId_ The ID of the NFT.
* @param state_ True if the NFT is now considered “voted,” false otherwise.
* @custom:error AccessDenied If called by any address other than the voter.
*/
function votingHook(uint256 tokenId_, bool state_) external;
/**
* @notice Creates a new lock for a specified recipient.
* @param amount_ The amount of tokens to lock.
* @param lockDuration_ The duration in seconds for which the tokens will be locked.
* @param to_ The address of the recipient who will receive the new veNFT.
* @param shouldBoosted_ Whether the deposit should attempt to get a veBoost.
* @param withPermanentLock_ Whether the lock should be created as a permanent lock.
* @param managedTokenIdForAttach_ (Optional) The ID of the managed NFT to attach. Pass 0 to ignore.
* @return The ID of the newly created veNFT.
* @dev Reverts with `InvalidLockDuration` if lockDuration_ is 0 or too large.
* Reverts with `ValueZero` if amount_ is 0.
* Emits a {Deposit} event on success.
*/
function createLockFor(
uint256 amount_,
uint256 lockDuration_,
address to_,
bool shouldBoosted_,
bool withPermanentLock_,
uint256 managedTokenIdForAttach_
) external returns (uint256);
/**
* @notice Deposits tokens for a specific NFT, increasing its locked balance.
* @param tokenId_ The ID of the veNFT to top up.
* @param amount_ The amount of tokens to deposit.
* @param shouldBoosted_ Whether this deposit should attempt to get a veBoost.
* @param withPermanentLock_ Whether to apply a permanent lock alongside the deposit.
* @dev Reverts with `ValueZero` if amount_ is 0.
* Emits a {Deposit} event upon success.
*/
function depositFor(uint256 tokenId_, uint256 amount_, bool shouldBoosted_, bool withPermanentLock_) external;
/**
* @notice Increases the unlock time for an existing lock.
* @param tokenId_ The ID of the veNFT to extend.
* @param lockDuration_ The additional duration in seconds to add to the current unlock time.
* @dev Reverts with `InvalidLockDuration` if the new unlock time is invalid.
* Reverts with `AccessDenied` if the caller is not the owner or approved.
* Emits a {Deposit} event with the deposit type set to {INCREASE_UNLOCK_TIME}.
*/
function increase_unlock_time(uint256 tokenId_, uint256 lockDuration_) external;
/**
* @notice Deposits tokens and extends the lock duration for a veNFT in one call.
* @dev This may trigger veBoost if conditions are met.
* @param tokenId_ The ID of the veNFT.
* @param amount_ The amount of tokens to deposit.
* @param lockDuration_ The duration in seconds to add to the current unlock time.
* Emits one {Deposit} event for the deposit itself
* and another {Deposit} event for the unlock time increase.
*/
function depositWithIncreaseUnlockTime(uint256 tokenId_, uint256 amount_, uint256 lockDuration_) external;
/**
* @notice Deposits tokens directly into a veNFT that is attached to a managed NFT.
* @dev This updates the locked balance on the managed NFT, adjusts total supply,
* and emits {DepositToAttachedNFT} and {Supply} events.
* @param tokenId_ The ID of the attached veNFT.
* @param amount_ The amount of tokens to deposit.
* @custom:error NotManagedNft if the managed token ID is invalid or not recognized.
*/
function depositToAttachedNFT(uint256 tokenId_, uint256 amount_) external;
/**
* @notice Withdraws tokens from an expired lock (non-permanent).
* @param tokenId_ The ID of the veNFT to withdraw from.
* @dev Reverts with `AccessDenied` if caller is not owner or approved.
* Reverts with `TokenNoExpired` if the lock is not yet expired.
* Reverts with `PermanentLocked` if the lock is permanent.
* Emits a {Withdraw} event and a {Supply} event.
*/
function withdraw(uint256 tokenId_) external;
/**
* @notice Merges one veNFT (tokenFromId_) into another (tokenToId_).
* @param tokenFromId_ The ID of the source veNFT being merged.
* @param tokenToId_ The ID of the target veNFT receiving the locked tokens.
* @dev Reverts with `MergeTokenIdsTheSame` if both IDs are the same.
* Reverts with `AccessDenied` if the caller isn't owner or approved for both IDs.
* Emits a {MergeInit} event at the start, and a {Merge} event upon completion.
* Also emits a {Deposit} event reflecting the updated lock in the target token.
*/
function merge(uint256 tokenFromId_, uint256 tokenToId_) external;
/**
* @notice Permanently locks a veNFT.
* @param tokenId_ The ID of the veNFT to be permanently locked.
* @dev Reverts with `AccessDenied` if caller isn't owner or approved.
* Reverts with `TokenAttached` if the token is attached to a managed NFT.
* Reverts with `PermanentLocked` if the token already permanent lcoked
* Emits {LockPermanent} on success.
*/
function lockPermanent(uint256 tokenId_) external;
/**
* @notice Unlocks a permanently locked veNFT, reverting it to a temporary lock.
* @param tokenId_ The ID of the veNFT to unlock.
* @dev Reverts with `AccessDenied` if caller isn't owner or approved.
* Reverts with `TokenAttached` if the token is attached.
* Reverts with `NotPermanentLocked` if the lock isn't actually permanent.
* Emits {UnlockPermanent} on success.
*/
function unlockPermanent(uint256 tokenId_) external;
/**
* @notice Creates a new managed NFT for a given recipient.
* @param recipient_ The address that will receive the newly created managed NFT.
* @return The ID of the newly created managed NFT.
* @dev Reverts with `AccessDenied` if caller is not the managed NFT manager.
*/
function createManagedNFT(address recipient_) external returns (uint256);
/**
* @notice Attaches a veNFT (user’s token) to a managed NFT, combining their locked balances.
* @param tokenId_ The ID of the user’s veNFT being attached.
* @param managedTokenId_ The ID of the managed NFT.
* @return The amount of tokens locked during the attachment.
* @dev Reverts with `AccessDenied` if caller is not the managed NFT manager.
* Reverts with `ZeroVotingPower` if the user’s token has zero voting power.
* Reverts with `NotManagedNft` if the target is not recognized as a managed NFT.
*/
function onAttachToManagedNFT(uint256 tokenId_, uint256 managedTokenId_) external returns (uint256);
/**
* @notice Detaches a veNFT from a managed NFT.
* @param tokenId_ The ID of the user’s veNFT being detached.
* @param managedTokenId_ The ID of the managed NFT from which it’s being detached.
* @param newBalance_ The new locked balance the veNFT will hold after detachment.
* @dev Reverts with `AccessDenied` if caller is not the managed NFT manager.
* Reverts with `NotManagedNft` if the target is not recognized as a managed NFT.
*/
function onDettachFromManagedNFT(uint256 tokenId_, uint256 managedTokenId_, uint256 newBalance_) external;
/**
* @notice Burns a veNEST NFT to reclaim the underlying NEST tokens for use in bribes.
* @dev Must be called by `customBribeRewardRouter`.
* The token must not be permanently locked or attached.
* Also resets any votes before burning.
* Emits a {BurnToBribes} event on successful burn.
* @param tokenId_ The ID of the veNEST NFT to burn.
*/
function burnToBribes(uint256 tokenId_) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/**
* @title Interface for Managed NFT Manager
* @dev Defines the functions and events for managing NFTs, including attaching/detaching to strategies, authorization, and administrative checks.
*/
interface IManagedNFTManager {
/**
* @dev Emitted when the disabled state of a managed NFT is toggled.
* @param sender The address that triggered the state change.
* @param tokenId The ID of the managed NFT affected.
* @param isDisable True if the NFT is now disabled, false if it is enabled.
*/
event ToggleDisableManagedNFT(address indexed sender, uint256 indexed tokenId, bool indexed isDisable);
/**
* @dev Emitted when a new managed NFT is created and attached to a strategy.
* @param sender The address that performed the creation.
* @param strategy The address of the strategy to which the NFT is attached.
* @param tokenId The ID of the newly created managed NFT.
*/
event CreateManagedNFT(address indexed sender, address indexed strategy, uint256 indexed tokenId);
/**
* @dev Emitted when an NFT is whitelisted or removed from the whitelist.
* @param tokenId The ID of the NFT being modified.
* @param isWhitelisted True if the NFT is being whitelisted, false if it is being removed from the whitelist.
*/
event SetWhitelistedNFT(uint256 indexed tokenId, bool indexed isWhitelisted);
/**
* @dev Emitted when an authorized user is set for a managed NFT.
* @param managedTokenId The ID of the managed NFT.
* @param authorizedUser The address being authorized.
*/
event SetAuthorizedUser(uint256 indexed managedTokenId, address authorizedUser);
/**
* @dev Emitted when the strategy flags for a specific strategy are updated.
* @param strategy The address of the strategy whose flags are being updated.
* @param flags The new set of flags assigned to the strategy.
*/
event SetStrategyFlags(address indexed strategy, uint8 flags);
/**
* @notice Emitted when the default detachment-lock duration is updated.
* @param previousDuration The previous default duration (in seconds).
* @param newDuration The new default duration (in seconds).
*/
event SetDefaultDetachmentLockDuration(
uint256 previousDuration,
uint256 newDuration
);
/**
* @notice Checks if a managed NFT is currently disabled.
* @param managedTokenId_ The ID of the managed NFT.
* @return True if the managed NFT is disabled, false otherwise.
*/
function isDisabledNFT(uint256 managedTokenId_) external view returns (bool);
/**
* @notice Determines if a token ID is recognized as a managed NFT within the system.
* @param managedTokenId_ The ID of the token to check.
* @return True if the token is a managed NFT, false otherwise.
*/
function isManagedNFT(uint256 managedTokenId_) external view returns (bool);
/**
* @notice Checks if an NFT is whitelisted within the management system.
* @param tokenId_ The ID of the NFT to check.
* @return True if the NFT is whitelisted, false otherwise.
*/
function isWhitelistedNFT(uint256 tokenId_) external view returns (bool);
/**
* @notice Verifies if a user's NFT is attached to any managed NFT.
* @param tokenId_ The ID of the user's NFT.
* @return True if the NFT is attached, false otherwise.
*/
function isAttachedNFT(uint256 tokenId_) external view returns (bool);
/**
* @notice Checks if a given account is an administrator of the managed NFT system.
* @param account_ The address to check.
* @return True if the address is an admin, false otherwise.
*/
function isAdmin(address account_) external view returns (bool);
/**
* @notice Retrieves the managed token ID that a user's NFT is attached to.
* @param tokenId_ The ID of the user's NFT.
* @return The ID of the managed token to which the NFT is attached.
*/
function getAttachedManagedTokenId(uint256 tokenId_) external view returns (uint256);
/**
* @notice Address of the Voting Escrow contract managing voting and staking mechanisms.
*/
function votingEscrow() external view returns (address);
/**
* @notice Address of the Voter contract responsible for handling governance actions related to managed NFTs.
*/
function voter() external view returns (address);
/**
* @notice Verifies if a given address is authorized to manage a specific managed NFT.
* @param managedTokenId_ The ID of the managed NFT.
* @param account_ The address to verify.
* @return True if the address is authorized, false otherwise.
*/
function isAuthorized(uint256 managedTokenId_, address account_) external view returns (bool);
/**
* @notice Retrieves the strategy flags for a given strategy.
* @param strategy_ The address of the strategy to retrieve flags for.
* @return The flags assigned to the specified strategy.
*/
function getStrategyFlags(address strategy_) external view returns (uint8);
/**
* @notice Returns the default detachment/withdrawal lock window duration in seconds.
* @dev Strategies should treat this as the baseline lock window after epoch start
* unless an explicit per-strategy override applies.
* @return duration The default lock duration, in seconds.
*/
function defaultDetachmentLockDuration() external view returns (uint256 duration);
/**
* @notice Assigns an authorized user for a managed NFT.
* @param managedTokenId_ The ID of the managed NFT.
* @param authorizedUser_ The address to authorize.
*/
function setAuthorizedUser(uint256 managedTokenId_, address authorizedUser_) external;
/**
* @notice Creates a managed NFT and attaches it to a strategy
* @param strategy_ The strategy to which the managed NFT will be attached
*/
function createManagedNFT(address strategy_) external returns (uint256 managedTokenId);
/**
* @notice Toggles the disabled state of a managed NFT
* @param managedTokenId_ The ID of the managed token to toggle
* @dev Enables or disables a managed token to control its operational status, with an event emitted for state change.
*/
function toggleDisableManagedNFT(uint256 managedTokenId_) external;
/**
* @notice Attaches a user's NFT to a managed NFT, enabling it within a specific strategy.
* @param tokenId_ The user's NFT token ID.
* @param managedTokenId The managed NFT token ID.
*/
function onAttachToManagedNFT(uint256 tokenId_, uint256 managedTokenId) external;
/**
* @notice Detaches a user's NFT from a managed NFT, disabling it within the strategy.
* @param tokenId_ The user's NFT token ID.
*/
function onDettachFromManagedNFT(uint256 tokenId_) external;
/**
* @notice Handles the deposit of tokens to an NFT attached to a managed token.
* @dev Called by the Voting Escrow contract when tokens are deposited to an NFT that is attached to a managed NFT.
* The function verifies the token is attached, checks if it is disabled, and updates the token's state.
* @param tokenId_ The token ID of the user's NFT.
* @param amount_ The amount of tokens to deposit.
* @custom:error IncorrectUserNFT Thrown if the provided token ID is not attached or if it is a managed token itself.
* @custom:error ManagedNFTIsDisabled Thrown if the managed token is currently disabled.
*/
function onDepositToAttachedNFT(uint256 tokenId_, uint256 amount_) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/**
* @title IManagedNFTStrategy
* @dev Interface for strategies managing NFTs ,
* participate in voting, and claim rewards.
*/
interface IManagedNFTStrategy {
/**
* @dev Emitted when the name of the strategy is changed.
* @param newName The new name that has been set for the strategy.
*/
event SetName(string newName);
/**
* @dev Emitted when the description of the strategy is changed.
* @param newDescription The new description that has been set for the strategy.
*/
event SetDescription(string newDescription);
/**
* @dev Emitted when the description of the strategy is changed.
* @param newCreator The new description that has been set for the strategy.
*/
event SetCreator(string newCreator);
/**
* @dev Emitted when a new managed NFT is successfully attached to the strategy.
* @param managedTokenId The ID of the managed NFT that has been attached.
*/
event AttachedManagedNFT(uint256 indexed managedTokenId);
/**
* @notice Called when an NFT is attached to a strategy.
* @dev Allows the strategy to perform initial setup or balance tracking when an NFT is first attached.
* @param tokenId The ID of the NFT being attached.
* @param userBalance The balance of governance tokens associated with the NFT at the time of attachment.
*/
function onAttach(uint256 tokenId, uint256 userBalance) external;
/**
* @notice Called when an NFT is detached from a strategy.
* @dev Allows the strategy to clean up or update records when an NFT is removed.
* @param tokenId The ID of the NFT being detached.
* @param userBalance The remaining balance of governance tokens associated with the NFT at the time of detachment.
*/
function onDettach(uint256 tokenId, uint256 userBalance) external returns (uint256 lockedRewards);
/**
* @notice Gets the address of the managed NFT manager contract.
* @return The address of the managed NFT manager.
*/
function managedNFTManager() external view returns (address);
/**
* @notice Gets the address of the voting escrow contract used for locking governance tokens.
* @return The address of the voting escrow contract.
*/
function votingEscrow() external view returns (address);
/**
* @notice Gets the address of the voter contract that coordinates governance actions.
* @return The address of the voter contract.
*/
function voter() external view returns (address);
/**
* @notice Retrieves the name of the strategy.
* @return A string representing the name of the strategy.
*/
function name() external view returns (string memory);
/**
* @notice Retrieves the creator name of the strategy.
* Empty string by default
* @return A string representing the name of the strategy.
*/
function creator() external view returns (string memory);
/**
* @notice Retrieves the description of the strategy.
* Empty string by default
* @return A string representing the name of the strategy.
*/
function description() external view returns (string memory);
/**
* @notice Retrieves the ID of the managed token.
* @return The token ID used by the strategy.
*/
function managedTokenId() external view returns (uint256);
/**
* @notice Submits a governance vote on behalf of the strategy.
* @param poolVote_ An array of addresses representing the pools to vote on.
* @param weights_ An array of weights corresponding to each pool vote.
*/
function vote(address[] calldata poolVote_, uint256[] calldata weights_) external;
/**
* @notice Claims rewards allocated to the managed NFTs from specified gauges.
* @param gauges_ An array of addresses representing the gauges from which rewards are to be claimed.
*/
function claimRewards(address[] calldata gauges_) external;
/**
* @notice Claims bribes allocated to the managed NFTs for specific tokens and pools.
* @param bribes_ An array of addresses representing the bribe pools.
* @param tokens_ An array of token addresses for each bribe pool where rewards can be claimed.
*/
function claimBribes(address[] calldata bribes_, address[][] calldata tokens_) external;
/**
* @notice Attaches a specific managed NFT to this strategy, setting up necessary governance or reward mechanisms.
* @dev This function can only be called by administrators. It sets the `managedTokenId` and ensures that the token is
* valid and owned by this contract. Emits an `AttachedManagedNFT` event upon successful attachment.
* @param managedTokenId_ The token ID of the NFT to be managed by this strategy.
* throws AlreadyAttached if the strategy is already attached to a managed NFT.
* throws IncorrectManagedTokenId if the provided token ID is not managed or not owned by this contract.
*/
function attachManagedNFT(uint256 managedTokenId_) external;
/**
* @notice Returns whether detachment is currently time-locked and the active window bounds.
* @dev
* - `epochStart` is implementation-defined (e.g., aligned to the start of the current week).
* - The effective lock duration may be the per-strategy override or the manager default.
* @return locked True if detachment is currently blocked by the time-lock window.
* @return epochStart The epoch start timestamp used to compute the lock window.
* @return lockEnd The timestamp when detachment becomes allowed (end of the lock window).
*/
function dettachLockWindowInfo()
external
view
returns (
bool locked,
uint256 epochStart,
uint256 lockEnd
);
/**
* @notice Per-strategy override for the detachment lock duration (in seconds).
* @dev If this value is zero, the strategy MUST fall back to the manager’s
* {defaultDetachmentLockDuration()}.
* @return duration The configured per-strategy duration (0 = use manager default).
*/
function detachmentLockDuration() external view returns (uint256 duration);
}{
"evmVersion": "paris",
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 2000
},
"metadata": {
"bytecodeHash": "none"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"AlreadyAttached","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"DetachmentLockDurationTooLong","type":"error"},{"inputs":[],"name":"IncorrectUserNFT","type":"error"},{"inputs":[],"name":"ManagedNFTIsDisabled","type":"error"},{"inputs":[],"name":"NotAttached","type":"error"},{"inputs":[],"name":"NotManagedNFT","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"strategy","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"CreateManagedNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":"uint256","name":"managedTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"authorizedUser","type":"address"}],"name":"SetAuthorizedUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"previousDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"SetDefaultDetachmentLockDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint8","name":"flags","type":"uint8"}],"name":"SetStrategyFlags","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"SetWhitelistedNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"isDisable","type":"bool"}],"name":"ToggleDisableManagedNFT","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGED_NFT_ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"strategy_","type":"address"}],"name":"createManagedNFT","outputs":[{"internalType":"uint256","name":"managedTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultDetachmentLockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"getAttachedManagedTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getStrategyFlags","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"votingEscrow_","type":"address"},{"internalType":"address","name":"voter_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account_","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"isAttachedNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"},{"internalType":"address","name":"account_","type":"address"}],"name":"isAuthorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"}],"name":"isDisabledNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"}],"name":"isManagedNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isWhitelistedNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"managedTokensInfo","outputs":[{"internalType":"bool","name":"isManaged","type":"bool"},{"internalType":"bool","name":"isDisabled","type":"bool"},{"internalType":"address","name":"authorizedUser","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"managedTokenId_","type":"uint256"}],"name":"onAttachToManagedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"onDepositToAttachedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"onDettachFromManagedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"},{"internalType":"address","name":"authorizedUser_","type":"address"}],"name":"setAuthorizedUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDuration_","type":"uint256"}],"name":"setDefaultDetachmentLockDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategy_","type":"address"},{"internalType":"uint8","name":"flags_","type":"uint8"}],"name":"setStrategyFlags","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"bool","name":"isWhitelisted_","type":"bool"}],"name":"setWhitelistedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"}],"name":"toggleDisableManagedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokensInfo","outputs":[{"internalType":"bool","name":"isAttached","type":"bool"},{"internalType":"uint256","name":"attachedManagedTokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingEscrow","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608080604052346100c1576000549060ff8260081c1661006f575060ff80821603610034575b604051611e3190816100c78239f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a138610025565b62461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fdfe6080604081815260048036101561001557600080fd5b600092833560e01c90816301ffc9a71461173d5750806305574c5e146115045780630a0912261461139057806310be5d90146113205780631321852b1461105b578063187c83261461103c5780631e529a6c1461100d5780631e60c38b14610fe3578063248a9ca314610fb957806324d7806c14610f3b5780632f2ff15d14610e8857806336568abe14610de85780633a497cd214610dad5780633b83245a14610d8157806344bbcbf714610d0557806346c96aac14610cdd578063485cc955146109c75780634f2bfe5b1461099f5780635b9f3caf146106f6578063609c6d7f146106b657806369448b6d1461067457806378abe5a7146105f1578063905ab279146105a457806391d148541461055e578063a217fddf14610543578063d4e2616f14610517578063d547741f146104d9578063e4e64f60146102d1578063e74a37be14610293578063eefff5d5146102675763f49d3b081461017857600080fd5b34610263578160031936011261026357803591610193611808565b9161019c61181e565b838552609a60205260ff82862054161561023c57507fb663263c4e8e3e081832c34eb5808107ce9fbf4ba52cc79aafb19c15a1527b08916001600160a01b03602092858752609a845261023383828920907fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff000083549260101b169116179055565b5191168152a280f35b90517fa963c020000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b5034610263576020600319360112610263578160209360ff92358152609a855220541690519015158152f35b5050346102cd5760206003193601126102cd5760ff816020936001600160a01b036102bc6117f2565b168152609c85522054169051908152f35b5080fd5b508290346102cd5760209283600319360112610263579082916102f26117f2565b916102fb61181e565b6001600160a01b0386816024816097541696865198899384927fe4e64f60000000000000000000000000000000000000000000000000000000008452169889888401525af19485156104cf578695610499575b5082516103f49161035e82611b7a565b600182528882018881526103ad868401918a8352898b52609a8c52610396888c2095511515869060ff60ff1983541691151516179055565b51845461ff00191690151560081b61ff0016178455565b5182547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16911660101b75ffffffffffffffffffffffffffffffffffffffff000016179055565b823b1561049557838251917f4b985845000000000000000000000000000000000000000000000000000000008352820152848160248183875af1801561048b5784939291869161046c575b505051937f1ec88629262a427f794361e94fdf7d2afb0f49eb9f142e5a818299015f661d0e339180a48152f35b6104799192939450611bac565b61048757908291848761043f565b8380fd5b82513d87823e3d90fd5b8480fd5b9094508681813d83116104c8575b6104b18183611bdc565b810103126104c35751936103f461034e565b600080fd5b503d6104a7565b83513d88823e3d90fd5b509034610263578060031936011261026357610514913561050f60016104fd611808565b93838752606560205286200154611a30565b611bff565b80f35b5034610263576020600319360112610263578160209360ff92358152609b855220541690519015158152f35b5050346102cd57816003193601126102cd5751908152602090f35b50346102635781600319360112610263576001600160a01b0382602094610583611808565b9335815260658652209116600052825260ff81600020541690519015158152f35b5034610263576020600319360112610263576060928291358152609a6020522054906001600160a01b0381519260ff81161515845260ff8160081c161515602085015260101c1690820152f35b5090346102635760206003193601126102635781359161060f61181e565b828452609a60205260ff82852054161561023c5750818352609a6020528220805461ff00198116600891821c60ff16159182901b61ff00161790915590337f1039c16e7b51187f290e4dcbf3207771138eb7bc5bc0414e7e26377acd1a4bd78480a480f35b503461026357602060031936011261026357606092829135815260996020522060ff815416916002600183015492015491815193151584526020840152820152f35b509034610263578060031936011261026357806020936106d4611808565b93358152609a85526001600160a01b03918291205460101c1691519216148152f35b503461026357602090816003193601126104875780359060008052606583528360002033600052835260ff846000205416156107a3576207e90080831161077057857f8c6b25c51a76188484a005b26bfd6a92699b1d97918d6443b06936768ba7e54c868686609d549181609d558351928352820152a180f35b6044928551927f136866dd0000000000000000000000000000000000000000000000000000000084528301526024820152fd5b9050826107af33611cc0565b600082516107bc81611bc0565b6042815285810191606036843781511561098c5760308353815160019081101561097957607860218401536041905b8082116108ff5750506108be576108b5610884856108936048601f1997601f978c9760449c9b5196879361084f8b86019b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008d528251928391603789019101611b57565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190611b57565b01036028810185520183611bdc565b5197889662461bcd60e51b885287015251809281602488015287870190611b57565b01168101030190fd5b606485878087519262461bcd60e51b845283015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015610964577f3031323334353637383961626364656600000000000000000000000000000000901a61093b8486611c99565b53871c91801561094f5760001901906107eb565b601188634e487b7160e01b6000525260246000fd5b603289634e487b7160e01b6000525260246000fd5b602482603289634e487b7160e01b835252fd5b80603287634e487b7160e01b6024945252fd5b5050346102cd57816003193601126102cd576020906001600160a01b03609754169051908152f35b50346102635781600319360112610263576109e06117f2565b906109e9611808565b9184549260ff808560081c161593848095610cd1575b8015610cbb575b15610c525760ff1995856001888316178a55610c24575b5081885460081c1615610bbb5750610a3483611dea565b610a3d82611dea565b6000805260209460658652866000203360005286528187600020541615610b6f575b7fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a49182600052606587528760002033600052875287600020541615610b20575b50506001600160a01b0390817fffffffffffffffffffffffff0000000000000000000000000000000000000000931683609754161760975516906098541617609855610ae9578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff001984541684555160018152a138808280f35b81600052606586528660002033600052865260018760002091825416179055339033907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a43880610a9f565b60008052606586528660002033600052865286600020600182825416179055333360007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4610a5f565b608490602088519162461bcd60e51b8352820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661010117885538610a1d565b608490602088519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b158015610a065750600182871614610a06565b506001828716106109ff565b5050346102cd57816003193601126102cd576020906001600160a01b03609854169051908152f35b5050346102cd57806003193601126102cd57610d1f6117f2565b6024359060ff8216809203610487577f98ba184db7fdb55076f12c8673ff7b937ed5c275d4eb401c5f469be704ee5ced916001600160a01b03602092610d6361181e565b1693848652609c83528086208260ff1982541617905551908152a280f35b5034610263576020600319360112610263578160209360ff923581526099855220541690519015158152f35b5050346102cd57816003193601126102cd57602090517fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a48152f35b508290346102cd57826003193601126102cd57610e03611808565b90336001600160a01b03831603610e1f57906105149135611bff565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b50346102635781600319360112610263573590610ea3611808565b908284526065602052610ebb60018286200154611a30565b8260005260656020526001600160a01b03816000209216918260005260205260ff81600020541615610eeb578380f35b8260005260656020528060002082600052602052600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a43880808380f35b5050346102cd5760206003193601126102cd576020916001600160a01b03610f616117f2565b16308114918215610f78575b505090519015158152f35b839192507fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a48152606585522090600052825260ff8160002054163880610f6d565b50346102635760206003193601126102635781602093600192358152606585522001549051908152f35b50346102635760206003193601126102635781602093600192358152609985522001549051908152f35b5034610263576020600319360112610263578160209360ff92358152609a8552205460081c1690519015158152f35b5050346102cd57816003193601126102cd57602090609d549051908152f35b50346102635761106a366117dc565b6001600160a01b03908160985416330361131157808652602090609a825285872086519061109782611b7a565b549060ff821615908115815288868683019460ff8160081c161515865260101c169101526112e957516112c157838752609a825260ff868820541680156112b0575b6112885791818796949293879694836097541660448851809a81937f1321852b000000000000000000000000000000000000000000000000000000008352898b8401528660248401525af196871561124c578897611256575b50855161113e81611b7a565b600181526002838201838152888301908a8252878c52609986526111758a8d2094511515859060ff60ff1983541691151516179055565b516001840155519101558183609754169160248851809481936331a9108f60e11b83528a8301525afa91821561124c57889261121f575b505016803b1561121b57859283604492865197889586947f7f36b27600000000000000000000000000000000000000000000000000000000865285015260248401525af190811561121257506111ff5750f35b61120890611bac565b61120f5780f35b80fd5b513d84823e3d90fd5b8580fd5b61123e9250803d10611245575b6112368183611bdc565b810190611dcb565b38806111ac565b503d61122c565b86513d8a823e3d90fd5b975095508087813d8111611281575b61126f8183611bdc565b810103126104c3578796519538611132565b503d611265565b8486517fb97b4fe2000000000000000000000000000000000000000000000000000000008152fd5b506099825260ff86882054166110d9565b8486517fcdad3405000000000000000000000000000000000000000000000000000000008152fd5b8587517fa963c020000000000000000000000000000000000000000000000000000000008152fd5b838551634ca8886760e01b8152fd5b5034610263578160031936011261026357356024359182151592838103610495576113699161134d61181e565b838652609b60205285209060ff60ff1983541691151516179055565b7fe5c9fc09446cbb1388f8bb0f51a07b6459282099f6087798d09e9f05cff2c8ad8380a380f35b509190346102cd576113a1366117dc565b9190936001600160a01b0394856097541633036114f5578085526020956099875260ff84872054161580156114e4575b6114bc57818652609987526001848720015496878752609a815260ff8588205460081c1661149457869783885260998252600286892001611413888254611c76565b90558183609754169160248851809481936331a9108f60e11b83528a8301525afa91821561124c57889261121f57505016803b1561121b57859283604492865197889586947f7f36b27600000000000000000000000000000000000000000000000000000000865285015260248401525af190811561121257506111ff5750f35b8385517fcdad3405000000000000000000000000000000000000000000000000000000008152fd5b8284517fb97b4fe2000000000000000000000000000000000000000000000000000000008152fd5b50609a875260ff84872054166113d1565b509051634ca8886760e01b8152fd5b509190346102cd5760209283600319360112610263578035906001600160a01b03908160985416330361172f578285526099865283852084519261154784611b7a565b60ff82541615801585528660026001850154948b880195865201549501948552611707578151156116f457806097541688835160248951809481936331a9108f60e11b8352898301525afa9081156116cd5782918a918a916116d7575b50604487518b8b5195869485937ff83a20680000000000000000000000000000000000000000000000000000000085528d8c8601526024850152165af19081156116cd57889161169a575b50611601916097541692519451611c76565b813b15611696578692838693606493895197889687957f4a0b5818000000000000000000000000000000000000000000000000000000008752860152602485015260448401525af1801561168957611670575b5090609983946002938552528220828155826001820155015580f35b6002929193611680609992611bac565b93919250611654565b50505051903d90823e3d90fd5b8680fd5b90508881813d83116116c6575b6116b18183611bdc565b810103126116c257516116016115ef565b8780fd5b503d6116a7565b87513d8a823e3d90fd5b6116ee9150823d8411611245576112368183611bdc565b386115a4565b602487600185634e487b7160e01b835252fd5b8286517fd6e7efb0000000000000000000000000000000000000000000000000000000008152fd5b8351634ca8886760e01b8152fd5b9250503461026357602060031936011261026357357fffffffff00000000000000000000000000000000000000000000000000000000811680910361026357602092507f7965db0b0000000000000000000000000000000000000000000000000000000081149081156117b2575b5015158152f35b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014386117ab565b60031960409101126104c3576004359060243590565b600435906001600160a01b03821682036104c357565b602435906001600160a01b03821682036104c357565b3360009081527fb9dd0f678759a46c1781332d0dd2e78b1fae2d6bbb349488ed28bf95807cdb8c60209081526040808320547fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a4919060ff16156118815750505050565b61188a33611cc0565b9181519061189782611bc0565b60428252848201956060368837825115611a1c5760308753825190600191821015611a1c5790607860218501536041915b8183116119a15750505061195f57604493926108b58361193b6048601f95601f1997519a8b9161192c8b8401987f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a5261084f8d8251928391603789019101611b57565b0103602881018b520189611bdc565b5196879562461bcd60e51b8752600487015251809281602488015287870190611b57565b60648483519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611a08577f3031323334353637383961626364656600000000000000000000000000000000901a6119de8587611c99565b5360041c9280156119f4576000190191906118c8565b602482634e487b7160e01b81526011600452fd5b602483634e487b7160e01b81526032600452fd5b80634e487b7160e01b602492526032600452fd5b600090808252602090606582526040808420338552835260ff818520541615611a595750505050565b611a6233611cc0565b91815190611a6f82611bc0565b60428252848201956060368837825115611a1c5760308753825190600191821015611a1c5790607860218501536041915b818311611b045750505061195f57604493926108b58361193b6048601f95601f1997519a8b9161192c8b8401987f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a5261084f8d8251928391603789019101611b57565b909192600f81166010811015611a08577f3031323334353637383961626364656600000000000000000000000000000000901a611b418587611c99565b5360041c9280156119f457600019019190611aa0565b60005b838110611b6a5750506000910152565b8181015183820152602001611b5a565b6060810190811067ffffffffffffffff821117611b9657604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111611b9657604052565b6080810190811067ffffffffffffffff821117611b9657604052565b90601f601f19910116810190811067ffffffffffffffff821117611b9657604052565b9060009180835260656020526001600160a01b036040842092169182845260205260ff604084205416611c3157505050565b8083526065602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b91908201809211611c8357565b634e487b7160e01b600052601160045260246000fd5b908151811015611caa570160200190565b634e487b7160e01b600052603260045260246000fd5b60405190611ccd82611b7a565b602a8252602082016040368237825115611caa57603090538151600190811015611caa57607860218401536029905b808211611d50575050611d0c5790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015611db6577f3031323334353637383961626364656600000000000000000000000000000000901a611d8c8486611c99565b5360041c918015611da1576000190190611cfc565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b908160209103126104c357516001600160a01b03811681036104c35790565b6001600160a01b031615611dfa57565b60046040517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fdfea164736f6c6343000813000a
Deployed Bytecode
0x6080604081815260048036101561001557600080fd5b600092833560e01c90816301ffc9a71461173d5750806305574c5e146115045780630a0912261461139057806310be5d90146113205780631321852b1461105b578063187c83261461103c5780631e529a6c1461100d5780631e60c38b14610fe3578063248a9ca314610fb957806324d7806c14610f3b5780632f2ff15d14610e8857806336568abe14610de85780633a497cd214610dad5780633b83245a14610d8157806344bbcbf714610d0557806346c96aac14610cdd578063485cc955146109c75780634f2bfe5b1461099f5780635b9f3caf146106f6578063609c6d7f146106b657806369448b6d1461067457806378abe5a7146105f1578063905ab279146105a457806391d148541461055e578063a217fddf14610543578063d4e2616f14610517578063d547741f146104d9578063e4e64f60146102d1578063e74a37be14610293578063eefff5d5146102675763f49d3b081461017857600080fd5b34610263578160031936011261026357803591610193611808565b9161019c61181e565b838552609a60205260ff82862054161561023c57507fb663263c4e8e3e081832c34eb5808107ce9fbf4ba52cc79aafb19c15a1527b08916001600160a01b03602092858752609a845261023383828920907fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff000083549260101b169116179055565b5191168152a280f35b90517fa963c020000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b5034610263576020600319360112610263578160209360ff92358152609a855220541690519015158152f35b5050346102cd5760206003193601126102cd5760ff816020936001600160a01b036102bc6117f2565b168152609c85522054169051908152f35b5080fd5b508290346102cd5760209283600319360112610263579082916102f26117f2565b916102fb61181e565b6001600160a01b0386816024816097541696865198899384927fe4e64f60000000000000000000000000000000000000000000000000000000008452169889888401525af19485156104cf578695610499575b5082516103f49161035e82611b7a565b600182528882018881526103ad868401918a8352898b52609a8c52610396888c2095511515869060ff60ff1983541691151516179055565b51845461ff00191690151560081b61ff0016178455565b5182547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16911660101b75ffffffffffffffffffffffffffffffffffffffff000016179055565b823b1561049557838251917f4b985845000000000000000000000000000000000000000000000000000000008352820152848160248183875af1801561048b5784939291869161046c575b505051937f1ec88629262a427f794361e94fdf7d2afb0f49eb9f142e5a818299015f661d0e339180a48152f35b6104799192939450611bac565b61048757908291848761043f565b8380fd5b82513d87823e3d90fd5b8480fd5b9094508681813d83116104c8575b6104b18183611bdc565b810103126104c35751936103f461034e565b600080fd5b503d6104a7565b83513d88823e3d90fd5b509034610263578060031936011261026357610514913561050f60016104fd611808565b93838752606560205286200154611a30565b611bff565b80f35b5034610263576020600319360112610263578160209360ff92358152609b855220541690519015158152f35b5050346102cd57816003193601126102cd5751908152602090f35b50346102635781600319360112610263576001600160a01b0382602094610583611808565b9335815260658652209116600052825260ff81600020541690519015158152f35b5034610263576020600319360112610263576060928291358152609a6020522054906001600160a01b0381519260ff81161515845260ff8160081c161515602085015260101c1690820152f35b5090346102635760206003193601126102635781359161060f61181e565b828452609a60205260ff82852054161561023c5750818352609a6020528220805461ff00198116600891821c60ff16159182901b61ff00161790915590337f1039c16e7b51187f290e4dcbf3207771138eb7bc5bc0414e7e26377acd1a4bd78480a480f35b503461026357602060031936011261026357606092829135815260996020522060ff815416916002600183015492015491815193151584526020840152820152f35b509034610263578060031936011261026357806020936106d4611808565b93358152609a85526001600160a01b03918291205460101c1691519216148152f35b503461026357602090816003193601126104875780359060008052606583528360002033600052835260ff846000205416156107a3576207e90080831161077057857f8c6b25c51a76188484a005b26bfd6a92699b1d97918d6443b06936768ba7e54c868686609d549181609d558351928352820152a180f35b6044928551927f136866dd0000000000000000000000000000000000000000000000000000000084528301526024820152fd5b9050826107af33611cc0565b600082516107bc81611bc0565b6042815285810191606036843781511561098c5760308353815160019081101561097957607860218401536041905b8082116108ff5750506108be576108b5610884856108936048601f1997601f978c9760449c9b5196879361084f8b86019b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008d528251928391603789019101611b57565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190611b57565b01036028810185520183611bdc565b5197889662461bcd60e51b885287015251809281602488015287870190611b57565b01168101030190fd5b606485878087519262461bcd60e51b845283015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015610964577f3031323334353637383961626364656600000000000000000000000000000000901a61093b8486611c99565b53871c91801561094f5760001901906107eb565b601188634e487b7160e01b6000525260246000fd5b603289634e487b7160e01b6000525260246000fd5b602482603289634e487b7160e01b835252fd5b80603287634e487b7160e01b6024945252fd5b5050346102cd57816003193601126102cd576020906001600160a01b03609754169051908152f35b50346102635781600319360112610263576109e06117f2565b906109e9611808565b9184549260ff808560081c161593848095610cd1575b8015610cbb575b15610c525760ff1995856001888316178a55610c24575b5081885460081c1615610bbb5750610a3483611dea565b610a3d82611dea565b6000805260209460658652866000203360005286528187600020541615610b6f575b7fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a49182600052606587528760002033600052875287600020541615610b20575b50506001600160a01b0390817fffffffffffffffffffffffff0000000000000000000000000000000000000000931683609754161760975516906098541617609855610ae9578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff001984541684555160018152a138808280f35b81600052606586528660002033600052865260018760002091825416179055339033907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a43880610a9f565b60008052606586528660002033600052865286600020600182825416179055333360007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4610a5f565b608490602088519162461bcd60e51b8352820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661010117885538610a1d565b608490602088519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b158015610a065750600182871614610a06565b506001828716106109ff565b5050346102cd57816003193601126102cd576020906001600160a01b03609854169051908152f35b5050346102cd57806003193601126102cd57610d1f6117f2565b6024359060ff8216809203610487577f98ba184db7fdb55076f12c8673ff7b937ed5c275d4eb401c5f469be704ee5ced916001600160a01b03602092610d6361181e565b1693848652609c83528086208260ff1982541617905551908152a280f35b5034610263576020600319360112610263578160209360ff923581526099855220541690519015158152f35b5050346102cd57816003193601126102cd57602090517fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a48152f35b508290346102cd57826003193601126102cd57610e03611808565b90336001600160a01b03831603610e1f57906105149135611bff565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b50346102635781600319360112610263573590610ea3611808565b908284526065602052610ebb60018286200154611a30565b8260005260656020526001600160a01b03816000209216918260005260205260ff81600020541615610eeb578380f35b8260005260656020528060002082600052602052600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a43880808380f35b5050346102cd5760206003193601126102cd576020916001600160a01b03610f616117f2565b16308114918215610f78575b505090519015158152f35b839192507fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a48152606585522090600052825260ff8160002054163880610f6d565b50346102635760206003193601126102635781602093600192358152606585522001549051908152f35b50346102635760206003193601126102635781602093600192358152609985522001549051908152f35b5034610263576020600319360112610263578160209360ff92358152609a8552205460081c1690519015158152f35b5050346102cd57816003193601126102cd57602090609d549051908152f35b50346102635761106a366117dc565b6001600160a01b03908160985416330361131157808652602090609a825285872086519061109782611b7a565b549060ff821615908115815288868683019460ff8160081c161515865260101c169101526112e957516112c157838752609a825260ff868820541680156112b0575b6112885791818796949293879694836097541660448851809a81937f1321852b000000000000000000000000000000000000000000000000000000008352898b8401528660248401525af196871561124c578897611256575b50855161113e81611b7a565b600181526002838201838152888301908a8252878c52609986526111758a8d2094511515859060ff60ff1983541691151516179055565b516001840155519101558183609754169160248851809481936331a9108f60e11b83528a8301525afa91821561124c57889261121f575b505016803b1561121b57859283604492865197889586947f7f36b27600000000000000000000000000000000000000000000000000000000865285015260248401525af190811561121257506111ff5750f35b61120890611bac565b61120f5780f35b80fd5b513d84823e3d90fd5b8580fd5b61123e9250803d10611245575b6112368183611bdc565b810190611dcb565b38806111ac565b503d61122c565b86513d8a823e3d90fd5b975095508087813d8111611281575b61126f8183611bdc565b810103126104c3578796519538611132565b503d611265565b8486517fb97b4fe2000000000000000000000000000000000000000000000000000000008152fd5b506099825260ff86882054166110d9565b8486517fcdad3405000000000000000000000000000000000000000000000000000000008152fd5b8587517fa963c020000000000000000000000000000000000000000000000000000000008152fd5b838551634ca8886760e01b8152fd5b5034610263578160031936011261026357356024359182151592838103610495576113699161134d61181e565b838652609b60205285209060ff60ff1983541691151516179055565b7fe5c9fc09446cbb1388f8bb0f51a07b6459282099f6087798d09e9f05cff2c8ad8380a380f35b509190346102cd576113a1366117dc565b9190936001600160a01b0394856097541633036114f5578085526020956099875260ff84872054161580156114e4575b6114bc57818652609987526001848720015496878752609a815260ff8588205460081c1661149457869783885260998252600286892001611413888254611c76565b90558183609754169160248851809481936331a9108f60e11b83528a8301525afa91821561124c57889261121f57505016803b1561121b57859283604492865197889586947f7f36b27600000000000000000000000000000000000000000000000000000000865285015260248401525af190811561121257506111ff5750f35b8385517fcdad3405000000000000000000000000000000000000000000000000000000008152fd5b8284517fb97b4fe2000000000000000000000000000000000000000000000000000000008152fd5b50609a875260ff84872054166113d1565b509051634ca8886760e01b8152fd5b509190346102cd5760209283600319360112610263578035906001600160a01b03908160985416330361172f578285526099865283852084519261154784611b7a565b60ff82541615801585528660026001850154948b880195865201549501948552611707578151156116f457806097541688835160248951809481936331a9108f60e11b8352898301525afa9081156116cd5782918a918a916116d7575b50604487518b8b5195869485937ff83a20680000000000000000000000000000000000000000000000000000000085528d8c8601526024850152165af19081156116cd57889161169a575b50611601916097541692519451611c76565b813b15611696578692838693606493895197889687957f4a0b5818000000000000000000000000000000000000000000000000000000008752860152602485015260448401525af1801561168957611670575b5090609983946002938552528220828155826001820155015580f35b6002929193611680609992611bac565b93919250611654565b50505051903d90823e3d90fd5b8680fd5b90508881813d83116116c6575b6116b18183611bdc565b810103126116c257516116016115ef565b8780fd5b503d6116a7565b87513d8a823e3d90fd5b6116ee9150823d8411611245576112368183611bdc565b386115a4565b602487600185634e487b7160e01b835252fd5b8286517fd6e7efb0000000000000000000000000000000000000000000000000000000008152fd5b8351634ca8886760e01b8152fd5b9250503461026357602060031936011261026357357fffffffff00000000000000000000000000000000000000000000000000000000811680910361026357602092507f7965db0b0000000000000000000000000000000000000000000000000000000081149081156117b2575b5015158152f35b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014386117ab565b60031960409101126104c3576004359060243590565b600435906001600160a01b03821682036104c357565b602435906001600160a01b03821682036104c357565b3360009081527fb9dd0f678759a46c1781332d0dd2e78b1fae2d6bbb349488ed28bf95807cdb8c60209081526040808320547fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a4919060ff16156118815750505050565b61188a33611cc0565b9181519061189782611bc0565b60428252848201956060368837825115611a1c5760308753825190600191821015611a1c5790607860218501536041915b8183116119a15750505061195f57604493926108b58361193b6048601f95601f1997519a8b9161192c8b8401987f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a5261084f8d8251928391603789019101611b57565b0103602881018b520189611bdc565b5196879562461bcd60e51b8752600487015251809281602488015287870190611b57565b60648483519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611a08577f3031323334353637383961626364656600000000000000000000000000000000901a6119de8587611c99565b5360041c9280156119f4576000190191906118c8565b602482634e487b7160e01b81526011600452fd5b602483634e487b7160e01b81526032600452fd5b80634e487b7160e01b602492526032600452fd5b600090808252602090606582526040808420338552835260ff818520541615611a595750505050565b611a6233611cc0565b91815190611a6f82611bc0565b60428252848201956060368837825115611a1c5760308753825190600191821015611a1c5790607860218501536041915b818311611b045750505061195f57604493926108b58361193b6048601f95601f1997519a8b9161192c8b8401987f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a5261084f8d8251928391603789019101611b57565b909192600f81166010811015611a08577f3031323334353637383961626364656600000000000000000000000000000000901a611b418587611c99565b5360041c9280156119f457600019019190611aa0565b60005b838110611b6a5750506000910152565b8181015183820152602001611b5a565b6060810190811067ffffffffffffffff821117611b9657604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111611b9657604052565b6080810190811067ffffffffffffffff821117611b9657604052565b90601f601f19910116810190811067ffffffffffffffff821117611b9657604052565b9060009180835260656020526001600160a01b036040842092169182845260205260ff604084205416611c3157505050565b8083526065602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b91908201809211611c8357565b634e487b7160e01b600052601160045260246000fd5b908151811015611caa570160200190565b634e487b7160e01b600052603260045260246000fd5b60405190611ccd82611b7a565b602a8252602082016040368237825115611caa57603090538151600190811015611caa57607860218401536029905b808211611d50575050611d0c5790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015611db6577f3031323334353637383961626364656600000000000000000000000000000000901a611d8c8486611c99565b5360041c918015611da1576000190190611cfc565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b908160209103126104c357516001600160a01b03811681036104c35790565b6001600160a01b031615611dfa57565b60046040517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fdfea164736f6c6343000813000a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in HYPE
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.