-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: add more test for `totalAssets()`. * feat: add modifiers to simulate gain or loss assets in ARM. * fix: use boolean instead of int256. * fix: use Foundry stdError lib for expectRevert. * test: add setter test for LCP. * chore: fix lcov name in .gitignore * test: add tests for collectFees().
- Loading branch information
1 parent
f1c9ee4
commit 5130d6c
Showing
5 changed files
with
185 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ dependencies/ | |
soldeer.lock | ||
|
||
# Coverage | ||
lock.info* | ||
lcov.info* | ||
|
||
# Defender Actions | ||
dist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.23; | ||
|
||
// Test imports | ||
import {Fork_Shared_Test_} from "test/fork/shared/Shared.sol"; | ||
|
||
// Contracts | ||
import {IERC20} from "contracts/Interfaces.sol"; | ||
import {PerformanceFee} from "contracts/PerformanceFee.sol"; | ||
|
||
contract Fork_Concrete_LidoFixedPriceMultiLpARM_CollectFees_Test_ is Fork_Shared_Test_ { | ||
////////////////////////////////////////////////////// | ||
/// --- SETUP | ||
////////////////////////////////////////////////////// | ||
function setUp() public override { | ||
super.setUp(); | ||
} | ||
|
||
////////////////////////////////////////////////////// | ||
/// --- REVERTING TESTS | ||
////////////////////////////////////////////////////// | ||
/// @notice This test is expected to revert as almost all the liquidity is in stETH | ||
function test_RevertWhen_CollectFees_Because_InsufficientLiquidity() | ||
public | ||
simulateAssetGainInLidoFixedPriceMultiLpARM(DEFAULT_AMOUNT, address(steth), true) | ||
{ | ||
vm.expectRevert("ARM: insufficient liquidity"); | ||
lidoFixedPriceMulltiLpARM.collectFees(); | ||
} | ||
|
||
////////////////////////////////////////////////////// | ||
/// --- PASSING TESTS | ||
////////////////////////////////////////////////////// | ||
function test_CollectFees_Once() | ||
public | ||
simulateAssetGainInLidoFixedPriceMultiLpARM(DEFAULT_AMOUNT, address(weth), true) | ||
{ | ||
address feeCollector = lidoFixedPriceMulltiLpARM.feeCollector(); | ||
uint256 fee = DEFAULT_AMOUNT * 20 / 100; | ||
|
||
// Expected Events | ||
vm.expectEmit({emitter: address(weth)}); | ||
emit IERC20.Transfer(address(lidoFixedPriceMulltiLpARM), feeCollector, fee); | ||
vm.expectEmit({emitter: address(lidoFixedPriceMulltiLpARM)}); | ||
emit PerformanceFee.FeeCollected(feeCollector, fee); | ||
|
||
// Main call | ||
uint256 claimedFee = lidoFixedPriceMulltiLpARM.collectFees(); | ||
|
||
// Assertions after | ||
assertEq(claimedFee, fee); | ||
assertEq(lidoFixedPriceMulltiLpARM.feesAccrued(), 0); | ||
} | ||
|
||
function test_CollectFees_Twice() | ||
public | ||
simulateAssetGainInLidoFixedPriceMultiLpARM(DEFAULT_AMOUNT, address(weth), true) | ||
collectFeesOnLidoFixedPriceMultiLpARM | ||
simulateAssetGainInLidoFixedPriceMultiLpARM(DEFAULT_AMOUNT, address(weth), true) | ||
{ | ||
// Main call | ||
uint256 claimedFee = lidoFixedPriceMulltiLpARM.collectFees(); | ||
|
||
// Assertions after | ||
assertEq(claimedFee, DEFAULT_AMOUNT * 20 / 100); // This test should pass! | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters