requestNetwork
requestNetwork copied to clipboard
Feat: Erc20swapToPay w/fees
Feature: ERC20SwapToPay with swap fee.
Context:
The purpose of this new feature is to be able to collect a small swapFee from every transaction executed by this smart contract.
Code addition to ERC20SwapToPay.sol
-Added an internal function to calculate the fee amount.
_calculateSwapFee(uint256 _amount) internal view returns (uint256 _swapFeeAmount).
-Added a public function to change the swap fee.
function setSwapFee(uint256 _newSwapFee) public onlyWhitelisted.
-Added a public function to change the swap fee address.
function setFeeAddress(address _newFeeAddress) public onlyWhitelisted.
Note: Only whitelisted admins can change the currentSwapFee and swapFeeAddress.