requestNetwork icon indicating copy to clipboard operation
requestNetwork copied to clipboard

Feat: Erc20swapToPay w/fees

Open Dadogg80 opened this issue 3 years ago • 1 comments

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.

Dadogg80 avatar Feb 01 '22 14:02 Dadogg80

Coverage Status

Coverage remained the same at 89.449% when pulling eaafda678d9b52c1552a558d08d466de04436432 on erc20SwapToPay_with_fees into 8d81be3fb01793ba57270a716daded44749f90f0 on master.

coveralls avatar Feb 01 '22 14:02 coveralls