IERC721Power

Interface Description

License: MIT

interface IERC721Power is IERC721EnumerableUpgradeable

This is the custom NFT contract with voting power

Structs info

NftInfo

struct NftInfo {
	uint64 lastUpdate;
	uint256 maxRawPower;
	uint256 currentRawPower;
	uint256 requiredCollateral;
	uint256 currentCollateral;
}

This struct holds NFT Power parameters. These parameters are used to recalculate nft power

Parameters:

NameTypeDescription

lastUpdate

uint64

the last time when the power was recalculated

maxRawPower

uint256

the maximum raw nft power limit

currentRawPower

uint256

the current raw nft power

requiredCollateral

uint256

the required collateral amount

currentCollateral

uint256

the current nft collateral

NftInfoView

struct NftInfoView {
	IERC721Power.NftInfo rawInfo;
	uint256 maxPower;
	uint256 minPower;
	uint256 currentPower;
}

The struct to get info about the NFT

Parameters:

NameTypeDescription

rawInfo

struct IERC721Power.NftInfo

the raw NFT info

maxPower

uint256

real max nft power

minPower

uint256

real min nft power

currentPower

uint256

real nft power

Functions info

addCollateral (0xa8f35adf)

function addCollateral(uint256 amount, uint256 tokenId) external

Add collateral amount to certain nft

Parameters:

NameTypeDescription

amount

uint256

Wei

tokenId

uint256

Nft number

removeCollateral (0x6a9b1891)

function removeCollateral(uint256 amount, uint256 tokenId) external

Remove collateral amount from certain nft

Parameters:

NameTypeDescription

amount

uint256

Wei

tokenId

uint256

Nft number

recalculateNftPowers (0xa79b53d5)

function recalculateNftPowers(uint256[] calldata tokenIds) external

Recalculate nft power (coefficient)

Parameters:

NameTypeDescription

tokenIds

uint256[]

Nft numbers

totalPower (0xdb3ad22c)

function totalPower() external view returns (uint256)

Get total power

Return values:

NameTypeDescription

[0]

uint256

totalPower

getNftMaxPower (0x6c889f41)

function getNftMaxPower(uint256 tokenId) external view returns (uint256)

Return max possible power (coefficient) for nft

Parameters:

NameTypeDescription

tokenId

uint256

Nft number

Return values:

NameTypeDescription

[0]

uint256

max power for Nft

getNftMinPower (0x7c24b33a)

function getNftMinPower(uint256 tokenId) external view returns (uint256)

Return min possible power (coefficient) for nft

Parameters:

NameTypeDescription

tokenId

uint256

Nft number

Return values:

NameTypeDescription

[0]

uint256

min power for Nft

getNftPower (0x412e8a29)

function getNftPower(uint256 tokenId) external view returns (uint256)

The function to get current NFT power

Parameters:

NameTypeDescription

tokenId

uint256

the Nft number

Return values:

NameTypeDescription

[0]

uint256

current power of the Nft

getNftRequiredCollateral (0xcbf208a7)

function getNftRequiredCollateral(
    uint256 tokenId
) external view returns (uint256)

Return required collateral amount for nft

Parameters:

NameTypeDescription

tokenId

uint256

Nft number

Return values:

NameTypeDescription

[0]

uint256

required collateral for Nft