IvNFT

Git Source

Inherits: INFT, IAdministrable

Author: mortimr @ Kiln

Mint or Purchase 1 NFT = own 1 validator

Functions

initialize

function initialize(VNFTConfiguration calldata config) external;

Parameters

NameTypeDescription
configVNFTConfigurationThe configuration for the vNFT

factory

Retrieve the factory address

function factory() external view returns (address);

Returns

NameTypeDescription
<none>addressThe current factory address

integrator

Retrieve the integrator address

function integrator() external view returns (address);

Returns

NameTypeDescription
<none>addressThe current integrator address

beneficiaryOf

Retriver the current beneficiary of EL and CL rewards

function beneficiaryOf(uint256 tokenId) external view returns (address beneficiary);

Parameters

NameTypeDescription
tokenIduint256Id of the vNFT

Returns

NameTypeDescription
beneficiaryaddressThe 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

NameTypeDescription
<none>uint256The 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

NameTypeDescription
<none>uint256The current integrator commission

soulboundMode

Retrieve the soulbound mode status

if active, thansfers are disabled

function soulboundMode() external view returns (bool);

Returns

NameTypeDescription
<none>boolThe current soulbound mode status

startTokenId

Retrieve the starting token id

function startTokenId() external pure returns (uint256);

Returns

NameTypeDescription
<none>uint256The starting token id

execLayerVault

Retrieve the exec layer vault address

function execLayerVault() external view returns (address);

Returns

NameTypeDescription
<none>addressThe current exec layer vault address

extraData

Retrieve the extra data used for each deposit

function extraData() external view returns (string memory);

Returns

NameTypeDescription
<none>stringThe 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

NameTypeDescription
tokenIdsuint256[]The list of token ids to lookup

Returns

NameTypeDescription
<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

NameTypeDescription
<none>stringThe current uri prefix

isExited

Retrieve if the token is exited

function isExited(uint256 tokenId) external view returns (bool);

Parameters

NameTypeDescription
tokenIduint256The token id to lookup

Returns

NameTypeDescription
<none>boolTrue if the token is exited or false otherwise

purchasable

Retrieve the amount of purchasable validators

function purchasable() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The currently purchasable validator amount

purchasePaused

Retrieve the purchase function status

function purchasePaused() external view returns (bool);

Returns

NameTypeDescription
<none>boolTrue if the purchase function is paused or false otherwise

setIntegrator

Sets the integrator address

function setIntegrator(address newIntegrator) external;

Parameters

NameTypeDescription
newIntegratoraddressThe new integrator address to use

setIntegratorCommission

Sets the integrator commission

function setIntegratorCommission(uint256 newIntegratorCommission) external;

Parameters

NameTypeDescription
newIntegratorCommissionuint256The new integrator commission to use

setOperatorCommission

Sets the operator commission

function setOperatorCommission(uint256 newOperatorCommission) external;

Parameters

NameTypeDescription
newOperatorCommissionuint256The new operator commission to use

setName

Sets the ERC721 contract name

function setName(string calldata newName) external;

Parameters

NameTypeDescription
newNamestringThe new name of the contract

setSymbol

Sets the ERC721 contract symbol

function setSymbol(string calldata newSymbol) external;

Parameters

NameTypeDescription
newSymbolstringThe new symbol of the contract

setUriPrefix

Sets the uri prefix of the contract

function setUriPrefix(string calldata newUriPrefix) external;

Parameters

NameTypeDescription
newUriPrefixstringThe 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

NameTypeDescription
<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

NameTypeDescription
tokenIdsuint256[]The list of token ids upon which to perform the withdrawal
recipientaddressThe address that should receive the pulled funds

exit

Triggers an exit action on the underlying validators

function exit(uint256[] calldata tokenIds) external;

Parameters

NameTypeDescription
tokenIdsuint256[]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

NameTypeDescription
tokenIduint256The 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

NameTypeDescription
useraddressThe user to lookup

Returns

NameTypeDescription
<none>uint256The debt due to the user

Events

SetFactory

Emitted when the factory is changed

event SetFactory(address factory);

Parameters

NameTypeDescription
factoryaddressThe new factory address

SetExtraData

