update program, and deploy to devnet

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-03-30 17:16:32 +02:00
parent faba5c47bf
commit 795fa532da
5 changed files with 648 additions and 113 deletions

View File

@ -1,5 +1,5 @@
[programs.localnet]
mango_v4 = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
mango_v4 = "m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD"
[features]
seeds = true

View File

@ -17,7 +17,7 @@ pub mod state;
use state::{OrderType, PerpMarketIndex, Serum3MarketIndex, Side, TokenIndex};
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
declare_id!("m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD");
#[program]
pub mod mango_v4 {

View File

@ -22,7 +22,7 @@ yarn clean && yarn build && cp package.json ./dist/
# # update on chain program and IDL, atm used for testing/developing
# anchor deploy --provider.cluster devnet --provider.wallet ${PROVIDER_WALLET}
# anchor idl upgrade --provider.cluster devnet --provider.wallet ${PROVIDER_WALLET}\
# --filepath target/idl/voter_stake_registry.json Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
# --filepath target/idl/voter_stake_registry.json m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD
# # publish the npm package

View File

@ -3,14 +3,11 @@ import { PublicKey } from '@solana/web3.js';
import { MangoV4, IDL } from './mango_v4';
export const MANGO_V4_ID = new PublicKey(
'Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS',
'm43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD',
);
export class MangoClient {
constructor(
public program: Program<MangoV4>,
public devnet?: boolean,
) {}
constructor(public program: Program<MangoV4>, public devnet?: boolean) {}
static async connect(
provider: Provider,
@ -21,11 +18,7 @@ export class MangoClient {
const idl = IDL;
return new MangoClient(
new Program<MangoV4>(
idl as MangoV4,
MANGO_V4_ID,
provider,
),
new Program<MangoV4>(idl as MangoV4, MANGO_V4_ID, provider),
devnet,
);
}

View File

@ -195,6 +195,10 @@ export type MangoV4 = {
{
"name": "initLiabWeight",
"type": "f32"
},
{
"name": "liquidationFee",
"type": "f32"
}
]
},
@ -499,6 +503,16 @@ export type MangoV4 = {
]
}
},
{
"name": "quoteBank",
"isMut": false,
"isSigner": false
},
{
"name": "baseBank",
"isMut": false,
"isSigner": false
},
{
"name": "payer",
"isMut": true,
@ -516,18 +530,6 @@ export type MangoV4 = {
"type": {
"defined": "Serum3MarketIndex"
}
},
{
"name": "baseTokenIndex",
"type": {
"defined": "TokenIndex"
}
},
{
"name": "quoteTokenIndex",
"type": {
"defined": "TokenIndex"
}
}
]
},
@ -954,6 +956,51 @@ export type MangoV4 = {
}
]
},
{
"name": "liqTokenWithToken",
"accounts": [
{
"name": "group",
"isMut": false,
"isSigner": false
},
{
"name": "liqor",
"isMut": true,
"isSigner": false
},
{
"name": "liqorOwner",
"isMut": false,
"isSigner": true
},
{
"name": "liqee",
"isMut": true,
"isSigner": false
}
],
"args": [
{
"name": "assetTokenIndex",
"type": {
"defined": "TokenIndex"
}
},
{
"name": "liabTokenIndex",
"type": {
"defined": "TokenIndex"
}
},
{
"name": "maxLiabTransfer",
"type": {
"defined": "I80F48"
}
}
]
},
{
"name": "createPerpMarket",
"accounts": [
@ -1010,7 +1057,7 @@ export type MangoV4 = {
},
{
"name": "eventQueue",
"isMut": false,
"isMut": true,
"isSigner": false
},
{
@ -1052,6 +1099,34 @@ export type MangoV4 = {
{
"name": "baseLotSize",
"type": "i64"
},
{
"name": "maintAssetWeight",
"type": "f32"
},
{
"name": "initAssetWeight",
"type": "f32"
},
{
"name": "maintLiabWeight",
"type": "f32"
},
{
"name": "initLiabWeight",
"type": "f32"
},
{
"name": "liquidationFee",
"type": "f32"
},
{
"name": "makerFee",
"type": "f32"
},
{
"name": "takerFee",
"type": "f32"
}
]
},
@ -1085,7 +1160,7 @@ export type MangoV4 = {
},
{
"name": "eventQueue",
"isMut": false,
"isMut": true,
"isSigner": false
},
{
@ -1100,6 +1175,12 @@ export type MangoV4 = {
}
],
"args": [
{
"name": "side",
"type": {
"defined": "Side"
}
},
{
"name": "price",
"type": "i64"
@ -1131,6 +1212,39 @@ export type MangoV4 = {
"type": "u8"
}
]
},
{
"name": "consumeEvents",
"accounts": [
{
"name": "group",
"isMut": false,
"isSigner": false
},
{
"name": "perpMarket",
"isMut": true,
"isSigner": false
},
{
"name": "eventQueue",
"isMut": true,
"isSigner": false
}
],
"args": [
{
"name": "limit",
"type": {
"defined": "usize"
}
}
]
},
{
"name": "benchmark",
"accounts": [],
"args": []
}
],
"accounts": [
@ -1203,6 +1317,12 @@ export type MangoV4 = {
"defined": "I80F48"
}
},
{
"name": "liquidationFee",
"type": {
"defined": "I80F48"
}
},
{
"name": "dust",
"type": {
@ -1318,6 +1438,52 @@ export type MangoV4 = {
"defined": "Serum3AccountMap"
}
},
{
"name": "perpAccountMap",
"type": {
"defined": "PerpAccountMap"
}
},
{
"name": "orderMarket",
"type": {
"array": [
{
"defined": "PerpMarketIndex"
},
8
]
}
},
{
"name": "orderSide",
"type": {
"array": [
{
"defined": "Side"
},
8
]
}
},
{
"name": "orders",
"type": {
"array": [
"i128",
8
]
}
},
{
"name": "clientOrderIds",
"type": {
"array": [
"u64",
8
]
}
},
{
"name": "beingLiquidated",
"type": "bool"
@ -1439,10 +1605,62 @@ export type MangoV4 = {
"name": "baseLotSize",
"type": "i64"
},
{
"name": "maintAssetWeight",
"type": {
"defined": "I80F48"
}
},
{
"name": "initAssetWeight",
"type": {
"defined": "I80F48"
}
},
{
"name": "maintLiabWeight",
"type": {
"defined": "I80F48"
}
},
{
"name": "initLiabWeight",
"type": {
"defined": "I80F48"
}
},
{
"name": "liquidationFee",
"type": {
"defined": "I80F48"
}
},
{
"name": "makerFee",
"type": {
"defined": "I80F48"
}
},
{
"name": "takerFee",
"type": {
"defined": "I80F48"
}
},
{
"name": "openInterest",
"type": "i64"
},
{
"name": "seqNum",
"type": "u64"
},
{
"name": "feesAccrued",
"type": {
"defined": "I80F48"
}
},
{
"name": "bump",
"type": "u8"
@ -1469,16 +1687,35 @@ export type MangoV4 = {
}
},
{
"name": "eventQueueHeader",
"name": "queue",
"type": {
"kind": "struct",
"fields": [
{
"name": "metaData",
"name": "header",
"type": {
"defined": "MetaData"
"defined": "H"
}
},
{
"name": "buf",
"type": {
"array": [
{
"defined": "H::Item"
},
512
]
}
}
]
}
},
{
"name": "eventQueueHeader",
"type": {
"kind": "struct",
"fields": [
{
"name": "head",
"type": {
@ -1636,6 +1873,65 @@ export type MangoV4 = {
]
}
},
{
"name": "PerpAccount",
"type": {
"kind": "struct",
"fields": [
{
"name": "marketIndex",
"type": {
"defined": "PerpMarketIndex"
}
},
{
"name": "basePosition",
"type": "i64"
},
{
"name": "quotePosition",
"type": {
"defined": "I80F48"
}
},
{
"name": "bidsQuantity",
"type": "i64"
},
{
"name": "asksQuantity",
"type": "i64"
},
{
"name": "takerBase",
"type": "i64"
},
{
"name": "takerQuote",
"type": "i64"
}
]
}
},
{
"name": "PerpAccountMap",
"type": {
"kind": "struct",
"fields": [
{
"name": "values",
"type": {
"array": [
{
"defined": "PerpAccount"
},
8
]
}
}
]
}
},
{
"name": "BookSideType",
"type": {
@ -1651,45 +1947,15 @@ export type MangoV4 = {
}
},
{
"name": "DataType",
"name": "HealthType",
"type": {
"kind": "enum",
"variants": [
{
"name": "MangoGroup"
"name": "Init"
},
{
"name": "MangoAccount"
},
{
"name": "RootBank"
},
{
"name": "NodeBank"
},
{
"name": "PerpMarket"
},
{
"name": "Bids"
},
{
"name": "Asks"
},
{
"name": "MangoCache"
},
{
"name": "EventQueue"
},
{
"name": "AdvancedOrders"
},
{
"name": "ReferrerMemory"
},
{
"name": "ReferrerIdRecord"
"name": "Maint"
}
]
}
@ -1907,6 +2173,11 @@ export type MangoV4 = {
"code": 6005,
"name": "HealthMustBePositive",
"msg": ""
},
{
"code": 6006,
"name": "IsBankrupt",
"msg": "The account is bankrupt"
}
]
};
@ -2108,6 +2379,10 @@ export const IDL: MangoV4 = {
{
"name": "initLiabWeight",
"type": "f32"
},
{
"name": "liquidationFee",
"type": "f32"
}
]
},
@ -2412,6 +2687,16 @@ export const IDL: MangoV4 = {
]
}
},
{
"name": "quoteBank",
"isMut": false,
"isSigner": false
},
{
"name": "baseBank",
"isMut": false,
"isSigner": false
},
{
"name": "payer",
"isMut": true,
@ -2429,18 +2714,6 @@ export const IDL: MangoV4 = {
"type": {
"defined": "Serum3MarketIndex"
}
},
{
"name": "baseTokenIndex",
"type": {
"defined": "TokenIndex"
}
},
{
"name": "quoteTokenIndex",
"type": {
"defined": "TokenIndex"
}
}
]
},
@ -2867,6 +3140,51 @@ export const IDL: MangoV4 = {
}
]
},
{
"name": "liqTokenWithToken",
"accounts": [
{
"name": "group",
"isMut": false,
"isSigner": false
},
{
"name": "liqor",
"isMut": true,
"isSigner": false
},
{
"name": "liqorOwner",
"isMut": false,
"isSigner": true
},
{
"name": "liqee",
"isMut": true,
"isSigner": false
}
],
"args": [
{
"name": "assetTokenIndex",
"type": {
"defined": "TokenIndex"
}
},
{
"name": "liabTokenIndex",
"type": {
"defined": "TokenIndex"
}
},
{
"name": "maxLiabTransfer",
"type": {
"defined": "I80F48"
}
}
]
},
{
"name": "createPerpMarket",
"accounts": [
@ -2923,7 +3241,7 @@ export const IDL: MangoV4 = {
},
{
"name": "eventQueue",
"isMut": false,
"isMut": true,
"isSigner": false
},
{
@ -2965,6 +3283,34 @@ export const IDL: MangoV4 = {
{
"name": "baseLotSize",
"type": "i64"
},
{
"name": "maintAssetWeight",
"type": "f32"
},
{
"name": "initAssetWeight",
"type": "f32"
},
{
"name": "maintLiabWeight",
"type": "f32"
},
{
"name": "initLiabWeight",
"type": "f32"
},
{
"name": "liquidationFee",
"type": "f32"
},
{
"name": "makerFee",
"type": "f32"
},
{
"name": "takerFee",
"type": "f32"
}
]
},
@ -2998,7 +3344,7 @@ export const IDL: MangoV4 = {
},
{
"name": "eventQueue",
"isMut": false,
"isMut": true,
"isSigner": false
},
{
@ -3013,6 +3359,12 @@ export const IDL: MangoV4 = {
}
],
"args": [
{
"name": "side",
"type": {
"defined": "Side"
}
},
{
"name": "price",
"type": "i64"
@ -3044,6 +3396,39 @@ export const IDL: MangoV4 = {
"type": "u8"
}
]
},
{
"name": "consumeEvents",
"accounts": [
{
"name": "group",
"isMut": false,
"isSigner": false
},
{
"name": "perpMarket",
"isMut": true,
"isSigner": false
},
{
"name": "eventQueue",
"isMut": true,
"isSigner": false
}
],
"args": [
{
"name": "limit",
"type": {
"defined": "usize"
}
}
]
},
{
"name": "benchmark",
"accounts": [],
"args": []
}
],
"accounts": [
@ -3116,6 +3501,12 @@ export const IDL: MangoV4 = {
"defined": "I80F48"
}
},
{
"name": "liquidationFee",
"type": {
"defined": "I80F48"
}
},
{
"name": "dust",
"type": {
@ -3231,6 +3622,52 @@ export const IDL: MangoV4 = {
"defined": "Serum3AccountMap"
}
},
{
"name": "perpAccountMap",
"type": {
"defined": "PerpAccountMap"
}
},
{
"name": "orderMarket",
"type": {
"array": [
{
"defined": "PerpMarketIndex"
},
8
]
}
},
{
"name": "orderSide",
"type": {
"array": [
{
"defined": "Side"
},
8
]
}
},
{
"name": "orders",
"type": {
"array": [
"i128",
8
]
}
},
{
"name": "clientOrderIds",
"type": {
"array": [
"u64",
8
]
}
},
{
"name": "beingLiquidated",
"type": "bool"
@ -3352,10 +3789,62 @@ export const IDL: MangoV4 = {
"name": "baseLotSize",
"type": "i64"
},
{
"name": "maintAssetWeight",
"type": {
"defined": "I80F48"
}
},
{
"name": "initAssetWeight",
"type": {
"defined": "I80F48"
}
},
{
"name": "maintLiabWeight",
"type": {
"defined": "I80F48"
}
},
{
"name": "initLiabWeight",
"type": {
"defined": "I80F48"
}
},
{
"name": "liquidationFee",
"type": {
"defined": "I80F48"
}
},
{
"name": "makerFee",
"type": {
"defined": "I80F48"
}
},
{
"name": "takerFee",
"type": {
"defined": "I80F48"
}
},
{
"name": "openInterest",
"type": "i64"
},
{
"name": "seqNum",
"type": "u64"
},
{
"name": "feesAccrued",
"type": {
"defined": "I80F48"
}
},
{
"name": "bump",
"type": "u8"
@ -3382,16 +3871,35 @@ export const IDL: MangoV4 = {
}
},
{
"name": "eventQueueHeader",
"name": "queue",
"type": {
"kind": "struct",
"fields": [
{
"name": "metaData",
"name": "header",
"type": {
"defined": "MetaData"
"defined": "H"
}
},
{
"name": "buf",
"type": {
"array": [
{
"defined": "H::Item"
},
512
]
}
}
]
}
},
{
"name": "eventQueueHeader",
"type": {
"kind": "struct",
"fields": [
{
"name": "head",
"type": {
@ -3549,6 +4057,65 @@ export const IDL: MangoV4 = {
]
}
},
{
"name": "PerpAccount",
"type": {
"kind": "struct",
"fields": [
{
"name": "marketIndex",
"type": {
"defined": "PerpMarketIndex"
}
},
{
"name": "basePosition",
"type": "i64"
},
{
"name": "quotePosition",
"type": {
"defined": "I80F48"
}
},
{
"name": "bidsQuantity",
"type": "i64"
},
{
"name": "asksQuantity",
"type": "i64"
},
{
"name": "takerBase",
"type": "i64"
},
{
"name": "takerQuote",
"type": "i64"
}
]
}
},
{
"name": "PerpAccountMap",
"type": {
"kind": "struct",
"fields": [
{
"name": "values",
"type": {
"array": [
{
"defined": "PerpAccount"
},
8
]
}
}
]
}
},
{
"name": "BookSideType",
"type": {
@ -3564,45 +4131,15 @@ export const IDL: MangoV4 = {
}
},
{
"name": "DataType",
"name": "HealthType",
"type": {
"kind": "enum",
"variants": [
{
"name": "MangoGroup"
"name": "Init"
},
{
"name": "MangoAccount"
},
{
"name": "RootBank"
},
{
"name": "NodeBank"
},
{
"name": "PerpMarket"
},
{
"name": "Bids"
},
{
"name": "Asks"
},
{
"name": "MangoCache"
},
{
"name": "EventQueue"
},
{
"name": "AdvancedOrders"
},
{
"name": "ReferrerMemory"
},
{
"name": "ReferrerIdRecord"
"name": "Maint"
}
]
}
@ -3820,6 +4357,11 @@ export const IDL: MangoV4 = {
"code": 6005,
"name": "HealthMustBePositive",
"msg": ""
},
{
"code": 6006,
"name": "IsBankrupt",
"msg": "The account is bankrupt"
}
]
};