Appearance
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
| Name | Type | Description |
|---|---|---|
| feeType | string | The type of fee that was changed, indexed for easier filtering |
| feeAmounts | uint256[] | An array of fee amounts, allowing for multiple fee tiers |
| feeRecipients | address[] | An array of addresses that will receive the fees |
| feeTypeEnum | enum PropsFeesStorage.FeeType | The type of fee (e.g., Fixed, Percentage) as defined in PropsFeesStorage |
| feeApplication | enum PropsFeesStorage.FeeApplication | How the fee is applied (e.g., Per Token, Per Transaction) as defined in PropsFeesStorage |
| tokenId | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| feeType | string | The 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) externalAdds a new fee or updates an existing one
This function allows for the creation of new fees or the modification of existing ones
Parameters
| Name | Type | Description |
|---|---|---|
| _feeType | string | A string identifier for the fee type |
| _feeAmounts | uint256[] | An array of fee amounts, allowing for multiple fee tiers |
| _feeRecipients | address[] | An array of addresses that will receive the fee |
| _feeTypeEnum | enum PropsFeesStorage.FeeType | The type of fee (e.g., Fixed, Percentage) as defined in PropsFeesStorage |
| _feeApplication | enum PropsFeesStorage.FeeApplication | How the fee is applied (e.g., Per Token, Per Transaction) as defined in PropsFeesStorage |
| _tokenId | uint256 | The ID of the token this fee applies to (if applicable), use 0 if not token-specific |
removeFee
solidity
function removeFee(string _feeType) externalRemoves a fee
This function completely removes a fee from the system
Parameters
| Name | Type | Description |
|---|---|---|
| _feeType | string | The 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
| Name | Type | Description |
|---|---|---|
| _feeType | string | The string identifier of the fee type to retrieve |
Return Values
| Name | Type | Description |
|---|---|---|
| feeAmounts | uint256[] | An array of fee amounts for the specified fee type |
| feeRecipients | address[] | An array of addresses that receive the fee |
| feeType | enum PropsFeesStorage.FeeType | The type of fee (e.g., Fixed, Percentage) as defined in PropsFeesStorage |
| feeApplication | enum PropsFeesStorage.FeeApplication | How the fee is applied (e.g., Per Token, Per Transaction) as defined in PropsFeesStorage |
| tokenId | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| feeTypes | string[] | An array of string identifiers for all fee types |
| feeAmounts | uint256[][] | A 2D array of fee amounts for all fee types |
| feeRecipients | address[][] | A 2D array of addresses that receive the fees for all fee types |
| feeTypeEnums | enum PropsFeesStorage.FeeType[] | An array of fee types (e.g., Fixed, Percentage) for all fee types |
| feeApplications | enum 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
| Name | Type | Description |
|---|---|---|
| _feeType | string | The string identifier of the fee type to calculate |
| _amount | uint256 | The base amount to calculate the fee on |
| _quantity | uint256 | The quantity of items (for per-token fees), use 1 for non-token-specific fees |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| _prefixes | string[] | An array of fee prefixes to match against. |
| _tokenId | uint256 | The ID of the token associated with the fees. |
| _quantity | uint256 | The number of tokens or items. |
Return Values
| Name | Type | Description |
|---|---|---|
| totalFee | uint256 | The total calculated fee. |
| feeRecipients | address[] | An array of fee recipient addresses. |
| feeAmounts | uint256[] | 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;
}