Smart contract

Contract Flow

MultiTokenBurnPortal allows users to purchase fee on transfer tokens with smaller fees. Managers will create and set discounts and taxes for each fee on transfer tokens.

Example: TokenX is a fee on transfer token with 20% transfer fee. Manager adds TokenX with baseTax=2000 and specifies feeReceiver and discounts If user burns 100 tokens, his discount will be 10%, and he will be able to purchase TokenX with 18% fee If user burns 500 tokens, his discount will be 50%, and he will be able to purchase TokenX with 10% fee If user burns 1000 tokens, his discount will be 100%, and he will be able to purchase TokenX without fee

Contract functions

constructor

Creates contract

constructor(
        IWETH _WETH,
        uint16 _adminFee,
        address _adminFeeReceiver
    )

_WETH WETH address _adminFee Admin fee in basis points (10000 = 100%). This fee share will be transferred to admin fee receiver _adminFeeReceiver Receiver of admin fees

buyTokensWithBNB

Swaps BNB for Token and sends them to msg.sender

router Router address, that should be used for the swap amountOutMin Minimum amount of tokens to receive path Swap path deadline Deadline of swap transaction

Returns: amountOut Amount of tokens user has received

Only approved routers are allowed

buyTokensWithERC20

Swaps ERC20 for token and sends them to msg.sender

router Router address, that should be used for the swap amountIn Amount tokens to spend amountOutMin Minimum amount of tokens to receive path Swap path deadline Deadline of swap transaction

Returns: amountOut Amount of tokens user has received

Only approved routers are allowed

burnTokens

Burns tokens by sending them to dead wallet

token ERC20 token address to burn amount Amount of tokens to burn

setManager

Sets manager account

account Account address add true - add manager, false - remove manager

Can be called only by contract Owner

setAdminFeeSettings

Sets admin fee and admin fee receiver

_adminFee Admin fee in basis points (10000 = 100%). This fee share will be transferred to admin fee receiver _adminFeeReceiver Receiver of admin fees

Can be called only by contract Owner

addToken

Creates a burn portal for new token

token ERC20 token address baseTax Base tax for the token, in basis points (10000 = 100%) feeReceiver Fee receiver address for the token discounts Array of Discount structs, containing discount amount and burn amount to receive that discount

struct Discount { uint16 discount; uint112 burnAmount; }

Can be called only by contract Owner or Manager

removeToken

Removes token from Burn Portal

token ERC20 token address

Can be called only by contract Owner or Manager

setTokenBaseTax

Sets new base tax for the token. Should be called if token tax was updated

token ERC20 token address baseTax Base tax for the token, in basis points (10000 = 100%)

Can be called only by contract Owner or Manager

setTokenFeeReceiver

Updates fee receiver address for specific token

token ERC20 token address feeReceiver Fee receiver address for the token

Can be called only by contract Owner or Manager

setTokenDiscounts

Updates discounts for specific token

token ERC20 token address discounts Array of Discount structs, containing discount amount and burn amount to receive that discount+

struct Discount { uint16 discount; uint112 burnAmount; }

Can be called only by contract Owner or Manager

approveTokenIn

Approves token to be swapped to Portal Token

token ERC20 token address

Can be called only by contract Owner

removeTokenIn

Remove token from the list of approved tokens In

token ERC20 token address

Can be called only by contract Owner

approveRouter

Approves Router address

router Router address approve true - approve, false - forbid

Can be called only by contract Owner

emergencyWithdrawERC20

Withdraws stuck ERC20 token

token IERC20 token address account Address of receiver amount Amount of tokens to withdraw

Can be called only by contract Owner

emergencyWithdrawBNB

Withdraws stuck BNB

account Address of receiver amount Amount of BNB to withdraw

Can be called only by contract Owner

getDiscounts

View function go get discounts list for specific token

token ERC20 token address

Returns: List or discounts

getApprovedTokens

View function go get list or approved tokens IN

Returns: List or approved tokens

getApprovedRouters

View function go get list or approved routers

Returns: List or approved routers

getActiveTokens

View function go get list or active Portal Tokens

Returns: List or active Portal Tokens

getPortalInfo

View function go collect portal info

token Portal Token address

Returns: baseTax Token tax in basis points (10000 = 100%) feeReceiver Fee receiver for this token totalBought Amount of tokens, bought through this portal totalBurned Amount of tokens, burned with this portal discounts List of token discounts

getManagers

View function to get list or managers

Returns: List or managers

isManager

View function check if address is manager

account Account address

Returns: Is account a manager?

isApprovedTokenIn

View function go determine if token is approved to be swapped to Portal Token

token ERC20 token address

Returns: Is approved to be swapped to Portal Token?

isApprovedRouter

View function go determine if Router is approved to be used to buy Portal Token

router Router address

Returns: Is approved router?

getPersonalDiscount

View function go get personal discount

account Account address token ERC20 token address

Returns: Discount in basis points where 10_000 is 100% discount = purchase without fee