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.
Contract functions
constructor
Creates contract
constructor(
IWETH _WETH,
uint16 _adminFee,
address _adminFeeReceiver
)
buyTokensWithBNB
Swaps BNB for Token and sends them to msg.sender
function buyTokensWithBNB(
address router,
uint256 amountOutMin,
address[] calldata path,
uint256 deadline
) external payable onlyApprovedRouter(router) returns(uint256 amountOut)
buyTokensWithERC20
Swaps ERC20 for token and sends them to msg.sender
function buyTokensWithERC20(
address router,
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
uint256 deadline
) external onlyApprovedRouter(router) returns(uint256 amountOut)
burnTokens
Burns tokens by sending them to dead wallet
function burnTokens(address token, uint128 amount) external
setManager
Sets manager account
function setManager(address account, bool add) external onlyOwner
setAdminFeeSettings
Sets admin fee and admin fee receiver
function setAdminFeeSettings(
uint16 _adminFee,
address _adminFeeReceiver
) external onlyOwner
addToken
Creates a burn portal for new token
function addToken(
address token,
uint16 baseTax,
address feeReceiver,
Discount[] calldata discounts
) external onlyOwnerOrManager
removeToken
Removes token from Burn Portal
function removeToken(address token) external onlyOwnerOrManager
setTokenBaseTax
Sets new base tax for the token. Should be called if token tax was updated
function setTokenBaseTax(
address token,
uint16 baseTax
) external onlyOwnerOrManager
setTokenFeeReceiver
Updates fee receiver address for specific token
function setTokenFeeReceiver(
address token,
address feeReceiver
) external onlyOwnerOrManager
setTokenDiscounts
Updates discounts for specific token
function setTokenDiscounts(
address token,
Discount[] calldata discounts
) external onlyOwnerOrManager
approveTokenIn
Approves token to be swapped to Portal Token
function approveTokenIn(address token) external onlyOwner
removeTokenIn
Remove token from the list of approved tokens In
function removeTokenIn(address token) external onlyOwner
approveRouter
Approves Router address
function approveRouter(address router, bool approve) external onlyOwner
emergencyWithdrawERC20
Withdraws stuck ERC20 token
function emergencyWithdrawERC20(
IERC20 token,
address account,
uint256 amount
) external onlyOwner
emergencyWithdrawBNB
Withdraws stuck BNB
function emergencyWithdrawBNB(
address account,
uint256 amount
) external onlyOwner
getDiscounts
View function go get discounts list for specific token
function getDiscounts(address token) external view returns(Discount[] memory)
getApprovedTokens
View function go get list or approved tokens IN
function getApprovedTokens() external view returns(address[] memory)
getApprovedRouters
View function go get list or approved routers
function getApprovedRouters() external view returns(address[] memory)
getActiveTokens
View function go get list or active Portal Tokens
function getActiveTokens() external view returns(address[] memory)
getPortalInfo
View function go collect portal info
function getPortalInfo(address token) external view returns(
uint16 baseTax,
address feeReceiver,
uint128 totalBought,
uint128 totalBurned,
Discount[] memory discounts
)
getManagers
View function to get list or managers
function getManagers() external view returns(address[] memory)
isManager
View function check if address is manager
function isManager(address account) external view returns(bool)
isApprovedTokenIn
View function go determine if token is approved to be swapped to Portal Token
function isApprovedTokenIn(address token) external view returns(bool)
isApprovedRouter
View function go determine if Router is approved to be used to buy Portal Token
function isApprovedRouter(address router) external view returns(bool)
getPersonalDiscount
View function go get personal discount
function getPersonalDiscount(address account, address token) public view returns(uint256)