Revert "add support for msrm vault for serum3 discounts (#285)"
This reverts commit 0a4f7150d6
.
This commit is contained in:
parent
39ed94aa87
commit
d82608ebee
2
anchor
2
anchor
|
@ -1 +1 @@
|
||||||
Subproject commit fbd238fb7c5a99557faa89620499858cb9806d0e
|
Subproject commit b52f23614601652a99ec6c27aec77bd327363b31
|
|
@ -590,11 +590,6 @@ impl MangoClient {
|
||||||
Serum3Side::Ask => s3.base.mint_info,
|
Serum3Side::Ask => s3.base.mint_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
let group = account_fetcher_fetch_anchor_account::<Group>(
|
|
||||||
&*self.account_fetcher,
|
|
||||||
&self.context.group,
|
|
||||||
)?;
|
|
||||||
|
|
||||||
self.program()
|
self.program()
|
||||||
.request()
|
.request()
|
||||||
.instruction(Instruction {
|
.instruction(Instruction {
|
||||||
|
@ -603,7 +598,6 @@ impl MangoClient {
|
||||||
let mut ams = anchor_lang::ToAccountMetas::to_account_metas(
|
let mut ams = anchor_lang::ToAccountMetas::to_account_metas(
|
||||||
&mango_v4::accounts::Serum3PlaceOrder {
|
&mango_v4::accounts::Serum3PlaceOrder {
|
||||||
group: self.group(),
|
group: self.group(),
|
||||||
msrm_vault: group.msrm_vault,
|
|
||||||
account: self.mango_account_address,
|
account: self.mango_account_address,
|
||||||
open_orders,
|
open_orders,
|
||||||
payer_bank: payer_mint_info.first_bank(),
|
payer_bank: payer_mint_info.first_bank(),
|
||||||
|
|
|
@ -30,18 +30,6 @@ pub struct GroupCreate<'info> {
|
||||||
)]
|
)]
|
||||||
pub insurance_vault: Account<'info, TokenAccount>,
|
pub insurance_vault: Account<'info, TokenAccount>,
|
||||||
|
|
||||||
pub msrm_mint: Account<'info, Mint>,
|
|
||||||
|
|
||||||
#[account(
|
|
||||||
init,
|
|
||||||
seeds = [b"MsrmVault".as_ref(), group.key().as_ref()],
|
|
||||||
bump,
|
|
||||||
token::authority = group,
|
|
||||||
token::mint = msrm_mint,
|
|
||||||
payer = payer
|
|
||||||
)]
|
|
||||||
pub msrm_vault: Account<'info, TokenAccount>,
|
|
||||||
|
|
||||||
#[account(mut)]
|
#[account(mut)]
|
||||||
pub payer: Signer<'info>,
|
pub payer: Signer<'info>,
|
||||||
|
|
||||||
|
@ -66,6 +54,5 @@ pub fn group_create(
|
||||||
group.bump = *ctx.bumps.get("group").ok_or(MangoError::SomeError)?;
|
group.bump = *ctx.bumps.get("group").ok_or(MangoError::SomeError)?;
|
||||||
group.testing = testing;
|
group.testing = testing;
|
||||||
group.version = version;
|
group.version = version;
|
||||||
group.msrm_vault = ctx.accounts.msrm_vault.key();
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
use anchor_lang::prelude::*;
|
|
||||||
use anchor_spl::token::{Mint, Token, TokenAccount};
|
|
||||||
|
|
||||||
use crate::state::*;
|
|
||||||
|
|
||||||
#[derive(Accounts)]
|
|
||||||
pub struct GroupCreateMsrmVault<'info> {
|
|
||||||
#[account(
|
|
||||||
mut,
|
|
||||||
has_one = admin,
|
|
||||||
)]
|
|
||||||
pub group: AccountLoader<'info, Group>,
|
|
||||||
pub admin: Signer<'info>,
|
|
||||||
|
|
||||||
pub msrm_mint: Account<'info, Mint>,
|
|
||||||
|
|
||||||
#[account(
|
|
||||||
init,
|
|
||||||
seeds = [b"MsrmVault".as_ref(), group.key().as_ref()],
|
|
||||||
bump,
|
|
||||||
token::authority = group,
|
|
||||||
token::mint = msrm_mint,
|
|
||||||
payer = payer
|
|
||||||
)]
|
|
||||||
pub msrm_vault: Account<'info, TokenAccount>,
|
|
||||||
|
|
||||||
#[account(mut)]
|
|
||||||
pub payer: Signer<'info>,
|
|
||||||
|
|
||||||
pub token_program: Program<'info, Token>,
|
|
||||||
pub system_program: Program<'info, System>,
|
|
||||||
pub rent: Sysvar<'info, Rent>,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ix only exists to add vaults to groups created before msrm vault integration was done
|
|
||||||
pub fn group_create_msrm_vault(ctx: Context<GroupCreateMsrmVault>) -> Result<()> {
|
|
||||||
let mut group = ctx.accounts.group.load_mut()?;
|
|
||||||
group.msrm_vault = ctx.accounts.msrm_vault.key();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
|
@ -9,7 +9,6 @@ pub use compute_account_data::*;
|
||||||
pub use flash_loan::*;
|
pub use flash_loan::*;
|
||||||
pub use group_close::*;
|
pub use group_close::*;
|
||||||
pub use group_create::*;
|
pub use group_create::*;
|
||||||
pub use group_create_msrm_vault::*;
|
|
||||||
pub use group_edit::*;
|
pub use group_edit::*;
|
||||||
pub use health_region::*;
|
pub use health_region::*;
|
||||||
pub use perp_cancel_all_orders::*;
|
pub use perp_cancel_all_orders::*;
|
||||||
|
@ -62,7 +61,6 @@ mod compute_account_data;
|
||||||
mod flash_loan;
|
mod flash_loan;
|
||||||
mod group_close;
|
mod group_close;
|
||||||
mod group_create;
|
mod group_create;
|
||||||
mod group_create_msrm_vault;
|
|
||||||
mod group_edit;
|
mod group_edit;
|
||||||
mod health_region;
|
mod health_region;
|
||||||
mod perp_cancel_all_orders;
|
mod perp_cancel_all_orders;
|
||||||
|
|
|
@ -133,11 +133,7 @@ pub enum Serum3Side {
|
||||||
|
|
||||||
#[derive(Accounts)]
|
#[derive(Accounts)]
|
||||||
pub struct Serum3PlaceOrder<'info> {
|
pub struct Serum3PlaceOrder<'info> {
|
||||||
#[account(
|
|
||||||
has_one = msrm_vault
|
|
||||||
)]
|
|
||||||
pub group: AccountLoader<'info, Group>,
|
pub group: AccountLoader<'info, Group>,
|
||||||
pub msrm_vault: Account<'info, TokenAccount>,
|
|
||||||
|
|
||||||
#[account(
|
#[account(
|
||||||
mut,
|
mut,
|
||||||
|
@ -496,7 +492,6 @@ fn cpi_place_order(ctx: &Serum3PlaceOrder, order: NewOrderInstructionV3) -> Resu
|
||||||
open_orders: ctx.open_orders.to_account_info(),
|
open_orders: ctx.open_orders.to_account_info(),
|
||||||
order_payer_token_account: ctx.payer_vault.to_account_info(),
|
order_payer_token_account: ctx.payer_vault.to_account_info(),
|
||||||
user_authority: ctx.group.to_account_info(),
|
user_authority: ctx.group.to_account_info(),
|
||||||
msrm_vault: ctx.msrm_vault.to_account_info(),
|
|
||||||
}
|
}
|
||||||
.call(&group, order)
|
.call(&group, order)
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,6 @@ pub mod mango_v4 {
|
||||||
instructions::group_create(ctx, group_num, testing, version)
|
instructions::group_create(ctx, group_num, testing, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn group_create_msrm_vault(ctx: Context<GroupCreateMsrmVault>) -> Result<()> {
|
|
||||||
instructions::group_create_msrm_vault(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn group_edit(
|
pub fn group_edit(
|
||||||
ctx: Context<GroupEdit>,
|
ctx: Context<GroupEdit>,
|
||||||
admin_opt: Option<Pubkey>,
|
admin_opt: Option<Pubkey>,
|
||||||
|
@ -230,10 +226,6 @@ pub mod mango_v4 {
|
||||||
instructions::token_withdraw(ctx, amount, allow_borrow)
|
instructions::token_withdraw(ctx, amount, allow_borrow)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
// pub fn token_deposit_msrm
|
|
||||||
// pub fn token_withdraw_msrm
|
|
||||||
|
|
||||||
pub fn flash_loan_begin<'key, 'accounts, 'remaining, 'info>(
|
pub fn flash_loan_begin<'key, 'accounts, 'remaining, 'info>(
|
||||||
ctx: Context<'key, 'accounts, 'remaining, 'info, FlashLoanBegin<'info>>,
|
ctx: Context<'key, 'accounts, 'remaining, 'info, FlashLoanBegin<'info>>,
|
||||||
loan_amounts: Vec<u64>,
|
loan_amounts: Vec<u64>,
|
||||||
|
|
|
@ -298,8 +298,6 @@ pub struct PlaceOrder<'info> {
|
||||||
/// must cover the open_orders and the order_payer_token_account
|
/// must cover the open_orders and the order_payer_token_account
|
||||||
/// CHECK: cpi
|
/// CHECK: cpi
|
||||||
pub user_authority: AccountInfo<'info>,
|
pub user_authority: AccountInfo<'info>,
|
||||||
/// CHECK: cpi
|
|
||||||
pub msrm_vault: AccountInfo<'info>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PlaceOrder<'a> {
|
impl<'a> PlaceOrder<'a> {
|
||||||
|
@ -325,7 +323,6 @@ impl<'a> PlaceOrder<'a> {
|
||||||
AccountMeta::new(*self.quote_vault.key, false),
|
AccountMeta::new(*self.quote_vault.key, false),
|
||||||
AccountMeta::new_readonly(*self.token_program.key, false),
|
AccountMeta::new_readonly(*self.token_program.key, false),
|
||||||
AccountMeta::new_readonly(*self.user_authority.key, false),
|
AccountMeta::new_readonly(*self.user_authority.key, false),
|
||||||
AccountMeta::new_readonly(*self.msrm_vault.key, false),
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
let account_infos = [
|
let account_infos = [
|
||||||
|
@ -342,7 +339,6 @@ impl<'a> PlaceOrder<'a> {
|
||||||
self.quote_vault,
|
self.quote_vault,
|
||||||
self.token_program,
|
self.token_program,
|
||||||
self.user_authority,
|
self.user_authority,
|
||||||
self.msrm_vault,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
let seeds = group_seeds!(group);
|
let seeds = group_seeds!(group);
|
||||||
|
|
|
@ -35,9 +35,7 @@ pub struct Group {
|
||||||
|
|
||||||
pub address_lookup_tables: [Pubkey; 20],
|
pub address_lookup_tables: [Pubkey; 20],
|
||||||
|
|
||||||
pub msrm_vault: Pubkey,
|
pub reserved: [u8; 1920],
|
||||||
|
|
||||||
pub reserved: [u8; 1888],
|
|
||||||
}
|
}
|
||||||
const_assert_eq!(
|
const_assert_eq!(
|
||||||
size_of::<Group>(),
|
size_of::<Group>(),
|
||||||
|
|
|
@ -1120,7 +1120,6 @@ pub struct GroupCreateInstruction {
|
||||||
pub creator: TestKeypair,
|
pub creator: TestKeypair,
|
||||||
pub payer: TestKeypair,
|
pub payer: TestKeypair,
|
||||||
pub insurance_mint: Pubkey,
|
pub insurance_mint: Pubkey,
|
||||||
pub msrm_mint: Pubkey,
|
|
||||||
}
|
}
|
||||||
#[async_trait::async_trait(?Send)]
|
#[async_trait::async_trait(?Send)]
|
||||||
impl ClientInstruction for GroupCreateInstruction {
|
impl ClientInstruction for GroupCreateInstruction {
|
||||||
|
@ -1153,16 +1152,11 @@ impl ClientInstruction for GroupCreateInstruction {
|
||||||
)
|
)
|
||||||
.0;
|
.0;
|
||||||
|
|
||||||
let msrm_vault =
|
|
||||||
Pubkey::find_program_address(&[b"MsrmVault".as_ref(), group.as_ref()], &program_id).0;
|
|
||||||
|
|
||||||
let accounts = Self::Accounts {
|
let accounts = Self::Accounts {
|
||||||
group,
|
group,
|
||||||
creator: self.creator.pubkey(),
|
creator: self.creator.pubkey(),
|
||||||
insurance_mint: self.insurance_mint,
|
insurance_mint: self.insurance_mint,
|
||||||
insurance_vault,
|
insurance_vault,
|
||||||
msrm_mint: self.msrm_mint,
|
|
||||||
msrm_vault,
|
|
||||||
payer: self.payer.pubkey(),
|
payer: self.payer.pubkey(),
|
||||||
token_program: Token::id(),
|
token_program: Token::id(),
|
||||||
system_program: System::id(),
|
system_program: System::id(),
|
||||||
|
@ -1719,11 +1713,8 @@ impl ClientInstruction for Serum3PlaceOrderInstruction {
|
||||||
Serum3Side::Ask => (base_info.first_bank(), base_info.first_vault()),
|
Serum3Side::Ask => (base_info.first_bank(), base_info.first_vault()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let group: Group = account_loader.load(&account.fixed.group).await.unwrap();
|
|
||||||
|
|
||||||
let accounts = Self::Accounts {
|
let accounts = Self::Accounts {
|
||||||
group: account.fixed.group,
|
group: account.fixed.group,
|
||||||
msrm_vault: group.msrm_vault,
|
|
||||||
account: self.account,
|
account: self.account,
|
||||||
open_orders,
|
open_orders,
|
||||||
payer_bank,
|
payer_bank,
|
||||||
|
|
|
@ -45,7 +45,6 @@ impl<'a> GroupWithTokensConfig {
|
||||||
creator: admin,
|
creator: admin,
|
||||||
payer,
|
payer,
|
||||||
insurance_mint: mints[0].pubkey,
|
insurance_mint: mints[0].pubkey,
|
||||||
msrm_mint: mints[0].pubkey,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -40,7 +40,6 @@ export class Group {
|
||||||
testing: number;
|
testing: number;
|
||||||
version: number;
|
version: number;
|
||||||
addressLookupTables: PublicKey[];
|
addressLookupTables: PublicKey[];
|
||||||
msrmVault: PublicKey;
|
|
||||||
},
|
},
|
||||||
): Group {
|
): Group {
|
||||||
return new Group(
|
return new Group(
|
||||||
|
@ -55,7 +54,6 @@ export class Group {
|
||||||
obj.version,
|
obj.version,
|
||||||
obj.addressLookupTables,
|
obj.addressLookupTables,
|
||||||
[], // addressLookupTablesList
|
[], // addressLookupTablesList
|
||||||
obj.msrmVault,
|
|
||||||
new Map(), // banksMapByName
|
new Map(), // banksMapByName
|
||||||
new Map(), // banksMapByMint
|
new Map(), // banksMapByMint
|
||||||
new Map(), // banksMapByTokenIndex
|
new Map(), // banksMapByTokenIndex
|
||||||
|
@ -83,7 +81,6 @@ export class Group {
|
||||||
public version: number,
|
public version: number,
|
||||||
public addressLookupTables: PublicKey[],
|
public addressLookupTables: PublicKey[],
|
||||||
public addressLookupTablesList: AddressLookupTableAccount[],
|
public addressLookupTablesList: AddressLookupTableAccount[],
|
||||||
public msrmVault: PublicKey,
|
|
||||||
public banksMapByName: Map<string, Bank[]>,
|
public banksMapByName: Map<string, Bank[]>,
|
||||||
public banksMapByMint: Map<string, Bank[]>,
|
public banksMapByMint: Map<string, Bank[]>,
|
||||||
public banksMapByTokenIndex: Map<TokenIndex, Bank[]>,
|
public banksMapByTokenIndex: Map<TokenIndex, Bank[]>,
|
||||||
|
|
|
@ -102,7 +102,6 @@ export class MangoClient {
|
||||||
testing: boolean,
|
testing: boolean,
|
||||||
version: number,
|
version: number,
|
||||||
insuranceMintPk: PublicKey,
|
insuranceMintPk: PublicKey,
|
||||||
msrmMintPk: PublicKey,
|
|
||||||
): Promise<TransactionSignature> {
|
): Promise<TransactionSignature> {
|
||||||
const adminPk = (this.program.provider as AnchorProvider).wallet.publicKey;
|
const adminPk = (this.program.provider as AnchorProvider).wallet.publicKey;
|
||||||
return await this.program.methods
|
return await this.program.methods
|
||||||
|
@ -111,23 +110,6 @@ export class MangoClient {
|
||||||
creator: adminPk,
|
creator: adminPk,
|
||||||
payer: adminPk,
|
payer: adminPk,
|
||||||
insuranceMint: insuranceMintPk,
|
insuranceMint: insuranceMintPk,
|
||||||
msrmMint: msrmMintPk,
|
|
||||||
})
|
|
||||||
.rpc();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async groupCreateMsrmVault(
|
|
||||||
group: Group,
|
|
||||||
msrmMintPk: PublicKey,
|
|
||||||
): Promise<TransactionSignature> {
|
|
||||||
const adminPk = (this.program.provider as AnchorProvider).wallet.publicKey;
|
|
||||||
return await this.program.methods
|
|
||||||
.groupCreateMsrmVault()
|
|
||||||
.accounts({
|
|
||||||
group: group.publicKey,
|
|
||||||
admin: adminPk,
|
|
||||||
msrmMint: msrmMintPk,
|
|
||||||
payer: adminPk,
|
|
||||||
})
|
})
|
||||||
.rpc();
|
.rpc();
|
||||||
}
|
}
|
||||||
|
@ -1186,7 +1168,6 @@ export class MangoClient {
|
||||||
)
|
)
|
||||||
.accounts({
|
.accounts({
|
||||||
group: group.publicKey,
|
group: group.publicKey,
|
||||||
msrmVault: group.msrmVault,
|
|
||||||
account: mangoAccount.publicKey,
|
account: mangoAccount.publicKey,
|
||||||
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
|
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
|
||||||
openOrders: mangoAccount.getSerum3Account(serum3Market.marketIndex)
|
openOrders: mangoAccount.getSerum3Account(serum3Market.marketIndex)
|
||||||
|
|
|
@ -11,9 +11,3 @@ export const MANGO_V4_ID = {
|
||||||
devnet: new PublicKey('m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD'),
|
devnet: new PublicKey('m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD'),
|
||||||
'mainnet-beta': new PublicKey('m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD'),
|
'mainnet-beta': new PublicKey('m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD'),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MSRM_MINTS = {
|
|
||||||
testnet: new PublicKey('3Ho7PN3bYv9bp1JDErBD2FxsRepPkL88vju3oDX9c3Ez'),
|
|
||||||
devnet: new PublicKey('8DJBo4bF4mHNxobjdax3BL9RMh5o71Jf8UiKsf5C5eVH'),
|
|
||||||
'mainnet-beta': new PublicKey('MSRMcoVyrFxnSgo5uXwone5SKcGhT1KEJMFEkMEWf9L'),
|
|
||||||
};
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ import { AnchorProvider, Wallet } from '@project-serum/anchor';
|
||||||
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { MangoClient } from '../client';
|
import { MangoClient } from '../client';
|
||||||
import { MANGO_V4_ID, MSRM_MINTS } from '../constants';
|
import { MANGO_V4_ID } from '../constants';
|
||||||
import { InterestRateParams } from '../types';
|
|
||||||
|
|
||||||
const GROUP_NUM = Number(process.env.GROUP_NUM || 0);
|
const GROUP_NUM = Number(process.env.GROUP_NUM || 0);
|
||||||
|
|
||||||
|
@ -63,7 +62,6 @@ async function createGroup() {
|
||||||
true /* with intention */,
|
true /* with intention */,
|
||||||
0 /* since spot and perp features are not finished */,
|
0 /* since spot and perp features are not finished */,
|
||||||
insuranceMint,
|
insuranceMint,
|
||||||
MSRM_MINTS['mainnet-beta'],
|
|
||||||
);
|
);
|
||||||
const group = await client.getGroupForCreator(admin.publicKey, GROUP_NUM);
|
const group = await client.getGroupForCreator(admin.publicKey, GROUP_NUM);
|
||||||
console.log(`...registered group ${group.publicKey}`);
|
console.log(`...registered group ${group.publicKey}`);
|
||||||
|
|
|
@ -58,30 +58,6 @@ export type MangoV4 = {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "msrmMint",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "msrmVault",
|
|
||||||
"isMut": true,
|
|
||||||
"isSigner": false,
|
|
||||||
"pda": {
|
|
||||||
"seeds": [
|
|
||||||
{
|
|
||||||
"kind": "const",
|
|
||||||
"type": "string",
|
|
||||||
"value": "MsrmVault"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "account",
|
|
||||||
"type": "publicKey",
|
|
||||||
"path": "group"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "payer",
|
"name": "payer",
|
||||||
"isMut": true,
|
"isMut": true,
|
||||||
|
@ -118,66 +94,6 @@ export type MangoV4 = {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "groupCreateMsrmVault",
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"name": "group",
|
|
||||||
"isMut": true,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "msrmMint",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "msrmVault",
|
|
||||||
"isMut": true,
|
|
||||||
"isSigner": false,
|
|
||||||
"pda": {
|
|
||||||
"seeds": [
|
|
||||||
{
|
|
||||||
"kind": "const",
|
|
||||||
"type": "string",
|
|
||||||
"value": "MsrmVault"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "account",
|
|
||||||
"type": "publicKey",
|
|
||||||
"path": "group"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "payer",
|
|
||||||
"isMut": true,
|
|
||||||
"isSigner": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "tokenProgram",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "systemProgram",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rent",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "groupEdit",
|
"name": "groupEdit",
|
||||||
"accounts": [
|
"accounts": [
|
||||||
|
@ -1687,11 +1603,6 @@ export type MangoV4 = {
|
||||||
"isMut": false,
|
"isMut": false,
|
||||||
"isSigner": false
|
"isSigner": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "msrmVault",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "account",
|
"name": "account",
|
||||||
"isMut": true,
|
"isMut": true,
|
||||||
|
@ -3692,16 +3603,12 @@ export type MangoV4 = {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "msrmVault",
|
|
||||||
"type": "publicKey"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "reserved",
|
"name": "reserved",
|
||||||
"type": {
|
"type": {
|
||||||
"array": [
|
"array": [
|
||||||
"u8",
|
"u8",
|
||||||
1888
|
1920
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7024,30 +6931,6 @@ export const IDL: MangoV4 = {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "msrmMint",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "msrmVault",
|
|
||||||
"isMut": true,
|
|
||||||
"isSigner": false,
|
|
||||||
"pda": {
|
|
||||||
"seeds": [
|
|
||||||
{
|
|
||||||
"kind": "const",
|
|
||||||
"type": "string",
|
|
||||||
"value": "MsrmVault"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "account",
|
|
||||||
"type": "publicKey",
|
|
||||||
"path": "group"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "payer",
|
"name": "payer",
|
||||||
"isMut": true,
|
"isMut": true,
|
||||||
|
@ -7084,66 +6967,6 @@ export const IDL: MangoV4 = {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "groupCreateMsrmVault",
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"name": "group",
|
|
||||||
"isMut": true,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "msrmMint",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "msrmVault",
|
|
||||||
"isMut": true,
|
|
||||||
"isSigner": false,
|
|
||||||
"pda": {
|
|
||||||
"seeds": [
|
|
||||||
{
|
|
||||||
"kind": "const",
|
|
||||||
"type": "string",
|
|
||||||
"value": "MsrmVault"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "account",
|
|
||||||
"type": "publicKey",
|
|
||||||
"path": "group"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "payer",
|
|
||||||
"isMut": true,
|
|
||||||
"isSigner": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "tokenProgram",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "systemProgram",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rent",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"args": []
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "groupEdit",
|
"name": "groupEdit",
|
||||||
"accounts": [
|
"accounts": [
|
||||||
|
@ -8653,11 +8476,6 @@ export const IDL: MangoV4 = {
|
||||||
"isMut": false,
|
"isMut": false,
|
||||||
"isSigner": false
|
"isSigner": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "msrmVault",
|
|
||||||
"isMut": false,
|
|
||||||
"isSigner": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "account",
|
"name": "account",
|
||||||
"isMut": true,
|
"isMut": true,
|
||||||
|
@ -10658,16 +10476,12 @@ export const IDL: MangoV4 = {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "msrmVault",
|
|
||||||
"type": "publicKey"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "reserved",
|
"name": "reserved",
|
||||||
"type": {
|
"type": {
|
||||||
"array": [
|
"array": [
|
||||||
"u8",
|
"u8",
|
||||||
1888
|
1920
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
} from '@solana/web3.js';
|
} from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { MangoClient } from '../client';
|
import { MangoClient } from '../client';
|
||||||
import { MANGO_V4_ID, MSRM_MINTS } from '../constants';
|
import { MANGO_V4_ID } from '../constants';
|
||||||
import { buildVersionedTx } from '../utils';
|
import { buildVersionedTx } from '../utils';
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -74,13 +74,7 @@ async function main() {
|
||||||
console.log(`Creating Group...`);
|
console.log(`Creating Group...`);
|
||||||
const insuranceMint = new PublicKey(DEVNET_MINTS.get('USDC')!);
|
const insuranceMint = new PublicKey(DEVNET_MINTS.get('USDC')!);
|
||||||
try {
|
try {
|
||||||
await client.groupCreate(
|
await client.groupCreate(GROUP_NUM, true, 0, insuranceMint);
|
||||||
GROUP_NUM,
|
|
||||||
true,
|
|
||||||
0,
|
|
||||||
insuranceMint,
|
|
||||||
MSRM_MINTS['devnet'],
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
Serum3Side,
|
Serum3Side,
|
||||||
} from '../accounts/serum3';
|
} from '../accounts/serum3';
|
||||||
import { MangoClient } from '../client';
|
import { MangoClient } from '../client';
|
||||||
import { MANGO_V4_ID, MSRM_MINTS } from '../constants';
|
import { MANGO_V4_ID } from '../constants';
|
||||||
import { buildVersionedTx } from '../utils';
|
import { buildVersionedTx } from '../utils';
|
||||||
|
|
||||||
const MAINNET_MINTS = new Map([
|
const MAINNET_MINTS = new Map([
|
||||||
|
@ -110,13 +110,7 @@ async function createGroup() {
|
||||||
|
|
||||||
console.log(`Creating Group...`);
|
console.log(`Creating Group...`);
|
||||||
const insuranceMint = new PublicKey(MAINNET_MINTS.get('USDC')!);
|
const insuranceMint = new PublicKey(MAINNET_MINTS.get('USDC')!);
|
||||||
await client.groupCreate(
|
await client.groupCreate(2, true, 0, insuranceMint);
|
||||||
2,
|
|
||||||
true,
|
|
||||||
0,
|
|
||||||
insuranceMint,
|
|
||||||
MSRM_MINTS['mainnet-beta'],
|
|
||||||
);
|
|
||||||
const group = await client.getGroupForCreator(admin.publicKey, 2);
|
const group = await client.getGroupForCreator(admin.publicKey, 2);
|
||||||
console.log(`...registered group ${group.publicKey}`);
|
console.log(`...registered group ${group.publicKey}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { AnchorProvider, Wallet } from '@project-serum/anchor';
|
||||||
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { MangoClient } from '../client';
|
import { MangoClient } from '../client';
|
||||||
import { MANGO_V4_ID, MSRM_MINTS } from '../constants';
|
import { MANGO_V4_ID } from '../constants';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Script which depoys a new mango group, and registers 3 tokens
|
// Script which depoys a new mango group, and registers 3 tokens
|
||||||
|
@ -60,13 +60,7 @@ async function main() {
|
||||||
console.log(`Creating Group...`);
|
console.log(`Creating Group...`);
|
||||||
try {
|
try {
|
||||||
const insuranceMint = new PublicKey(MAINNET_MINTS.get('USDC')!);
|
const insuranceMint = new PublicKey(MAINNET_MINTS.get('USDC')!);
|
||||||
await client.groupCreate(
|
await client.groupCreate(GROUP_NUM, true, 0, insuranceMint);
|
||||||
GROUP_NUM,
|
|
||||||
true,
|
|
||||||
0,
|
|
||||||
insuranceMint,
|
|
||||||
MSRM_MINTS['mainnet-beta'],
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue