Rename: LiqToken* -> TokenLiq*
This commit is contained in:
parent
f3bdfec6a6
commit
50be520e99
|
@ -857,7 +857,7 @@ impl MangoClient {
|
|||
program_id: mango_v4::id(),
|
||||
accounts: {
|
||||
let mut ams = anchor_lang::ToAccountMetas::to_account_metas(
|
||||
&mango_v4::accounts::LiqTokenWithToken {
|
||||
&mango_v4::accounts::TokenLiqWithToken {
|
||||
group: self.group(),
|
||||
liqee: *liqee.0,
|
||||
liqor: self.mango_account_address,
|
||||
|
@ -869,7 +869,7 @@ impl MangoClient {
|
|||
ams
|
||||
},
|
||||
data: anchor_lang::InstructionData::data(
|
||||
&mango_v4::instruction::LiqTokenWithToken {
|
||||
&mango_v4::instruction::TokenLiqWithToken {
|
||||
asset_token_index,
|
||||
liab_token_index,
|
||||
max_liab_transfer,
|
||||
|
@ -918,7 +918,7 @@ impl MangoClient {
|
|||
program_id: mango_v4::id(),
|
||||
accounts: {
|
||||
let mut ams = anchor_lang::ToAccountMetas::to_account_metas(
|
||||
&mango_v4::accounts::LiqTokenBankruptcy {
|
||||
&mango_v4::accounts::TokenLiqBankruptcy {
|
||||
group: self.group(),
|
||||
liqee: *liqee.0,
|
||||
liqor: self.mango_account_address,
|
||||
|
@ -935,7 +935,7 @@ impl MangoClient {
|
|||
ams
|
||||
},
|
||||
data: anchor_lang::InstructionData::data(
|
||||
&mango_v4::instruction::LiqTokenBankruptcy { max_liab_transfer },
|
||||
&mango_v4::instruction::TokenLiqBankruptcy { max_liab_transfer },
|
||||
),
|
||||
})
|
||||
.signer(&self.owner)
|
||||
|
|
|
@ -9,8 +9,6 @@ pub use group_close::*;
|
|||
pub use group_create::*;
|
||||
pub use group_edit::*;
|
||||
pub use health_region::*;
|
||||
pub use liq_token_bankruptcy::*;
|
||||
pub use liq_token_with_token::*;
|
||||
pub use perp_cancel_all_orders::*;
|
||||
pub use perp_cancel_all_orders_by_side::*;
|
||||
pub use perp_cancel_order::*;
|
||||
|
@ -42,6 +40,8 @@ pub use token_add_bank::*;
|
|||
pub use token_deposit::*;
|
||||
pub use token_deregister::*;
|
||||
pub use token_edit::*;
|
||||
pub use token_liq_bankruptcy::*;
|
||||
pub use token_liq_with_token::*;
|
||||
pub use token_register::*;
|
||||
pub use token_register_trustless::*;
|
||||
pub use token_update_index_and_rate::*;
|
||||
|
@ -58,8 +58,6 @@ mod group_close;
|
|||
mod group_create;
|
||||
mod group_edit;
|
||||
mod health_region;
|
||||
mod liq_token_bankruptcy;
|
||||
mod liq_token_with_token;
|
||||
mod perp_cancel_all_orders;
|
||||
mod perp_cancel_all_orders_by_side;
|
||||
mod perp_cancel_order;
|
||||
|
@ -91,6 +89,8 @@ mod token_add_bank;
|
|||
mod token_deposit;
|
||||
mod token_deregister;
|
||||
mod token_edit;
|
||||
mod token_liq_bankruptcy;
|
||||
mod token_liq_with_token;
|
||||
mod token_register;
|
||||
mod token_register_trustless;
|
||||
mod token_update_index_and_rate;
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::logs::{
|
|||
// - all banks for liab_mint_info (writable)
|
||||
// - merged health accounts for liqor+liqee
|
||||
#[derive(Accounts)]
|
||||
pub struct LiqTokenBankruptcy<'info> {
|
||||
pub struct TokenLiqBankruptcy<'info> {
|
||||
#[account(
|
||||
has_one = insurance_vault,
|
||||
)]
|
||||
|
@ -56,7 +56,7 @@ pub struct LiqTokenBankruptcy<'info> {
|
|||
pub token_program: Program<'info, Token>,
|
||||
}
|
||||
|
||||
impl<'info> LiqTokenBankruptcy<'info> {
|
||||
impl<'info> TokenLiqBankruptcy<'info> {
|
||||
pub fn transfer_ctx(&self) -> CpiContext<'_, '_, '_, 'info, token::Transfer<'info>> {
|
||||
let program = self.token_program.to_account_info();
|
||||
let accounts = token::Transfer {
|
||||
|
@ -68,8 +68,8 @@ impl<'info> LiqTokenBankruptcy<'info> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn liq_token_bankruptcy(
|
||||
ctx: Context<LiqTokenBankruptcy>,
|
||||
pub fn token_liq_bankruptcy(
|
||||
ctx: Context<TokenLiqBankruptcy>,
|
||||
max_liab_transfer: I80F48,
|
||||
) -> Result<()> {
|
||||
let group = ctx.accounts.group.load()?;
|
|
@ -12,7 +12,7 @@ use crate::state::*;
|
|||
use crate::util::checked_math as cm;
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct LiqTokenWithToken<'info> {
|
||||
pub struct TokenLiqWithToken<'info> {
|
||||
pub group: AccountLoader<'info, Group>,
|
||||
|
||||
#[account(
|
||||
|
@ -30,8 +30,8 @@ pub struct LiqTokenWithToken<'info> {
|
|||
pub liqee: AccountLoaderDynamic<'info, MangoAccount>,
|
||||
}
|
||||
|
||||
pub fn liq_token_with_token(
|
||||
ctx: Context<LiqTokenWithToken>,
|
||||
pub fn token_liq_with_token(
|
||||
ctx: Context<TokenLiqWithToken>,
|
||||
asset_token_index: TokenIndex,
|
||||
liab_token_index: TokenIndex,
|
||||
max_liab_transfer: I80F48,
|
|
@ -328,13 +328,14 @@ pub mod mango_v4 {
|
|||
|
||||
// TODO serum3_cancel_all_spot_orders
|
||||
|
||||
// DEPRECATED: use token_liq_with_token
|
||||
pub fn liq_token_with_token(
|
||||
ctx: Context<LiqTokenWithToken>,
|
||||
ctx: Context<TokenLiqWithToken>,
|
||||
asset_token_index: TokenIndex,
|
||||
liab_token_index: TokenIndex,
|
||||
max_liab_transfer: I80F48,
|
||||
) -> Result<()> {
|
||||
instructions::liq_token_with_token(
|
||||
instructions::token_liq_with_token(
|
||||
ctx,
|
||||
asset_token_index,
|
||||
liab_token_index,
|
||||
|
@ -342,11 +343,33 @@ pub mod mango_v4 {
|
|||
)
|
||||
}
|
||||
|
||||
// DEPRECATED: use token_liq_bankruptcy
|
||||
pub fn liq_token_bankruptcy(
|
||||
ctx: Context<LiqTokenBankruptcy>,
|
||||
ctx: Context<TokenLiqBankruptcy>,
|
||||
max_liab_transfer: I80F48,
|
||||
) -> Result<()> {
|
||||
instructions::liq_token_bankruptcy(ctx, max_liab_transfer)
|
||||
instructions::token_liq_bankruptcy(ctx, max_liab_transfer)
|
||||
}
|
||||
|
||||
pub fn token_liq_with_token(
|
||||
ctx: Context<TokenLiqWithToken>,
|
||||
asset_token_index: TokenIndex,
|
||||
liab_token_index: TokenIndex,
|
||||
max_liab_transfer: I80F48,
|
||||
) -> Result<()> {
|
||||
instructions::token_liq_with_token(
|
||||
ctx,
|
||||
asset_token_index,
|
||||
liab_token_index,
|
||||
max_liab_transfer,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn token_liq_bankruptcy(
|
||||
ctx: Context<TokenLiqBankruptcy>,
|
||||
max_liab_transfer: I80F48,
|
||||
) -> Result<()> {
|
||||
instructions::token_liq_bankruptcy(ctx, max_liab_transfer)
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
@ -1941,7 +1941,7 @@ impl ClientInstruction for Serum3LiqForceCancelOrdersInstruction {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct LiqTokenWithTokenInstruction {
|
||||
pub struct TokenLiqWithTokenInstruction {
|
||||
pub liqee: Pubkey,
|
||||
pub liqor: Pubkey,
|
||||
pub liqor_owner: TestKeypair,
|
||||
|
@ -1953,9 +1953,9 @@ pub struct LiqTokenWithTokenInstruction {
|
|||
pub max_liab_transfer: I80F48,
|
||||
}
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl ClientInstruction for LiqTokenWithTokenInstruction {
|
||||
type Accounts = mango_v4::accounts::LiqTokenWithToken;
|
||||
type Instruction = mango_v4::instruction::LiqTokenWithToken;
|
||||
impl ClientInstruction for TokenLiqWithTokenInstruction {
|
||||
type Accounts = mango_v4::accounts::TokenLiqWithToken;
|
||||
type Instruction = mango_v4::instruction::TokenLiqWithToken;
|
||||
async fn to_instruction(
|
||||
&self,
|
||||
account_loader: impl ClientAccountLoader + 'async_trait,
|
||||
|
@ -2004,7 +2004,7 @@ impl ClientInstruction for LiqTokenWithTokenInstruction {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct LiqTokenBankruptcyInstruction {
|
||||
pub struct TokenLiqBankruptcyInstruction {
|
||||
pub liqee: Pubkey,
|
||||
pub liqor: Pubkey,
|
||||
pub liqor_owner: TestKeypair,
|
||||
|
@ -2013,9 +2013,9 @@ pub struct LiqTokenBankruptcyInstruction {
|
|||
pub liab_mint_info: Pubkey,
|
||||
}
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl ClientInstruction for LiqTokenBankruptcyInstruction {
|
||||
type Accounts = mango_v4::accounts::LiqTokenBankruptcy;
|
||||
type Instruction = mango_v4::instruction::LiqTokenBankruptcy;
|
||||
impl ClientInstruction for TokenLiqBankruptcyInstruction {
|
||||
type Accounts = mango_v4::accounts::TokenLiqBankruptcy;
|
||||
type Instruction = mango_v4::instruction::TokenLiqBankruptcy;
|
||||
async fn to_instruction(
|
||||
&self,
|
||||
account_loader: impl ClientAccountLoader + 'async_trait,
|
||||
|
|
|
@ -180,7 +180,7 @@ async fn test_bankrupt_tokens_socialize_loss() -> Result<(), TransportError> {
|
|||
// eat collateral1
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -204,7 +204,7 @@ async fn test_bankrupt_tokens_socialize_loss() -> Result<(), TransportError> {
|
|||
// eat collateral2, leaving the account bankrupt
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -233,7 +233,7 @@ async fn test_bankrupt_tokens_socialize_loss() -> Result<(), TransportError> {
|
|||
let vault_before = account_position(solana, vault_account, borrow_token1.bank).await;
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenBankruptcyInstruction {
|
||||
TokenLiqBankruptcyInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -258,7 +258,7 @@ async fn test_bankrupt_tokens_socialize_loss() -> Result<(), TransportError> {
|
|||
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenBankruptcyInstruction {
|
||||
TokenLiqBankruptcyInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -489,7 +489,7 @@ async fn test_bankrupt_tokens_insurance_fund() -> Result<(), TransportError> {
|
|||
// eat collateral1
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -509,7 +509,7 @@ async fn test_bankrupt_tokens_insurance_fund() -> Result<(), TransportError> {
|
|||
// eat collateral2, leaving the account bankrupt
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -536,7 +536,7 @@ async fn test_bankrupt_tokens_insurance_fund() -> Result<(), TransportError> {
|
|||
let liqor_before = account_position(solana, vault_account, borrow_token1.bank).await;
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenBankruptcyInstruction {
|
||||
TokenLiqBankruptcyInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -567,7 +567,7 @@ async fn test_bankrupt_tokens_insurance_fund() -> Result<(), TransportError> {
|
|||
let liab_transfer: f64 = 500.0 / 20.0;
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenBankruptcyInstruction {
|
||||
TokenLiqBankruptcyInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -600,7 +600,7 @@ async fn test_bankrupt_tokens_insurance_fund() -> Result<(), TransportError> {
|
|||
let liqor_before = account_position(solana, vault_account, borrow_token1.bank).await;
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenBankruptcyInstruction {
|
||||
TokenLiqBankruptcyInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
|
|
@ -338,7 +338,7 @@ async fn test_liq_tokens_with_token() -> Result<(), TransportError> {
|
|||
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -367,7 +367,7 @@ async fn test_liq_tokens_with_token() -> Result<(), TransportError> {
|
|||
//
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -395,7 +395,7 @@ async fn test_liq_tokens_with_token() -> Result<(), TransportError> {
|
|||
//
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -426,7 +426,7 @@ async fn test_liq_tokens_with_token() -> Result<(), TransportError> {
|
|||
//
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
@ -503,7 +503,7 @@ async fn test_liq_tokens_with_token() -> Result<(), TransportError> {
|
|||
|
||||
send_tx(
|
||||
solana,
|
||||
LiqTokenWithTokenInstruction {
|
||||
TokenLiqWithTokenInstruction {
|
||||
liqee: account,
|
||||
liqor: vault_account,
|
||||
liqor_owner: owner,
|
||||
|
|
Loading…
Reference in New Issue