Rename perp instructions to have perp_ prefix
This commit is contained in:
parent
fbc7c5e9d5
commit
10ab9804d1
|
@ -1,13 +1,13 @@
|
|||
pub use self::margin_trade::*;
|
||||
pub use close_account::*;
|
||||
pub use consume_events::*;
|
||||
pub use create_account::*;
|
||||
pub use create_group::*;
|
||||
pub use create_perp_market::*;
|
||||
pub use create_stub_oracle::*;
|
||||
pub use deposit::*;
|
||||
pub use liq_token_with_token::*;
|
||||
pub use place_perp_order::*;
|
||||
pub use perp_consume_events::*;
|
||||
pub use perp_create_market::*;
|
||||
pub use perp_place_order::*;
|
||||
pub use register_token::*;
|
||||
pub use serum3_cancel_order::*;
|
||||
pub use serum3_create_open_orders::*;
|
||||
|
@ -19,15 +19,15 @@ pub use set_stub_oracle::*;
|
|||
pub use withdraw::*;
|
||||
|
||||
mod close_account;
|
||||
mod consume_events;
|
||||
mod create_account;
|
||||
mod create_group;
|
||||
mod create_perp_market;
|
||||
mod create_stub_oracle;
|
||||
mod deposit;
|
||||
mod liq_token_with_token;
|
||||
mod margin_trade;
|
||||
mod place_perp_order;
|
||||
mod perp_consume_events;
|
||||
mod perp_create_market;
|
||||
mod perp_place_order;
|
||||
mod register_token;
|
||||
mod serum3_cancel_order;
|
||||
mod serum3_create_open_orders;
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::{
|
|||
};
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct ConsumeEvents<'info> {
|
||||
pub struct PerpConsumeEvents<'info> {
|
||||
pub group: AccountLoader<'info, Group>,
|
||||
|
||||
#[account(
|
||||
|
@ -23,7 +23,7 @@ pub struct ConsumeEvents<'info> {
|
|||
pub event_queue: AccountLoader<'info, Queue<EventQueueHeader>>,
|
||||
}
|
||||
|
||||
pub fn consume_events(ctx: Context<ConsumeEvents>, limit: usize) -> Result<()> {
|
||||
pub fn perp_consume_events(ctx: Context<PerpConsumeEvents>, limit: usize) -> Result<()> {
|
||||
let limit = std::cmp::min(limit, 8);
|
||||
|
||||
let mut perp_market = ctx.accounts.perp_market.load_mut()?;
|
|
@ -6,7 +6,7 @@ use crate::state::*;
|
|||
|
||||
#[derive(Accounts)]
|
||||
#[instruction(perp_market_index: PerpMarketIndex)]
|
||||
pub struct CreatePerpMarket<'info> {
|
||||
pub struct PerpCreateMarket<'info> {
|
||||
#[account(
|
||||
has_one = admin,
|
||||
)]
|
||||
|
@ -40,8 +40,8 @@ pub struct CreatePerpMarket<'info> {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn create_perp_market(
|
||||
ctx: Context<CreatePerpMarket>,
|
||||
pub fn perp_create_market(
|
||||
ctx: Context<PerpCreateMarket>,
|
||||
perp_market_index: PerpMarketIndex,
|
||||
base_token_index_opt: Option<TokenIndex>,
|
||||
quote_token_index: TokenIndex,
|
|
@ -6,7 +6,7 @@ use crate::state::{
|
|||
};
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct PlacePerpOrder<'info> {
|
||||
pub struct PerpPlaceOrder<'info> {
|
||||
pub group: AccountLoader<'info, Group>,
|
||||
|
||||
#[account(
|
||||
|
@ -39,8 +39,8 @@ pub struct PlacePerpOrder<'info> {
|
|||
|
||||
// TODO
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn place_perp_order(
|
||||
ctx: Context<PlacePerpOrder>,
|
||||
pub fn perp_place_order(
|
||||
ctx: Context<PerpPlaceOrder>,
|
||||
side: Side,
|
||||
price: i64,
|
||||
max_base_quantity: i64,
|
|
@ -149,8 +149,8 @@ pub mod mango_v4 {
|
|||
///
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn create_perp_market(
|
||||
ctx: Context<CreatePerpMarket>,
|
||||
pub fn perp_create_market(
|
||||
ctx: Context<PerpCreateMarket>,
|
||||
perp_market_index: PerpMarketIndex,
|
||||
base_token_index_opt: Option<TokenIndex>,
|
||||
quote_token_index: TokenIndex,
|
||||
|
@ -164,7 +164,7 @@ pub mod mango_v4 {
|
|||
maker_fee: f32,
|
||||
taker_fee: f32,
|
||||
) -> Result<()> {
|
||||
instructions::create_perp_market(
|
||||
instructions::perp_create_market(
|
||||
ctx,
|
||||
perp_market_index,
|
||||
base_token_index_opt,
|
||||
|
@ -182,8 +182,8 @@ pub mod mango_v4 {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn place_perp_order(
|
||||
ctx: Context<PlacePerpOrder>,
|
||||
pub fn perp_place_order(
|
||||
ctx: Context<PerpPlaceOrder>,
|
||||
side: Side,
|
||||
price: i64,
|
||||
max_base_quantity: i64,
|
||||
|
@ -193,7 +193,7 @@ pub mod mango_v4 {
|
|||
expiry_timestamp: u64,
|
||||
limit: u8,
|
||||
) -> Result<()> {
|
||||
instructions::place_perp_order(
|
||||
instructions::perp_place_order(
|
||||
ctx,
|
||||
side,
|
||||
price,
|
||||
|
@ -206,8 +206,8 @@ pub mod mango_v4 {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn consume_events(ctx: Context<ConsumeEvents>, limit: usize) -> Result<()> {
|
||||
instructions::consume_events(ctx, limit)
|
||||
pub fn perp_consume_events(ctx: Context<PerpConsumeEvents>, limit: usize) -> Result<()> {
|
||||
instructions::perp_consume_events(ctx, limit)
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
@ -1233,7 +1233,7 @@ impl<'keypair> ClientInstruction for LiqTokenWithTokenInstruction<'keypair> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct CreatePerpMarketInstruction<'keypair> {
|
||||
pub struct PerpCreateMarketInstruction<'keypair> {
|
||||
pub group: Pubkey,
|
||||
pub admin: &'keypair Keypair,
|
||||
pub oracle: Pubkey,
|
||||
|
@ -1255,9 +1255,9 @@ pub struct CreatePerpMarketInstruction<'keypair> {
|
|||
pub taker_fee: f32,
|
||||
}
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl<'keypair> ClientInstruction for CreatePerpMarketInstruction<'keypair> {
|
||||
type Accounts = mango_v4::accounts::CreatePerpMarket;
|
||||
type Instruction = mango_v4::instruction::CreatePerpMarket;
|
||||
impl<'keypair> ClientInstruction for PerpCreateMarketInstruction<'keypair> {
|
||||
type Accounts = mango_v4::accounts::PerpCreateMarket;
|
||||
type Instruction = mango_v4::instruction::PerpCreateMarket;
|
||||
async fn to_instruction(
|
||||
&self,
|
||||
_loader: impl ClientAccountLoader + 'async_trait,
|
||||
|
@ -1309,7 +1309,7 @@ impl<'keypair> ClientInstruction for CreatePerpMarketInstruction<'keypair> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct PlacePerpOrderInstruction<'keypair> {
|
||||
pub struct PerpPlaceOrderInstruction<'keypair> {
|
||||
pub group: Pubkey,
|
||||
pub account: Pubkey,
|
||||
pub perp_market: Pubkey,
|
||||
|
@ -1323,9 +1323,9 @@ pub struct PlacePerpOrderInstruction<'keypair> {
|
|||
pub quantity: i64,
|
||||
}
|
||||
#[async_trait::async_trait(?Send)]
|
||||
impl<'keypair> ClientInstruction for PlacePerpOrderInstruction<'keypair> {
|
||||
type Accounts = mango_v4::accounts::PlacePerpOrder;
|
||||
type Instruction = mango_v4::instruction::PlacePerpOrder;
|
||||
impl<'keypair> ClientInstruction for PerpPlaceOrderInstruction<'keypair> {
|
||||
type Accounts = mango_v4::accounts::PerpPlaceOrder;
|
||||
type Instruction = mango_v4::instruction::PerpPlaceOrder;
|
||||
async fn to_instruction(
|
||||
&self,
|
||||
_loader: impl ClientAccountLoader + 'async_trait,
|
||||
|
|
|
@ -79,7 +79,7 @@ async fn test_perp() -> Result<(), TransportError> {
|
|||
//
|
||||
// TEST: Create a perp market
|
||||
//
|
||||
let mango_v4::accounts::CreatePerpMarket {
|
||||
let mango_v4::accounts::PerpCreateMarket {
|
||||
perp_market,
|
||||
asks,
|
||||
bids,
|
||||
|
@ -87,7 +87,7 @@ async fn test_perp() -> Result<(), TransportError> {
|
|||
..
|
||||
} = send_tx(
|
||||
solana,
|
||||
CreatePerpMarketInstruction {
|
||||
PerpCreateMarketInstruction {
|
||||
group,
|
||||
admin,
|
||||
oracle: tokens[0].oracle,
|
||||
|
@ -125,7 +125,7 @@ async fn test_perp() -> Result<(), TransportError> {
|
|||
|
||||
send_tx(
|
||||
solana,
|
||||
PlacePerpOrderInstruction {
|
||||
PerpPlaceOrderInstruction {
|
||||
group,
|
||||
account,
|
||||
perp_market,
|
||||
|
@ -144,7 +144,7 @@ async fn test_perp() -> Result<(), TransportError> {
|
|||
|
||||
send_tx(
|
||||
solana,
|
||||
PlacePerpOrderInstruction {
|
||||
PerpPlaceOrderInstruction {
|
||||
group,
|
||||
account,
|
||||
perp_market,
|
||||
|
|
|
@ -20,7 +20,7 @@ solana --url https://mango.devnet.rpcpool.com program deploy --program-id $PROGR
|
|||
-k $WALLET_WITH_FUNDS target/deploy/mango_v4.so
|
||||
|
||||
# publish idl
|
||||
anchor idl init --provider.cluster https://mango.devnet.rpcpool.com --provider.wallet $WALLET_WITH_FUNDS \
|
||||
anchor idl upgrade --provider.cluster https://mango.devnet.rpcpool.com --provider.wallet $WALLET_WITH_FUNDS \
|
||||
--filepath target/idl/mango_v4.json $PROGRAM_ID
|
||||
|
||||
# build npm package
|
||||
|
|
792
ts/mango_v4.ts
792
ts/mango_v4.ts
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue