Skip to content

Commit

Permalink
update SwapERC20.calculateProtocolFee tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmosites committed Oct 8, 2023
1 parent 29ea0b5 commit 3af57b5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions source/swap-erc20/test/SwapERC20.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ describe('SwapERC20 Unit', () => {
const REBATE_SCALE = '10'
const REBATE_MAX = '100'
const FEE_DIVISOR = '10000'
const DEFAULT_AMOUNT = '1000'
const DEFAULT_BALANCE = '10000'
const DEFAULT_AMOUNT = '10000'
const DEFAULT_BALANCE = '100000'
const STAKING_BALANCE = '10000000000'
const SWAP_FEE =
(parseInt(DEFAULT_AMOUNT) * parseInt(PROTOCOL_FEE)) / parseInt(FEE_DIVISOR)

Expand Down Expand Up @@ -117,7 +118,7 @@ describe('SwapERC20 Unit', () => {
staking = await deployMockContract(deployer, STAKING.abi)
await signerToken.mock.transferFrom.returns(true)
await senderToken.mock.transferFrom.returns(true)
await staking.mock.balanceOf.returns(10000000)
await staking.mock.balanceOf.returns(STAKING_BALANCE)

swap = await (
await ethers.getContractFactory('SwapERC20')
Expand Down Expand Up @@ -305,7 +306,7 @@ describe('SwapERC20 Unit', () => {
)
const discount = await swap
.connect(deployer)
.calculateDiscount(10000000, initialFeeAmount)
.calculateDiscount(STAKING_BALANCE, initialFeeAmount)
const actualFeeAmount = await swap
.connect(deployer)
.calculateProtocolFee(sender.address, DEFAULT_AMOUNT)
Expand All @@ -321,7 +322,7 @@ describe('SwapERC20 Unit', () => {
const initialFeeAmount = (DEFAULT_AMOUNT * zeroProtocolFee) / FEE_DIVISOR
const discount = await swap
.connect(deployer)
.calculateDiscount(10000000, initialFeeAmount)
.calculateDiscount(STAKING_BALANCE, initialFeeAmount)
const actualFeeAmount = await swap
.connect(deployer)
.calculateProtocolFee(sender.address, DEFAULT_AMOUNT)
Expand Down

0 comments on commit 3af57b5

Please sign in to comment.