Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albertfolch-redeemeum committed May 23, 2024
1 parent c164117 commit 3494523
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/protocol/FundsHandlerTest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-only-tests/no-only-tests */
const { ethers } = require("hardhat");
const { ZeroAddress, getSigners, provider, parseUnits, getContractAt, getContractFactory, MaxUint256 } = ethers;
const { expect, assert } = require("chai");
Expand Down Expand Up @@ -5921,7 +5920,7 @@ describe("IBosonFundsHandler", function () {
exchangeToken: offerPriceDiscovery.exchangeToken,
price: orderPrice,
};
priceDiscoveryProtocolFee = applyPercentage(order.price, protocolFeePercentage);
priceDiscoveryProtocolFee = applyPercentage(order.price, "200");

const priceDiscoveryData = priceDiscoveryContract.interface.encodeFunctionData("fulfilBuyOrder", [order]);

Expand Down Expand Up @@ -6871,17 +6870,17 @@ describe("IBosonFundsHandler", function () {
// expected payoffs
// buyer: (price + sellerDeposit + buyerEscalationDeposit)*buyerPercentage
buyerPayoff =
((BigInt(orderPrice) + BigInt(offerPriceDiscovery.sellerDeposit)) * BigInt(buyerPercentBasisPoints)) /
((BigInt(order.price) + BigInt(offerPriceDiscovery.sellerDeposit)) * BigInt(buyerPercentBasisPoints)) /
10000n;

const sellerPercentBasisPoints = 10000n - BigInt(buyerPercentBasisPoints);

sellerPayoff =
(BigInt(offerPriceDiscovery.sellerDeposit) * (10000n - BigInt(buyerPercentBasisPoints))) / 10000n;

const sellerPricePart = BigInt(orderPrice) - (BigInt(orderPrice) * sellerPercentBasisPoints) / 10000n;
const sellerPricePart = BigInt(order.price) - (BigInt(order.price) * sellerPercentBasisPoints) / 10000n;
const sellerProtocolFeePart = (BigInt(priceDiscoveryProtocolFee) * sellerPercentBasisPoints) / 10000n;
sellerPayoff2 = BigInt(orderPrice) - sellerPricePart - sellerProtocolFeePart;
sellerPayoff2 = BigInt(order.price) - sellerPricePart - sellerProtocolFeePart;

protocolPayoff = sellerProtocolFeePart;

Expand Down

0 comments on commit 3494523

Please sign in to comment.