TokenEdit: remove bank_num arg

This commit is contained in:
Christian Kamm 2022-09-02 13:14:27 +02:00
parent 14913c70d2
commit 3fbc3ca32d
5 changed files with 137 additions and 13 deletions

View File

@ -27,6 +27,7 @@ pub struct PerpSettlePnl<'info> {
#[account(mut, has_one = group)]
pub account_b: AccountLoaderDynamic<'info, MangoAccount>,
/// CHECK: Oracle can have different account types, constrained by address in perp_market
pub oracle: UncheckedAccount<'info>,
#[account(mut, has_one = group)]

View File

@ -12,7 +12,6 @@ use crate::state::*;
/// In addition to these accounts, all banks must be passed as remaining_accounts
/// in MintInfo order.
#[derive(Accounts)]
#[instruction(bank_num: u64)]
pub struct TokenEdit<'info> {
#[account(
has_one = admin,
@ -31,7 +30,6 @@ pub struct TokenEdit<'info> {
#[allow(clippy::too_many_arguments)]
pub fn token_edit(
ctx: Context<TokenEdit>,
bank_num: u64,
oracle_opt: Option<Pubkey>,
oracle_config_opt: Option<OracleConfig>,
group_insurance_fund_opt: Option<bool>,

View File

@ -101,7 +101,6 @@ pub mod mango_v4 {
#[allow(clippy::too_many_arguments)]
pub fn token_edit(
ctx: Context<TokenEdit>,
bank_num: u64,
oracle_opt: Option<Pubkey>,
oracle_config_opt: Option<OracleConfig>,
group_insurance_fund_opt: Option<bool>,
@ -116,7 +115,6 @@ pub mod mango_v4 {
) -> Result<()> {
instructions::token_edit(
ctx,
bank_num,
oracle_opt,
oracle_config_opt,
group_insurance_fund_opt,

View File

@ -294,7 +294,6 @@ export class MangoClient {
return await this.program.methods
.tokenEdit(
new BN(0),
oracle,
oracleConf,
groupInsuranceFund,

View File

@ -502,10 +502,6 @@ export type MangoV4 = {
}
],
"args": [
{
"name": "bankNum",
"type": "u64"
},
{
"name": "oracleOpt",
"type": {
@ -2692,6 +2688,49 @@ export type MangoV4 = {
],
"args": []
},
{
"name": "perpSettlePnl",
"accounts": [
{
"name": "group",
"isMut": false,
"isSigner": false
},
{
"name": "perpMarket",
"isMut": false,
"isSigner": false
},
{
"name": "accountA",
"isMut": true,
"isSigner": false
},
{
"name": "accountB",
"isMut": true,
"isSigner": false
},
{
"name": "oracle",
"isMut": false,
"isSigner": false
},
{
"name": "quoteBank",
"isMut": true,
"isSigner": false
}
],
"args": [
{
"name": "maxSettleAmount",
"type": {
"defined": "I80F48"
}
}
]
},
{
"name": "computeAccountData",
"accounts": [
@ -5308,6 +5347,31 @@ export type MangoV4 = {
"code": 6016,
"name": "BeingLiquidated",
"msg": "account is currently being liquidated"
},
{
"code": 6017,
"name": "InvalidBank",
"msg": "invalid bank"
},
{
"code": 6018,
"name": "ProfitabilityMismatch",
"msg": "account profitability is mismatched"
},
{
"code": 6019,
"name": "CannotSettleWithSelf",
"msg": "cannot settle with self"
},
{
"code": 6020,
"name": "PerpPositionDoesNotExist",
"msg": "perp position does not exist"
},
{
"code": 6021,
"name": "MaxSettleAmountMustBeGreaterThanZero",
"msg": "max settle amount must be greater than zero"
}
]
};
@ -5816,10 +5880,6 @@ export const IDL: MangoV4 = {
}
],
"args": [
{
"name": "bankNum",
"type": "u64"
},
{
"name": "oracleOpt",
"type": {
@ -8006,6 +8066,49 @@ export const IDL: MangoV4 = {
],
"args": []
},
{
"name": "perpSettlePnl",
"accounts": [
{
"name": "group",
"isMut": false,
"isSigner": false
},
{
"name": "perpMarket",
"isMut": false,
"isSigner": false
},
{
"name": "accountA",
"isMut": true,
"isSigner": false
},
{
"name": "accountB",
"isMut": true,
"isSigner": false
},
{
"name": "oracle",
"isMut": false,
"isSigner": false
},
{
"name": "quoteBank",
"isMut": true,
"isSigner": false
}
],
"args": [
{
"name": "maxSettleAmount",
"type": {
"defined": "I80F48"
}
}
]
},
{
"name": "computeAccountData",
"accounts": [
@ -10622,6 +10725,31 @@ export const IDL: MangoV4 = {
"code": 6016,
"name": "BeingLiquidated",
"msg": "account is currently being liquidated"
},
{
"code": 6017,
"name": "InvalidBank",
"msg": "invalid bank"
},
{
"code": 6018,
"name": "ProfitabilityMismatch",
"msg": "account profitability is mismatched"
},
{
"code": 6019,
"name": "CannotSettleWithSelf",
"msg": "cannot settle with self"
},
{
"code": 6020,
"name": "PerpPositionDoesNotExist",
"msg": "perp position does not exist"
},
{
"code": 6021,
"name": "MaxSettleAmountMustBeGreaterThanZero",
"msg": "max settle amount must be greater than zero"
}
]
};