Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kylezs committed Mar 1, 2024
1 parent 9d53950 commit 053492a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bouncer/tests/broker_fee_collection_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ async function testBrokerFees(asset: Asset, seed?: string): Promise<void> {
console.log('brokerCommission:', brokerCommission);

// Check that the deposit amount is correct after deducting the deposit fee
const depositAmountAfterIngressFee = BigInt(swapScheduledEvent.data.depositAmount.replaceAll(',', ''));
const depositAmountAfterIngressFee = BigInt(
swapScheduledEvent.data.depositAmount.replaceAll(',', ''),
);
const rawDepositForSwapAmountBigInt = BigInt(
amountToFineAmount(rawDepositForSwapAmount, assetDecimals[asset]),
);
console.log('depositAmount:', depositAmountAfterIngressFee);
assert(
depositAmountAfterIngressFee >= 0 && depositAmountAfterIngressFee <= rawDepositForSwapAmountBigInt,
depositAmountAfterIngressFee >= 0 &&
depositAmountAfterIngressFee <= rawDepositForSwapAmountBigInt,
`Unexpected ${asset} deposit amount ${depositAmountAfterIngressFee},
}`,
);
Expand All @@ -117,7 +120,8 @@ async function testBrokerFees(asset: Asset, seed?: string): Promise<void> {
// Calculating the fee. Using some strange math here because the SC rounds down on 0.5 instead of up.
const divisor = BigInt(10000 / commissionBps);
const expectedIncrease =
depositAmountAfterIngressFee / divisor + (depositAmountAfterIngressFee % divisor > divisor / 2n ? 1n : 0n);
depositAmountAfterIngressFee / divisor +
(depositAmountAfterIngressFee % divisor > divisor / 2n ? 1n : 0n);
assert.strictEqual(
increase,
expectedIncrease,
Expand Down

0 comments on commit 053492a

Please sign in to comment.