-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b860e60
commit bf387ca
Showing
4 changed files
with
67 additions
and
16 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
import "./BaseTest.sol"; | ||
|
||
contract FeeTest is BaseTest { | ||
using MarketParamsLib for MarketParams; | ||
|
||
uint256 internal constant FEE = 0.1 ether; // 10% | ||
|
||
function setUp() public override { | ||
super.setUp(); | ||
|
||
_submitAndEnableMarket(allMarkets[0], CAP); | ||
|
||
irm.setRate(0.1 ether); // 10% APY. | ||
} | ||
|
||
function _setFee() internal { | ||
vm.startPrank(OWNER); | ||
vault.submitPendingFee(FEE); | ||
vault.setFee(); | ||
vault.setFeeRecipient(FEE_RECIPIENT); | ||
vm.stopPrank(); | ||
} | ||
|
||
function testShouldMintSharesToFeeRecipient(uint256 amount) public { | ||
_setFee(); | ||
|
||
amount = bound(amount, MIN_TEST_AMOUNT, MAX_TEST_AMOUNT); | ||
|
||
vm.prank(SUPPLIER); | ||
uint256 shares = vault.deposit(amount, SUPPLIER); | ||
|
||
_borrow(allMarkets[0], amount / 2); | ||
|
||
vm.warp(block.timestamp + 365 days); | ||
|
||
vm.prank(SUPPLIER); | ||
vault.redeem(shares / 3, SUPPLIER, SUPPLIER); | ||
|
||
assertGt(vault.balanceOf(FEE_RECIPIENT), 0, "fee recipient balance is zero"); | ||
} | ||
} |
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