@symmetry-hq/temp-v3-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/idl/idl.d.ts +8 -0
- package/dist/idl/idl.js +4958 -0
- package/dist/idl/types.d.ts +4955 -0
- package/dist/idl/types.js +2 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +60 -0
- package/dist/layouts/basket.d.ts +42 -0
- package/dist/layouts/basket.js +43 -0
- package/dist/layouts/config.d.ts +97 -0
- package/dist/layouts/config.js +102 -0
- package/dist/layouts/fraction.d.ts +6 -0
- package/dist/layouts/fraction.js +9 -0
- package/dist/layouts/oracle.d.ts +36 -0
- package/dist/layouts/oracle.js +37 -0
- package/dist/src/constants.d.ts +15 -0
- package/dist/src/constants.js +19 -0
- package/dist/src/idl/idl.d.ts +8 -0
- package/dist/src/idl/idl.js +4958 -0
- package/dist/src/idl/types.d.ts +4955 -0
- package/dist/src/idl/types.js +2 -0
- package/dist/src/index.d.ts +53 -0
- package/dist/src/index.js +199 -0
- package/dist/src/instructions/accounts.d.ts +27 -0
- package/dist/src/instructions/accounts.js +110 -0
- package/dist/src/instructions/auction.d.ts +7 -0
- package/dist/src/instructions/auction.js +43 -0
- package/dist/src/instructions/automation/auction.d.ts +6 -0
- package/dist/src/instructions/automation/auction.js +40 -0
- package/dist/src/instructions/automation/claimBounty.d.ts +12 -0
- package/dist/src/instructions/automation/claimBounty.js +44 -0
- package/dist/src/instructions/automation/priceUpdate.d.ts +15 -0
- package/dist/src/instructions/automation/priceUpdate.js +47 -0
- package/dist/src/instructions/automation/rebalanceSwap.d.ts +10 -0
- package/dist/src/instructions/automation/rebalanceSwap.js +42 -0
- package/dist/src/instructions/basket.d.ts +120 -0
- package/dist/src/instructions/basket.js +622 -0
- package/dist/src/instructions/bounty.d.ts +18 -0
- package/dist/src/instructions/bounty.js +81 -0
- package/dist/src/instructions/fee.d.ts +8 -0
- package/dist/src/instructions/fee.js +46 -0
- package/dist/src/instructions/globalConfig.d.ts +11 -0
- package/dist/src/instructions/globalConfig.js +43 -0
- package/dist/src/instructions/luts.d.ts +33 -0
- package/dist/src/instructions/luts.js +91 -0
- package/dist/src/instructions/management/addBounty.d.ts +7 -0
- package/dist/src/instructions/management/addBounty.js +39 -0
- package/dist/src/instructions/management/admin.d.ts +9 -0
- package/dist/src/instructions/management/admin.js +43 -0
- package/dist/src/instructions/management/claimFees.d.ts +7 -0
- package/dist/src/instructions/management/claimFees.js +47 -0
- package/dist/src/instructions/management/createBasket.d.ts +22 -0
- package/dist/src/instructions/management/createBasket.js +101 -0
- package/dist/src/instructions/management/edit.d.ts +34 -0
- package/dist/src/instructions/management/edit.js +192 -0
- package/dist/src/instructions/management/luts.d.ts +29 -0
- package/dist/src/instructions/management/luts.js +88 -0
- package/dist/src/instructions/pda.d.ts +26 -0
- package/dist/src/instructions/pda.js +110 -0
- package/dist/src/instructions/price.d.ts +17 -0
- package/dist/src/instructions/price.js +47 -0
- package/dist/src/instructions/user/deposit.d.ts +32 -0
- package/dist/src/instructions/user/deposit.js +168 -0
- package/dist/src/instructions/user/withdraw.d.ts +16 -0
- package/dist/src/instructions/user/withdraw.js +82 -0
- package/dist/src/layouts/basket.d.ts +41 -0
- package/dist/src/layouts/basket.js +43 -0
- package/dist/src/layouts/config.d.ts +133 -0
- package/dist/src/layouts/config.js +137 -0
- package/dist/src/layouts/fraction.d.ts +6 -0
- package/dist/src/layouts/fraction.js +9 -0
- package/dist/src/layouts/intents/bounty.d.ts +18 -0
- package/dist/src/layouts/intents/bounty.js +19 -0
- package/dist/src/layouts/intents/intent.d.ts +101 -0
- package/dist/src/layouts/intents/intent.js +113 -0
- package/dist/src/layouts/intents/rebalanceIntent.d.ts +56 -0
- package/dist/src/layouts/intents/rebalanceIntent.js +63 -0
- package/dist/src/layouts/lookupTable.d.ts +7 -0
- package/dist/src/layouts/lookupTable.js +10 -0
- package/dist/src/layouts/oracle.d.ts +42 -0
- package/dist/src/layouts/oracle.js +43 -0
- package/dist/src/states/basket.d.ts +8 -0
- package/dist/src/states/basket.js +54 -0
- package/dist/src/states/intents/intent.d.ts +14 -0
- package/dist/src/states/intents/intent.js +90 -0
- package/dist/src/states/intents/rebalanceIntent.d.ts +8 -0
- package/dist/src/states/intents/rebalanceIntent.js +54 -0
- package/dist/src/states/oracles/clmm_oracle.d.ts +178 -0
- package/dist/src/states/oracles/clmm_oracle.js +546 -0
- package/dist/src/states/oracles/constants.d.ts +8 -0
- package/dist/src/states/oracles/constants.js +12 -0
- package/dist/src/states/oracles/oracle.d.ts +60 -0
- package/dist/src/states/oracles/oracle.js +237 -0
- package/dist/src/states/oracles/pythOracle.d.ts +39 -0
- package/dist/src/states/oracles/pythOracle.js +202 -0
- package/dist/src/states/oracles/pyth_oracle.d.ts +39 -0
- package/dist/src/states/oracles/pyth_oracle.js +202 -0
- package/dist/src/states/oracles/raydiumClmmOracle.d.ts +178 -0
- package/dist/src/states/oracles/raydiumClmmOracle.js +546 -0
- package/dist/src/states/oracles/raydiumCpmmOracle.d.ts +139 -0
- package/dist/src/states/oracles/raydiumCpmmOracle.js +420 -0
- package/dist/src/states/oracles/raydium_cpmm_oracle.d.ts +139 -0
- package/dist/src/states/oracles/raydium_cpmm_oracle.js +420 -0
- package/dist/src/states/oracles/switchboardOracle.d.ts +0 -0
- package/dist/src/states/oracles/switchboardOracle.js +1 -0
- package/dist/src/states/oracles/switchboard_oracle.d.ts +0 -0
- package/dist/src/states/oracles/switchboard_oracle.js +1 -0
- package/dist/src/txUtils.d.ts +26 -0
- package/dist/src/txUtils.js +183 -0
- package/dist/states/basket.d.ts +8 -0
- package/dist/states/basket.js +57 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +39 -0
- package/package.json +30 -0
- package/src/constants.ts +24 -0
- package/src/index.ts +260 -0
- package/src/instructions/automation/auction.ts +55 -0
- package/src/instructions/automation/claimBounty.ts +69 -0
- package/src/instructions/automation/priceUpdate.ts +73 -0
- package/src/instructions/automation/rebalanceSwap.ts +60 -0
- package/src/instructions/management/addBounty.ts +56 -0
- package/src/instructions/management/admin.ts +65 -0
- package/src/instructions/management/claimFees.ts +59 -0
- package/src/instructions/management/createBasket.ts +148 -0
- package/src/instructions/management/edit.ts +255 -0
- package/src/instructions/management/luts.ts +134 -0
- package/src/instructions/pda.ts +160 -0
- package/src/instructions/user/deposit.ts +237 -0
- package/src/instructions/user/withdraw.ts +130 -0
- package/src/layouts/basket.ts +82 -0
- package/src/layouts/config.ts +301 -0
- package/src/layouts/fraction.ts +12 -0
- package/src/layouts/intents/bounty.ts +35 -0
- package/src/layouts/intents/intent.ts +204 -0
- package/src/layouts/intents/rebalanceIntent.ts +111 -0
- package/src/layouts/lookupTable.ts +14 -0
- package/src/layouts/oracle.ts +96 -0
- package/src/states/basket.ts +56 -0
- package/src/states/intents/intent.ts +107 -0
- package/src/states/intents/rebalanceIntent.ts +57 -0
- package/src/states/oracles/constants.ts +13 -0
- package/src/states/oracles/oracle.ts +260 -0
- package/src/states/oracles/pythOracle.ts +270 -0
- package/src/states/oracles/raydiumClmmOracle.ts +812 -0
- package/src/states/oracles/raydiumCpmmOracle.ts +614 -0
- package/src/states/oracles/switchboardOracle.ts +0 -0
- package/src/txUtils.ts +250 -0
- package/test.ts +30 -0
- package/tsconfig.json +101 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createUserRebalanceIntentIx = createUserRebalanceIntentIx;
|
|
4
|
+
exports.resizeRebalanceIntentIx = resizeRebalanceIntentIx;
|
|
5
|
+
exports.depositStateIx = depositStateIx;
|
|
6
|
+
exports.depositTokensIx = depositTokensIx;
|
|
7
|
+
exports.lockDepositsIx = lockDepositsIx;
|
|
8
|
+
exports.mintBasketIx = mintBasketIx;
|
|
9
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
10
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
11
|
+
const constants_1 = require("../../constants");
|
|
12
|
+
const pda_1 = require("../pda");
|
|
13
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
14
|
+
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
15
|
+
const web3_js_2 = require("@solana/web3.js");
|
|
16
|
+
const CREATE_USER_REBALANCE_INTENT_ACCOUNT = Buffer.from([212, 23, 1, 46, 192, 87, 74, 196]);
|
|
17
|
+
const RESIZE_REBALANCE_INTENT_HANDLER = Buffer.from([71, 204, 243, 183, 209, 118, 111, 94]);
|
|
18
|
+
const CREATE_DEPOSIT_STATE_DISCRIMINATOR = Buffer.from([66, 42, 217, 222, 49, 159, 36, 188]);
|
|
19
|
+
const DEPOSIT_TOKENS_DISCRIMINATOR = Buffer.from([88, 92, 158, 219, 83, 71, 239, 164]);
|
|
20
|
+
const LOCK_DEPOSITS_DISCRIMINATOR = Buffer.from([64, 238, 171, 198, 135, 253, 37, 9]);
|
|
21
|
+
const MINT_BASKET_DISCRIMINATOR = Buffer.from([161, 207, 48, 45, 7, 156, 233, 143]);
|
|
22
|
+
function createUserRebalanceIntentIx(params) {
|
|
23
|
+
const { user, basket } = params;
|
|
24
|
+
let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, user);
|
|
25
|
+
let rentPayerPda = (0, pda_1.getRentPayerPda)();
|
|
26
|
+
let globalConfig = (0, pda_1.getGlobalConfigPda)();
|
|
27
|
+
const keys = [
|
|
28
|
+
{ pubkey: user, isSigner: true, isWritable: true },
|
|
29
|
+
{ pubkey: basket, isSigner: false, isWritable: true },
|
|
30
|
+
{ pubkey: rebalanceIntent, isSigner: false, isWritable: true },
|
|
31
|
+
{ pubkey: rentPayerPda, isSigner: false, isWritable: true },
|
|
32
|
+
{ pubkey: globalConfig, isSigner: false, isWritable: true },
|
|
33
|
+
{ pubkey: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false },
|
|
34
|
+
{ pubkey: web3_js_1.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false },
|
|
35
|
+
{ pubkey: system_1.SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
36
|
+
];
|
|
37
|
+
const data = CREATE_USER_REBALANCE_INTENT_ACCOUNT;
|
|
38
|
+
return new web3_js_2.TransactionInstruction({
|
|
39
|
+
keys,
|
|
40
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
41
|
+
data
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function resizeRebalanceIntentIx(rebalanceIntent) {
|
|
45
|
+
const data = RESIZE_REBALANCE_INTENT_HANDLER;
|
|
46
|
+
const keys = [
|
|
47
|
+
{ pubkey: rebalanceIntent, isSigner: false, isWritable: true }
|
|
48
|
+
];
|
|
49
|
+
return new web3_js_2.TransactionInstruction({
|
|
50
|
+
keys,
|
|
51
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
52
|
+
data
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function depositStateIx(params) {
|
|
56
|
+
const { buyer, basket, bountyMint, rebalanceIntentRentPayer, rebalanceSlippageBps, executionStartTime, } = params;
|
|
57
|
+
let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, buyer);
|
|
58
|
+
let basketTokenMint = (0, pda_1.getBasketTokenMintPda)(basket);
|
|
59
|
+
let globalConfig = (0, pda_1.getGlobalConfigPda)();
|
|
60
|
+
let rentPayerPda = (0, pda_1.getRentPayerPda)();
|
|
61
|
+
let bountyVault = (0, pda_1.getBountyVaultPda)();
|
|
62
|
+
let bountyVaultAta = (0, pda_1.getAta)(bountyVault, bountyMint);
|
|
63
|
+
let buyerBountyAta = (0, pda_1.getAta)(buyer, bountyMint);
|
|
64
|
+
let buyerBasketAta = (0, pda_1.getAta)(buyer, basketTokenMint);
|
|
65
|
+
const rebalanceIntentRentPayerBuf = rebalanceIntentRentPayer.toBuffer();
|
|
66
|
+
const rebalanceSlippageBuf = Buffer.from(new anchor_1.BN(rebalanceSlippageBps).toArray("le", 2));
|
|
67
|
+
const executionStartBuf = Buffer.from(new anchor_1.BN(executionStartTime).toArray("le", 8));
|
|
68
|
+
const data = Buffer.concat([
|
|
69
|
+
CREATE_DEPOSIT_STATE_DISCRIMINATOR,
|
|
70
|
+
rebalanceIntentRentPayerBuf,
|
|
71
|
+
rebalanceSlippageBuf,
|
|
72
|
+
executionStartBuf
|
|
73
|
+
]);
|
|
74
|
+
const keys = [
|
|
75
|
+
{ pubkey: buyer, isSigner: true, isWritable: true },
|
|
76
|
+
{ pubkey: basket, isSigner: false, isWritable: true },
|
|
77
|
+
{ pubkey: rebalanceIntent, isSigner: false, isWritable: true },
|
|
78
|
+
{ pubkey: rentPayerPda, isSigner: false, isWritable: true },
|
|
79
|
+
{ pubkey: basketTokenMint, isSigner: false, isWritable: false },
|
|
80
|
+
{ pubkey: buyerBasketAta, isSigner: false, isWritable: true },
|
|
81
|
+
{ pubkey: globalConfig, isSigner: false, isWritable: false },
|
|
82
|
+
{ pubkey: bountyMint, isSigner: false, isWritable: false },
|
|
83
|
+
{ pubkey: buyerBountyAta, isSigner: false, isWritable: true },
|
|
84
|
+
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
85
|
+
{ pubkey: bountyVaultAta, isSigner: false, isWritable: true },
|
|
86
|
+
{ pubkey: system_1.SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
87
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
88
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
89
|
+
// { pubkey: rebalanceIntent, isSigner: false, isWritable: true } // remaining accounts
|
|
90
|
+
];
|
|
91
|
+
return new web3_js_2.TransactionInstruction({
|
|
92
|
+
keys,
|
|
93
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
94
|
+
data,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function depositTokensIx(params) {
|
|
98
|
+
const { owner, basket, contributions } = params;
|
|
99
|
+
let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, owner);
|
|
100
|
+
const discriminator = DEPOSIT_TOKENS_DISCRIMINATOR;
|
|
101
|
+
const amountsBuffer = Buffer.concat(contributions.map((contribution) => Buffer.from(new anchor_1.BN(contribution.amount).toArray("le", 8))));
|
|
102
|
+
const data = Buffer.concat([discriminator, amountsBuffer]);
|
|
103
|
+
const keys = [
|
|
104
|
+
{ pubkey: owner, isSigner: true, isWritable: true },
|
|
105
|
+
{ pubkey: basket, isSigner: false, isWritable: true },
|
|
106
|
+
{ pubkey: rebalanceIntent, isSigner: false, isWritable: true },
|
|
107
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
108
|
+
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
109
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
110
|
+
{ pubkey: system_1.SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
111
|
+
];
|
|
112
|
+
// remaining accounts
|
|
113
|
+
contributions.forEach((contribution) => {
|
|
114
|
+
let mint = contribution.mint;
|
|
115
|
+
let ownerAta = (0, pda_1.getAta)(owner, mint);
|
|
116
|
+
let basketAta = (0, pda_1.getAta)(basket, mint);
|
|
117
|
+
keys.push({ pubkey: mint, isSigner: false, isWritable: false });
|
|
118
|
+
keys.push({ pubkey: ownerAta, isSigner: false, isWritable: true });
|
|
119
|
+
keys.push({ pubkey: basketAta, isSigner: false, isWritable: true });
|
|
120
|
+
});
|
|
121
|
+
return new web3_js_2.TransactionInstruction({
|
|
122
|
+
keys,
|
|
123
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
124
|
+
data,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function lockDepositsIx(params) {
|
|
128
|
+
const { owner, basket } = params;
|
|
129
|
+
let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, owner);
|
|
130
|
+
const keys = [
|
|
131
|
+
{ pubkey: params.owner, isSigner: true, isWritable: true },
|
|
132
|
+
{ pubkey: rebalanceIntent, isSigner: false, isWritable: true },
|
|
133
|
+
];
|
|
134
|
+
return new web3_js_2.TransactionInstruction({
|
|
135
|
+
keys,
|
|
136
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
137
|
+
data: LOCK_DEPOSITS_DISCRIMINATOR,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function mintBasketIx(params) {
|
|
141
|
+
const { keeper, basket, buyer } = params;
|
|
142
|
+
let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, buyer);
|
|
143
|
+
let basketTokenMint = (0, pda_1.getBasketTokenMintPda)(basket);
|
|
144
|
+
let basketFees = (0, pda_1.getBasketFeesPda)(basket);
|
|
145
|
+
let globalConfig = (0, pda_1.getGlobalConfigPda)();
|
|
146
|
+
let buyerBasketATA = (0, pda_1.getAta)(buyer, basketTokenMint);
|
|
147
|
+
let basketFeesAta = (0, pda_1.getAta)(basketFees, basketTokenMint);
|
|
148
|
+
const keys = [
|
|
149
|
+
{ pubkey: keeper, isWritable: true, isSigner: true },
|
|
150
|
+
{ pubkey: basket, isWritable: true, isSigner: false },
|
|
151
|
+
{ pubkey: rebalanceIntent, isWritable: true, isSigner: false },
|
|
152
|
+
{ pubkey: basketTokenMint, isWritable: true, isSigner: false },
|
|
153
|
+
{ pubkey: buyer, isWritable: true, isSigner: false },
|
|
154
|
+
{ pubkey: buyerBasketATA, isWritable: true, isSigner: false },
|
|
155
|
+
{ pubkey: globalConfig, isWritable: false, isSigner: false },
|
|
156
|
+
{ pubkey: basketFees, isWritable: true, isSigner: false },
|
|
157
|
+
{ pubkey: basketFeesAta, isWritable: true, isSigner: false },
|
|
158
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
159
|
+
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
160
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
161
|
+
{ pubkey: system_1.SYSTEM_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
162
|
+
];
|
|
163
|
+
return new web3_js_2.TransactionInstruction({
|
|
164
|
+
keys,
|
|
165
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
166
|
+
data: MINT_BASKET_DISCRIMINATOR,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { TransactionInstruction } from "@solana/web3.js";
|
|
3
|
+
export declare function createWithdrawStateIx(params: {
|
|
4
|
+
seller: PublicKey;
|
|
5
|
+
basket: PublicKey;
|
|
6
|
+
withdrawAmount: number;
|
|
7
|
+
rebalanceSlippageBps: number;
|
|
8
|
+
executionStartTime: number;
|
|
9
|
+
bountyMint: PublicKey;
|
|
10
|
+
}): TransactionInstruction;
|
|
11
|
+
export declare function redeemTokensIx(params: {
|
|
12
|
+
keeper: PublicKey;
|
|
13
|
+
basket: PublicKey;
|
|
14
|
+
owner: PublicKey;
|
|
15
|
+
tokenMints: PublicKey[];
|
|
16
|
+
}): TransactionInstruction;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWithdrawStateIx = createWithdrawStateIx;
|
|
4
|
+
exports.redeemTokensIx = redeemTokensIx;
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
7
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
8
|
+
const pda_1 = require("../pda");
|
|
9
|
+
const system_1 = require("@coral-xyz/anchor/dist/cjs/native/system");
|
|
10
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
11
|
+
const CREATE_WITHDRAW_STATE_DISCRIMINATOR = Buffer.from([161, 45, 253, 59, 110, 240, 65, 3]);
|
|
12
|
+
const REDEEM_TOKENS_DISCRIMINATOR = Buffer.from([83, 49, 112, 2, 105, 193, 106, 126]);
|
|
13
|
+
function createWithdrawStateIx(params) {
|
|
14
|
+
const { seller, basket, withdrawAmount, rebalanceSlippageBps, executionStartTime, bountyMint, } = params;
|
|
15
|
+
let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, seller);
|
|
16
|
+
let rentPayerPda = (0, pda_1.getRentPayerPda)();
|
|
17
|
+
let basketTokenMint = (0, pda_1.getBasketTokenMintPda)(basket);
|
|
18
|
+
let globalConfig = (0, pda_1.getGlobalConfigPda)();
|
|
19
|
+
let bountyVault = (0, pda_1.getBountyVaultPda)();
|
|
20
|
+
let sellerBasketAta = (0, pda_1.getAta)(seller, basketTokenMint);
|
|
21
|
+
let sellerBountyAta = (0, pda_1.getAta)(seller, bountyMint);
|
|
22
|
+
let bountyVaultAta = (0, pda_1.getAta)(bountyVault, bountyMint);
|
|
23
|
+
let basketRebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, basket);
|
|
24
|
+
const data = Buffer.concat([
|
|
25
|
+
CREATE_WITHDRAW_STATE_DISCRIMINATOR,
|
|
26
|
+
Buffer.from(new anchor_1.BN(withdrawAmount).toArray("le", 8)),
|
|
27
|
+
Buffer.from(new anchor_1.BN(rebalanceSlippageBps).toArray("le", 2)),
|
|
28
|
+
Buffer.from(new anchor_1.BN(executionStartTime).toArray("le", 8)),
|
|
29
|
+
]);
|
|
30
|
+
const keys = [
|
|
31
|
+
{ pubkey: seller, isSigner: true, isWritable: true },
|
|
32
|
+
{ pubkey: basket, isSigner: false, isWritable: true },
|
|
33
|
+
{ pubkey: basketRebalanceIntent, isSigner: false, isWritable: true },
|
|
34
|
+
{ pubkey: rebalanceIntent, isSigner: false, isWritable: true },
|
|
35
|
+
{ pubkey: rentPayerPda, isSigner: false, isWritable: true },
|
|
36
|
+
{ pubkey: basketTokenMint, isSigner: false, isWritable: false },
|
|
37
|
+
{ pubkey: sellerBasketAta, isSigner: false, isWritable: true },
|
|
38
|
+
{ pubkey: globalConfig, isSigner: false, isWritable: false },
|
|
39
|
+
{ pubkey: bountyMint, isSigner: false, isWritable: false },
|
|
40
|
+
{ pubkey: sellerBountyAta, isSigner: false, isWritable: true },
|
|
41
|
+
{ pubkey: bountyVault, isSigner: false, isWritable: true },
|
|
42
|
+
{ pubkey: bountyVaultAta, isSigner: false, isWritable: true },
|
|
43
|
+
{ pubkey: system_1.SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
44
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
45
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
46
|
+
{ pubkey: rebalanceIntent, isSigner: false, isWritable: false } // remaining accounts
|
|
47
|
+
];
|
|
48
|
+
return new web3_js_1.TransactionInstruction({
|
|
49
|
+
keys,
|
|
50
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
51
|
+
data,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function redeemTokensIx(params) {
|
|
55
|
+
const { keeper, basket, owner, } = params;
|
|
56
|
+
let rebalanceIntent = (0, pda_1.getRebalanceIntentPda)(basket, owner);
|
|
57
|
+
const keys = [
|
|
58
|
+
{ pubkey: keeper, isSigner: true, isWritable: true },
|
|
59
|
+
{ pubkey: basket, isSigner: false, isWritable: true },
|
|
60
|
+
{ pubkey: rebalanceIntent, isSigner: false, isWritable: true },
|
|
61
|
+
{ pubkey: owner, isSigner: false, isWritable: true },
|
|
62
|
+
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
63
|
+
{ pubkey: spl_token_1.TOKEN_2022_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
64
|
+
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
65
|
+
{ pubkey: system_1.SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
66
|
+
];
|
|
67
|
+
// remaining accounts
|
|
68
|
+
params.tokenMints.forEach((mint) => {
|
|
69
|
+
keys.push({ pubkey: mint, isWritable: false, isSigner: false });
|
|
70
|
+
const ownerAta = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, owner);
|
|
71
|
+
keys.push({ pubkey: ownerAta, isWritable: true, isSigner: false });
|
|
72
|
+
const basketAta = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, basket);
|
|
73
|
+
keys.push({ pubkey: basketAta, isWritable: true, isSigner: false });
|
|
74
|
+
});
|
|
75
|
+
const discriminator = REDEEM_TOKENS_DISCRIMINATOR;
|
|
76
|
+
const data = discriminator;
|
|
77
|
+
return new web3_js_1.TransactionInstruction({
|
|
78
|
+
keys,
|
|
79
|
+
programId: constants_1.BASKETS_V3_PROGRAM_ID,
|
|
80
|
+
data,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey } from "@solana/web3.js";
|
|
3
|
+
import { OracleAggregator } from "./oracle";
|
|
4
|
+
import { Fraction } from "./fraction";
|
|
5
|
+
import { BasketSettings } from "./config";
|
|
6
|
+
export declare const MAX_SUPPORTED_TOKENS_PER_BASKET: number;
|
|
7
|
+
export interface BasketFees {
|
|
8
|
+
symmetryFees: BN;
|
|
9
|
+
creatorFees: BN;
|
|
10
|
+
hostFees: BN;
|
|
11
|
+
managersFees: BN;
|
|
12
|
+
}
|
|
13
|
+
export declare const BasketFeesLayout: any;
|
|
14
|
+
export interface LookupTables {
|
|
15
|
+
active: PublicKey[];
|
|
16
|
+
temp: PublicKey[];
|
|
17
|
+
}
|
|
18
|
+
export declare const LookupTablesLayout: any;
|
|
19
|
+
export interface Asset {
|
|
20
|
+
mint: PublicKey;
|
|
21
|
+
amount: BN;
|
|
22
|
+
weight: number;
|
|
23
|
+
oracleAggregator: OracleAggregator;
|
|
24
|
+
}
|
|
25
|
+
export declare const AssetLayout: any;
|
|
26
|
+
export interface Basket {
|
|
27
|
+
version: number;
|
|
28
|
+
seedArray: number[];
|
|
29
|
+
ownAddress: PublicKey;
|
|
30
|
+
mint: PublicKey;
|
|
31
|
+
supplyOutstanding: BN;
|
|
32
|
+
highWaterMark: Fraction;
|
|
33
|
+
bountyBalance: BN;
|
|
34
|
+
settings: BasketSettings;
|
|
35
|
+
accumulatedFees: BasketFees;
|
|
36
|
+
lookupTables: LookupTables;
|
|
37
|
+
writeVersion: BN;
|
|
38
|
+
numTokens: number;
|
|
39
|
+
composition: Asset[];
|
|
40
|
+
}
|
|
41
|
+
export declare const BasketLayout: any;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasketLayout = exports.AssetLayout = exports.LookupTablesLayout = exports.BasketFeesLayout = exports.MAX_SUPPORTED_TOKENS_PER_BASKET = void 0;
|
|
4
|
+
const borsh_1 = require("@coral-xyz/borsh");
|
|
5
|
+
const oracle_1 = require("./oracle");
|
|
6
|
+
const fraction_1 = require("./fraction");
|
|
7
|
+
const config_1 = require("./config");
|
|
8
|
+
exports.MAX_SUPPORTED_TOKENS_PER_BASKET = 100;
|
|
9
|
+
;
|
|
10
|
+
exports.BasketFeesLayout = (0, borsh_1.struct)([
|
|
11
|
+
(0, borsh_1.u64)("symmetryFees"),
|
|
12
|
+
(0, borsh_1.u64)("creatorFees"),
|
|
13
|
+
(0, borsh_1.u64)("hostFees"),
|
|
14
|
+
(0, borsh_1.u64)("managersFees"),
|
|
15
|
+
]);
|
|
16
|
+
;
|
|
17
|
+
exports.LookupTablesLayout = (0, borsh_1.struct)([
|
|
18
|
+
(0, borsh_1.array)((0, borsh_1.publicKey)(), 2, "active"),
|
|
19
|
+
(0, borsh_1.array)((0, borsh_1.publicKey)(), 2, "temp"),
|
|
20
|
+
]);
|
|
21
|
+
;
|
|
22
|
+
exports.AssetLayout = (0, borsh_1.struct)([
|
|
23
|
+
(0, borsh_1.publicKey)('mint'),
|
|
24
|
+
(0, borsh_1.u64)('amount'),
|
|
25
|
+
(0, borsh_1.u16)('weight'),
|
|
26
|
+
oracle_1.OracleAggregatorLayout.replicate('oracleAggregator'),
|
|
27
|
+
]);
|
|
28
|
+
;
|
|
29
|
+
exports.BasketLayout = (0, borsh_1.struct)([
|
|
30
|
+
(0, borsh_1.u8)('version'),
|
|
31
|
+
(0, borsh_1.array)((0, borsh_1.u8)(), 16, 'seedArray'),
|
|
32
|
+
(0, borsh_1.publicKey)('ownAddress'),
|
|
33
|
+
(0, borsh_1.publicKey)('mint'),
|
|
34
|
+
(0, borsh_1.u64)('supplyOutstanding'),
|
|
35
|
+
fraction_1.FractionLayout.replicate('highWaterMark'),
|
|
36
|
+
(0, borsh_1.u64)('bountyBalance'),
|
|
37
|
+
config_1.BasketSettingsLayout.replicate('settings'),
|
|
38
|
+
exports.BasketFeesLayout.replicate('accumulatedFees'),
|
|
39
|
+
exports.LookupTablesLayout.replicate('lookupTables'),
|
|
40
|
+
(0, borsh_1.u64)('writeVersion'),
|
|
41
|
+
(0, borsh_1.u8)('numTokens'),
|
|
42
|
+
(0, borsh_1.array)(exports.AssetLayout, exports.MAX_SUPPORTED_TOKENS_PER_BASKET, 'composition'),
|
|
43
|
+
]);
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { Fraction } from "./fraction";
|
|
3
|
+
import { BN } from "@coral-xyz/anchor";
|
|
4
|
+
import { BountySchedule } from "./intents/bounty";
|
|
5
|
+
export declare const MAX_MANAGERS_PER_BASKET = 10;
|
|
6
|
+
export declare const MAX_SYMBOL_LENGTH = 10;
|
|
7
|
+
export declare const MAX_NAME_LENGTH = 32;
|
|
8
|
+
export declare const MAX_URI_LENGTH = 200;
|
|
9
|
+
export declare enum BasketType {
|
|
10
|
+
Private = 0,
|
|
11
|
+
Public = 1
|
|
12
|
+
}
|
|
13
|
+
export declare const BasketTypeLayout: any;
|
|
14
|
+
export interface ScheduleSettings {
|
|
15
|
+
cycleDuration: BN;
|
|
16
|
+
depositsStart: BN;
|
|
17
|
+
depositsEnd: BN;
|
|
18
|
+
automationStart: BN;
|
|
19
|
+
automationEnd: BN;
|
|
20
|
+
managementStart: BN;
|
|
21
|
+
managementEnd: BN;
|
|
22
|
+
modificationDelay: BN;
|
|
23
|
+
}
|
|
24
|
+
export declare const ScheduleSettingsLayout: any;
|
|
25
|
+
export interface FeeSettings {
|
|
26
|
+
hostDepositFeeBps: number;
|
|
27
|
+
hostManagementFeeBps: number;
|
|
28
|
+
hostPerformanceFeeBps: number;
|
|
29
|
+
creatorDepositFeeBps: number;
|
|
30
|
+
creatorManagementFeeBps: number;
|
|
31
|
+
creatorPerformanceFeeBps: number;
|
|
32
|
+
managersDepositFeeBps: number;
|
|
33
|
+
managersManagementFeeBps: number;
|
|
34
|
+
managersPerformanceFeeBps: number;
|
|
35
|
+
basketDepositFeeBps: number;
|
|
36
|
+
basketWithdrawFeeBps: number;
|
|
37
|
+
modificationDelay: BN;
|
|
38
|
+
}
|
|
39
|
+
export declare const FeeSettingsLayout: any;
|
|
40
|
+
export interface ManagerSettings {
|
|
41
|
+
managers: PublicKey[];
|
|
42
|
+
managersWeightBps: number[];
|
|
43
|
+
modificationDelay: BN;
|
|
44
|
+
}
|
|
45
|
+
export declare const ManagerSettingsLayout: any;
|
|
46
|
+
export interface AutomationSettings {
|
|
47
|
+
allowAutomation: number;
|
|
48
|
+
rebalanceSlippageBps: number;
|
|
49
|
+
rebalanceThresholdBps: number;
|
|
50
|
+
rebalanceIntervalSeconds: BN;
|
|
51
|
+
modificationDelay: BN;
|
|
52
|
+
}
|
|
53
|
+
export declare const AutomationSettingsLayout: any;
|
|
54
|
+
export interface LpSettings {
|
|
55
|
+
lpThresholdBps: number;
|
|
56
|
+
allowLp: number;
|
|
57
|
+
modificationDelay: BN;
|
|
58
|
+
}
|
|
59
|
+
export declare const LpSettingsLayout: any;
|
|
60
|
+
export interface MetadataSettings {
|
|
61
|
+
symbolLength: number;
|
|
62
|
+
symbol: number[];
|
|
63
|
+
nameLength: number;
|
|
64
|
+
name: number[];
|
|
65
|
+
uriLength: number;
|
|
66
|
+
uri: number[];
|
|
67
|
+
modificationDelay: BN;
|
|
68
|
+
}
|
|
69
|
+
export declare const MetadataSettingsLayout: any;
|
|
70
|
+
export interface BasketSettings {
|
|
71
|
+
creator: PublicKey;
|
|
72
|
+
host: PublicKey;
|
|
73
|
+
basketType: BasketType;
|
|
74
|
+
startPrice: Fraction;
|
|
75
|
+
activeRebalance: BN;
|
|
76
|
+
activeDeposits: BN;
|
|
77
|
+
activeManagements: BN;
|
|
78
|
+
schedule: ScheduleSettings;
|
|
79
|
+
scheduleAuthorityBitmask: number;
|
|
80
|
+
feeSettings: FeeSettings;
|
|
81
|
+
feeSettingsAuthorityBitmask: number;
|
|
82
|
+
managerSettings: ManagerSettings;
|
|
83
|
+
managerSettingsAuthorityBitmask: number;
|
|
84
|
+
automationSettings: AutomationSettings;
|
|
85
|
+
automationSettingsAuthorityBitmask: number;
|
|
86
|
+
lpSettings: LpSettings;
|
|
87
|
+
lpSettingsAuthorityBitmask: number;
|
|
88
|
+
metadataSettings: MetadataSettings;
|
|
89
|
+
metadataSettingsAuthorityBitmask: number;
|
|
90
|
+
addTokenDelay: BN;
|
|
91
|
+
addTokenIntentAuthorityBitmask: number;
|
|
92
|
+
updateWeightsDelay: BN;
|
|
93
|
+
updateWeightsIntentAuthorityBitmask: number;
|
|
94
|
+
makeDirectSwapDelay: BN;
|
|
95
|
+
makeDirectSwapIntentAuthorityBitmask: number;
|
|
96
|
+
extraData: BN[];
|
|
97
|
+
}
|
|
98
|
+
export declare const BasketSettingsLayout: any;
|
|
99
|
+
export interface GlobalConfig {
|
|
100
|
+
admin: PublicKey;
|
|
101
|
+
owners: PublicKey[];
|
|
102
|
+
allowCreation: number;
|
|
103
|
+
allowManagement: number;
|
|
104
|
+
allowAutomation: number;
|
|
105
|
+
allowDeposits: number;
|
|
106
|
+
allowWithdraws: number;
|
|
107
|
+
maxDepositFeeBps: number;
|
|
108
|
+
maxWithdrawFeeBps: number;
|
|
109
|
+
maxManagementFeeBps: number;
|
|
110
|
+
maxPerformanceFeeBps: number;
|
|
111
|
+
symmetryFeeCollector: PublicKey;
|
|
112
|
+
symmetryDepositFeeBps: number;
|
|
113
|
+
symmetryWithdrawFeeBps: number;
|
|
114
|
+
symmetryRebalanceFeeBps: number;
|
|
115
|
+
symmetryManagementFeeBps: number;
|
|
116
|
+
symmetryPerformanceFeeBps: number;
|
|
117
|
+
bountyMint: PublicKey;
|
|
118
|
+
minBountyForBasketAutomation: BN;
|
|
119
|
+
bountyBondAmount: BN;
|
|
120
|
+
bountyPerPriceUpdateTask: BountySchedule;
|
|
121
|
+
bountyPerTask: BountySchedule;
|
|
122
|
+
aprBpsPerYear: number;
|
|
123
|
+
rebalanceIntentLifetime: BN;
|
|
124
|
+
depositTimeframe: BN;
|
|
125
|
+
priceUpdateTimeframe: BN;
|
|
126
|
+
rebalanceAuction1Timeframe: BN;
|
|
127
|
+
rebalanceAuction2Timeframe: BN;
|
|
128
|
+
rebalanceAuction3Timeframe: BN;
|
|
129
|
+
priceUpdateDelayAfterCreation: BN;
|
|
130
|
+
priceUpdateLifetime: BN;
|
|
131
|
+
priceUpdateReexecutionDelay: BN;
|
|
132
|
+
}
|
|
133
|
+
export declare const GlobalConfigLayout: any;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GlobalConfigLayout = exports.BasketSettingsLayout = exports.MetadataSettingsLayout = exports.LpSettingsLayout = exports.AutomationSettingsLayout = exports.ManagerSettingsLayout = exports.FeeSettingsLayout = exports.ScheduleSettingsLayout = exports.BasketTypeLayout = exports.BasketType = exports.MAX_URI_LENGTH = exports.MAX_NAME_LENGTH = exports.MAX_SYMBOL_LENGTH = exports.MAX_MANAGERS_PER_BASKET = void 0;
|
|
4
|
+
const borsh_1 = require("@coral-xyz/borsh");
|
|
5
|
+
const fraction_1 = require("./fraction");
|
|
6
|
+
const bounty_1 = require("./intents/bounty");
|
|
7
|
+
exports.MAX_MANAGERS_PER_BASKET = 10;
|
|
8
|
+
exports.MAX_SYMBOL_LENGTH = 10;
|
|
9
|
+
exports.MAX_NAME_LENGTH = 32;
|
|
10
|
+
exports.MAX_URI_LENGTH = 200;
|
|
11
|
+
var BasketType;
|
|
12
|
+
(function (BasketType) {
|
|
13
|
+
BasketType[BasketType["Private"] = 0] = "Private";
|
|
14
|
+
BasketType[BasketType["Public"] = 1] = "Public";
|
|
15
|
+
})(BasketType || (exports.BasketType = BasketType = {}));
|
|
16
|
+
;
|
|
17
|
+
exports.BasketTypeLayout = (0, borsh_1.struct)([
|
|
18
|
+
(0, borsh_1.u8)('basketType'),
|
|
19
|
+
]);
|
|
20
|
+
;
|
|
21
|
+
exports.ScheduleSettingsLayout = (0, borsh_1.struct)([
|
|
22
|
+
(0, borsh_1.u64)('cycleDuration'),
|
|
23
|
+
(0, borsh_1.u64)('depositsStart'),
|
|
24
|
+
(0, borsh_1.u64)('depositsEnd'),
|
|
25
|
+
(0, borsh_1.u64)('automationStart'),
|
|
26
|
+
(0, borsh_1.u64)('automationEnd'),
|
|
27
|
+
(0, borsh_1.u64)('managementStart'),
|
|
28
|
+
(0, borsh_1.u64)('managementEnd'),
|
|
29
|
+
(0, borsh_1.u64)('modificationDelay'),
|
|
30
|
+
]);
|
|
31
|
+
;
|
|
32
|
+
exports.FeeSettingsLayout = (0, borsh_1.struct)([
|
|
33
|
+
(0, borsh_1.u16)('hostDepositFeeBps'),
|
|
34
|
+
(0, borsh_1.u16)('hostManagementFeeBps'),
|
|
35
|
+
(0, borsh_1.u16)('hostPerformanceFeeBps'),
|
|
36
|
+
(0, borsh_1.u16)('creatorDepositFeeBps'),
|
|
37
|
+
(0, borsh_1.u16)('creatorManagementFeeBps'),
|
|
38
|
+
(0, borsh_1.u16)('creatorPerformanceFeeBps'),
|
|
39
|
+
(0, borsh_1.u16)('managersDepositFeeBps'),
|
|
40
|
+
(0, borsh_1.u16)('managersManagementFeeBps'),
|
|
41
|
+
(0, borsh_1.u16)('managersPerformanceFeeBps'),
|
|
42
|
+
(0, borsh_1.u16)('basketDepositFeeBps'),
|
|
43
|
+
(0, borsh_1.u16)('basketWithdrawFeeBps'),
|
|
44
|
+
(0, borsh_1.u64)('modificationDelay'),
|
|
45
|
+
]);
|
|
46
|
+
exports.ManagerSettingsLayout = (0, borsh_1.struct)([
|
|
47
|
+
(0, borsh_1.array)((0, borsh_1.publicKey)(), exports.MAX_MANAGERS_PER_BASKET, 'managers'),
|
|
48
|
+
(0, borsh_1.array)((0, borsh_1.u16)(), exports.MAX_MANAGERS_PER_BASKET, 'managersWeightBps'),
|
|
49
|
+
(0, borsh_1.u64)('modificationDelay'),
|
|
50
|
+
]);
|
|
51
|
+
;
|
|
52
|
+
exports.AutomationSettingsLayout = (0, borsh_1.struct)([
|
|
53
|
+
(0, borsh_1.u8)('allowAutomation'),
|
|
54
|
+
(0, borsh_1.u16)('rebalanceSlippageBps'),
|
|
55
|
+
(0, borsh_1.u16)('rebalanceThresholdBps'),
|
|
56
|
+
(0, borsh_1.u64)('rebalanceIntervalSeconds'),
|
|
57
|
+
(0, borsh_1.u64)('modificationDelay'),
|
|
58
|
+
]);
|
|
59
|
+
;
|
|
60
|
+
exports.LpSettingsLayout = (0, borsh_1.struct)([
|
|
61
|
+
(0, borsh_1.u16)('lpThresholdBps'),
|
|
62
|
+
(0, borsh_1.u8)('allowLp'),
|
|
63
|
+
(0, borsh_1.u64)('modificationDelay'),
|
|
64
|
+
]);
|
|
65
|
+
;
|
|
66
|
+
exports.MetadataSettingsLayout = (0, borsh_1.struct)([
|
|
67
|
+
(0, borsh_1.u8)('symbolLength'),
|
|
68
|
+
(0, borsh_1.array)((0, borsh_1.u8)(), exports.MAX_SYMBOL_LENGTH, 'symbol'),
|
|
69
|
+
(0, borsh_1.u8)('nameLength'),
|
|
70
|
+
(0, borsh_1.array)((0, borsh_1.u8)(), exports.MAX_NAME_LENGTH, 'name'),
|
|
71
|
+
(0, borsh_1.u8)('uriLength'),
|
|
72
|
+
(0, borsh_1.array)((0, borsh_1.u8)(), exports.MAX_URI_LENGTH, 'uri'),
|
|
73
|
+
(0, borsh_1.u64)('modificationDelay'),
|
|
74
|
+
]);
|
|
75
|
+
;
|
|
76
|
+
exports.BasketSettingsLayout = (0, borsh_1.struct)([
|
|
77
|
+
(0, borsh_1.publicKey)('creator'),
|
|
78
|
+
(0, borsh_1.publicKey)('host'),
|
|
79
|
+
exports.BasketTypeLayout.replicate('basketType'),
|
|
80
|
+
fraction_1.FractionLayout.replicate('startPrice'),
|
|
81
|
+
(0, borsh_1.u64)('activeRebalance'),
|
|
82
|
+
(0, borsh_1.u64)('activeDeposits'),
|
|
83
|
+
(0, borsh_1.u64)('activeManagements'),
|
|
84
|
+
exports.ScheduleSettingsLayout.replicate('schedule'),
|
|
85
|
+
(0, borsh_1.u16)('scheduleAuthorityBitmask'),
|
|
86
|
+
exports.FeeSettingsLayout.replicate('feeSettings'),
|
|
87
|
+
(0, borsh_1.u16)('feeSettingsAuthorityBitmask'),
|
|
88
|
+
exports.ManagerSettingsLayout.replicate('managerSettings'),
|
|
89
|
+
(0, borsh_1.u16)('managerSettingsAuthorityBitmask'),
|
|
90
|
+
exports.AutomationSettingsLayout.replicate('automationSettings'),
|
|
91
|
+
(0, borsh_1.u16)('automationSettingsAuthorityBitmask'),
|
|
92
|
+
exports.LpSettingsLayout.replicate('lpSettings'),
|
|
93
|
+
(0, borsh_1.u16)('lpSettingsAuthorityBitmask'),
|
|
94
|
+
exports.MetadataSettingsLayout.replicate('metadataSettings'),
|
|
95
|
+
(0, borsh_1.u16)('metadataSettingsAuthorityBitmask'),
|
|
96
|
+
(0, borsh_1.u64)('addTokenDelay'),
|
|
97
|
+
(0, borsh_1.u16)('addTokenIntentAuthorityBitmask'),
|
|
98
|
+
(0, borsh_1.u64)('updateWeightsDelay'),
|
|
99
|
+
(0, borsh_1.u16)('updateWeightsIntentAuthorityBitmask'),
|
|
100
|
+
(0, borsh_1.u64)('makeDirectSwapDelay'),
|
|
101
|
+
(0, borsh_1.u16)('makeDirectSwapIntentAuthorityBitmask'),
|
|
102
|
+
(0, borsh_1.array)((0, borsh_1.u64)(), 32, 'extraData'),
|
|
103
|
+
]);
|
|
104
|
+
exports.GlobalConfigLayout = (0, borsh_1.struct)([
|
|
105
|
+
(0, borsh_1.publicKey)('admin'),
|
|
106
|
+
(0, borsh_1.array)((0, borsh_1.publicKey)(), 3, 'owners'),
|
|
107
|
+
(0, borsh_1.u8)('allowCreation'),
|
|
108
|
+
(0, borsh_1.u8)('allowManagement'),
|
|
109
|
+
(0, borsh_1.u8)('allowAutomation'),
|
|
110
|
+
(0, borsh_1.u8)('allowDeposits'),
|
|
111
|
+
(0, borsh_1.u8)('allowWithdraws'),
|
|
112
|
+
(0, borsh_1.u16)('maxDepositFeeBps'),
|
|
113
|
+
(0, borsh_1.u16)('maxWithdrawFeeBps'),
|
|
114
|
+
(0, borsh_1.u16)('maxManagementFeeBps'),
|
|
115
|
+
(0, borsh_1.u16)('maxPerformanceFeeBps'),
|
|
116
|
+
(0, borsh_1.publicKey)('symmetryFeeCollector'),
|
|
117
|
+
(0, borsh_1.u16)('symmetryDepositFeeBps'),
|
|
118
|
+
(0, borsh_1.u16)('symmetryWithdrawFeeBps'),
|
|
119
|
+
(0, borsh_1.u16)('symmetryRebalanceFeeBps'),
|
|
120
|
+
(0, borsh_1.u16)('symmetryManagementFeeBps'),
|
|
121
|
+
(0, borsh_1.u16)('symmetryPerformanceFeeBps'),
|
|
122
|
+
(0, borsh_1.publicKey)('bountyMint'),
|
|
123
|
+
(0, borsh_1.u64)('minBountyForBasketAutomation'),
|
|
124
|
+
(0, borsh_1.u64)('bountyBondAmount'),
|
|
125
|
+
bounty_1.BountyScheduleLayout.replicate('bountyPerPriceUpdateTask'),
|
|
126
|
+
bounty_1.BountyScheduleLayout.replicate('bountyPerTask'),
|
|
127
|
+
(0, borsh_1.u16)('aprBpsPerYear'),
|
|
128
|
+
(0, borsh_1.u64)('rebalanceIntentLifetime'),
|
|
129
|
+
(0, borsh_1.u64)('depositTimeframe'),
|
|
130
|
+
(0, borsh_1.u64)('priceUpdateTimeframe'),
|
|
131
|
+
(0, borsh_1.u64)('rebalanceAuction1Timeframe'),
|
|
132
|
+
(0, borsh_1.u64)('rebalanceAuction2Timeframe'),
|
|
133
|
+
(0, borsh_1.u64)('rebalanceAuction3Timeframe'),
|
|
134
|
+
(0, borsh_1.u64)('priceUpdateDelayAfterCreation'),
|
|
135
|
+
(0, borsh_1.u64)('priceUpdateLifetime'),
|
|
136
|
+
(0, borsh_1.u64)('priceUpdateReexecutionDelay'),
|
|
137
|
+
]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FractionLayout = void 0;
|
|
4
|
+
const borsh_1 = require("@coral-xyz/borsh");
|
|
5
|
+
;
|
|
6
|
+
exports.FractionLayout = (0, borsh_1.struct)([
|
|
7
|
+
(0, borsh_1.u64)('numerator'),
|
|
8
|
+
(0, borsh_1.u64)('exponent'),
|
|
9
|
+
]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey } from "@solana/web3.js";
|
|
3
|
+
export interface BountySchedule {
|
|
4
|
+
minBounty: BN;
|
|
5
|
+
maxBounty: BN;
|
|
6
|
+
minBountyUntil: BN;
|
|
7
|
+
maxBountyAfter: BN;
|
|
8
|
+
}
|
|
9
|
+
export declare const BountyScheduleLayout: any;
|
|
10
|
+
export interface Bounty {
|
|
11
|
+
bountyDepositor: PublicKey;
|
|
12
|
+
bountyMint: PublicKey;
|
|
13
|
+
bountyTotal: BN;
|
|
14
|
+
bountyLeft: BN;
|
|
15
|
+
bountyPerPriceUpdateTask: BountySchedule;
|
|
16
|
+
bountyPerTask: BountySchedule;
|
|
17
|
+
}
|
|
18
|
+
export declare const BountyLayout: any;
|