Skip to content

Commit

Permalink
test: complete borrow flow
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdcota committed Oct 12, 2024
1 parent 639a7da commit 0fec606
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/TestIntegrationCrediTalentCenter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,35 @@ contract TestIntegrationCrediTalentCenter is Test {
assertEq(position.borrowShares, 0);
}

function test_useTheCreditLine() public {
address applicant = User1.addr;
do_applyToCredit(applicant);

address underWriter = User2.addr;
uint256 tenThousandXocs = 10000e18;
do_applyToUnderwrite(underWriter, tenThousandXocs);

uint256 floatingRate = type(uint256).max;
vm.prank(underWriter);
talentCenter.approveCredit(applicant, 1, tenThousandXocs, floatingRate);

IMorpho morpho = IMorpho(MORPHO);

MarketParams memory marketParams = MarketParams({
loanToken: address(xocolatl),
collateralToken: address(creditPoints),
oracle: address(talentCenter),
irm: MOPRHO_ADAPTIVEIRM,
lltv: talentCenter.DEFAULT_LLTV()
});

uint256 fiveThousandXocs = 5000e18;
vm.prank(applicant);
morpho.borrow(marketParams, fiveThousandXocs, 0, applicant, applicant);

assertEq(xocolatl.balanceOf(applicant), fiveThousandXocs);
}

function load_tokens_to_user(MockToken token, address user, uint256 amount) internal {
token.mint(user, amount);
}
Expand Down

0 comments on commit 0fec606

Please sign in to comment.