Skip to content

Solidity API

PropsFees

Implements fee management functionality for the Props system.

This contract manages fee structures for various operations in the Props system. It allows for setting, retrieving, and calculating fees based on different fee types and applications.

upsertFee

solidity
function upsertFee(string _feeType, uint256[] _feeAmounts, address[] _feeRecipients, enum PropsFeesStorage.FeeType _feeTypeEnum, enum PropsFeesStorage.FeeApplication _feeApplication, uint256 _tokenId) public

Only accounts with FEE_MANAGER_ROLE can call this function.

Adds or updates a fee in the system.

Parameters

NameTypeDescription
_feeTypestringThe identifier for the fee type.
_feeAmountsuint256[]An array of fee amounts.
_feeRecipientsaddress[]An array of addresses that will receive the fees.
_feeTypeEnumenum PropsFeesStorage.FeeTypeThe type of fee (FLAT or PERCENTAGE).
_feeApplicationenum PropsFeesStorage.FeeApplicationHow the fee is applied (PER_UNIT or PER_TRANSACTION).
_tokenIduint256The ID of the token associated with this fee.

getFee

solidity
function getFee(string _feeType) public view returns (uint256[] feeAmounts, address[] feeRecipients, enum PropsFeesStorage.FeeType feeType, enum PropsFeesStorage.FeeApplication feeApplication, uint256 tokenId)

Returns default values if the fee doesn't exist.

Retrieves the details of a specific fee.

Parameters

NameTypeDescription
_feeTypestringThe identifier for the fee type.

Return Values

NameTypeDescription
feeAmountsuint256[]An array of fee amounts.
feeRecipientsaddress[]An array of addresses that receive the fees.
feeTypeenum PropsFeesStorage.FeeTypeThe type of fee (FLAT or PERCENTAGE).
feeApplicationenum PropsFeesStorage.FeeApplicationHow the fee is applied (PER_UNIT or PER_TRANSACTION).
tokenIduint256The ID of the token associated with this fee.

getAllFees

solidity
function getAllFees() public view returns (string[] feeTypes, uint256[][] feeAmounts, address[][] feeRecipients, enum PropsFeesStorage.FeeType[] feeTypeEnums, enum PropsFeesStorage.FeeApplication[] feeApplications)

This function may be gas-intensive for a large number of fees.

Retrieves all fees stored in the system.

Return Values

NameTypeDescription
feeTypesstring[]An array of fee type identifiers.
feeAmountsuint256[][]A 2D array of fee amounts for each fee type.
feeRecipientsaddress[][]A 2D array of fee recipients for each fee type.
feeTypeEnumsenum PropsFeesStorage.FeeType[]An array of fee types (FLAT or PERCENTAGE) for each fee.
feeApplicationsenum PropsFeesStorage.FeeApplication[]An array of fee applications (PER_UNIT or PER_TRANSACTION) for each fee.

calculateFees

solidity
function calculateFees(string _feeType, uint256 _amount, uint256 _quantity) public view returns (uint256)

For PERCENTAGE fees, the calculation assumes the percentage is in basis points (e.g., 100 = 1%).

Calculates the total fee for a given fee type, amount, and quantity.

Parameters

NameTypeDescription
_feeTypestringThe identifier for the fee type.
_amountuint256The base amount to calculate the fee on.
_quantityuint256The number of units (used for PER_UNIT fees).

Return Values

NameTypeDescription
[0]uint256The calculated total fee.

removeFee

solidity
function removeFee(string _feeType) public

Only accounts with FEE_MANAGER_ROLE can call this function.

Removes a fee from the system.

Parameters

NameTypeDescription
_feeTypestringThe identifier for the fee type to be removed.

calculateTotalFees

solidity
function calculateTotalFees(string[] _prefixes, uint256 _tokenId, uint256 _quantity) public view returns (uint256 totalFee, address[] feeRecipients, uint256[] feeAmounts)

This function calculates fees for all types: FLAT and PERCENTAGE.

Calculates the total fees for given fee prefixes, including all fee types.

Parameters

NameTypeDescription
_prefixesstring[]An array of fee prefixes to match against.
_tokenIduint256The ID of the token associated with the fees.
_quantityuint256The number of tokens or items.

Return Values

NameTypeDescription
totalFeeuint256The total calculated fee.
feeRecipientsaddress[]An array of fee recipient addresses.
feeAmountsuint256[]An array of fee amounts corresponding to each recipient.