Fix tests
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
fbd3fd410c
commit
ee6fe93b26
|
@ -462,13 +462,14 @@ async fn test_liq_tokens_with_token() -> Result<(), BanksClientError> {
|
|||
// health after borrow2 liquidation was (1000-32) * 0.6 - 350 * 2 * 1.4 = -399.2
|
||||
// borrow1 needed 399.2 / (1.4*2 - 0.6*2*1.04) = 257.2
|
||||
// asset cost = 257.2 * 2 * 1.04 = 535
|
||||
// loan orignation fee = 1
|
||||
assert_eq!(
|
||||
account_position(solana, account, borrow_token1.bank).await,
|
||||
-350 + 257
|
||||
);
|
||||
assert_eq!(
|
||||
account_position(solana, account, collateral_token1.bank).await,
|
||||
1000 - 32 - 535
|
||||
1000 - 32 - 535 - 1
|
||||
);
|
||||
let liqee: MangoAccount = solana.get_account(account).await;
|
||||
assert_eq!(liqee.being_liquidated, 0);
|
||||
|
|
|
@ -171,17 +171,33 @@ async fn test_position_lifetime() -> Result<()> {
|
|||
);
|
||||
|
||||
// give it back, closing the position
|
||||
send_tx(
|
||||
solana,
|
||||
DepositInstruction {
|
||||
amount: borrow_amount,
|
||||
account,
|
||||
token_account: payer_mint_accounts[1],
|
||||
token_authority: payer,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
{
|
||||
send_tx(
|
||||
solana,
|
||||
DepositInstruction {
|
||||
// deposit withdraw amount + some more to cover loan origination fees
|
||||
amount: borrow_amount + 2,
|
||||
account,
|
||||
token_account: payer_mint_accounts[1],
|
||||
token_authority: payer,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
send_tx(
|
||||
solana,
|
||||
WithdrawInstruction {
|
||||
// withdraw residual amount left
|
||||
amount: u64::MAX,
|
||||
allow_borrow: false,
|
||||
account,
|
||||
owner,
|
||||
token_account: payer_mint_accounts[1],
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// withdraw the collateral, closing the position
|
||||
send_tx(
|
||||
|
|
Loading…
Reference in New Issue