IvNFT
Inherits: INFT, IAdministrable
Author: mortimr @ Kiln
Mint or Purchase 1 NFT = own 1 validator
Functions
initialize
function initialize(VNFTConfiguration calldata config) external;
Parameters
| Name | Type | Description |
|---|---|---|
config | VNFTConfiguration | The configuration for the vNFT |
factory
Retrieve the factory address
function factory() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current factory address |
integrator
Retrieve the integrator address
function integrator() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current integrator address |
beneficiaryOf
Retriver the current beneficiary of EL and CL rewards
function beneficiaryOf(uint256 tokenId) external view returns (address beneficiary);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | Id of the vNFT |
Returns
| Name | Type | Description |
|---|---|---|
beneficiary | address | The current rewards beneficiary address |
operatorCommission
Retrieve the operator commission
This value is not used inside the contract but only in the off-chain accounting engine building the exec layer vault merkle tree
function operatorCommission() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The current operator commission |
integratorCommission
Retrieve the integrator commission
This value is not used inside the contract but only in the off-chain accounting engine building the exec layer vault merkle tree
function integratorCommission() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The current integrator commission |
soulboundMode
Retrieve the soulbound mode status
if active, thansfers are disabled
function soulboundMode() external view returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | The current soulbound mode status |
startTokenId
Retrieve the starting token id
function startTokenId() external pure returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The starting token id |
execLayerVault
Retrieve the exec layer vault address
function execLayerVault() external view returns (address);
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The current exec layer vault address |
extraData
Retrieve the extra data used for each deposit
function extraData() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The currently used extra data |
resolve
Retrieve the associated validator ids for the given token ids
function resolve(uint256[] calldata tokenIds) external view returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids to lookup |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | The list of associated validator ids |
uriPrefix
Retrieve the uri prefix used for all token uris
function uriPrefix() external view returns (string memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The current uri prefix |
isExited
Retrieve if the token is exited
function isExited(uint256 tokenId) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The token id to lookup |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the token is exited or false otherwise |
purchasable
Retrieve the amount of purchasable validators
function purchasable() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The currently purchasable validator amount |
purchasePaused
Retrieve the purchase function status
function purchasePaused() external view returns (bool);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the purchase function is paused or false otherwise |
setIntegrator
Sets the integrator address
function setIntegrator(address newIntegrator) external;
Parameters
| Name | Type | Description |
|---|---|---|
newIntegrator | address | The new integrator address to use |
setIntegratorCommission
Sets the integrator commission
function setIntegratorCommission(uint256 newIntegratorCommission) external;
Parameters
| Name | Type | Description |
|---|---|---|
newIntegratorCommission | uint256 | The new integrator commission to use |
setOperatorCommission
Sets the operator commission
function setOperatorCommission(uint256 newOperatorCommission) external;
Parameters
| Name | Type | Description |
|---|---|---|
newOperatorCommission | uint256 | The new operator commission to use |
setName
Sets the ERC721 contract name
function setName(string calldata newName) external;
Parameters
| Name | Type | Description |
|---|---|---|
newName | string | The new name of the contract |
setSymbol
Sets the ERC721 contract symbol
function setSymbol(string calldata newSymbol) external;
Parameters
| Name | Type | Description |
|---|---|---|
newSymbol | string | The new symbol of the contract |
setUriPrefix
Sets the uri prefix of the contract
function setUriPrefix(string calldata newUriPrefix) external;
Parameters
| Name | Type | Description |
|---|---|---|
newUriPrefix | string | The new uri prefix to use |
purchase
Purchase one or several validators
The msg.value should be a multiple of 32 ETH > 0
function purchase() external payable returns (uint256[] memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256[] | The list of minted NFT ids |
withdraw
Triggers a withdrawal action on the underlying validators
function withdraw(uint256[] calldata tokenIds, address recipient) external returns (uint256[] memory);
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids upon which to perform the withdrawal |
recipient | address | The address that should receive the pulled funds |
exit
Triggers an exit action on the underlying validators
function exit(uint256[] calldata tokenIds) external;
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | The list of token ids upon which to perform the exits |
clearUsership
Withdraw rewards if any for the user and clears the usership
function clearUsership(uint256 tokenId) external returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The token id to clear the usership for |
pausePurchase
Pause the purchase function
function pausePurchase() external;
unpausePurchase
Unpause the purchase function
function unpausePurchase() external;
claimDebt
Claim the rewards due to the user
function claimDebt() external;
debt
Retrieve the debt due to an user
function debt(address user) external view returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user to lookup |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The debt due to the user |
Events
SetFactory
Emitted when the factory is changed
event SetFactory(address factory);
Parameters
| Name | Type | Description |
|---|---|---|
factory | address | The new factory address |
SetExtraData
Emitted when the extraData value is changed
event SetExtraData(string extraData);
Parameters
| Name | Type | Description |
|---|---|---|
extraData | string | The new extraData value |
SetURIPrefix
Emitted when the uri prefix value is changed
event SetURIPrefix(string uriPrefix);
Parameters
| Name | Type | Description |
|---|---|---|
uriPrefix | string | The new uri prefix value |
SetExecLayerVault
Emitted when the exec layer vault address is changed
event SetExecLayerVault(address execLayerVault);
Parameters
| Name | Type | Description |
|---|---|---|
execLayerVault | address | The new exec layer vault address |
SetIntegratorCommission
Emitted when the integrator commission is changed
event SetIntegratorCommission(uint256 integratorCommission);
Parameters
| Name | Type | Description |
|---|---|---|
integratorCommission | uint256 | The new integrator commission |
SetOperatorCommission
Emitted when the operator commission is changed
event SetOperatorCommission(uint256 operatorCommission);
Parameters
| Name | Type | Description |
|---|---|---|
operatorCommission | uint256 | The new operator commission |
SetIntegrator
Emitted when the integrator address is changed
event SetIntegrator(address integrator);
Parameters
| Name | Type | Description |
|---|---|---|
integrator | address | The new integrator address |
SetSoulboundMode
Emitted when the soulbound mode is changed
event SetSoulboundMode(bool active);
Parameters
| Name | Type | Description |
|---|---|---|
active | bool | Whether or not the soulbound mode is enabled |
PurchasedValidator
Emitted when a validator has been purchased by the contract
event PurchasedValidator(address indexed owner, uint256 tokenId, uint256 validatorId);
Parameters
| Name | Type | Description |
|---|---|---|
owner | address | The address owning the newly created validator |
tokenId | uint256 | The id of the NFT representation |
validatorId | uint256 | The id of the validator in the vFactory |
UsershipCleared
Emitted when owner claims back the usership of the NFT
event UsershipCleared(uint256 indexed tokenId);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The id of the NFT representation |
SetPurchasePause
Emitted when the purchase function is paused or unpaused
event SetPurchasePause(bool isPaused);
Parameters
| Name | Type | Description |
|---|---|---|
isPaused | bool | The status of the pause |
DebtClaimed
Emitted when an user claims its debt
event DebtClaimed(address indexed user, uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The address of the user |
amount | uint256 | The amount of debt claimed |
TokenIdUpdated
Emitted when a NFT is reminted for a validator
event TokenIdUpdated(uint256 indexed oldTokenId, uint256 indexed newTokenId, uint256 validatorId);
Parameters
| Name | Type | Description |
|---|---|---|
oldTokenId | uint256 | The id of the NFT representation |
newTokenId | uint256 | The new id of the NFT representation |
validatorId | uint256 | The id of the validator in the vFactory |
Errors
InvalidAmount
Thrown when the provided amount is invalid
error InvalidAmount(uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | The provided amount |
ValidatorCountUnavailable
Thrown when the requested validator count to purchase is unavailable
error ValidatorCountUnavailable(uint256 requestedAmount, uint256 availableAmount);
Parameters
| Name | Type | Description |
|---|---|---|
requestedAmount | uint256 | The amount of validators requested |
availableAmount | uint256 | The amount of validators available |
InvalidDepositCount
Thrown when the validator count retrieved by the factory is invalid
error InvalidDepositCount(uint256 requestedAmount, uint256 depositedAmount);
Parameters
| Name | Type | Description |
|---|---|---|
requestedAmount | uint256 | The amount of validators that was initially requested |
depositedAmount | uint256 | The amount of validators actually deposited by the vFactory |
EmptyTokenIdArray
Thrown when the provided token id array is empty
error EmptyTokenIdArray();
PurchasePaused
Thrown when purchase function is paused
error PurchasePaused();
ClearUsershipError
Thrown when usership cannot be claimed (no user is set or not expired yet)
error ClearUsershipError();
IllegalTransferWhileInSoulboundMode
Thrown when the soulbound mode is enabled and a transfer is attempted
error IllegalTransferWhileInSoulboundMode();
IllegalTransferOfExitedToken
Thrown when the a user tries to transfer an exited token
error IllegalTransferOfExitedToken(uint256 tokenId);
IllegalExpirationExtensionAttempt
Thrown when a user tries to change the expiration for a greater value
error IllegalExpirationExtensionAttempt(address user, uint64 initialExpiration, uint64 proposedExpiration);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The address of the user |
initialExpiration | uint64 | The expiration before the setUser attempt |
proposedExpiration | uint64 | The expiration proposed |
IllegalExpirationValue
Thrown when a user tries to set an expiration in the past
error IllegalExpirationValue(uint64 expiration);
Parameters
| Name | Type | Description |
|---|---|---|
expiration | uint64 | The expiration proposed |
WithdrawError
Thrown when a withdrawal fails
error WithdrawError();
ValidatorAlreadyExited
Thrown when a validator is already exited
error ValidatorAlreadyExited(uint256 tokenId);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The id of the NFT representation |
CannotExitWhileRented
Thrown when a validator is already rented and the owner wants to exit
error CannotExitWhileRented(uint256 tokenId);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | The id of the NFT representation |
Structs
VNFTConfiguration
Struct containing the configuration for the vNFT
struct VNFTConfiguration {
string name;
string symbol;
string uriPrefix;
string extraData;
address[4] actors;
uint256[2] commissions;
bool soulboundMode;
}
Properties
| Name | Type | Description |
|---|---|---|
name | string | The name of the ERC721 token |
symbol | string | The symbol of the ERC721 token |
uriPrefix | string | The uri prefix to use for every token |
extraData | string | The extra data to use upon validator deposits |
actors | address[4] | Array containing the linked addresses = [factory, execLayerVault, owner, integrator] |
commissions | uint256[2] | Array containing the commissions = [operatorCommission, integratorCommission] |
soulboundMode | bool |