Skip to content

Commit

Permalink
Add AludelV3Lib tests
Browse files Browse the repository at this point in the history
The idea is to only tests AludelV3 logic without the need to instanciate
an aludel.

remove duplicated tests from AludelV3.t.sol
  • Loading branch information
itirabasso committed Jan 17, 2023
1 parent 9fc1d98 commit f171d1d
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions src/test/AludelV3.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -135,37 +135,6 @@ contract AludelV3Test is Test {
vm.warp(START_TIME);
}

// When the aludel has no outstanding shares the minted shares are linearly scaled.
function test_calculate_new_shares_no_previous_shares(
uint128 sharesOutstanding,
uint128 remainingRewards,
uint128 newRewards
) public {

vm.assume(sharesOutstanding == 0);
assertEq(
AludelV3Lib.calculateNewShares(sharesOutstanding, remainingRewards, newRewards),
newRewards * BASE_SHARES_PER_WEI
);

}

function test_calculate_new_shares_with_previous_shares(
uint128 sharesOutstanding,
uint128 remainingRewards,
uint128 newRewards
) public {

vm.assume(sharesOutstanding > 0);
vm.assume(remainingRewards > 0);
// todo : do we need this?
// vm.assume(sharesOutstanding < remainingRewards * BASE_SHARES_PER_WEI);
assertEq(
AludelV3Lib.calculateNewShares(sharesOutstanding, remainingRewards, newRewards),
uint256(sharesOutstanding) * uint256(newRewards) / uint256(remainingRewards)
);
}

function test_funding_shares() public {
// Scenario: Aludel is funded several times.
// Shares should unlock linearly.
Expand Down Expand Up @@ -355,7 +324,8 @@ contract AludelV3Test is Test {
}

function test_stakes_invalid_vault() public {


// Create a crucible instance from a different factory
Crucible crucibleTemplate = new Crucible();
CrucibleFactory crucibleFactory = new CrucibleFactory(address(crucibleTemplate));
Crucible crucible = Utils.createCrucible(user, crucibleFactory);
Expand All @@ -374,6 +344,7 @@ contract AludelV3Test is Test {

Crucible crucible = Utils.createCrucible(user, crucibleFactory);
Utils.fundMockToken(address(crucible), stakingToken, STAKE_AMOUNT);

bytes memory lockSig;

// stake 30 times 1 wei
Expand Down

0 comments on commit f171d1d

Please sign in to comment.