Git Source

Inherits: IApplicationEvents, ITokenHandlerEvents, IInputErrors, ITagInputErrors, IOwnershipErrors, IZeroAddressError, IFeesErrors, RuleAdministratorOnly

Author: @ShaneDuncan602, @oscarsernarosero, @TJ-Everett

This contract serves as a storage for asset transfer fees

This contract should not be accessed directly. All processing should go through its controlling asset. Example found in (UtilApplicationERC20, UtilApplicationERC721).

State Variables

BLANK_TAG

bytes32 constant BLANK_TAG = bytes32("");

Functions

addFee

This function adds a fee to the token. Blank tags are allowed

function addFee(bytes32 _tag, uint256 _minBalance, uint256 _maxBalance, int24 _feePercentage, address _targetAccount)
    external
    ruleAdministratorOnly(lib.handlerBaseStorage().appManager);

Parameters

NameTypeDescription
_tagbytes32meta data tag for fee
_minBalanceuint256minimum balance for fee application
_maxBalanceuint256maximum balance for fee application
_feePercentageint24fee percentage to assess
_targetAccountaddressfee percentage to assess

removeFee

This function removes a fee to the token

function removeFee(bytes32 _tag) external ruleAdministratorOnly(lib.handlerBaseStorage().appManager);

Parameters

NameTypeDescription
_tagbytes32meta data tag for fee

getFee

returns the fee struct for the given tag

function getFee(bytes32 _tag) public view returns (Fee memory);

Parameters

NameTypeDescription
_tagbytes32meta data tag for fee

Returns

NameTypeDescription
<none>Feefee struct containing fee data

getFeeTotal

returns the total number of fees

function getFeeTotal() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256feeTotal total number of fees

getApplicableFees

Get all the fees/discounts for the transaction. This is assessed and returned as two separate arrays. This was necessary because the fees may go to different target accounts. Since struct arrays cannot be function parameters for external functions, two separate arrays must be used.

function getApplicableFees(address _from, uint256 _balanceFrom)
    public
    view
    returns (address[] memory feeSinks, int24[] memory feePercentages);

Parameters

NameTypeDescription
_fromaddressoriginating address
_balanceFromuint256Token balance of the sender address

Returns

NameTypeDescription
feeSinksaddress[]list of where the fees are sent
feePercentagesint24[]list of all applicable fees/discounts