πŸ“Collect Fees

Fee Receiver Contract

Each time a user swaps, the handling fee is directly transferred to the contract. And the preset users can withdraw fees from the contract.

Preset the Payee for fee withdrawl

The admin can add payee and set the corresponding withdrawal propotion in the contract; Payees can only withdraw tokens from the contract according to their preset propotions.

The payee addresses and their corresponding shares are set in the constructor function

constructor(address[] memory payees, uint256[] memory shares_,address _owner){
        require(payees.length == shares_.length, "payees and shares length mismatch");
        require(payees.length > 0, "no payees");

        for (uint256 i = 0; i < payees.length; i++) {
            _addPayee(payees[i], shares_[i]);
        }
        require(_owner != address(0), "owner can not be zero address");
        _transferOwnership(_owner);
        converters[_owner] = true;
    }

Covert fee token to stablecoins

The contract contains a 'Convert' interface for converting tokens in the contract to stablecoins like USDT or USDC.

Convert structure is a key component for a convert transaction. It contains four fields, see below code blocks for detailed information.

The convertToStablecoin function is responsible for executing the transaction to swap fee tokens to stablecoin

Claim the converted stablecoin

All the preset payee addresses can claim their generated fees as stablecoins via release function

Last updated