Skip to content

Commit

Permalink
test: add yieldMaxClaimable
Browse files Browse the repository at this point in the history
  • Loading branch information
0xashu committed May 21, 2024
1 parent 28e8ec0 commit eb2ac70
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/unit/YieldAggregator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,23 @@ contract YieldAggregatorTests is BaseTest {
}

function test_yieldMaxClaimable() public {

_depositETH2AaveYieldAggregator(10 ether);
uint256 yieldBuffer = aaveYieldAggregator.yieldBuffer();

// Initial state, return 0
uint256 expectedClaimableBefore = 0;
uint256 actualClaimableBefore = aaveYieldAggregator.yieldMaxClaimable(10 ether);
assertEq(actualClaimableBefore, expectedClaimableBefore);

// Mock time to 2029-11-01 00:00:30, return yield
vm.warp(YIELD_CLAIM_TIME);
uint256 withdrawableETHAmount = aWETH.balanceOf(address(sharesFactory));
uint256 expectedClaimableAfter = withdrawableETHAmount - 10 ether - yieldBuffer;
uint256 actualClaimableAfter = aaveYieldAggregator.yieldMaxClaimable(10 ether);
assertEq(actualClaimableAfter, expectedClaimableAfter);

// BlankYieldAggregator always return 0
assertEq(blankYieldAggregator.yieldMaxClaimable(0), 0);
}

function _depositETH2AaveYieldAggregator(uint256 amount) internal {
Expand Down

0 comments on commit eb2ac70

Please sign in to comment.