Skip to content

Commit

Permalink
e2e carousel fix + NatSpec fix (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnexusflip authored and 3xHarry committed May 23, 2023
1 parent aa22c27 commit 4fdde1d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 124 deletions.
111 changes: 0 additions & 111 deletions soljson-v0.8.15+commit.e14f2714.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/v2/Carousel/Carousel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ contract Carousel is VaultV2 {
relayerFee = _relayerFee;
}

/** @notice changes deposit fee
* @param _depositFee deposit fee
*/
function changeDepositFee(uint256 _depositFee) external onlyFactory {
if(_depositFee > 250) revert BPSToHigh();
depositFee = _depositFee;
Expand Down
4 changes: 3 additions & 1 deletion test/V2/Helper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ contract Helper is Test {
uint256 public constant COLLATERAL_MINUS_FEES = 21989999998408000000;
uint256 public constant COLLATERAL_MINUS_FEES_DIV10 = 2198999999840800000;
uint256 public constant NEXT_COLLATERAL_MINUS_FEES = 21827317001456829251;
uint256 public constant USER_ASSETS_AFTER_WITHDRAW = 9999999995999999950;
uint256 public constant USER1_EMISSIONS_AFTER_WITHDRAW = 15856599995999999950;
uint256 public constant USER2_EMISSIONS_AFTER_WITHDRAW = 9999999995999999950;
uint256 public constant USER_AMOUNT_AFTER_WITHDRAW = 13112658495641799946;
address public constant ADMIN = address(0x1);
address public constant WETH = address(0x888);
address public constant TREASURY = address(0x777);
Expand Down
26 changes: 14 additions & 12 deletions test/V2/e2e/EndToEndCarouselTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "../../../src/V2/interfaces/ICarousel.sol";
import "../../../src/V2/Carousel/Carousel.sol";
import "../../../src/V2/Controllers/ControllerPeggedAssetV2.sol";


contract EndToEndCarouselTest is Helper {
using stdStorage for StdStorage;

Expand Down Expand Up @@ -119,10 +118,9 @@ contract EndToEndCarouselTest is Helper {
premiumEmissions,
collatEmissions
);


deal(UNDERLYING, USER, 1000 ether, true);
deal(UNDERLYING, USER2, 1000 ether, true);
deal(UNDERLYING, USER, 18 ether, true);
deal(UNDERLYING, USER2, 10 ether, true);

}

Expand All @@ -131,10 +129,6 @@ contract EndToEndCarouselTest is Helper {

//warp to deposit period
vm.warp(begin - 1 days);

//deal ether
vm.deal(USER, 18 ether);
vm.deal(USER2, 10 ether);

//approve ether deposit
IERC20(UNDERLYING).approve(premium, 2 ether);
Expand Down Expand Up @@ -266,6 +260,7 @@ contract EndToEndCarouselTest is Helper {

//withdraw after rollover
Carousel(collateral).withdraw(nextEpochId, balanceInNextEpoch, USER, USER);
Carousel(premium).withdraw(nextEpochId, Carousel(premium).balanceOf(USER, nextEpochId), USER, USER);

vm.stopPrank();

Expand Down Expand Up @@ -295,11 +290,18 @@ contract EndToEndCarouselTest is Helper {
vm.stopPrank();

//check vaults balance
assertEq(Carousel(premium).balanceOf(USER, nextEpochId), 0);
assertEq(Carousel(collateral).balanceOf(USER, nextEpochId), 0);
assertEq(Carousel(premium).balanceOf(USER2, nextEpochId), 0);
assertEq(Carousel(collateral).balanceOf(USER2, nextEpochId), 0);


//assert balance of treasury and users
//assert emissions balance of treasury and users
assertEq(IERC20(emissionsToken).balanceOf(TREASURY), 2800 ether);
assertEq(IERC20(emissionsToken).balanceOf(USER), USER_ASSETS_AFTER_WITHDRAW);
assertEq(IERC20(emissionsToken).balanceOf(USER2), USER_ASSETS_AFTER_WITHDRAW);
assertEq(IERC20(emissionsToken).balanceOf(USER), USER1_EMISSIONS_AFTER_WITHDRAW);
assertEq(IERC20(emissionsToken).balanceOf(USER2), USER2_EMISSIONS_AFTER_WITHDRAW);

//assert UNDERLYING users balance
assertEq(IERC20(UNDERLYING).balanceOf(USER), USER_AMOUNT_AFTER_WITHDRAW);
assertEq(IERC20(UNDERLYING).balanceOf(USER2), USER_AMOUNT_AFTER_WITHDRAW);
}
}

0 comments on commit 4fdde1d

Please sign in to comment.