Factory-Of-Factories Fees methods

The Factory-Of-Factories provides two methods that must be called in your Factory in order to build a fee-based business model.

Creation Fee and Usage Static Fee

The burnOrTransferTokenAmount function allow you to implement a Creation Fee(burn or transfer) and/or a Usage Static Fee.

function burnOrTransferTokenAmount(address sender, address tokenAddress, uint256 value, bytes calldata permitSignature, address receiver) external payable returns(uint256 feeSentOrBurnt, uint256 amountTransferedOrBurnt);

It takes as input:

  • address sender -> address paying the Fee

  • address tokenAddress -> in which token the fee should be paid

  • uint256 value -> fee amount to pay

  • bytes permitSignature -> eventual Permit approval. If it's not passed, the classic approve must be executed

  • address receiver -> if it's passed as address(0), the fee is burned. If it's populated, it represents the address receiving the transfer Fee. For example, it could be your Factory host address or a treasury.

The FoF takes a percentage on the value (whether it is burn or transfer) amount, actually it is 0.8%.

Examples

  • You set a burn fee value of 10 USDC. 0.08 USDC goes to the FoF, 9.92 are burned

  • You set a transfer fee value of 1 ETH. 0.008 ETH goes to the FoF, 0.992 ETH goes to the receiver address you set

Usage Percentage Fee

The payFee function allow you to implement a Percentage Fee.

function payFee(address sender, address tokenAddress, uint256 value, bytes calldata permitSignature, uint256 feePercentage, address feeReceiver) external payable returns (uint256 feeSentOrBurnt, uint256 feePaid);

It takes as input:

  • address sender -> address paying the Fee

  • address tokenAddress -> in which token the fee should be paid

  • uint256 value -> transacted amount

  • bytes permitSignature -> eventual Permit approval. If it's not passed, the classic approve must be executed

  • uint256 feePercentage -> percentage fee amount. It is multiplied by value

  • address feeReceiver -> address receiving the Fee. For example, it could be your Factory host address or a treasury.

The FoF takes a percentage on the value*feePercentage amount, actually it is 0.8%.

Examples

  • You set a fee percentage of 5%, the transacted value is 1000USDC. 0.04 USDC goes to the FoF, 49.96 goes to the receiver address you set

  • You set a fee percentage of 12%, the transacted value is 15ETH. 0.00144 ETH goes to the FoF, 1.79856 goes to the receiver address you set

In the next page, you can find how to implement these functions in your Factory.

Last updated