-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add supply and create market integration tests
- Loading branch information
1 parent
d308bab
commit f785921
Showing
3 changed files
with
58 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.21; | ||
|
||
import "test/forge/BlueBase.t.sol"; | ||
|
||
contract IntegrationCreateMarketTest is BlueBaseTest { | ||
function testCreateMarketWithNotEnabledIrm(Market memory marketFuzz) public { | ||
vm.assume(marketFuzz.irm != irm); | ||
|
||
vm.prank(OWNER); | ||
vm.expectRevert(bytes(Errors.IRM_NOT_ENABLED)); | ||
blue.createMarket(marketFuzz); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,22 +1,43 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.20; | ||
pragma solidity 0.8.21; | ||
|
||
import "test/forge/BlueBase.t.sol"; | ||
|
||
contract BlueBaseTest is BlueBaseTest { | ||
contract IntegrationSupplyTest is BlueBaseTest { | ||
|
||
|
||
function testSupplyUnknownMarket(Market memory marketFuzz) public { | ||
vm.assume(neq(marketFuzz, market)); | ||
|
||
vm.expectRevert("unknown market"); | ||
blue.supply(marketFuzz, 1, address(this)); | ||
} | ||
|
||
function testSupplyUnknownMarket() public { | ||
function testSupplyZeroAmount() public { | ||
vm.expectRevert("zero amount"); | ||
blue.supply(market, 0, address(this)); | ||
} | ||
|
||
function testSupply(uint256 amount) {} | ||
function testSupply(uint256 amount) public { | ||
amount = bound(amount, 1, 2 ** 64); | ||
|
||
borrowableAsset.setBalance(address(this), amount); | ||
blue.supply(market, amount, address(this)); | ||
|
||
assertEq(blue.supplyShare(id, address(this)), amount * SharesMath.VIRTUAL_SHARES, "supply share"); | ||
assertEq(borrowableAsset.balanceOf(address(this)), 0, "lender balance"); | ||
assertEq(borrowableAsset.balanceOf(address(blue)), amount, "blue balance"); | ||
} | ||
|
||
function testSupplyOnBehalf(uint256 amount, address onBehalf) public { | ||
vm.assume(onBehalf != address(blue)); | ||
amount = bound(amount, 1, 2 ** 64); | ||
|
||
function testSupplyOnBehalf(uint256 amount, address onBehalf) {} | ||
borrowableAsset.setBalance(address(this), amount); | ||
blue.supply(market, amount, onBehalf); | ||
|
||
assertEq(blue.supplyShare(id, onBehalf), amount * SharesMath.VIRTUAL_SHARES, "supply share"); | ||
assertEq(borrowableAsset.balanceOf(onBehalf), 0, "lender balance"); | ||
assertEq(borrowableAsset.balanceOf(address(blue)), amount, "blue balance"); | ||
} | ||
} |