Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/contracts/LiquidityReserve.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ contract LiquidityReserve is
// claim the stakingToken from previous unstakes
IStaking(stakingContract).claimWithdraw(address(this));

uint256 amountMinusFee = _amount - ((_amount * fee) / BASIS_POINTS);
uint256 amountMinusFee = (_amount * (BASIS_POINTS - fee)) /
BASIS_POINTS;

IERC20Upgradeable(rewardToken).safeTransferFrom(
msg.sender,
Expand Down
4 changes: 2 additions & 2 deletions test/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ describe("Integration", function () {
const rewardBalanceStaker1 = await yieldy.balanceOf(staker1);
expect(rewardBalanceStaker1).eq(0);
const stakingBalanceStaker1 = await stakingToken.balanceOf(staker1);
expect(stakingBalanceStaker1).eq(74158730158730);
expect(stakingBalanceStaker1).eq(74158730158729);

// stake with staker3
await stakingStaker3.functions["stake(uint256)"](stakingAmount3);
Expand Down Expand Up @@ -451,6 +451,6 @@ describe("Integration", function () {
warmUpLP2Reward = await yieldy.tokenBalanceForCredits(warmUpInfo.credits);
expect(warmUpLP2Reward).eq(0);
const stakingBalanceLP2 = await stakingToken.balanceOf(liquidityProvider2);
expect(stakingBalanceLP2).eq(753646311488562); // 80% of 942057889360702
expect(stakingBalanceLP2).eq(753646311488561); // 80% of 942057889360702
});
});
7 changes: 4 additions & 3 deletions test/migrationTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,10 @@ describe("Migration", function () {
await stakingV2Staker1.instantUnstakeReserve(transferAmount);

const unstakingFee = await liquidityReserveV2.fee();
const balanceMinusFee = transferAmount.sub(
transferAmount.mul(unstakingFee).div(BigNumber.from("10000"))
);
const basisFee = BigNumber.from("10000").sub(unstakingFee);
const balanceMinusFee = transferAmount
.mul(basisFee)
.div(BigNumber.from("10000"));

// should be unstaked with the correct fee
await confirmBalance(staker1, stakingToken, balanceMinusFee);
Expand Down