Skip to content

Solidity API

IPropsFees

Interface for managing fees in the Props ecosystem

This interface defines the structure and functions for fee management, including adding, updating, removing, and querying fees.

FeeChanged

solidity
event FeeChanged(string feeType, uint256[] feeAmounts, address[] feeRecipients, enum PropsFeesStorage.FeeType feeTypeEnum, enum PropsFeesStorage.FeeApplication feeApplication, uint256 tokenId)

Emitted when a fee is changed or added

This event is triggered whenever a fee is updated or a new fee is added to the system

Parameters

NameTypeDescription
feeTypestringThe type of fee that was changed, indexed for easier filtering
feeAmountsuint256[]An array of fee amounts, allowing for multiple fee tiers
feeRecipientsaddress[]An array of addresses that will receive the fees
feeTypeEnumenum PropsFeesStorage.FeeTypeThe type of fee (e.g., Fixed, Percentage) as defined in PropsFeesStorage
feeApplicationenum PropsFeesStorage.FeeApplicationHow the fee is applied (e.g., Per Token, Per Transaction) as defined in PropsFeesStorage
tokenIduint256The ID of the token this fee applies to (if applicable), 0 if not token-specific

FeeRemoved

solidity
event FeeRemoved(string feeType)

Emitted when a fee is removed

This event is triggered when a fee is completely removed from the system

Parameters

NameTypeDescription
feeTypestringThe type of fee that was removed, indexed for easier filtering

upsertFee

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

Adds a new fee or updates an existing one

This function allows for the creation of new fees or the modification of existing ones

Parameters

NameTypeDescription
_feeTypestringA string identifier for the fee type
_feeAmountsuint256[]An array of fee amounts, allowing for multiple fee tiers
_feeRecipientsaddress[]An array of addresses that will receive the fee
_feeTypeEnumenum PropsFeesStorage.FeeTypeThe type of fee (e.g., Fixed, Percentage) as defined in PropsFeesStorage
_feeApplicationenum PropsFeesStorage.FeeApplicationHow the fee is applied (e.g., Per Token, Per Transaction) as defined in PropsFeesStorage
_tokenIduint256The ID of the token this fee applies to (if applicable), use 0 if not token-specific

removeFee

solidity
function removeFee(string _feeType) external

Removes a fee

This function completely removes a fee from the system

Parameters

NameTypeDescription
_feeTypestringThe string identifier of the fee type to remove

getFee

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

Retrieves the details of a specific fee

This function allows querying of all details for a particular fee type

Parameters

NameTypeDescription
_feeTypestringThe string identifier of the fee type to retrieve

Return Values

NameTypeDescription
feeAmountsuint256[]An array of fee amounts for the specified fee type
feeRecipientsaddress[]An array of addresses that receive the fee
feeTypeenum PropsFeesStorage.FeeTypeThe type of fee (e.g., Fixed, Percentage) as defined in PropsFeesStorage
feeApplicationenum PropsFeesStorage.FeeApplicationHow the fee is applied (e.g., Per Token, Per Transaction) as defined in PropsFeesStorage
tokenIduint256The ID of the token this fee applies to (if applicable), 0 if not token-specific

getAllFees

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

Retrieves all fees

This function returns arrays of all fee details, useful for getting an overview of the fee structure

Return Values

NameTypeDescription
feeTypesstring[]An array of string identifiers for all fee types
feeAmountsuint256[][]A 2D array of fee amounts for all fee types
feeRecipientsaddress[][]A 2D array of addresses that receive the fees for all fee types
feeTypeEnumsenum PropsFeesStorage.FeeType[]An array of fee types (e.g., Fixed, Percentage) for all fee types
feeApplicationsenum PropsFeesStorage.FeeApplication[]An array of fee applications (e.g., Per Token, Per Transaction) for all fee types

calculateFees

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

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

This function computes the total fee based on the fee type, base amount, and quantity

Parameters

NameTypeDescription
_feeTypestringThe string identifier of the fee type to calculate
_amountuint256The base amount to calculate the fee on
_quantityuint256The quantity of items (for per-token fees), use 1 for non-token-specific fees

Return Values

NameTypeDescription
[0]uint256The total calculated fee as a uint256

calculateTotalFees

solidity
function calculateTotalFees(string[] _prefixes, uint256 _tokenId, uint256 _quantity) external 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.

ProcessFeeTypeInput

solidity
struct ProcessFeeTypeInput {
  string[] feeKeys;
  struct PropsFeesStorage.Fee[] fees;
  enum PropsFeesStorage.FeeType feeType;
  enum PropsFeesStorage.FeeApplication feeApplication;
  uint256 quantity;
  uint256 pricePerToken;
  uint256 subtotal;
  uint256[] tempAmounts;
  address[] tempRecipients;
  uint256 uniqueRecipientCount;
  uint256 tokenId;
}