Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoscelynFarr committed Feb 26, 2024
1 parent 6b76d16 commit 60d2573
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/impl/Subaccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ contract SubaccountTest is JUSDBankInitTest {
Subaccount(aliceSub).execute(address(jusdBank), dataBorrow, 0);

// withdraw USDC or JUSD from trading account, and repay it to JUSDBank
bytes memory repayParam = abi.encodeWithSignature(
"repayToBank(address,address)",
0x518638a658aCd9A3A06cd4c9f44829305a6a8df4,
0x518638a658aCd9A3A06cd4c9f44829305a6a8df4
);
bytes memory repayParam = abi.encodeWithSignature("repayToBank(address,address)", aliceSub, aliceSub);
emit log_bytes(repayParam);
bytes memory fastWithdraw = abi.encodeWithSignature(
"fastWithdraw(address,address,uint256,uint256,bool,bytes)",
Expand All @@ -154,6 +150,8 @@ contract SubaccountTest is JUSDBankInitTest {
vm.stopPrank();
jojoDealer.disableFastWithdraw(false);

emit log_uint(jusdBank.getBorrowBalance(aliceSub));

vm.startPrank(alice);
Subaccount(aliceSub).execute(address(jojoDealer), fastWithdraw, 0);
bytes memory fastWithdraw2 = abi.encodeWithSignature(
Expand All @@ -165,6 +163,7 @@ contract SubaccountTest is JUSDBankInitTest {
false,
repayParam
);
cheats.expectRevert("repayed jusd too much");
Subaccount(aliceSub).execute(address(jojoDealer), fastWithdraw2, 0);

console.log("aliceSub borrow", jusdBank.getBorrowBalance(aliceSub));
Expand Down

0 comments on commit 60d2573

Please sign in to comment.