Serum3 edit market: Allow changing the name (#621)
This commit is contained in:
parent
a77515acbf
commit
7eedcbae0d
|
@ -1906,6 +1906,12 @@
|
|||
"type": {
|
||||
"option": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "nameOpt",
|
||||
"type": {
|
||||
"option": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -2393,7 +2399,8 @@
|
|||
{
|
||||
"name": "serum3SettleFunds",
|
||||
"docs": [
|
||||
"Settles all free funds from the OpenOrders account into the MangoAccount.",
|
||||
"Deprecated instruction that used to settles all free funds from the OpenOrders account",
|
||||
"into the MangoAccount.",
|
||||
"",
|
||||
"Any serum \"referrer rebates\" (ui fees) are considered Mango fees."
|
||||
],
|
||||
|
@ -5687,7 +5694,10 @@
|
|||
{
|
||||
"name": "openInterest",
|
||||
"docs": [
|
||||
"Number of base lot pairs currently active in the market. Always >= 0."
|
||||
"Number of base lots currently active in the market. Always >= 0.",
|
||||
"",
|
||||
"Since this counts positive base lots and negative base lots, the more relevant",
|
||||
"number of open base lot pairs is half this value."
|
||||
],
|
||||
"type": "i64"
|
||||
},
|
||||
|
@ -9054,6 +9064,50 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "WithdrawLoanLog",
|
||||
"fields": [
|
||||
{
|
||||
"name": "mangoGroup",
|
||||
"type": "publicKey",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "mangoAccount",
|
||||
"type": "publicKey",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "tokenIndex",
|
||||
"type": "u16",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "loanAmount",
|
||||
"type": "i128",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "loanOriginationFee",
|
||||
"type": "i128",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "instruction",
|
||||
"type": {
|
||||
"defined": "LoanOriginationFeeInstruction"
|
||||
},
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "price",
|
||||
"type": {
|
||||
"option": "i128"
|
||||
},
|
||||
"index": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TokenLiqBankruptcyLog",
|
||||
"fields": [
|
||||
|
@ -9749,7 +9803,7 @@
|
|||
{
|
||||
"code": 6007,
|
||||
"name": "HealthMustBePositiveOrIncrease",
|
||||
"msg": "health must be positive or increase"
|
||||
"msg": "health must be positive or not decrease"
|
||||
},
|
||||
{
|
||||
"code": 6008,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use crate::util::fill_from_str;
|
||||
use crate::{accounts_ix::*, error::MangoError};
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
|
@ -5,6 +6,7 @@ pub fn serum3_edit_market(
|
|||
ctx: Context<Serum3EditMarket>,
|
||||
reduce_only_opt: Option<bool>,
|
||||
force_close_opt: Option<bool>,
|
||||
name_opt: Option<String>,
|
||||
) -> Result<()> {
|
||||
let mut serum3_market = ctx.accounts.market.load_mut()?;
|
||||
|
||||
|
@ -38,6 +40,12 @@ pub fn serum3_edit_market(
|
|||
require_group_admin = true;
|
||||
};
|
||||
|
||||
if let Some(name) = name_opt.as_ref() {
|
||||
msg!("Name: old - {:?}, new - {:?}", serum3_market.name, name);
|
||||
serum3_market.name = fill_from_str(&name)?;
|
||||
require_group_admin = true;
|
||||
};
|
||||
|
||||
if require_group_admin {
|
||||
require!(
|
||||
group.admin == ctx.accounts.admin.key(),
|
||||
|
|
|
@ -415,9 +415,10 @@ pub mod mango_v4 {
|
|||
ctx: Context<Serum3EditMarket>,
|
||||
reduce_only_opt: Option<bool>,
|
||||
force_close_opt: Option<bool>,
|
||||
name_opt: Option<String>,
|
||||
) -> Result<()> {
|
||||
#[cfg(feature = "enable-gpl")]
|
||||
instructions::serum3_edit_market(ctx, reduce_only_opt, force_close_opt)?;
|
||||
instructions::serum3_edit_market(ctx, reduce_only_opt, force_close_opt, name_opt)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -1306,11 +1306,12 @@ export class MangoClient {
|
|||
serum3MarketIndex: MarketIndex,
|
||||
reduceOnly: boolean | null,
|
||||
forceClose: boolean | null,
|
||||
name: string | null,
|
||||
): Promise<TransactionSignature> {
|
||||
const serum3Market =
|
||||
group.serum3MarketsMapByMarketIndex.get(serum3MarketIndex);
|
||||
const ix = await this.program.methods
|
||||
.serum3EditMarket(reduceOnly, forceClose)
|
||||
.serum3EditMarket(reduceOnly, forceClose, name)
|
||||
.accounts({
|
||||
group: group.publicKey,
|
||||
admin: (this.program.provider as AnchorProvider).wallet.publicKey,
|
||||
|
|
|
@ -1906,6 +1906,12 @@ export type MangoV4 = {
|
|||
"type": {
|
||||
"option": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "nameOpt",
|
||||
"type": {
|
||||
"option": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -2393,7 +2399,8 @@ export type MangoV4 = {
|
|||
{
|
||||
"name": "serum3SettleFunds",
|
||||
"docs": [
|
||||
"Settles all free funds from the OpenOrders account into the MangoAccount.",
|
||||
"Deprecated instruction that used to settles all free funds from the OpenOrders account",
|
||||
"into the MangoAccount.",
|
||||
"",
|
||||
"Any serum \"referrer rebates\" (ui fees) are considered Mango fees."
|
||||
],
|
||||
|
@ -5687,7 +5694,10 @@ export type MangoV4 = {
|
|||
{
|
||||
"name": "openInterest",
|
||||
"docs": [
|
||||
"Number of base lot pairs currently active in the market. Always >= 0."
|
||||
"Number of base lots currently active in the market. Always >= 0.",
|
||||
"",
|
||||
"Since this counts positive base lots and negative base lots, the more relevant",
|
||||
"number of open base lot pairs is half this value."
|
||||
],
|
||||
"type": "i64"
|
||||
},
|
||||
|
@ -9054,6 +9064,50 @@ export type MangoV4 = {
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "WithdrawLoanLog",
|
||||
"fields": [
|
||||
{
|
||||
"name": "mangoGroup",
|
||||
"type": "publicKey",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "mangoAccount",
|
||||
"type": "publicKey",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "tokenIndex",
|
||||
"type": "u16",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "loanAmount",
|
||||
"type": "i128",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "loanOriginationFee",
|
||||
"type": "i128",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "instruction",
|
||||
"type": {
|
||||
"defined": "LoanOriginationFeeInstruction"
|
||||
},
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "price",
|
||||
"type": {
|
||||
"option": "i128"
|
||||
},
|
||||
"index": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TokenLiqBankruptcyLog",
|
||||
"fields": [
|
||||
|
@ -9749,7 +9803,7 @@ export type MangoV4 = {
|
|||
{
|
||||
"code": 6007,
|
||||
"name": "HealthMustBePositiveOrIncrease",
|
||||
"msg": "health must be positive or increase"
|
||||
"msg": "health must be positive or not decrease"
|
||||
},
|
||||
{
|
||||
"code": 6008,
|
||||
|
@ -11867,6 +11921,12 @@ export const IDL: MangoV4 = {
|
|||
"type": {
|
||||
"option": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "nameOpt",
|
||||
"type": {
|
||||
"option": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -12354,7 +12414,8 @@ export const IDL: MangoV4 = {
|
|||
{
|
||||
"name": "serum3SettleFunds",
|
||||
"docs": [
|
||||
"Settles all free funds from the OpenOrders account into the MangoAccount.",
|
||||
"Deprecated instruction that used to settles all free funds from the OpenOrders account",
|
||||
"into the MangoAccount.",
|
||||
"",
|
||||
"Any serum \"referrer rebates\" (ui fees) are considered Mango fees."
|
||||
],
|
||||
|
@ -15648,7 +15709,10 @@ export const IDL: MangoV4 = {
|
|||
{
|
||||
"name": "openInterest",
|
||||
"docs": [
|
||||
"Number of base lot pairs currently active in the market. Always >= 0."
|
||||
"Number of base lots currently active in the market. Always >= 0.",
|
||||
"",
|
||||
"Since this counts positive base lots and negative base lots, the more relevant",
|
||||
"number of open base lot pairs is half this value."
|
||||
],
|
||||
"type": "i64"
|
||||
},
|
||||
|
@ -19015,6 +19079,50 @@ export const IDL: MangoV4 = {
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "WithdrawLoanLog",
|
||||
"fields": [
|
||||
{
|
||||
"name": "mangoGroup",
|
||||
"type": "publicKey",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "mangoAccount",
|
||||
"type": "publicKey",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "tokenIndex",
|
||||
"type": "u16",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "loanAmount",
|
||||
"type": "i128",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "loanOriginationFee",
|
||||
"type": "i128",
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "instruction",
|
||||
"type": {
|
||||
"defined": "LoanOriginationFeeInstruction"
|
||||
},
|
||||
"index": false
|
||||
},
|
||||
{
|
||||
"name": "price",
|
||||
"type": {
|
||||
"option": "i128"
|
||||
},
|
||||
"index": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TokenLiqBankruptcyLog",
|
||||
"fields": [
|
||||
|
@ -19710,7 +19818,7 @@ export const IDL: MangoV4 = {
|
|||
{
|
||||
"code": 6007,
|
||||
"name": "HealthMustBePositiveOrIncrease",
|
||||
"msg": "health must be positive or increase"
|
||||
"msg": "health must be positive or not decrease"
|
||||
},
|
||||
{
|
||||
"code": 6008,
|
||||
|
|
Loading…
Reference in New Issue