Update client to match program changes

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-05-17 15:06:29 +02:00
parent f19f3da659
commit 2518ec24a6
6 changed files with 956 additions and 492 deletions

View File

@ -1,6 +1,5 @@
use anchor_lang::prelude::*;
use fixed::types::I80F48;
use fixed_macro::types::I80F48;
use crate::error::MangoError;
use crate::state::*;
@ -57,8 +56,8 @@ pub fn perp_create_market(
liquidation_fee: f32,
maker_fee: f32,
taker_fee: f32,
max_funding: f32,
min_funding: f32,
max_funding: f32,
impact_quantity: i64,
) -> Result<()> {
let mut perp_market = ctx.accounts.perp_market.load_init()?;
@ -78,8 +77,8 @@ pub fn perp_create_market(
liquidation_fee: I80F48::from_num(liquidation_fee),
maker_fee: I80F48::from_num(maker_fee),
taker_fee: I80F48::from_num(taker_fee),
max_funding: I80F48::from_num(max_funding),
min_funding: I80F48::from_num(min_funding),
max_funding: I80F48::from_num(max_funding),
long_funding: I80F48::ZERO,
short_funding: I80F48::ZERO,
funding_last_updated: Clock::get()?.unix_timestamp,

View File

@ -205,8 +205,8 @@ pub mod mango_v4 {
liquidation_fee: f32,
maker_fee: f32,
taker_fee: f32,
max_funding: f32,
min_funding: f32,
max_funding: f32,
impact_quantity: i64,
) -> Result<()> {
instructions::perp_create_market(

View File

@ -47,12 +47,12 @@ pub struct PerpMarket {
pub maker_fee: I80F48,
pub taker_fee: I80F48,
pub max_funding: I80F48,
pub min_funding: I80F48,
pub max_funding: I80F48,
pub impact_quantity: i64,
pub long_funding: I80F48,
pub short_funding: I80F48,
pub funding_last_updated: i64,
pub impact_quantity: i64,
///
pub open_interest: i64,

View File

@ -642,6 +642,9 @@ export class MangoClient {
liquidationFee: number,
makerFee: number,
takerFee: number,
minFunding: number,
maxFunding: number,
impactQuantity: number,
): Promise<TransactionSignature> {
const bids = new Keypair();
const asks = new Keypair();
@ -664,6 +667,9 @@ export class MangoClient {
liquidationFee,
makerFee,
takerFee,
minFunding,
maxFunding,
new BN(impactQuantity),
)
.accounts({
group: group.publicKey,

File diff suppressed because it is too large Load Diff

View File

@ -155,6 +155,9 @@ async function main() {
0.012,
0.0002,
0.0,
0.05,
0.05,
100,
);
} catch (error) {
console.log(error);