Emitted when the extraData value is changed

event SetExtraData(string extraData);

Parameters

NameTypeDescription
extraDatastringThe new extraData value

SetURIPrefix

Emitted when the uri prefix value is changed

event SetURIPrefix(string uriPrefix);

Parameters

NameTypeDescription
uriPrefixstringThe new uri prefix value

SetExecLayerVault

Emitted when the exec layer vault address is changed

event SetExecLayerVault(address execLayerVault);

Parameters

NameTypeDescription
execLayerVaultaddressThe new exec layer vault address

SetIntegratorCommission

Emitted when the integrator commission is changed

event SetIntegratorCommission(uint256 integratorCommission);

Parameters

NameTypeDescription
integratorCommissionuint256The new integrator commission

SetOperatorCommission

Emitted when the operator commission is changed

event SetOperatorCommission(uint256 operatorCommission);

Parameters

NameTypeDescription
operatorCommissionuint256The new operator commission

SetIntegrator

Emitted when the integrator address is changed

event SetIntegrator(address integrator);

Parameters

NameTypeDescription
integratoraddressThe new integrator address

SetSoulboundMode

Emitted when the soulbound mode is changed

event SetSoulboundMode(bool active);

Parameters

NameTypeDescription
activeboolWhether 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

NameTypeDescription
owneraddressThe address owning the newly created validator
tokenIduint256The id of the NFT representation
validatorIduint256The id of the validator in the vFactory

UsershipCleared

Emitted when owner claims back the usership of the NFT

event UsershipCleared(uint256 indexed tokenId);

Parameters

NameTypeDescription
tokenIduint256The id of the NFT representation

SetPurchasePause

Emitted when the purchase function is paused or unpaused

event SetPurchasePause(bool isPaused);

Parameters

NameTypeDescription
isPausedboolThe status of the pause

DebtClaimed

Emitted when an user claims its debt

event DebtClaimed(address indexed user, uint256 amount);

Parameters

NameTypeDescription
useraddressThe address of the user
amountuint256The 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

NameTypeDescription
oldTokenIduint256The id of the NFT representation
newTokenIduint256The new id of the NFT representation
validatorIduint256The id of the validator in the vFactory

Errors

InvalidAmount

Thrown when the provided amount is invalid

error InvalidAmount(uint256 amount);

Parameters

NameTypeDescription
amountuint256The provided amount

ValidatorCountUnavailable

Thrown when the requested validator count to purchase is unavailable

error ValidatorCountUnavailable(uint256 requestedAmount, uint256 availableAmount);

Parameters

NameTypeDescription
requestedAmountuint256The amount of validators requested
availableAmountuint256The amount of validators available

InvalidDepositCount

Thrown when the validator count retrieved by the factory is invalid

error InvalidDepositCount(uint256 requestedAmount, uint256 depositedAmount);

Parameters

NameTypeDescription
requestedAmountuint256The amount of validators that was initially requested
depositedAmountuint256The 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

NameTypeDescription
useraddressThe address of the user
initialExpirationuint64The expiration before the setUser attempt
proposedExpirationuint64The expiration proposed

IllegalExpirationValue

Thrown when a user tries to set an expiration in the past

error IllegalExpirationValue(uint64 expiration);

Parameters

NameTypeDescription
expirationuint64The expiration proposed

WithdrawError

Thrown when a withdrawal fails

error WithdrawError();

ValidatorAlreadyExited

Thrown when a validator is already exited

error ValidatorAlreadyExited(uint256 tokenId);

Parameters

NameTypeDescription
tokenIduint256The id of the NFT representation

CannotExitWhileRented

Thrown when a validator is already rented and the owner wants to exit

error CannotExitWhileRented(uint256 tokenId);

Parameters

NameTypeDescription
tokenIduint256The 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

NameTypeDescription
namestringThe name of the ERC721 token
symbolstringThe symbol of the ERC721 token
uriPrefixstringThe uri prefix to use for every token
extraDatastringThe extra data to use upon validator deposits
actorsaddress[4]Array containing the linked addresses = [factory, execLayerVault, owner, integrator]
commissionsuint256[2]Array containing the commissions = [operatorCommission, integratorCommission]
soulboundModebool