@0dotxyz/p0-ts-sdk 2.5.0 → 2.6.0-alpha.0
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/index.cjs +4110 -436
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -2
- package/dist/index.d.ts +117 -2
- package/dist/index.js +4101 -437
- package/dist/index.js.map +1 -1
- package/dist/types-DLZaKA17.d.cts +88 -0
- package/dist/types-DLZaKA17.d.ts +88 -0
- package/dist/vendor.cjs +3389 -0
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +3318 -2
- package/dist/vendor.d.ts +3318 -2
- package/dist/vendor.js +3374 -1
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-BDDVBMdM.d.cts +0 -48
- package/dist/index-BDDVBMdM.d.ts +0 -48
package/dist/index.cjs
CHANGED
|
@@ -20351,6 +20351,9 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
|
20351
20351
|
TransactionType2["INITIALIZE_STAKED_POOL"] = "INITIALIZE_STAKED_POOL";
|
|
20352
20352
|
TransactionType2["ADD_STAKED_BANK"] = "ADD_STAKED_BANK";
|
|
20353
20353
|
TransactionType2["MERGE_STAKE_ACCOUNTS"] = "MERGE_STAKE_ACCOUNTS";
|
|
20354
|
+
TransactionType2["VAULT_DEPOSIT"] = "VAULT_DEPOSIT";
|
|
20355
|
+
TransactionType2["VAULT_WITHDRAW"] = "VAULT_WITHDRAW";
|
|
20356
|
+
TransactionType2["VAULT_COMPLETE_WITHDRAWAL"] = "VAULT_COMPLETE_WITHDRAWAL";
|
|
20354
20357
|
TransactionType2["STAKE_TO_STAKE"] = "STAKE_TO_STAKE";
|
|
20355
20358
|
TransactionType2["MINT_LST_NATIVE"] = "MINT_LST_NATIVE";
|
|
20356
20359
|
TransactionType2["SWAP_TO_SOL"] = "SWAP_TO_SOL";
|
|
@@ -20419,6 +20422,16 @@ var TransactionConfigMap = {
|
|
|
20419
20422
|
["INITIALIZE_STAKED_POOL" /* INITIALIZE_STAKED_POOL */]: { label: () => "Initialize stake pool" },
|
|
20420
20423
|
["ADD_STAKED_BANK" /* ADD_STAKED_BANK */]: { label: () => "Create staked asset bank" },
|
|
20421
20424
|
["MERGE_STAKE_ACCOUNTS" /* MERGE_STAKE_ACCOUNTS */]: { label: () => "Merge stake accounts" },
|
|
20425
|
+
// GAMMA VAULT ACTIONS
|
|
20426
|
+
["VAULT_DEPOSIT" /* VAULT_DEPOSIT */]: {
|
|
20427
|
+
label: ({ amount, token } = {}) => amount && token ? `Deposit ${amount} ${token} into vault` : "Deposit into vault"
|
|
20428
|
+
},
|
|
20429
|
+
["VAULT_WITHDRAW" /* VAULT_WITHDRAW */]: {
|
|
20430
|
+
label: ({ amount, token } = {}) => amount && token ? `Withdraw ${amount} ${token} from vault` : "Withdraw from vault"
|
|
20431
|
+
},
|
|
20432
|
+
["VAULT_COMPLETE_WITHDRAWAL" /* VAULT_COMPLETE_WITHDRAWAL */]: {
|
|
20433
|
+
label: () => "Claim vault withdrawal"
|
|
20434
|
+
},
|
|
20422
20435
|
// LST (Liquid Staking Tokens)
|
|
20423
20436
|
["STAKE_TO_STAKE" /* STAKE_TO_STAKE */]: { label: () => "Convert stake" },
|
|
20424
20437
|
["MINT_LST_NATIVE" /* MINT_LST_NATIVE */]: { label: () => "Mint LST" },
|
|
@@ -20781,16 +20794,16 @@ var instructions = {
|
|
|
20781
20794
|
var instructions_default = instructions;
|
|
20782
20795
|
function serializeBankConfigOpt(bankConfigOpt) {
|
|
20783
20796
|
const toWrappedI80F48 = (value) => value && bigNumberToWrappedI80F48(value);
|
|
20784
|
-
const
|
|
20797
|
+
const toBN2 = (value) => value && new BN9__default.default(value.toString());
|
|
20785
20798
|
return {
|
|
20786
20799
|
assetWeightInit: toWrappedI80F48(bankConfigOpt.assetWeightInit),
|
|
20787
20800
|
assetWeightMaint: toWrappedI80F48(bankConfigOpt.assetWeightMaint),
|
|
20788
20801
|
liabilityWeightInit: toWrappedI80F48(bankConfigOpt.liabilityWeightInit),
|
|
20789
20802
|
liabilityWeightMaint: toWrappedI80F48(bankConfigOpt.liabilityWeightMaint),
|
|
20790
|
-
depositLimit:
|
|
20791
|
-
borrowLimit:
|
|
20803
|
+
depositLimit: toBN2(bankConfigOpt.depositLimit),
|
|
20804
|
+
borrowLimit: toBN2(bankConfigOpt.borrowLimit),
|
|
20792
20805
|
riskTier: bankConfigOpt.riskTier && serializeRiskTier(bankConfigOpt.riskTier),
|
|
20793
|
-
totalAssetValueInitLimit:
|
|
20806
|
+
totalAssetValueInitLimit: toBN2(bankConfigOpt.totalAssetValueInitLimit),
|
|
20794
20807
|
assetTag: bankConfigOpt.assetTag !== null ? Number(bankConfigOpt.assetTag) : 0,
|
|
20795
20808
|
interestRateConfig: bankConfigOpt.interestRateConfig && {
|
|
20796
20809
|
insuranceFeeFixedApr: toWrappedI80F48(
|
|
@@ -62801,430 +62814,3803 @@ async function resolveExponentClmmTradePtContext(params) {
|
|
|
62801
62814
|
pt: { mint: market.mintPt, decimals: ptDecimals, tokenProgram: ptTokenProgram }
|
|
62802
62815
|
};
|
|
62803
62816
|
}
|
|
62817
|
+
var GAMMA_VAULT_PROGRAM_ID = new web3_js.PublicKey(
|
|
62818
|
+
"gvvtqvEmwQDnFwEvLJzzyweABcXV7HAYsTwTgztEHWJ"
|
|
62819
|
+
);
|
|
62820
|
+
var SEED_WITHDRAWAL_POLICY = "withdrawal_policy";
|
|
62821
|
+
var SEED_DEPOSIT_RECEIPT = "deposit_receipt";
|
|
62822
|
+
var SEED_WITHDRAW_ESCROW = "withdraw_escrow";
|
|
62823
|
+
var SEED_WITHDRAW_RECEIPT = "withdraw_receipt";
|
|
62804
62824
|
|
|
62805
|
-
// src/vendor/
|
|
62806
|
-
|
|
62807
|
-
|
|
62808
|
-
|
|
62809
|
-
|
|
62810
|
-
|
|
62811
|
-
|
|
62812
|
-
|
|
62813
|
-
|
|
62814
|
-
|
|
62815
|
-
const pendingReferrerFees = new Fraction(reserve.liquidity.pendingReferrerFeesSf).toDecimal();
|
|
62816
|
-
return liquidityAvailableAmount.add(borrowedAmount).sub(accumulatedProtocolFee).sub(accumulatedReferrerFees).sub(pendingReferrerFees);
|
|
62817
|
-
}
|
|
62818
|
-
function scaledSupplies(state) {
|
|
62819
|
-
const liqMintDecimals = new Decimal3__default.default(state.liquidity.mintDecimals.toString());
|
|
62820
|
-
const totalSupplyLamports = getKaminoTotalSupply(state);
|
|
62821
|
-
const mintTotalSupplyLam = new Decimal3__default.default(state.collateral.mintTotalSupply.toString());
|
|
62822
|
-
const liqScale = new Decimal3__default.default(10).pow(liqMintDecimals);
|
|
62823
|
-
const collScale = new Decimal3__default.default(10).pow(liqMintDecimals);
|
|
62824
|
-
const totalSupply = totalSupplyLamports.div(liqScale);
|
|
62825
|
-
const totalCollateral = mintTotalSupplyLam.div(collScale);
|
|
62826
|
-
return [totalSupply, totalCollateral];
|
|
62827
|
-
}
|
|
62828
|
-
|
|
62829
|
-
// src/vendor/klend/utils/farms/serialize.utils.ts
|
|
62830
|
-
function kaminoFarmStateToDto(farmState) {
|
|
62831
|
-
return {
|
|
62832
|
-
token: {
|
|
62833
|
-
mint: farmState.token.mint.toBase58(),
|
|
62834
|
-
decimals: farmState.token.decimals.toString()
|
|
62835
|
-
},
|
|
62836
|
-
rewardInfos: farmState.rewardInfos.map((item) => ({
|
|
62837
|
-
token: {
|
|
62838
|
-
mint: item.token.mint.toBase58(),
|
|
62839
|
-
decimals: item.token.decimals.toString()
|
|
62840
|
-
},
|
|
62841
|
-
rewardsAvailable: item.rewardsAvailable.toString(),
|
|
62842
|
-
rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
|
|
62843
|
-
rewardScheduleCurve: {
|
|
62844
|
-
points: item.rewardScheduleCurve.points.map((p) => ({
|
|
62845
|
-
tsStart: p.tsStart.toString(),
|
|
62846
|
-
rewardPerTimeUnit: p.rewardPerTimeUnit.toString()
|
|
62847
|
-
}))
|
|
62848
|
-
}
|
|
62849
|
-
}))
|
|
62850
|
-
};
|
|
62851
|
-
}
|
|
62852
|
-
var farmDiscriminator = Buffer.from([198, 102, 216, 74, 63, 66, 163, 190]);
|
|
62853
|
-
var farmLayout = borsh.struct([
|
|
62854
|
-
borsh.publicKey("farmAdmin"),
|
|
62855
|
-
borsh.publicKey("globalConfig"),
|
|
62856
|
-
borsh.struct(
|
|
62857
|
-
[
|
|
62858
|
-
borsh.publicKey("mint"),
|
|
62859
|
-
borsh.u64("decimals"),
|
|
62860
|
-
borsh.publicKey("tokenProgram"),
|
|
62861
|
-
borsh.array(borsh.u64(), 6, "padding")
|
|
62862
|
-
],
|
|
62863
|
-
"token"
|
|
62864
|
-
),
|
|
62865
|
-
borsh.array(
|
|
62866
|
-
borsh.struct([
|
|
62867
|
-
borsh.struct(
|
|
62868
|
-
[
|
|
62869
|
-
borsh.publicKey("mint"),
|
|
62870
|
-
borsh.u64("decimals"),
|
|
62871
|
-
borsh.publicKey("tokenProgram"),
|
|
62872
|
-
borsh.array(borsh.u64(), 6, "padding")
|
|
62873
|
-
],
|
|
62874
|
-
"token"
|
|
62875
|
-
),
|
|
62876
|
-
borsh.publicKey("rewardsVault"),
|
|
62877
|
-
borsh.u64("rewardsAvailable"),
|
|
62878
|
-
borsh.struct(
|
|
62879
|
-
[
|
|
62880
|
-
borsh.array(
|
|
62881
|
-
borsh.struct([borsh.u64("tsStart"), borsh.u64("rewardPerTimeUnit")]),
|
|
62882
|
-
20,
|
|
62883
|
-
"points"
|
|
62884
|
-
)
|
|
62885
|
-
],
|
|
62886
|
-
"rewardScheduleCurve"
|
|
62887
|
-
),
|
|
62888
|
-
borsh.u64("minClaimDurationSeconds"),
|
|
62889
|
-
borsh.u64("lastIssuanceTs"),
|
|
62890
|
-
borsh.u64("rewardsIssuedUnclaimed"),
|
|
62891
|
-
borsh.u64("rewardsIssuedCumulative"),
|
|
62892
|
-
borsh.u128("rewardPerShareScaled"),
|
|
62893
|
-
borsh.u64("placeholder0"),
|
|
62894
|
-
borsh.u8("rewardType"),
|
|
62895
|
-
borsh.u8("rewardsPerSecondDecimals"),
|
|
62896
|
-
borsh.array(borsh.u8(), 6, "padding0"),
|
|
62897
|
-
borsh.array(borsh.u64(), 20, "padding1")
|
|
62898
|
-
]),
|
|
62899
|
-
10,
|
|
62900
|
-
"rewardInfos"
|
|
62901
|
-
),
|
|
62902
|
-
borsh.u64("numRewardTokens"),
|
|
62903
|
-
borsh.u64("numUsers"),
|
|
62904
|
-
borsh.u64("totalStakedAmount"),
|
|
62905
|
-
borsh.publicKey("farmVault"),
|
|
62906
|
-
borsh.publicKey("farmVaultsAuthority"),
|
|
62907
|
-
borsh.u64("farmVaultsAuthorityBump"),
|
|
62908
|
-
borsh.publicKey("delegateAuthority"),
|
|
62909
|
-
borsh.u8("timeUnit"),
|
|
62910
|
-
borsh.u8("isFarmFrozen"),
|
|
62911
|
-
borsh.u8("isFarmDelegated"),
|
|
62912
|
-
borsh.array(borsh.u8(), 5, "padding0"),
|
|
62913
|
-
borsh.publicKey("withdrawAuthority"),
|
|
62914
|
-
borsh.u32("depositWarmupPeriod"),
|
|
62915
|
-
borsh.u32("withdrawalCooldownPeriod"),
|
|
62916
|
-
borsh.u128("totalActiveStakeScaled"),
|
|
62917
|
-
borsh.u128("totalPendingStakeScaled"),
|
|
62918
|
-
borsh.u64("totalPendingAmount"),
|
|
62919
|
-
borsh.u64("slashedAmountCurrent"),
|
|
62920
|
-
borsh.u64("slashedAmountCumulative"),
|
|
62921
|
-
borsh.publicKey("slashedAmountSpillAddress"),
|
|
62922
|
-
borsh.u64("lockingMode"),
|
|
62923
|
-
borsh.u64("lockingStartTimestamp"),
|
|
62924
|
-
borsh.u64("lockingDuration"),
|
|
62925
|
-
borsh.u64("lockingEarlyWithdrawalPenaltyBps"),
|
|
62926
|
-
borsh.u64("depositCapAmount"),
|
|
62927
|
-
borsh.publicKey("scopePrices"),
|
|
62928
|
-
borsh.u64("scopeOraclePriceId"),
|
|
62929
|
-
borsh.u64("scopeOracleMaxAge"),
|
|
62930
|
-
borsh.publicKey("pendingFarmAdmin"),
|
|
62931
|
-
borsh.publicKey("strategyId"),
|
|
62932
|
-
borsh.publicKey("delegatedRpsAdmin"),
|
|
62933
|
-
borsh.publicKey("vaultId"),
|
|
62934
|
-
borsh.publicKey("secondDelegatedAuthority"),
|
|
62935
|
-
borsh.array(borsh.u64(), 74, "padding")
|
|
62936
|
-
]);
|
|
62937
|
-
function decodeFarmDataRaw(data) {
|
|
62938
|
-
if (!data.slice(0, 8).equals(farmDiscriminator)) {
|
|
62939
|
-
throw new Error("invalid account discriminator");
|
|
62940
|
-
}
|
|
62941
|
-
const dec = farmLayout.decode(data.slice(8));
|
|
62942
|
-
return dec;
|
|
62943
|
-
}
|
|
62944
|
-
function dtoToKaminoFarmState(dto) {
|
|
62945
|
-
return {
|
|
62946
|
-
token: {
|
|
62947
|
-
mint: new web3_js.PublicKey(dto.token.mint),
|
|
62948
|
-
decimals: new BN9__default.default(dto.token.decimals)
|
|
62949
|
-
},
|
|
62950
|
-
rewardInfos: dto.rewardInfos.map((item) => ({
|
|
62951
|
-
token: {
|
|
62952
|
-
mint: new web3_js.PublicKey(item.token.mint),
|
|
62953
|
-
decimals: new BN9__default.default(item.token.decimals)
|
|
62954
|
-
},
|
|
62955
|
-
rewardsAvailable: new BN9__default.default(item.rewardsAvailable),
|
|
62956
|
-
rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
|
|
62957
|
-
rewardScheduleCurve: {
|
|
62958
|
-
points: item.rewardScheduleCurve.points.map((p) => ({
|
|
62959
|
-
tsStart: new BN9__default.default(p.tsStart),
|
|
62960
|
-
rewardPerTimeUnit: new BN9__default.default(p.rewardPerTimeUnit)
|
|
62961
|
-
}))
|
|
62962
|
-
}
|
|
62963
|
-
}))
|
|
62964
|
-
};
|
|
62965
|
-
}
|
|
62966
|
-
var KAMINO_PROGRAM_ID = new web3_js.PublicKey("KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD");
|
|
62967
|
-
var FARMS_PROGRAM_ID2 = new web3_js.PublicKey("FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr");
|
|
62968
|
-
function encodeU64(value) {
|
|
62969
|
-
const buf = Buffer.alloc(8);
|
|
62970
|
-
value.toArrayLike(Buffer, "le", 8).copy(buf);
|
|
62971
|
-
return buf;
|
|
62972
|
-
}
|
|
62973
|
-
function encodeU8(value) {
|
|
62974
|
-
const buf = Buffer.alloc(1);
|
|
62975
|
-
buf.writeUInt8(value, 0);
|
|
62976
|
-
return buf;
|
|
62977
|
-
}
|
|
62978
|
-
function encodeBool(value) {
|
|
62979
|
-
const buf = Buffer.alloc(1);
|
|
62980
|
-
buf.writeUInt8(value ? 1 : 0, 0);
|
|
62981
|
-
return buf;
|
|
62982
|
-
}
|
|
62983
|
-
function encodeOptionBool(value) {
|
|
62984
|
-
if (value === null || value === void 0) {
|
|
62985
|
-
return Buffer.from([0]);
|
|
62986
|
-
}
|
|
62987
|
-
return Buffer.concat([Buffer.from([1]), encodeBool(value)]);
|
|
62988
|
-
}
|
|
62989
|
-
function encodeOptionU8(value) {
|
|
62990
|
-
if (value === null || value === void 0) {
|
|
62991
|
-
return Buffer.from([0]);
|
|
62992
|
-
}
|
|
62993
|
-
return Buffer.concat([Buffer.from([1]), encodeU8(value)]);
|
|
62994
|
-
}
|
|
62995
|
-
function encodePublicKey(pubkey) {
|
|
62996
|
-
return Buffer.from(pubkey.toBytes());
|
|
62997
|
-
}
|
|
62998
|
-
var DISCRIMINATORS = {
|
|
62999
|
-
MARGINFI_ACCOUNT_INITIALIZE: Buffer.from([43, 78, 61, 255, 148, 52, 249, 154]),
|
|
63000
|
-
KAMINO_DEPOSIT: Buffer.from([237, 8, 188, 187, 115, 99, 49, 85]),
|
|
63001
|
-
LENDING_ACCOUNT_DEPOSIT: Buffer.from([171, 94, 235, 103, 82, 64, 212, 140]),
|
|
63002
|
-
LENDING_ACCOUNT_REPAY: Buffer.from([79, 209, 172, 177, 222, 51, 173, 151]),
|
|
63003
|
-
KAMINO_WITHDRAW: Buffer.from([199, 101, 41, 45, 213, 98, 224, 200]),
|
|
63004
|
-
LENDING_ACCOUNT_WITHDRAW: Buffer.from([36, 72, 74, 19, 210, 210, 192, 192]),
|
|
63005
|
-
LENDING_ACCOUNT_BORROW: Buffer.from([4, 126, 116, 53, 48, 5, 212, 31]),
|
|
63006
|
-
LENDING_ACCOUNT_LIQUIDATE: Buffer.from([214, 169, 151, 213, 251, 167, 86, 219]),
|
|
63007
|
-
LENDING_POOL_ADD_BANK: Buffer.from([215, 68, 72, 78, 208, 218, 103, 182]),
|
|
63008
|
-
LENDING_POOL_CONFIGURE_BANK: Buffer.from([121, 173, 156, 40, 93, 148, 56, 237]),
|
|
63009
|
-
LENDING_ACCOUNT_START_FLASHLOAN: Buffer.from([14, 131, 33, 220, 81, 186, 180, 107]),
|
|
63010
|
-
LENDING_ACCOUNT_END_FLASHLOAN: Buffer.from([105, 124, 201, 106, 153, 2, 8, 156]),
|
|
63011
|
-
TRANSFER_TO_NEW_ACCOUNT: Buffer.from([28, 79, 129, 231, 169, 69, 69, 65]),
|
|
63012
|
-
MARGINFI_GROUP_INITIALIZE: Buffer.from([255, 67, 67, 26, 94, 31, 34, 20]),
|
|
63013
|
-
MARGINFI_ACCOUNT_CLOSE: Buffer.from([186, 221, 93, 34, 50, 97, 194, 241]),
|
|
63014
|
-
LENDING_POOL_ADD_BANK_PERMISSIONLESS: Buffer.from([127, 187, 121, 34, 187, 167, 238, 102]),
|
|
63015
|
-
LENDING_POOL_CONFIGURE_BANK_ORACLE: Buffer.from([209, 82, 255, 171, 124, 21, 71, 81]),
|
|
63016
|
-
LENDING_ACCOUNT_PULSE_HEALTH: Buffer.from([186, 52, 117, 97, 34, 74, 39, 253]),
|
|
63017
|
-
LENDING_ACCOUNT_SORT_BALANCES: Buffer.from([187, 194, 110, 84, 82, 170, 204, 9]),
|
|
63018
|
-
DRIFT_DEPOSIT: Buffer.from([252, 63, 250, 201, 98, 55, 130, 12]),
|
|
63019
|
-
DRIFT_WITHDRAW: Buffer.from([86, 59, 186, 123, 183, 181, 234, 137])
|
|
63020
|
-
};
|
|
63021
|
-
function makeInitMarginfiAccountIx2(programId, accounts) {
|
|
63022
|
-
const keys = [
|
|
63023
|
-
{ pubkey: accounts.marginfiGroup, isSigner: false, isWritable: false },
|
|
63024
|
-
{ pubkey: accounts.marginfiAccount, isSigner: true, isWritable: true },
|
|
63025
|
-
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
63026
|
-
{ pubkey: accounts.feePayer, isSigner: true, isWritable: true },
|
|
63027
|
-
{
|
|
63028
|
-
pubkey: accounts.systemProgram || web3_js.SystemProgram.programId,
|
|
63029
|
-
isSigner: false,
|
|
63030
|
-
isWritable: false
|
|
63031
|
-
}
|
|
63032
|
-
];
|
|
63033
|
-
return new web3_js.TransactionInstruction({
|
|
63034
|
-
keys,
|
|
63035
|
-
programId,
|
|
63036
|
-
data: DISCRIMINATORS.MARGINFI_ACCOUNT_INITIALIZE
|
|
63037
|
-
});
|
|
63038
|
-
}
|
|
63039
|
-
function makeDepositIx2(programId, accounts, args, remainingAccounts = []) {
|
|
63040
|
-
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
63041
|
-
const keys = [
|
|
63042
|
-
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
63043
|
-
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
63044
|
-
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
63045
|
-
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
63046
|
-
{ pubkey: accounts.signerTokenAccount, isSigner: false, isWritable: true },
|
|
63047
|
-
{
|
|
63048
|
-
pubkey: accounts.liquidityVault ?? liquidityVault,
|
|
63049
|
-
isSigner: false,
|
|
63050
|
-
isWritable: true
|
|
63051
|
-
},
|
|
63052
|
-
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
63053
|
-
];
|
|
63054
|
-
keys.push(...remainingAccounts);
|
|
63055
|
-
const data = Buffer.concat([
|
|
63056
|
-
DISCRIMINATORS.LENDING_ACCOUNT_DEPOSIT,
|
|
63057
|
-
encodeU64(args.amount),
|
|
63058
|
-
encodeOptionBool(args.depositUpToLimit ?? null)
|
|
63059
|
-
]);
|
|
63060
|
-
return new web3_js.TransactionInstruction({
|
|
63061
|
-
keys,
|
|
63062
|
-
programId,
|
|
63063
|
-
data
|
|
63064
|
-
});
|
|
63065
|
-
}
|
|
63066
|
-
function makeRepayIx2(programId, accounts, args, remainingAccounts = []) {
|
|
63067
|
-
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
63068
|
-
const keys = [
|
|
63069
|
-
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
63070
|
-
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
63071
|
-
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
63072
|
-
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
63073
|
-
{ pubkey: accounts.signerTokenAccount, isSigner: false, isWritable: true },
|
|
63074
|
-
{ pubkey: liquidityVault, isSigner: false, isWritable: true },
|
|
63075
|
-
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
63076
|
-
];
|
|
63077
|
-
keys.push(...remainingAccounts);
|
|
63078
|
-
const data = Buffer.concat([
|
|
63079
|
-
DISCRIMINATORS.LENDING_ACCOUNT_REPAY,
|
|
63080
|
-
encodeU64(args.amount),
|
|
63081
|
-
encodeOptionBool(args.repayAll ?? null)
|
|
63082
|
-
]);
|
|
63083
|
-
return new web3_js.TransactionInstruction({
|
|
63084
|
-
keys,
|
|
63085
|
-
programId,
|
|
63086
|
-
data
|
|
63087
|
-
});
|
|
63088
|
-
}
|
|
63089
|
-
function makeWithdrawIx2(programId, accounts, args, remainingAccounts = []) {
|
|
63090
|
-
const [bankLiquidityVaultAuthority] = deriveBankLiquidityVaultAuthority(programId, accounts.bank);
|
|
63091
|
-
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
63092
|
-
const keys = [
|
|
63093
|
-
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
63094
|
-
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
63095
|
-
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
63096
|
-
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
63097
|
-
{
|
|
63098
|
-
pubkey: accounts.destinationTokenAccount,
|
|
63099
|
-
isSigner: false,
|
|
63100
|
-
isWritable: true
|
|
63101
|
-
},
|
|
63102
|
-
{ pubkey: bankLiquidityVaultAuthority, isSigner: false, isWritable: false },
|
|
63103
|
-
{ pubkey: liquidityVault, isSigner: false, isWritable: true },
|
|
63104
|
-
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
63105
|
-
];
|
|
63106
|
-
keys.push(...remainingAccounts);
|
|
63107
|
-
const data = Buffer.concat([
|
|
63108
|
-
DISCRIMINATORS.LENDING_ACCOUNT_WITHDRAW,
|
|
63109
|
-
encodeU64(args.amount),
|
|
63110
|
-
encodeOptionBool(args.withdrawAll ?? null)
|
|
63111
|
-
]);
|
|
63112
|
-
return new web3_js.TransactionInstruction({
|
|
63113
|
-
keys,
|
|
63114
|
-
programId,
|
|
63115
|
-
data
|
|
63116
|
-
});
|
|
63117
|
-
}
|
|
63118
|
-
function makeBorrowIx2(programId, accounts, args, remainingAccounts = []) {
|
|
63119
|
-
const [bankLiquidityVaultAuthority] = deriveBankLiquidityVaultAuthority(programId, accounts.bank);
|
|
63120
|
-
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
63121
|
-
const keys = [
|
|
63122
|
-
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
63123
|
-
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
63124
|
-
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
63125
|
-
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
63126
|
-
{
|
|
63127
|
-
pubkey: accounts.destinationTokenAccount,
|
|
63128
|
-
isSigner: false,
|
|
63129
|
-
isWritable: true
|
|
63130
|
-
},
|
|
63131
|
-
{ pubkey: bankLiquidityVaultAuthority, isSigner: false, isWritable: false },
|
|
63132
|
-
{ pubkey: liquidityVault, isSigner: false, isWritable: true },
|
|
63133
|
-
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
63134
|
-
];
|
|
63135
|
-
keys.push(...remainingAccounts);
|
|
63136
|
-
const data = Buffer.concat([DISCRIMINATORS.LENDING_ACCOUNT_BORROW, encodeU64(args.amount)]);
|
|
63137
|
-
return new web3_js.TransactionInstruction({
|
|
63138
|
-
keys,
|
|
63139
|
-
programId,
|
|
63140
|
-
data
|
|
63141
|
-
});
|
|
63142
|
-
}
|
|
63143
|
-
function makeBeginFlashLoanIx2(programId, accounts, args) {
|
|
63144
|
-
const keys = [
|
|
63145
|
-
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
63146
|
-
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
63147
|
-
{
|
|
63148
|
-
pubkey: web3_js.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
63149
|
-
// hardcoded address from IDL
|
|
63150
|
-
isSigner: false,
|
|
63151
|
-
isWritable: false
|
|
63152
|
-
}
|
|
63153
|
-
];
|
|
63154
|
-
const data = Buffer.concat([
|
|
63155
|
-
DISCRIMINATORS.LENDING_ACCOUNT_START_FLASHLOAN,
|
|
63156
|
-
encodeU64(args.endIndex)
|
|
63157
|
-
]);
|
|
63158
|
-
return new web3_js.TransactionInstruction({
|
|
63159
|
-
keys,
|
|
63160
|
-
programId,
|
|
63161
|
-
data
|
|
63162
|
-
});
|
|
63163
|
-
}
|
|
63164
|
-
function makeEndFlashLoanIx2(programId, accounts, remainingAccounts = []) {
|
|
63165
|
-
const keys = [
|
|
63166
|
-
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
63167
|
-
{ pubkey: accounts.authority, isSigner: true, isWritable: false }
|
|
63168
|
-
];
|
|
63169
|
-
keys.push(...remainingAccounts);
|
|
63170
|
-
return new web3_js.TransactionInstruction({
|
|
63171
|
-
keys,
|
|
63172
|
-
programId,
|
|
63173
|
-
data: DISCRIMINATORS.LENDING_ACCOUNT_END_FLASHLOAN
|
|
63174
|
-
});
|
|
63175
|
-
}
|
|
63176
|
-
function makeKaminoDepositIx2(programId, accounts, args, remainingAccounts = []) {
|
|
63177
|
-
const liquidityVaultAuthority = deriveBankLiquidityVaultAuthority(programId, accounts.bank)[0];
|
|
63178
|
-
const liquidityVault = deriveBankLiquidityVault(programId, accounts.bank)[0];
|
|
63179
|
-
const keys = [
|
|
63180
|
-
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
63181
|
-
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
63182
|
-
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
63183
|
-
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
63184
|
-
{ pubkey: accounts.signerTokenAccount, isSigner: false, isWritable: true },
|
|
63185
|
-
{
|
|
63186
|
-
pubkey: liquidityVaultAuthority,
|
|
63187
|
-
isSigner: false,
|
|
63188
|
-
isWritable: true
|
|
63189
|
-
},
|
|
63190
|
-
{ pubkey: liquidityVault, isSigner: false, isWritable: true },
|
|
63191
|
-
{ pubkey: accounts.integrationAcc2, isSigner: false, isWritable: true },
|
|
63192
|
-
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
63193
|
-
{
|
|
63194
|
-
pubkey: accounts.lendingMarketAuthority,
|
|
63195
|
-
isSigner: false,
|
|
63196
|
-
isWritable: false
|
|
63197
|
-
},
|
|
63198
|
-
{ pubkey: accounts.integrationAcc1, isSigner: false, isWritable: true },
|
|
63199
|
-
{ pubkey: accounts.mint, isSigner: false, isWritable: false },
|
|
62825
|
+
// src/vendor/gamma/idl/gamma-vault.json
|
|
62826
|
+
var gamma_vault_default = {
|
|
62827
|
+
address: "GaMmanX9i4jGmqDZZD2tbD6B2v9p21btenPneMXnTczV",
|
|
62828
|
+
metadata: {
|
|
62829
|
+
name: "gamma_vault",
|
|
62830
|
+
version: "2.0.0",
|
|
62831
|
+
spec: "0.1.0",
|
|
62832
|
+
description: "Gamma Protocol vault program \u2014 LP vaults with instant deposits, escrow withdrawals, and performance fees"
|
|
62833
|
+
},
|
|
62834
|
+
instructions: [
|
|
63200
62835
|
{
|
|
63201
|
-
|
|
63202
|
-
|
|
63203
|
-
|
|
62836
|
+
name: "assess_fees",
|
|
62837
|
+
docs: [
|
|
62838
|
+
"Assess scheduled performance fees (keeper)."
|
|
62839
|
+
],
|
|
62840
|
+
discriminator: [
|
|
62841
|
+
224,
|
|
62842
|
+
15,
|
|
62843
|
+
195,
|
|
62844
|
+
19,
|
|
62845
|
+
125,
|
|
62846
|
+
145,
|
|
62847
|
+
2,
|
|
62848
|
+
100
|
|
62849
|
+
],
|
|
62850
|
+
accounts: [
|
|
62851
|
+
{
|
|
62852
|
+
name: "fund_authority",
|
|
62853
|
+
signer: true,
|
|
62854
|
+
relations: [
|
|
62855
|
+
"lp_vault"
|
|
62856
|
+
]
|
|
62857
|
+
},
|
|
62858
|
+
{
|
|
62859
|
+
name: "lp_vault",
|
|
62860
|
+
writable: true
|
|
62861
|
+
},
|
|
62862
|
+
{
|
|
62863
|
+
name: "shares_mint",
|
|
62864
|
+
writable: true,
|
|
62865
|
+
relations: [
|
|
62866
|
+
"lp_vault"
|
|
62867
|
+
]
|
|
62868
|
+
},
|
|
62869
|
+
{
|
|
62870
|
+
name: "fee_recipient_account",
|
|
62871
|
+
writable: true
|
|
62872
|
+
},
|
|
62873
|
+
{
|
|
62874
|
+
name: "token_program"
|
|
62875
|
+
}
|
|
62876
|
+
],
|
|
62877
|
+
args: []
|
|
63204
62878
|
},
|
|
63205
62879
|
{
|
|
63206
|
-
|
|
63207
|
-
|
|
63208
|
-
|
|
62880
|
+
name: "close_deposit_receipt",
|
|
62881
|
+
docs: [
|
|
62882
|
+
"Close a deposit receipt and reclaim rent."
|
|
62883
|
+
],
|
|
62884
|
+
discriminator: [
|
|
62885
|
+
216,
|
|
62886
|
+
104,
|
|
62887
|
+
127,
|
|
62888
|
+
60,
|
|
62889
|
+
88,
|
|
62890
|
+
217,
|
|
62891
|
+
184,
|
|
62892
|
+
15
|
|
62893
|
+
],
|
|
62894
|
+
accounts: [
|
|
62895
|
+
{
|
|
62896
|
+
name: "user",
|
|
62897
|
+
docs: [
|
|
62898
|
+
"User who owns the deposit receipt."
|
|
62899
|
+
],
|
|
62900
|
+
writable: true,
|
|
62901
|
+
signer: true
|
|
62902
|
+
},
|
|
62903
|
+
{
|
|
62904
|
+
name: "lp_vault",
|
|
62905
|
+
docs: [
|
|
62906
|
+
"The vault this receipt is associated with."
|
|
62907
|
+
]
|
|
62908
|
+
},
|
|
62909
|
+
{
|
|
62910
|
+
name: "deposit_receipt",
|
|
62911
|
+
docs: [
|
|
62912
|
+
"Deposit receipt to close. Rent is returned to user."
|
|
62913
|
+
],
|
|
62914
|
+
writable: true,
|
|
62915
|
+
pda: {
|
|
62916
|
+
seeds: [
|
|
62917
|
+
{
|
|
62918
|
+
kind: "const",
|
|
62919
|
+
value: [
|
|
62920
|
+
100,
|
|
62921
|
+
101,
|
|
62922
|
+
112,
|
|
62923
|
+
111,
|
|
62924
|
+
115,
|
|
62925
|
+
105,
|
|
62926
|
+
116,
|
|
62927
|
+
95,
|
|
62928
|
+
114,
|
|
62929
|
+
101,
|
|
62930
|
+
99,
|
|
62931
|
+
101,
|
|
62932
|
+
105,
|
|
62933
|
+
112,
|
|
62934
|
+
116
|
|
62935
|
+
]
|
|
62936
|
+
},
|
|
62937
|
+
{
|
|
62938
|
+
kind: "account",
|
|
62939
|
+
path: "user"
|
|
62940
|
+
},
|
|
62941
|
+
{
|
|
62942
|
+
kind: "account",
|
|
62943
|
+
path: "lp_vault"
|
|
62944
|
+
}
|
|
62945
|
+
]
|
|
62946
|
+
}
|
|
62947
|
+
}
|
|
62948
|
+
],
|
|
62949
|
+
args: []
|
|
63209
62950
|
},
|
|
63210
62951
|
{
|
|
63211
|
-
|
|
63212
|
-
|
|
63213
|
-
|
|
63214
|
-
|
|
63215
|
-
|
|
63216
|
-
|
|
63217
|
-
|
|
63218
|
-
|
|
63219
|
-
|
|
63220
|
-
|
|
63221
|
-
|
|
63222
|
-
|
|
63223
|
-
|
|
63224
|
-
|
|
63225
|
-
|
|
63226
|
-
|
|
63227
|
-
|
|
62952
|
+
name: "complete_withdrawal",
|
|
62953
|
+
docs: [
|
|
62954
|
+
"User claims their withdrawal from escrow.",
|
|
62955
|
+
"Burns shares and transfers assets to user's wallet."
|
|
62956
|
+
],
|
|
62957
|
+
discriminator: [
|
|
62958
|
+
107,
|
|
62959
|
+
98,
|
|
62960
|
+
134,
|
|
62961
|
+
131,
|
|
62962
|
+
74,
|
|
62963
|
+
120,
|
|
62964
|
+
174,
|
|
62965
|
+
121
|
|
62966
|
+
],
|
|
62967
|
+
accounts: [
|
|
62968
|
+
{
|
|
62969
|
+
name: "user",
|
|
62970
|
+
docs: [
|
|
62971
|
+
"User claiming the withdrawal."
|
|
62972
|
+
],
|
|
62973
|
+
writable: true,
|
|
62974
|
+
signer: true
|
|
62975
|
+
},
|
|
62976
|
+
{
|
|
62977
|
+
name: "lp_vault",
|
|
62978
|
+
docs: [
|
|
62979
|
+
"LpVault (needed for shares_mint validation)."
|
|
62980
|
+
]
|
|
62981
|
+
},
|
|
62982
|
+
{
|
|
62983
|
+
name: "assets_mint",
|
|
62984
|
+
docs: [
|
|
62985
|
+
"Mint of the vault assets."
|
|
62986
|
+
],
|
|
62987
|
+
relations: [
|
|
62988
|
+
"lp_vault"
|
|
62989
|
+
]
|
|
62990
|
+
},
|
|
62991
|
+
{
|
|
62992
|
+
name: "shares_mint",
|
|
62993
|
+
docs: [
|
|
62994
|
+
"Mint for vault shares."
|
|
62995
|
+
],
|
|
62996
|
+
writable: true,
|
|
62997
|
+
relations: [
|
|
62998
|
+
"lp_vault"
|
|
62999
|
+
]
|
|
63000
|
+
},
|
|
63001
|
+
{
|
|
63002
|
+
name: "user_asset_ata",
|
|
63003
|
+
docs: [
|
|
63004
|
+
"User's asset token account (destination for claimed assets)."
|
|
63005
|
+
],
|
|
63006
|
+
writable: true,
|
|
63007
|
+
pda: {
|
|
63008
|
+
seeds: [
|
|
63009
|
+
{
|
|
63010
|
+
kind: "account",
|
|
63011
|
+
path: "user"
|
|
63012
|
+
},
|
|
63013
|
+
{
|
|
63014
|
+
kind: "account",
|
|
63015
|
+
path: "token_program"
|
|
63016
|
+
},
|
|
63017
|
+
{
|
|
63018
|
+
kind: "account",
|
|
63019
|
+
path: "assets_mint"
|
|
63020
|
+
}
|
|
63021
|
+
],
|
|
63022
|
+
program: {
|
|
63023
|
+
kind: "const",
|
|
63024
|
+
value: [
|
|
63025
|
+
140,
|
|
63026
|
+
151,
|
|
63027
|
+
37,
|
|
63028
|
+
143,
|
|
63029
|
+
78,
|
|
63030
|
+
36,
|
|
63031
|
+
137,
|
|
63032
|
+
241,
|
|
63033
|
+
187,
|
|
63034
|
+
61,
|
|
63035
|
+
16,
|
|
63036
|
+
41,
|
|
63037
|
+
20,
|
|
63038
|
+
142,
|
|
63039
|
+
13,
|
|
63040
|
+
131,
|
|
63041
|
+
11,
|
|
63042
|
+
90,
|
|
63043
|
+
19,
|
|
63044
|
+
153,
|
|
63045
|
+
218,
|
|
63046
|
+
255,
|
|
63047
|
+
16,
|
|
63048
|
+
132,
|
|
63049
|
+
4,
|
|
63050
|
+
142,
|
|
63051
|
+
123,
|
|
63052
|
+
216,
|
|
63053
|
+
219,
|
|
63054
|
+
233,
|
|
63055
|
+
248,
|
|
63056
|
+
89
|
|
63057
|
+
]
|
|
63058
|
+
}
|
|
63059
|
+
}
|
|
63060
|
+
},
|
|
63061
|
+
{
|
|
63062
|
+
name: "withdraw_escrow",
|
|
63063
|
+
docs: [
|
|
63064
|
+
"User's withdraw escrow."
|
|
63065
|
+
],
|
|
63066
|
+
writable: true,
|
|
63067
|
+
pda: {
|
|
63068
|
+
seeds: [
|
|
63069
|
+
{
|
|
63070
|
+
kind: "const",
|
|
63071
|
+
value: [
|
|
63072
|
+
119,
|
|
63073
|
+
105,
|
|
63074
|
+
116,
|
|
63075
|
+
104,
|
|
63076
|
+
100,
|
|
63077
|
+
114,
|
|
63078
|
+
97,
|
|
63079
|
+
119,
|
|
63080
|
+
95,
|
|
63081
|
+
101,
|
|
63082
|
+
115,
|
|
63083
|
+
99,
|
|
63084
|
+
114,
|
|
63085
|
+
111,
|
|
63086
|
+
119
|
|
63087
|
+
]
|
|
63088
|
+
},
|
|
63089
|
+
{
|
|
63090
|
+
kind: "account",
|
|
63091
|
+
path: "user"
|
|
63092
|
+
},
|
|
63093
|
+
{
|
|
63094
|
+
kind: "account",
|
|
63095
|
+
path: "lp_vault"
|
|
63096
|
+
}
|
|
63097
|
+
]
|
|
63098
|
+
}
|
|
63099
|
+
},
|
|
63100
|
+
{
|
|
63101
|
+
name: "escrow_assets_account",
|
|
63102
|
+
docs: [
|
|
63103
|
+
"Escrow's asset token account (source of assets)."
|
|
63104
|
+
],
|
|
63105
|
+
writable: true,
|
|
63106
|
+
relations: [
|
|
63107
|
+
"withdraw_escrow"
|
|
63108
|
+
]
|
|
63109
|
+
},
|
|
63110
|
+
{
|
|
63111
|
+
name: "escrow_shares_account",
|
|
63112
|
+
docs: [
|
|
63113
|
+
"Escrow's share token account (shares to burn)."
|
|
63114
|
+
],
|
|
63115
|
+
writable: true,
|
|
63116
|
+
relations: [
|
|
63117
|
+
"withdraw_escrow"
|
|
63118
|
+
]
|
|
63119
|
+
},
|
|
63120
|
+
{
|
|
63121
|
+
name: "withdraw_receipt",
|
|
63122
|
+
docs: [
|
|
63123
|
+
"User's withdraw receipt."
|
|
63124
|
+
],
|
|
63125
|
+
writable: true,
|
|
63126
|
+
pda: {
|
|
63127
|
+
seeds: [
|
|
63128
|
+
{
|
|
63129
|
+
kind: "const",
|
|
63130
|
+
value: [
|
|
63131
|
+
119,
|
|
63132
|
+
105,
|
|
63133
|
+
116,
|
|
63134
|
+
104,
|
|
63135
|
+
100,
|
|
63136
|
+
114,
|
|
63137
|
+
97,
|
|
63138
|
+
119,
|
|
63139
|
+
95,
|
|
63140
|
+
114,
|
|
63141
|
+
101,
|
|
63142
|
+
99,
|
|
63143
|
+
101,
|
|
63144
|
+
105,
|
|
63145
|
+
112,
|
|
63146
|
+
116
|
|
63147
|
+
]
|
|
63148
|
+
},
|
|
63149
|
+
{
|
|
63150
|
+
kind: "account",
|
|
63151
|
+
path: "user"
|
|
63152
|
+
},
|
|
63153
|
+
{
|
|
63154
|
+
kind: "account",
|
|
63155
|
+
path: "lp_vault"
|
|
63156
|
+
}
|
|
63157
|
+
]
|
|
63158
|
+
}
|
|
63159
|
+
},
|
|
63160
|
+
{
|
|
63161
|
+
name: "system_program",
|
|
63162
|
+
docs: [
|
|
63163
|
+
"System program."
|
|
63164
|
+
],
|
|
63165
|
+
address: "11111111111111111111111111111111"
|
|
63166
|
+
},
|
|
63167
|
+
{
|
|
63168
|
+
name: "token_program",
|
|
63169
|
+
docs: [
|
|
63170
|
+
"Token program."
|
|
63171
|
+
]
|
|
63172
|
+
},
|
|
63173
|
+
{
|
|
63174
|
+
name: "associated_token_program",
|
|
63175
|
+
docs: [
|
|
63176
|
+
"Associated token program."
|
|
63177
|
+
],
|
|
63178
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
63179
|
+
}
|
|
63180
|
+
],
|
|
63181
|
+
args: []
|
|
63182
|
+
},
|
|
63183
|
+
{
|
|
63184
|
+
name: "deposit",
|
|
63185
|
+
docs: [
|
|
63186
|
+
"Deposit assets and receive shares instantly.",
|
|
63187
|
+
"Requires NAV to be fresh (within nav_max_staleness)."
|
|
63188
|
+
],
|
|
63189
|
+
discriminator: [
|
|
63190
|
+
242,
|
|
63191
|
+
35,
|
|
63192
|
+
198,
|
|
63193
|
+
137,
|
|
63194
|
+
82,
|
|
63195
|
+
225,
|
|
63196
|
+
242,
|
|
63197
|
+
182
|
|
63198
|
+
],
|
|
63199
|
+
accounts: [
|
|
63200
|
+
{
|
|
63201
|
+
name: "user",
|
|
63202
|
+
docs: [
|
|
63203
|
+
"User depositing into the vault."
|
|
63204
|
+
],
|
|
63205
|
+
writable: true,
|
|
63206
|
+
signer: true
|
|
63207
|
+
},
|
|
63208
|
+
{
|
|
63209
|
+
name: "lp_vault",
|
|
63210
|
+
docs: [
|
|
63211
|
+
"LpVault to deposit into."
|
|
63212
|
+
],
|
|
63213
|
+
writable: true,
|
|
63214
|
+
relations: [
|
|
63215
|
+
"withdrawal_policy"
|
|
63216
|
+
]
|
|
63217
|
+
},
|
|
63218
|
+
{
|
|
63219
|
+
name: "withdrawal_policy",
|
|
63220
|
+
docs: [
|
|
63221
|
+
"Withdrawal policy for net capacity accounting. Deposits offset usage."
|
|
63222
|
+
],
|
|
63223
|
+
writable: true,
|
|
63224
|
+
pda: {
|
|
63225
|
+
seeds: [
|
|
63226
|
+
{
|
|
63227
|
+
kind: "const",
|
|
63228
|
+
value: [
|
|
63229
|
+
119,
|
|
63230
|
+
105,
|
|
63231
|
+
116,
|
|
63232
|
+
104,
|
|
63233
|
+
100,
|
|
63234
|
+
114,
|
|
63235
|
+
97,
|
|
63236
|
+
119,
|
|
63237
|
+
97,
|
|
63238
|
+
108,
|
|
63239
|
+
95,
|
|
63240
|
+
112,
|
|
63241
|
+
111,
|
|
63242
|
+
108,
|
|
63243
|
+
105,
|
|
63244
|
+
99,
|
|
63245
|
+
121
|
|
63246
|
+
]
|
|
63247
|
+
},
|
|
63248
|
+
{
|
|
63249
|
+
kind: "account",
|
|
63250
|
+
path: "lp_vault"
|
|
63251
|
+
}
|
|
63252
|
+
]
|
|
63253
|
+
}
|
|
63254
|
+
},
|
|
63255
|
+
{
|
|
63256
|
+
name: "assets_account",
|
|
63257
|
+
docs: [
|
|
63258
|
+
"Token account for vault assets."
|
|
63259
|
+
],
|
|
63260
|
+
writable: true,
|
|
63261
|
+
relations: [
|
|
63262
|
+
"lp_vault"
|
|
63263
|
+
]
|
|
63264
|
+
},
|
|
63265
|
+
{
|
|
63266
|
+
name: "user_asset_ata",
|
|
63267
|
+
docs: [
|
|
63268
|
+
"User's asset token account (source of deposit)."
|
|
63269
|
+
],
|
|
63270
|
+
writable: true,
|
|
63271
|
+
pda: {
|
|
63272
|
+
seeds: [
|
|
63273
|
+
{
|
|
63274
|
+
kind: "account",
|
|
63275
|
+
path: "user"
|
|
63276
|
+
},
|
|
63277
|
+
{
|
|
63278
|
+
kind: "account",
|
|
63279
|
+
path: "token_program"
|
|
63280
|
+
},
|
|
63281
|
+
{
|
|
63282
|
+
kind: "account",
|
|
63283
|
+
path: "assets_mint"
|
|
63284
|
+
}
|
|
63285
|
+
],
|
|
63286
|
+
program: {
|
|
63287
|
+
kind: "const",
|
|
63288
|
+
value: [
|
|
63289
|
+
140,
|
|
63290
|
+
151,
|
|
63291
|
+
37,
|
|
63292
|
+
143,
|
|
63293
|
+
78,
|
|
63294
|
+
36,
|
|
63295
|
+
137,
|
|
63296
|
+
241,
|
|
63297
|
+
187,
|
|
63298
|
+
61,
|
|
63299
|
+
16,
|
|
63300
|
+
41,
|
|
63301
|
+
20,
|
|
63302
|
+
142,
|
|
63303
|
+
13,
|
|
63304
|
+
131,
|
|
63305
|
+
11,
|
|
63306
|
+
90,
|
|
63307
|
+
19,
|
|
63308
|
+
153,
|
|
63309
|
+
218,
|
|
63310
|
+
255,
|
|
63311
|
+
16,
|
|
63312
|
+
132,
|
|
63313
|
+
4,
|
|
63314
|
+
142,
|
|
63315
|
+
123,
|
|
63316
|
+
216,
|
|
63317
|
+
219,
|
|
63318
|
+
233,
|
|
63319
|
+
248,
|
|
63320
|
+
89
|
|
63321
|
+
]
|
|
63322
|
+
}
|
|
63323
|
+
}
|
|
63324
|
+
},
|
|
63325
|
+
{
|
|
63326
|
+
name: "user_share_ata",
|
|
63327
|
+
docs: [
|
|
63328
|
+
"User's share token account (destination for minted shares)."
|
|
63329
|
+
],
|
|
63330
|
+
writable: true,
|
|
63331
|
+
pda: {
|
|
63332
|
+
seeds: [
|
|
63333
|
+
{
|
|
63334
|
+
kind: "account",
|
|
63335
|
+
path: "user"
|
|
63336
|
+
},
|
|
63337
|
+
{
|
|
63338
|
+
kind: "account",
|
|
63339
|
+
path: "token_program"
|
|
63340
|
+
},
|
|
63341
|
+
{
|
|
63342
|
+
kind: "account",
|
|
63343
|
+
path: "shares_mint"
|
|
63344
|
+
}
|
|
63345
|
+
],
|
|
63346
|
+
program: {
|
|
63347
|
+
kind: "const",
|
|
63348
|
+
value: [
|
|
63349
|
+
140,
|
|
63350
|
+
151,
|
|
63351
|
+
37,
|
|
63352
|
+
143,
|
|
63353
|
+
78,
|
|
63354
|
+
36,
|
|
63355
|
+
137,
|
|
63356
|
+
241,
|
|
63357
|
+
187,
|
|
63358
|
+
61,
|
|
63359
|
+
16,
|
|
63360
|
+
41,
|
|
63361
|
+
20,
|
|
63362
|
+
142,
|
|
63363
|
+
13,
|
|
63364
|
+
131,
|
|
63365
|
+
11,
|
|
63366
|
+
90,
|
|
63367
|
+
19,
|
|
63368
|
+
153,
|
|
63369
|
+
218,
|
|
63370
|
+
255,
|
|
63371
|
+
16,
|
|
63372
|
+
132,
|
|
63373
|
+
4,
|
|
63374
|
+
142,
|
|
63375
|
+
123,
|
|
63376
|
+
216,
|
|
63377
|
+
219,
|
|
63378
|
+
233,
|
|
63379
|
+
248,
|
|
63380
|
+
89
|
|
63381
|
+
]
|
|
63382
|
+
}
|
|
63383
|
+
}
|
|
63384
|
+
},
|
|
63385
|
+
{
|
|
63386
|
+
name: "deposit_receipt",
|
|
63387
|
+
docs: [
|
|
63388
|
+
"Deposit receipt account",
|
|
63389
|
+
"Derived from user pubkey and lp_vault pubkey."
|
|
63390
|
+
],
|
|
63391
|
+
writable: true,
|
|
63392
|
+
pda: {
|
|
63393
|
+
seeds: [
|
|
63394
|
+
{
|
|
63395
|
+
kind: "const",
|
|
63396
|
+
value: [
|
|
63397
|
+
100,
|
|
63398
|
+
101,
|
|
63399
|
+
112,
|
|
63400
|
+
111,
|
|
63401
|
+
115,
|
|
63402
|
+
105,
|
|
63403
|
+
116,
|
|
63404
|
+
95,
|
|
63405
|
+
114,
|
|
63406
|
+
101,
|
|
63407
|
+
99,
|
|
63408
|
+
101,
|
|
63409
|
+
105,
|
|
63410
|
+
112,
|
|
63411
|
+
116
|
|
63412
|
+
]
|
|
63413
|
+
},
|
|
63414
|
+
{
|
|
63415
|
+
kind: "account",
|
|
63416
|
+
path: "user"
|
|
63417
|
+
},
|
|
63418
|
+
{
|
|
63419
|
+
kind: "account",
|
|
63420
|
+
path: "lp_vault"
|
|
63421
|
+
}
|
|
63422
|
+
]
|
|
63423
|
+
}
|
|
63424
|
+
},
|
|
63425
|
+
{
|
|
63426
|
+
name: "assets_mint",
|
|
63427
|
+
docs: [
|
|
63428
|
+
"Mint of the vault assets."
|
|
63429
|
+
],
|
|
63430
|
+
relations: [
|
|
63431
|
+
"lp_vault"
|
|
63432
|
+
]
|
|
63433
|
+
},
|
|
63434
|
+
{
|
|
63435
|
+
name: "shares_mint",
|
|
63436
|
+
docs: [
|
|
63437
|
+
"Mint for vault shares."
|
|
63438
|
+
],
|
|
63439
|
+
writable: true,
|
|
63440
|
+
relations: [
|
|
63441
|
+
"lp_vault"
|
|
63442
|
+
]
|
|
63443
|
+
},
|
|
63444
|
+
{
|
|
63445
|
+
name: "system_program",
|
|
63446
|
+
docs: [
|
|
63447
|
+
"System program."
|
|
63448
|
+
],
|
|
63449
|
+
address: "11111111111111111111111111111111"
|
|
63450
|
+
},
|
|
63451
|
+
{
|
|
63452
|
+
name: "token_program",
|
|
63453
|
+
docs: [
|
|
63454
|
+
"Token program."
|
|
63455
|
+
]
|
|
63456
|
+
},
|
|
63457
|
+
{
|
|
63458
|
+
name: "associated_token_program",
|
|
63459
|
+
docs: [
|
|
63460
|
+
"Associated token program."
|
|
63461
|
+
],
|
|
63462
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
63463
|
+
}
|
|
63464
|
+
],
|
|
63465
|
+
args: [
|
|
63466
|
+
{
|
|
63467
|
+
name: "amount",
|
|
63468
|
+
type: "u64"
|
|
63469
|
+
}
|
|
63470
|
+
]
|
|
63471
|
+
},
|
|
63472
|
+
{
|
|
63473
|
+
name: "fulfill_withdrawal",
|
|
63474
|
+
docs: [
|
|
63475
|
+
"Fulfill pending withdrawals by transferring assets to user's escrow.",
|
|
63476
|
+
"Called by keeper when liquidity is available."
|
|
63477
|
+
],
|
|
63478
|
+
discriminator: [
|
|
63479
|
+
57,
|
|
63480
|
+
37,
|
|
63481
|
+
123,
|
|
63482
|
+
221,
|
|
63483
|
+
103,
|
|
63484
|
+
93,
|
|
63485
|
+
162,
|
|
63486
|
+
176
|
|
63487
|
+
],
|
|
63488
|
+
accounts: [
|
|
63489
|
+
{
|
|
63490
|
+
name: "signer",
|
|
63491
|
+
docs: [
|
|
63492
|
+
"Keeper signer. Must be the vault's fund_authority or keeper_authority."
|
|
63493
|
+
],
|
|
63494
|
+
writable: true,
|
|
63495
|
+
signer: true
|
|
63496
|
+
},
|
|
63497
|
+
{
|
|
63498
|
+
name: "user"
|
|
63499
|
+
},
|
|
63500
|
+
{
|
|
63501
|
+
name: "lp_vault",
|
|
63502
|
+
docs: [
|
|
63503
|
+
"LpVault."
|
|
63504
|
+
],
|
|
63505
|
+
writable: true,
|
|
63506
|
+
relations: [
|
|
63507
|
+
"withdrawal_policy"
|
|
63508
|
+
]
|
|
63509
|
+
},
|
|
63510
|
+
{
|
|
63511
|
+
name: "withdrawal_policy",
|
|
63512
|
+
docs: [
|
|
63513
|
+
"Withdrawal policy used to retain the configured base-asset fee."
|
|
63514
|
+
],
|
|
63515
|
+
writable: true,
|
|
63516
|
+
pda: {
|
|
63517
|
+
seeds: [
|
|
63518
|
+
{
|
|
63519
|
+
kind: "const",
|
|
63520
|
+
value: [
|
|
63521
|
+
119,
|
|
63522
|
+
105,
|
|
63523
|
+
116,
|
|
63524
|
+
104,
|
|
63525
|
+
100,
|
|
63526
|
+
114,
|
|
63527
|
+
97,
|
|
63528
|
+
119,
|
|
63529
|
+
97,
|
|
63530
|
+
108,
|
|
63531
|
+
95,
|
|
63532
|
+
112,
|
|
63533
|
+
111,
|
|
63534
|
+
108,
|
|
63535
|
+
105,
|
|
63536
|
+
99,
|
|
63537
|
+
121
|
|
63538
|
+
]
|
|
63539
|
+
},
|
|
63540
|
+
{
|
|
63541
|
+
kind: "account",
|
|
63542
|
+
path: "lp_vault"
|
|
63543
|
+
}
|
|
63544
|
+
]
|
|
63545
|
+
}
|
|
63546
|
+
},
|
|
63547
|
+
{
|
|
63548
|
+
name: "assets_account",
|
|
63549
|
+
docs: [
|
|
63550
|
+
"Vault's asset token account."
|
|
63551
|
+
],
|
|
63552
|
+
writable: true,
|
|
63553
|
+
relations: [
|
|
63554
|
+
"lp_vault"
|
|
63555
|
+
]
|
|
63556
|
+
},
|
|
63557
|
+
{
|
|
63558
|
+
name: "assets_mint",
|
|
63559
|
+
docs: [
|
|
63560
|
+
"Mint of the vault assets."
|
|
63561
|
+
],
|
|
63562
|
+
relations: [
|
|
63563
|
+
"lp_vault"
|
|
63564
|
+
]
|
|
63565
|
+
},
|
|
63566
|
+
{
|
|
63567
|
+
name: "shares_mint",
|
|
63568
|
+
docs: [
|
|
63569
|
+
"Mint for vault shares."
|
|
63570
|
+
],
|
|
63571
|
+
relations: [
|
|
63572
|
+
"lp_vault"
|
|
63573
|
+
]
|
|
63574
|
+
},
|
|
63575
|
+
{
|
|
63576
|
+
name: "withdraw_escrow",
|
|
63577
|
+
docs: [
|
|
63578
|
+
"User's withdraw escrow."
|
|
63579
|
+
],
|
|
63580
|
+
pda: {
|
|
63581
|
+
seeds: [
|
|
63582
|
+
{
|
|
63583
|
+
kind: "const",
|
|
63584
|
+
value: [
|
|
63585
|
+
119,
|
|
63586
|
+
105,
|
|
63587
|
+
116,
|
|
63588
|
+
104,
|
|
63589
|
+
100,
|
|
63590
|
+
114,
|
|
63591
|
+
97,
|
|
63592
|
+
119,
|
|
63593
|
+
95,
|
|
63594
|
+
101,
|
|
63595
|
+
115,
|
|
63596
|
+
99,
|
|
63597
|
+
114,
|
|
63598
|
+
111,
|
|
63599
|
+
119
|
|
63600
|
+
]
|
|
63601
|
+
},
|
|
63602
|
+
{
|
|
63603
|
+
kind: "account",
|
|
63604
|
+
path: "user"
|
|
63605
|
+
},
|
|
63606
|
+
{
|
|
63607
|
+
kind: "account",
|
|
63608
|
+
path: "lp_vault"
|
|
63609
|
+
}
|
|
63610
|
+
]
|
|
63611
|
+
}
|
|
63612
|
+
},
|
|
63613
|
+
{
|
|
63614
|
+
name: "escrow_assets_account",
|
|
63615
|
+
docs: [
|
|
63616
|
+
"Escrow's asset token account (destination for assets)."
|
|
63617
|
+
],
|
|
63618
|
+
writable: true,
|
|
63619
|
+
relations: [
|
|
63620
|
+
"withdraw_escrow"
|
|
63621
|
+
]
|
|
63622
|
+
},
|
|
63623
|
+
{
|
|
63624
|
+
name: "withdraw_receipt",
|
|
63625
|
+
docs: [
|
|
63626
|
+
"User's withdraw receipt."
|
|
63627
|
+
],
|
|
63628
|
+
writable: true,
|
|
63629
|
+
pda: {
|
|
63630
|
+
seeds: [
|
|
63631
|
+
{
|
|
63632
|
+
kind: "const",
|
|
63633
|
+
value: [
|
|
63634
|
+
119,
|
|
63635
|
+
105,
|
|
63636
|
+
116,
|
|
63637
|
+
104,
|
|
63638
|
+
100,
|
|
63639
|
+
114,
|
|
63640
|
+
97,
|
|
63641
|
+
119,
|
|
63642
|
+
95,
|
|
63643
|
+
114,
|
|
63644
|
+
101,
|
|
63645
|
+
99,
|
|
63646
|
+
101,
|
|
63647
|
+
105,
|
|
63648
|
+
112,
|
|
63649
|
+
116
|
|
63650
|
+
]
|
|
63651
|
+
},
|
|
63652
|
+
{
|
|
63653
|
+
kind: "account",
|
|
63654
|
+
path: "user"
|
|
63655
|
+
},
|
|
63656
|
+
{
|
|
63657
|
+
kind: "account",
|
|
63658
|
+
path: "lp_vault"
|
|
63659
|
+
}
|
|
63660
|
+
]
|
|
63661
|
+
}
|
|
63662
|
+
},
|
|
63663
|
+
{
|
|
63664
|
+
name: "token_program",
|
|
63665
|
+
docs: [
|
|
63666
|
+
"Token program."
|
|
63667
|
+
]
|
|
63668
|
+
}
|
|
63669
|
+
],
|
|
63670
|
+
args: []
|
|
63671
|
+
},
|
|
63672
|
+
{
|
|
63673
|
+
name: "init_global_config",
|
|
63674
|
+
discriminator: [
|
|
63675
|
+
140,
|
|
63676
|
+
136,
|
|
63677
|
+
214,
|
|
63678
|
+
48,
|
|
63679
|
+
87,
|
|
63680
|
+
0,
|
|
63681
|
+
120,
|
|
63682
|
+
255
|
|
63683
|
+
],
|
|
63684
|
+
accounts: [
|
|
63685
|
+
{
|
|
63686
|
+
name: "signer",
|
|
63687
|
+
docs: [
|
|
63688
|
+
"Signer initializing the GlobalConfig. MUST be the program's",
|
|
63689
|
+
"BPFLoaderUpgradeable upgrade authority (proven by the constraints on",
|
|
63690
|
+
"`program` + `program_data` below). Becomes the super_admin; the only",
|
|
63691
|
+
"later rotation path is `update_admin_authorities`, which is likewise",
|
|
63692
|
+
"gated on the upgrade authority. On a fresh deploy, call init BEFORE",
|
|
63693
|
+
"finalizing the program (a finalized/`--final` program has no upgrade",
|
|
63694
|
+
"authority \u2192 init AND rotation impossible) and while a plain deployer",
|
|
63695
|
+
"keypair (not a multisig PDA) still holds it."
|
|
63696
|
+
],
|
|
63697
|
+
writable: true,
|
|
63698
|
+
signer: true
|
|
63699
|
+
},
|
|
63700
|
+
{
|
|
63701
|
+
name: "global_config",
|
|
63702
|
+
docs: [
|
|
63703
|
+
"Global config account. Derived with a single str."
|
|
63704
|
+
],
|
|
63705
|
+
writable: true,
|
|
63706
|
+
pda: {
|
|
63707
|
+
seeds: [
|
|
63708
|
+
{
|
|
63709
|
+
kind: "const",
|
|
63710
|
+
value: [
|
|
63711
|
+
103,
|
|
63712
|
+
108,
|
|
63713
|
+
111,
|
|
63714
|
+
98,
|
|
63715
|
+
97,
|
|
63716
|
+
108,
|
|
63717
|
+
95,
|
|
63718
|
+
99,
|
|
63719
|
+
111,
|
|
63720
|
+
110,
|
|
63721
|
+
102,
|
|
63722
|
+
105,
|
|
63723
|
+
103
|
|
63724
|
+
]
|
|
63725
|
+
}
|
|
63726
|
+
]
|
|
63727
|
+
}
|
|
63728
|
+
},
|
|
63729
|
+
{
|
|
63730
|
+
name: "program",
|
|
63731
|
+
docs: [
|
|
63732
|
+
"This program's own account; ties `program_data` to this program so the",
|
|
63733
|
+
"upgrade-authority check below cannot be satisfied with an unrelated",
|
|
63734
|
+
"program's ProgramData."
|
|
63735
|
+
],
|
|
63736
|
+
address: "GaMmanX9i4jGmqDZZD2tbD6B2v9p21btenPneMXnTczV"
|
|
63737
|
+
},
|
|
63738
|
+
{
|
|
63739
|
+
name: "program_data",
|
|
63740
|
+
docs: [
|
|
63741
|
+
"ProgramData account holding the program's upgrade authority. Gate: the",
|
|
63742
|
+
"signer must equal the upgrade authority. `programdata_address()` returns",
|
|
63743
|
+
"`Ok(None)` for a non-upgradeable load and a revoked authority is `None`,",
|
|
63744
|
+
"so a `None` on either side fails closed."
|
|
63745
|
+
]
|
|
63746
|
+
},
|
|
63747
|
+
{
|
|
63748
|
+
name: "system_program",
|
|
63749
|
+
docs: [
|
|
63750
|
+
"System program."
|
|
63751
|
+
],
|
|
63752
|
+
address: "11111111111111111111111111111111"
|
|
63753
|
+
}
|
|
63754
|
+
],
|
|
63755
|
+
args: [
|
|
63756
|
+
{
|
|
63757
|
+
name: "create_authority",
|
|
63758
|
+
type: "pubkey"
|
|
63759
|
+
}
|
|
63760
|
+
]
|
|
63761
|
+
},
|
|
63762
|
+
{
|
|
63763
|
+
name: "init_lp_vault",
|
|
63764
|
+
discriminator: [
|
|
63765
|
+
40,
|
|
63766
|
+
247,
|
|
63767
|
+
24,
|
|
63768
|
+
8,
|
|
63769
|
+
152,
|
|
63770
|
+
98,
|
|
63771
|
+
18,
|
|
63772
|
+
220
|
|
63773
|
+
],
|
|
63774
|
+
accounts: [
|
|
63775
|
+
{
|
|
63776
|
+
name: "signer",
|
|
63777
|
+
docs: [
|
|
63778
|
+
"User creating the vault."
|
|
63779
|
+
],
|
|
63780
|
+
writable: true,
|
|
63781
|
+
signer: true
|
|
63782
|
+
},
|
|
63783
|
+
{
|
|
63784
|
+
name: "lp_vault",
|
|
63785
|
+
docs: [
|
|
63786
|
+
"Lp vault being created."
|
|
63787
|
+
],
|
|
63788
|
+
writable: true,
|
|
63789
|
+
pda: {
|
|
63790
|
+
seeds: [
|
|
63791
|
+
{
|
|
63792
|
+
kind: "arg",
|
|
63793
|
+
path: "vault_name"
|
|
63794
|
+
},
|
|
63795
|
+
{
|
|
63796
|
+
kind: "const",
|
|
63797
|
+
value: [
|
|
63798
|
+
118,
|
|
63799
|
+
97,
|
|
63800
|
+
117,
|
|
63801
|
+
108,
|
|
63802
|
+
116
|
|
63803
|
+
]
|
|
63804
|
+
},
|
|
63805
|
+
{
|
|
63806
|
+
kind: "account",
|
|
63807
|
+
path: "assets_mint"
|
|
63808
|
+
}
|
|
63809
|
+
]
|
|
63810
|
+
}
|
|
63811
|
+
},
|
|
63812
|
+
{
|
|
63813
|
+
name: "global_config",
|
|
63814
|
+
pda: {
|
|
63815
|
+
seeds: [
|
|
63816
|
+
{
|
|
63817
|
+
kind: "const",
|
|
63818
|
+
value: [
|
|
63819
|
+
103,
|
|
63820
|
+
108,
|
|
63821
|
+
111,
|
|
63822
|
+
98,
|
|
63823
|
+
97,
|
|
63824
|
+
108,
|
|
63825
|
+
95,
|
|
63826
|
+
99,
|
|
63827
|
+
111,
|
|
63828
|
+
110,
|
|
63829
|
+
102,
|
|
63830
|
+
105,
|
|
63831
|
+
103
|
|
63832
|
+
]
|
|
63833
|
+
}
|
|
63834
|
+
]
|
|
63835
|
+
}
|
|
63836
|
+
},
|
|
63837
|
+
{
|
|
63838
|
+
name: "shares_mint",
|
|
63839
|
+
docs: [
|
|
63840
|
+
"Mint for shares, minted on deposit."
|
|
63841
|
+
],
|
|
63842
|
+
writable: true,
|
|
63843
|
+
pda: {
|
|
63844
|
+
seeds: [
|
|
63845
|
+
{
|
|
63846
|
+
kind: "const",
|
|
63847
|
+
value: [
|
|
63848
|
+
115,
|
|
63849
|
+
104,
|
|
63850
|
+
97,
|
|
63851
|
+
114,
|
|
63852
|
+
101,
|
|
63853
|
+
115
|
|
63854
|
+
]
|
|
63855
|
+
},
|
|
63856
|
+
{
|
|
63857
|
+
kind: "account",
|
|
63858
|
+
path: "lp_vault"
|
|
63859
|
+
}
|
|
63860
|
+
]
|
|
63861
|
+
}
|
|
63862
|
+
},
|
|
63863
|
+
{
|
|
63864
|
+
name: "assets_mint",
|
|
63865
|
+
docs: [
|
|
63866
|
+
"Mint of the assets, USDC, maybe configurable."
|
|
63867
|
+
]
|
|
63868
|
+
},
|
|
63869
|
+
{
|
|
63870
|
+
name: "assets_account",
|
|
63871
|
+
docs: [
|
|
63872
|
+
"Token account for main asset."
|
|
63873
|
+
],
|
|
63874
|
+
writable: true,
|
|
63875
|
+
pda: {
|
|
63876
|
+
seeds: [
|
|
63877
|
+
{
|
|
63878
|
+
kind: "const",
|
|
63879
|
+
value: [
|
|
63880
|
+
109,
|
|
63881
|
+
97,
|
|
63882
|
+
105,
|
|
63883
|
+
110,
|
|
63884
|
+
95,
|
|
63885
|
+
97,
|
|
63886
|
+
115,
|
|
63887
|
+
115,
|
|
63888
|
+
101,
|
|
63889
|
+
116,
|
|
63890
|
+
115
|
|
63891
|
+
]
|
|
63892
|
+
},
|
|
63893
|
+
{
|
|
63894
|
+
kind: "account",
|
|
63895
|
+
path: "lp_vault"
|
|
63896
|
+
}
|
|
63897
|
+
]
|
|
63898
|
+
}
|
|
63899
|
+
},
|
|
63900
|
+
{
|
|
63901
|
+
name: "pending_shares_account",
|
|
63902
|
+
docs: [
|
|
63903
|
+
"Token account where shares are held during queued (illiquid) withdrawals."
|
|
63904
|
+
],
|
|
63905
|
+
writable: true,
|
|
63906
|
+
pda: {
|
|
63907
|
+
seeds: [
|
|
63908
|
+
{
|
|
63909
|
+
kind: "const",
|
|
63910
|
+
value: [
|
|
63911
|
+
112,
|
|
63912
|
+
101,
|
|
63913
|
+
110,
|
|
63914
|
+
100,
|
|
63915
|
+
105,
|
|
63916
|
+
110,
|
|
63917
|
+
103,
|
|
63918
|
+
95,
|
|
63919
|
+
115,
|
|
63920
|
+
104,
|
|
63921
|
+
97,
|
|
63922
|
+
114,
|
|
63923
|
+
101,
|
|
63924
|
+
115
|
|
63925
|
+
]
|
|
63926
|
+
},
|
|
63927
|
+
{
|
|
63928
|
+
kind: "account",
|
|
63929
|
+
path: "lp_vault"
|
|
63930
|
+
}
|
|
63931
|
+
]
|
|
63932
|
+
}
|
|
63933
|
+
},
|
|
63934
|
+
{
|
|
63935
|
+
name: "withdrawal_policy",
|
|
63936
|
+
docs: [
|
|
63937
|
+
"Withdrawal policy PDA for retained fees and net outflow caps."
|
|
63938
|
+
],
|
|
63939
|
+
writable: true,
|
|
63940
|
+
pda: {
|
|
63941
|
+
seeds: [
|
|
63942
|
+
{
|
|
63943
|
+
kind: "const",
|
|
63944
|
+
value: [
|
|
63945
|
+
119,
|
|
63946
|
+
105,
|
|
63947
|
+
116,
|
|
63948
|
+
104,
|
|
63949
|
+
100,
|
|
63950
|
+
114,
|
|
63951
|
+
97,
|
|
63952
|
+
119,
|
|
63953
|
+
97,
|
|
63954
|
+
108,
|
|
63955
|
+
95,
|
|
63956
|
+
112,
|
|
63957
|
+
111,
|
|
63958
|
+
108,
|
|
63959
|
+
105,
|
|
63960
|
+
99,
|
|
63961
|
+
121
|
|
63962
|
+
]
|
|
63963
|
+
},
|
|
63964
|
+
{
|
|
63965
|
+
kind: "account",
|
|
63966
|
+
path: "lp_vault"
|
|
63967
|
+
}
|
|
63968
|
+
]
|
|
63969
|
+
}
|
|
63970
|
+
},
|
|
63971
|
+
{
|
|
63972
|
+
name: "fee_recipient_account",
|
|
63973
|
+
docs: [
|
|
63974
|
+
"Optional fee recipient token account (shares mint).",
|
|
63975
|
+
"Required when initializing with performance_fee_bps > 0."
|
|
63976
|
+
],
|
|
63977
|
+
optional: true
|
|
63978
|
+
},
|
|
63979
|
+
{
|
|
63980
|
+
name: "system_program",
|
|
63981
|
+
docs: [
|
|
63982
|
+
"System program."
|
|
63983
|
+
],
|
|
63984
|
+
address: "11111111111111111111111111111111"
|
|
63985
|
+
},
|
|
63986
|
+
{
|
|
63987
|
+
name: "token_program",
|
|
63988
|
+
docs: [
|
|
63989
|
+
"Can either be spl-token or token-2022."
|
|
63990
|
+
]
|
|
63991
|
+
}
|
|
63992
|
+
],
|
|
63993
|
+
args: [
|
|
63994
|
+
{
|
|
63995
|
+
name: "fund_authority",
|
|
63996
|
+
type: "pubkey"
|
|
63997
|
+
},
|
|
63998
|
+
{
|
|
63999
|
+
name: "nav_max_staleness",
|
|
64000
|
+
type: "u64"
|
|
64001
|
+
},
|
|
64002
|
+
{
|
|
64003
|
+
name: "vault_name",
|
|
64004
|
+
type: "string"
|
|
64005
|
+
},
|
|
64006
|
+
{
|
|
64007
|
+
name: "decimals",
|
|
64008
|
+
type: "u8"
|
|
64009
|
+
},
|
|
64010
|
+
{
|
|
64011
|
+
name: "performance_fee_bps",
|
|
64012
|
+
type: "u16"
|
|
64013
|
+
},
|
|
64014
|
+
{
|
|
64015
|
+
name: "assessment_interval_secs",
|
|
64016
|
+
type: "i64"
|
|
64017
|
+
},
|
|
64018
|
+
{
|
|
64019
|
+
name: "keeper_authority",
|
|
64020
|
+
type: {
|
|
64021
|
+
option: "pubkey"
|
|
64022
|
+
}
|
|
64023
|
+
}
|
|
64024
|
+
]
|
|
64025
|
+
},
|
|
64026
|
+
{
|
|
64027
|
+
name: "set_fee_config",
|
|
64028
|
+
docs: [
|
|
64029
|
+
"Configure or disable performance fee settings."
|
|
64030
|
+
],
|
|
64031
|
+
discriminator: [
|
|
64032
|
+
221,
|
|
64033
|
+
222,
|
|
64034
|
+
52,
|
|
64035
|
+
206,
|
|
64036
|
+
114,
|
|
64037
|
+
198,
|
|
64038
|
+
64,
|
|
64039
|
+
91
|
|
64040
|
+
],
|
|
64041
|
+
accounts: [
|
|
64042
|
+
{
|
|
64043
|
+
name: "fund_authority",
|
|
64044
|
+
docs: [
|
|
64045
|
+
"Operator / fund authority."
|
|
64046
|
+
],
|
|
64047
|
+
signer: true,
|
|
64048
|
+
relations: [
|
|
64049
|
+
"lp_vault"
|
|
64050
|
+
]
|
|
64051
|
+
},
|
|
64052
|
+
{
|
|
64053
|
+
name: "lp_vault",
|
|
64054
|
+
writable: true
|
|
64055
|
+
},
|
|
64056
|
+
{
|
|
64057
|
+
name: "shares_mint",
|
|
64058
|
+
writable: true,
|
|
64059
|
+
relations: [
|
|
64060
|
+
"lp_vault"
|
|
64061
|
+
]
|
|
64062
|
+
},
|
|
64063
|
+
{
|
|
64064
|
+
name: "fee_recipient_account",
|
|
64065
|
+
docs: [
|
|
64066
|
+
"Token account that will receive fee shares.",
|
|
64067
|
+
"Required when enabling fees (performance_fee_bps > 0) or when",
|
|
64068
|
+
"mid-window settlement is needed (accrued fees must be settled",
|
|
64069
|
+
"to the old recipient before changing config).",
|
|
64070
|
+
"Omit when disabling with no accrued fees.",
|
|
64071
|
+
"Mutable because it may be the destination of a MintTo CPI during mid-window settlement."
|
|
64072
|
+
],
|
|
64073
|
+
writable: true,
|
|
64074
|
+
optional: true
|
|
64075
|
+
},
|
|
64076
|
+
{
|
|
64077
|
+
name: "token_program"
|
|
64078
|
+
}
|
|
64079
|
+
],
|
|
64080
|
+
args: [
|
|
64081
|
+
{
|
|
64082
|
+
name: "performance_fee_bps",
|
|
64083
|
+
type: "u16"
|
|
64084
|
+
},
|
|
64085
|
+
{
|
|
64086
|
+
name: "assessment_interval_secs",
|
|
64087
|
+
type: "i64"
|
|
64088
|
+
}
|
|
64089
|
+
]
|
|
64090
|
+
},
|
|
64091
|
+
{
|
|
64092
|
+
name: "set_keeper_authority",
|
|
64093
|
+
docs: [
|
|
64094
|
+
"Set or remove the keeper authority on a vault.",
|
|
64095
|
+
"When set, this key can call fulfill_withdrawal in addition to fund_authority."
|
|
64096
|
+
],
|
|
64097
|
+
discriminator: [
|
|
64098
|
+
29,
|
|
64099
|
+
124,
|
|
64100
|
+
191,
|
|
64101
|
+
114,
|
|
64102
|
+
184,
|
|
64103
|
+
243,
|
|
64104
|
+
33,
|
|
64105
|
+
155
|
|
64106
|
+
],
|
|
64107
|
+
accounts: [
|
|
64108
|
+
{
|
|
64109
|
+
name: "fund_authority",
|
|
64110
|
+
docs: [
|
|
64111
|
+
"Fund authority \u2014 only they can change keeper authority."
|
|
64112
|
+
],
|
|
64113
|
+
signer: true,
|
|
64114
|
+
relations: [
|
|
64115
|
+
"lp_vault"
|
|
64116
|
+
]
|
|
64117
|
+
},
|
|
64118
|
+
{
|
|
64119
|
+
name: "payer",
|
|
64120
|
+
docs: [
|
|
64121
|
+
"Payer for any reallocation rent."
|
|
64122
|
+
],
|
|
64123
|
+
writable: true,
|
|
64124
|
+
signer: true
|
|
64125
|
+
},
|
|
64126
|
+
{
|
|
64127
|
+
name: "lp_vault",
|
|
64128
|
+
writable: true
|
|
64129
|
+
},
|
|
64130
|
+
{
|
|
64131
|
+
name: "system_program",
|
|
64132
|
+
address: "11111111111111111111111111111111"
|
|
64133
|
+
}
|
|
64134
|
+
],
|
|
64135
|
+
args: [
|
|
64136
|
+
{
|
|
64137
|
+
name: "keeper_authority",
|
|
64138
|
+
type: "pubkey"
|
|
64139
|
+
}
|
|
64140
|
+
]
|
|
64141
|
+
},
|
|
64142
|
+
{
|
|
64143
|
+
name: "set_metadata",
|
|
64144
|
+
discriminator: [
|
|
64145
|
+
78,
|
|
64146
|
+
157,
|
|
64147
|
+
75,
|
|
64148
|
+
242,
|
|
64149
|
+
151,
|
|
64150
|
+
20,
|
|
64151
|
+
121,
|
|
64152
|
+
144
|
|
64153
|
+
],
|
|
64154
|
+
accounts: [
|
|
64155
|
+
{
|
|
64156
|
+
name: "fund_authority",
|
|
64157
|
+
docs: [
|
|
64158
|
+
"Fund authority - only they can set metadata."
|
|
64159
|
+
],
|
|
64160
|
+
writable: true,
|
|
64161
|
+
signer: true,
|
|
64162
|
+
relations: [
|
|
64163
|
+
"lp_vault"
|
|
64164
|
+
]
|
|
64165
|
+
},
|
|
64166
|
+
{
|
|
64167
|
+
name: "lp_vault",
|
|
64168
|
+
docs: [
|
|
64169
|
+
"LpVault that owns the shares_mint."
|
|
64170
|
+
]
|
|
64171
|
+
},
|
|
64172
|
+
{
|
|
64173
|
+
name: "shares_mint",
|
|
64174
|
+
docs: [
|
|
64175
|
+
"Shares mint for which we're setting metadata."
|
|
64176
|
+
],
|
|
64177
|
+
writable: true,
|
|
64178
|
+
relations: [
|
|
64179
|
+
"lp_vault"
|
|
64180
|
+
]
|
|
64181
|
+
},
|
|
64182
|
+
{
|
|
64183
|
+
name: "metadata_account",
|
|
64184
|
+
docs: [
|
|
64185
|
+
'Seeds: ["metadata", token_metadata_program_id, mint]'
|
|
64186
|
+
],
|
|
64187
|
+
writable: true,
|
|
64188
|
+
pda: {
|
|
64189
|
+
seeds: [
|
|
64190
|
+
{
|
|
64191
|
+
kind: "const",
|
|
64192
|
+
value: [
|
|
64193
|
+
109,
|
|
64194
|
+
101,
|
|
64195
|
+
116,
|
|
64196
|
+
97,
|
|
64197
|
+
100,
|
|
64198
|
+
97,
|
|
64199
|
+
116,
|
|
64200
|
+
97
|
|
64201
|
+
]
|
|
64202
|
+
},
|
|
64203
|
+
{
|
|
64204
|
+
kind: "const",
|
|
64205
|
+
value: [
|
|
64206
|
+
11,
|
|
64207
|
+
112,
|
|
64208
|
+
101,
|
|
64209
|
+
177,
|
|
64210
|
+
227,
|
|
64211
|
+
209,
|
|
64212
|
+
124,
|
|
64213
|
+
69,
|
|
64214
|
+
56,
|
|
64215
|
+
157,
|
|
64216
|
+
82,
|
|
64217
|
+
127,
|
|
64218
|
+
107,
|
|
64219
|
+
4,
|
|
64220
|
+
195,
|
|
64221
|
+
205,
|
|
64222
|
+
88,
|
|
64223
|
+
184,
|
|
64224
|
+
108,
|
|
64225
|
+
115,
|
|
64226
|
+
26,
|
|
64227
|
+
160,
|
|
64228
|
+
253,
|
|
64229
|
+
181,
|
|
64230
|
+
73,
|
|
64231
|
+
182,
|
|
64232
|
+
209,
|
|
64233
|
+
188,
|
|
64234
|
+
3,
|
|
64235
|
+
248,
|
|
64236
|
+
41,
|
|
64237
|
+
70
|
|
64238
|
+
]
|
|
64239
|
+
},
|
|
64240
|
+
{
|
|
64241
|
+
kind: "account",
|
|
64242
|
+
path: "shares_mint"
|
|
64243
|
+
}
|
|
64244
|
+
],
|
|
64245
|
+
program: {
|
|
64246
|
+
kind: "const",
|
|
64247
|
+
value: [
|
|
64248
|
+
11,
|
|
64249
|
+
112,
|
|
64250
|
+
101,
|
|
64251
|
+
177,
|
|
64252
|
+
227,
|
|
64253
|
+
209,
|
|
64254
|
+
124,
|
|
64255
|
+
69,
|
|
64256
|
+
56,
|
|
64257
|
+
157,
|
|
64258
|
+
82,
|
|
64259
|
+
127,
|
|
64260
|
+
107,
|
|
64261
|
+
4,
|
|
64262
|
+
195,
|
|
64263
|
+
205,
|
|
64264
|
+
88,
|
|
64265
|
+
184,
|
|
64266
|
+
108,
|
|
64267
|
+
115,
|
|
64268
|
+
26,
|
|
64269
|
+
160,
|
|
64270
|
+
253,
|
|
64271
|
+
181,
|
|
64272
|
+
73,
|
|
64273
|
+
182,
|
|
64274
|
+
209,
|
|
64275
|
+
188,
|
|
64276
|
+
3,
|
|
64277
|
+
248,
|
|
64278
|
+
41,
|
|
64279
|
+
70
|
|
64280
|
+
]
|
|
64281
|
+
}
|
|
64282
|
+
}
|
|
64283
|
+
},
|
|
64284
|
+
{
|
|
64285
|
+
name: "token_metadata_program",
|
|
64286
|
+
address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
|
|
64287
|
+
},
|
|
64288
|
+
{
|
|
64289
|
+
name: "system_program",
|
|
64290
|
+
docs: [
|
|
64291
|
+
"System program."
|
|
64292
|
+
],
|
|
64293
|
+
address: "11111111111111111111111111111111"
|
|
64294
|
+
},
|
|
64295
|
+
{
|
|
64296
|
+
name: "rent",
|
|
64297
|
+
docs: [
|
|
64298
|
+
"Rent sysvar."
|
|
64299
|
+
],
|
|
64300
|
+
address: "SysvarRent111111111111111111111111111111111"
|
|
64301
|
+
}
|
|
64302
|
+
],
|
|
64303
|
+
args: [
|
|
64304
|
+
{
|
|
64305
|
+
name: "name",
|
|
64306
|
+
type: "string"
|
|
64307
|
+
},
|
|
64308
|
+
{
|
|
64309
|
+
name: "symbol",
|
|
64310
|
+
type: "string"
|
|
64311
|
+
},
|
|
64312
|
+
{
|
|
64313
|
+
name: "uri",
|
|
64314
|
+
type: "string"
|
|
64315
|
+
}
|
|
64316
|
+
]
|
|
64317
|
+
},
|
|
64318
|
+
{
|
|
64319
|
+
name: "set_withdrawal_policy",
|
|
64320
|
+
docs: [
|
|
64321
|
+
"Configure retained withdrawal fees and net withdrawal caps."
|
|
64322
|
+
],
|
|
64323
|
+
discriminator: [
|
|
64324
|
+
3,
|
|
64325
|
+
223,
|
|
64326
|
+
67,
|
|
64327
|
+
81,
|
|
64328
|
+
69,
|
|
64329
|
+
30,
|
|
64330
|
+
203,
|
|
64331
|
+
150
|
|
64332
|
+
],
|
|
64333
|
+
accounts: [
|
|
64334
|
+
{
|
|
64335
|
+
name: "fund_authority",
|
|
64336
|
+
docs: [
|
|
64337
|
+
"Fund authority for the vault."
|
|
64338
|
+
],
|
|
64339
|
+
signer: true,
|
|
64340
|
+
relations: [
|
|
64341
|
+
"lp_vault"
|
|
64342
|
+
]
|
|
64343
|
+
},
|
|
64344
|
+
{
|
|
64345
|
+
name: "payer",
|
|
64346
|
+
docs: [
|
|
64347
|
+
"Payer for creating the policy account on existing vaults."
|
|
64348
|
+
],
|
|
64349
|
+
writable: true,
|
|
64350
|
+
signer: true
|
|
64351
|
+
},
|
|
64352
|
+
{
|
|
64353
|
+
name: "lp_vault"
|
|
64354
|
+
},
|
|
64355
|
+
{
|
|
64356
|
+
name: "withdrawal_policy",
|
|
64357
|
+
writable: true,
|
|
64358
|
+
pda: {
|
|
64359
|
+
seeds: [
|
|
64360
|
+
{
|
|
64361
|
+
kind: "const",
|
|
64362
|
+
value: [
|
|
64363
|
+
119,
|
|
64364
|
+
105,
|
|
64365
|
+
116,
|
|
64366
|
+
104,
|
|
64367
|
+
100,
|
|
64368
|
+
114,
|
|
64369
|
+
97,
|
|
64370
|
+
119,
|
|
64371
|
+
97,
|
|
64372
|
+
108,
|
|
64373
|
+
95,
|
|
64374
|
+
112,
|
|
64375
|
+
111,
|
|
64376
|
+
108,
|
|
64377
|
+
105,
|
|
64378
|
+
99,
|
|
64379
|
+
121
|
|
64380
|
+
]
|
|
64381
|
+
},
|
|
64382
|
+
{
|
|
64383
|
+
kind: "account",
|
|
64384
|
+
path: "lp_vault"
|
|
64385
|
+
}
|
|
64386
|
+
]
|
|
64387
|
+
}
|
|
64388
|
+
},
|
|
64389
|
+
{
|
|
64390
|
+
name: "system_program",
|
|
64391
|
+
address: "11111111111111111111111111111111"
|
|
64392
|
+
}
|
|
64393
|
+
],
|
|
64394
|
+
args: [
|
|
64395
|
+
{
|
|
64396
|
+
name: "withdrawal_fee_bps",
|
|
64397
|
+
type: "u16"
|
|
64398
|
+
},
|
|
64399
|
+
{
|
|
64400
|
+
name: "hourly_withdrawal_cap_bps",
|
|
64401
|
+
type: "u16"
|
|
64402
|
+
},
|
|
64403
|
+
{
|
|
64404
|
+
name: "daily_withdrawal_cap_bps",
|
|
64405
|
+
type: "u16"
|
|
64406
|
+
}
|
|
64407
|
+
]
|
|
64408
|
+
},
|
|
64409
|
+
{
|
|
64410
|
+
name: "update_admin_authorities",
|
|
64411
|
+
docs: [
|
|
64412
|
+
"Rotate super_admin, create_authority, and permissioned_creation",
|
|
64413
|
+
"atomically. Recovery instruction gated on the program's",
|
|
64414
|
+
"BPFLoaderUpgradeable upgrade authority (NOT the current super_admin),",
|
|
64415
|
+
"so a compromised or lost super_admin can be replaced."
|
|
64416
|
+
],
|
|
64417
|
+
discriminator: [
|
|
64418
|
+
41,
|
|
64419
|
+
241,
|
|
64420
|
+
142,
|
|
64421
|
+
184,
|
|
64422
|
+
75,
|
|
64423
|
+
212,
|
|
64424
|
+
72,
|
|
64425
|
+
171
|
|
64426
|
+
],
|
|
64427
|
+
accounts: [
|
|
64428
|
+
{
|
|
64429
|
+
name: "signer",
|
|
64430
|
+
docs: [
|
|
64431
|
+
"Signer rotating the authorities. MUST be the program's",
|
|
64432
|
+
"BPFLoaderUpgradeable upgrade authority (proven by the constraints on",
|
|
64433
|
+
"`program` + `program_data` below)."
|
|
64434
|
+
],
|
|
64435
|
+
signer: true
|
|
64436
|
+
},
|
|
64437
|
+
{
|
|
64438
|
+
name: "global_config",
|
|
64439
|
+
docs: [
|
|
64440
|
+
"The global config account being rotated. Unique in the program.",
|
|
64441
|
+
"Deliberately no `has_one = super_admin`: see the struct docs."
|
|
64442
|
+
],
|
|
64443
|
+
writable: true,
|
|
64444
|
+
pda: {
|
|
64445
|
+
seeds: [
|
|
64446
|
+
{
|
|
64447
|
+
kind: "const",
|
|
64448
|
+
value: [
|
|
64449
|
+
103,
|
|
64450
|
+
108,
|
|
64451
|
+
111,
|
|
64452
|
+
98,
|
|
64453
|
+
97,
|
|
64454
|
+
108,
|
|
64455
|
+
95,
|
|
64456
|
+
99,
|
|
64457
|
+
111,
|
|
64458
|
+
110,
|
|
64459
|
+
102,
|
|
64460
|
+
105,
|
|
64461
|
+
103
|
|
64462
|
+
]
|
|
64463
|
+
}
|
|
64464
|
+
]
|
|
64465
|
+
}
|
|
64466
|
+
},
|
|
64467
|
+
{
|
|
64468
|
+
name: "program",
|
|
64469
|
+
docs: [
|
|
64470
|
+
"This program's own account; ties `program_data` to this program so the",
|
|
64471
|
+
"upgrade-authority check below cannot be satisfied with an unrelated",
|
|
64472
|
+
"program's ProgramData."
|
|
64473
|
+
],
|
|
64474
|
+
address: "GaMmanX9i4jGmqDZZD2tbD6B2v9p21btenPneMXnTczV"
|
|
64475
|
+
},
|
|
64476
|
+
{
|
|
64477
|
+
name: "program_data",
|
|
64478
|
+
docs: [
|
|
64479
|
+
"ProgramData account holding the program's upgrade authority. Gate: the",
|
|
64480
|
+
"signer must equal the upgrade authority. `programdata_address()` returns",
|
|
64481
|
+
"`Ok(None)` for a non-upgradeable load and a revoked authority is `None`,",
|
|
64482
|
+
"so a `None` on either side fails closed."
|
|
64483
|
+
]
|
|
64484
|
+
}
|
|
64485
|
+
],
|
|
64486
|
+
args: [
|
|
64487
|
+
{
|
|
64488
|
+
name: "new_super_admin",
|
|
64489
|
+
type: "pubkey"
|
|
64490
|
+
},
|
|
64491
|
+
{
|
|
64492
|
+
name: "new_create_authority",
|
|
64493
|
+
type: "pubkey"
|
|
64494
|
+
},
|
|
64495
|
+
{
|
|
64496
|
+
name: "new_permissioned_creation",
|
|
64497
|
+
type: "bool"
|
|
64498
|
+
}
|
|
64499
|
+
]
|
|
64500
|
+
},
|
|
64501
|
+
{
|
|
64502
|
+
name: "update_global_config",
|
|
64503
|
+
discriminator: [
|
|
64504
|
+
164,
|
|
64505
|
+
84,
|
|
64506
|
+
130,
|
|
64507
|
+
189,
|
|
64508
|
+
111,
|
|
64509
|
+
58,
|
|
64510
|
+
250,
|
|
64511
|
+
200
|
|
64512
|
+
],
|
|
64513
|
+
accounts: [
|
|
64514
|
+
{
|
|
64515
|
+
name: "super_admin",
|
|
64516
|
+
docs: [
|
|
64517
|
+
"The signer must be the global_config super_admin."
|
|
64518
|
+
],
|
|
64519
|
+
writable: true,
|
|
64520
|
+
signer: true,
|
|
64521
|
+
relations: [
|
|
64522
|
+
"global_config"
|
|
64523
|
+
]
|
|
64524
|
+
},
|
|
64525
|
+
{
|
|
64526
|
+
name: "global_config",
|
|
64527
|
+
docs: [
|
|
64528
|
+
"The global config account. Unique in the program."
|
|
64529
|
+
],
|
|
64530
|
+
writable: true,
|
|
64531
|
+
pda: {
|
|
64532
|
+
seeds: [
|
|
64533
|
+
{
|
|
64534
|
+
kind: "const",
|
|
64535
|
+
value: [
|
|
64536
|
+
103,
|
|
64537
|
+
108,
|
|
64538
|
+
111,
|
|
64539
|
+
98,
|
|
64540
|
+
97,
|
|
64541
|
+
108,
|
|
64542
|
+
95,
|
|
64543
|
+
99,
|
|
64544
|
+
111,
|
|
64545
|
+
110,
|
|
64546
|
+
102,
|
|
64547
|
+
105,
|
|
64548
|
+
103
|
|
64549
|
+
]
|
|
64550
|
+
}
|
|
64551
|
+
]
|
|
64552
|
+
}
|
|
64553
|
+
}
|
|
64554
|
+
],
|
|
64555
|
+
args: [
|
|
64556
|
+
{
|
|
64557
|
+
name: "new_create_authority",
|
|
64558
|
+
type: "pubkey"
|
|
64559
|
+
},
|
|
64560
|
+
{
|
|
64561
|
+
name: "is_creation_permissioned",
|
|
64562
|
+
type: "bool"
|
|
64563
|
+
}
|
|
64564
|
+
]
|
|
64565
|
+
},
|
|
64566
|
+
{
|
|
64567
|
+
name: "update_nav",
|
|
64568
|
+
docs: [
|
|
64569
|
+
"Update the vault's NAV. Called by fund_authority (operator)."
|
|
64570
|
+
],
|
|
64571
|
+
discriminator: [
|
|
64572
|
+
56,
|
|
64573
|
+
16,
|
|
64574
|
+
234,
|
|
64575
|
+
109,
|
|
64576
|
+
155,
|
|
64577
|
+
165,
|
|
64578
|
+
5,
|
|
64579
|
+
0
|
|
64580
|
+
],
|
|
64581
|
+
accounts: [
|
|
64582
|
+
{
|
|
64583
|
+
name: "fund_authority",
|
|
64584
|
+
docs: [
|
|
64585
|
+
"Fund authority - only they can update NAV."
|
|
64586
|
+
],
|
|
64587
|
+
signer: true,
|
|
64588
|
+
relations: [
|
|
64589
|
+
"lp_vault"
|
|
64590
|
+
]
|
|
64591
|
+
},
|
|
64592
|
+
{
|
|
64593
|
+
name: "lp_vault",
|
|
64594
|
+
writable: true
|
|
64595
|
+
},
|
|
64596
|
+
{
|
|
64597
|
+
name: "shares_mint",
|
|
64598
|
+
relations: [
|
|
64599
|
+
"lp_vault"
|
|
64600
|
+
]
|
|
64601
|
+
}
|
|
64602
|
+
],
|
|
64603
|
+
args: [
|
|
64604
|
+
{
|
|
64605
|
+
name: "new_nav",
|
|
64606
|
+
type: "u64"
|
|
64607
|
+
}
|
|
64608
|
+
]
|
|
64609
|
+
},
|
|
64610
|
+
{
|
|
64611
|
+
name: "update_nav_max_staleness",
|
|
64612
|
+
docs: [
|
|
64613
|
+
"Update the NAV max staleness window on a vault."
|
|
64614
|
+
],
|
|
64615
|
+
discriminator: [
|
|
64616
|
+
212,
|
|
64617
|
+
225,
|
|
64618
|
+
120,
|
|
64619
|
+
109,
|
|
64620
|
+
83,
|
|
64621
|
+
96,
|
|
64622
|
+
40,
|
|
64623
|
+
17
|
|
64624
|
+
],
|
|
64625
|
+
accounts: [
|
|
64626
|
+
{
|
|
64627
|
+
name: "fund_authority",
|
|
64628
|
+
docs: [
|
|
64629
|
+
"Fund authority \u2014 only they can change vault config."
|
|
64630
|
+
],
|
|
64631
|
+
signer: true,
|
|
64632
|
+
relations: [
|
|
64633
|
+
"lp_vault"
|
|
64634
|
+
]
|
|
64635
|
+
},
|
|
64636
|
+
{
|
|
64637
|
+
name: "lp_vault",
|
|
64638
|
+
writable: true
|
|
64639
|
+
}
|
|
64640
|
+
],
|
|
64641
|
+
args: [
|
|
64642
|
+
{
|
|
64643
|
+
name: "nav_max_staleness",
|
|
64644
|
+
type: "u64"
|
|
64645
|
+
}
|
|
64646
|
+
]
|
|
64647
|
+
},
|
|
64648
|
+
{
|
|
64649
|
+
name: "withdraw",
|
|
64650
|
+
docs: [
|
|
64651
|
+
"Withdraw shares for assets.",
|
|
64652
|
+
"If vault has sufficient liquidity: instant withdrawal.",
|
|
64653
|
+
"If illiquid: creates WithdrawReceipt, shares go to pending account."
|
|
64654
|
+
],
|
|
64655
|
+
discriminator: [
|
|
64656
|
+
183,
|
|
64657
|
+
18,
|
|
64658
|
+
70,
|
|
64659
|
+
156,
|
|
64660
|
+
148,
|
|
64661
|
+
109,
|
|
64662
|
+
161,
|
|
64663
|
+
34
|
|
64664
|
+
],
|
|
64665
|
+
accounts: [
|
|
64666
|
+
{
|
|
64667
|
+
name: "user",
|
|
64668
|
+
docs: [
|
|
64669
|
+
"User withdrawing from the vault."
|
|
64670
|
+
],
|
|
64671
|
+
writable: true,
|
|
64672
|
+
signer: true
|
|
64673
|
+
},
|
|
64674
|
+
{
|
|
64675
|
+
name: "lp_vault",
|
|
64676
|
+
docs: [
|
|
64677
|
+
"LpVault to withdraw from."
|
|
64678
|
+
],
|
|
64679
|
+
writable: true,
|
|
64680
|
+
relations: [
|
|
64681
|
+
"withdrawal_policy"
|
|
64682
|
+
]
|
|
64683
|
+
},
|
|
64684
|
+
{
|
|
64685
|
+
name: "withdrawal_policy",
|
|
64686
|
+
docs: [
|
|
64687
|
+
"Withdrawal policy for retained asset fees and net withdrawal caps."
|
|
64688
|
+
],
|
|
64689
|
+
writable: true,
|
|
64690
|
+
pda: {
|
|
64691
|
+
seeds: [
|
|
64692
|
+
{
|
|
64693
|
+
kind: "const",
|
|
64694
|
+
value: [
|
|
64695
|
+
119,
|
|
64696
|
+
105,
|
|
64697
|
+
116,
|
|
64698
|
+
104,
|
|
64699
|
+
100,
|
|
64700
|
+
114,
|
|
64701
|
+
97,
|
|
64702
|
+
119,
|
|
64703
|
+
97,
|
|
64704
|
+
108,
|
|
64705
|
+
95,
|
|
64706
|
+
112,
|
|
64707
|
+
111,
|
|
64708
|
+
108,
|
|
64709
|
+
105,
|
|
64710
|
+
99,
|
|
64711
|
+
121
|
|
64712
|
+
]
|
|
64713
|
+
},
|
|
64714
|
+
{
|
|
64715
|
+
kind: "account",
|
|
64716
|
+
path: "lp_vault"
|
|
64717
|
+
}
|
|
64718
|
+
]
|
|
64719
|
+
}
|
|
64720
|
+
},
|
|
64721
|
+
{
|
|
64722
|
+
name: "assets_account",
|
|
64723
|
+
docs: [
|
|
64724
|
+
"Token account for vault assets."
|
|
64725
|
+
],
|
|
64726
|
+
writable: true,
|
|
64727
|
+
relations: [
|
|
64728
|
+
"lp_vault"
|
|
64729
|
+
]
|
|
64730
|
+
},
|
|
64731
|
+
{
|
|
64732
|
+
name: "user_share_ata",
|
|
64733
|
+
docs: [
|
|
64734
|
+
"User's share token account (source of shares)."
|
|
64735
|
+
],
|
|
64736
|
+
writable: true,
|
|
64737
|
+
pda: {
|
|
64738
|
+
seeds: [
|
|
64739
|
+
{
|
|
64740
|
+
kind: "account",
|
|
64741
|
+
path: "user"
|
|
64742
|
+
},
|
|
64743
|
+
{
|
|
64744
|
+
kind: "account",
|
|
64745
|
+
path: "token_program"
|
|
64746
|
+
},
|
|
64747
|
+
{
|
|
64748
|
+
kind: "account",
|
|
64749
|
+
path: "shares_mint"
|
|
64750
|
+
}
|
|
64751
|
+
],
|
|
64752
|
+
program: {
|
|
64753
|
+
kind: "const",
|
|
64754
|
+
value: [
|
|
64755
|
+
140,
|
|
64756
|
+
151,
|
|
64757
|
+
37,
|
|
64758
|
+
143,
|
|
64759
|
+
78,
|
|
64760
|
+
36,
|
|
64761
|
+
137,
|
|
64762
|
+
241,
|
|
64763
|
+
187,
|
|
64764
|
+
61,
|
|
64765
|
+
16,
|
|
64766
|
+
41,
|
|
64767
|
+
20,
|
|
64768
|
+
142,
|
|
64769
|
+
13,
|
|
64770
|
+
131,
|
|
64771
|
+
11,
|
|
64772
|
+
90,
|
|
64773
|
+
19,
|
|
64774
|
+
153,
|
|
64775
|
+
218,
|
|
64776
|
+
255,
|
|
64777
|
+
16,
|
|
64778
|
+
132,
|
|
64779
|
+
4,
|
|
64780
|
+
142,
|
|
64781
|
+
123,
|
|
64782
|
+
216,
|
|
64783
|
+
219,
|
|
64784
|
+
233,
|
|
64785
|
+
248,
|
|
64786
|
+
89
|
|
64787
|
+
]
|
|
64788
|
+
}
|
|
64789
|
+
}
|
|
64790
|
+
},
|
|
64791
|
+
{
|
|
64792
|
+
name: "assets_mint",
|
|
64793
|
+
docs: [
|
|
64794
|
+
"Mint of the vault assets."
|
|
64795
|
+
],
|
|
64796
|
+
relations: [
|
|
64797
|
+
"lp_vault"
|
|
64798
|
+
]
|
|
64799
|
+
},
|
|
64800
|
+
{
|
|
64801
|
+
name: "shares_mint",
|
|
64802
|
+
docs: [
|
|
64803
|
+
"Mint for vault shares (mutable for fee mint CPI)."
|
|
64804
|
+
],
|
|
64805
|
+
writable: true,
|
|
64806
|
+
relations: [
|
|
64807
|
+
"lp_vault"
|
|
64808
|
+
]
|
|
64809
|
+
},
|
|
64810
|
+
{
|
|
64811
|
+
name: "fee_recipient_account",
|
|
64812
|
+
docs: [
|
|
64813
|
+
"Token account that receives fee shares on withdrawal.",
|
|
64814
|
+
"Required when `has_fee_config()` is true; omit otherwise.",
|
|
64815
|
+
"Mutable because it is the destination of a MintTo CPI."
|
|
64816
|
+
],
|
|
64817
|
+
writable: true,
|
|
64818
|
+
optional: true
|
|
64819
|
+
},
|
|
64820
|
+
{
|
|
64821
|
+
name: "withdraw_escrow",
|
|
64822
|
+
docs: [
|
|
64823
|
+
"Withdraw escrow - holds assets and shares until user claims."
|
|
64824
|
+
],
|
|
64825
|
+
writable: true,
|
|
64826
|
+
pda: {
|
|
64827
|
+
seeds: [
|
|
64828
|
+
{
|
|
64829
|
+
kind: "const",
|
|
64830
|
+
value: [
|
|
64831
|
+
119,
|
|
64832
|
+
105,
|
|
64833
|
+
116,
|
|
64834
|
+
104,
|
|
64835
|
+
100,
|
|
64836
|
+
114,
|
|
64837
|
+
97,
|
|
64838
|
+
119,
|
|
64839
|
+
95,
|
|
64840
|
+
101,
|
|
64841
|
+
115,
|
|
64842
|
+
99,
|
|
64843
|
+
114,
|
|
64844
|
+
111,
|
|
64845
|
+
119
|
|
64846
|
+
]
|
|
64847
|
+
},
|
|
64848
|
+
{
|
|
64849
|
+
kind: "account",
|
|
64850
|
+
path: "user"
|
|
64851
|
+
},
|
|
64852
|
+
{
|
|
64853
|
+
kind: "account",
|
|
64854
|
+
path: "lp_vault"
|
|
64855
|
+
}
|
|
64856
|
+
]
|
|
64857
|
+
}
|
|
64858
|
+
},
|
|
64859
|
+
{
|
|
64860
|
+
name: "escrow_assets_account",
|
|
64861
|
+
docs: [
|
|
64862
|
+
"Escrow's asset token account (holds USDC for user to claim)."
|
|
64863
|
+
],
|
|
64864
|
+
writable: true,
|
|
64865
|
+
pda: {
|
|
64866
|
+
seeds: [
|
|
64867
|
+
{
|
|
64868
|
+
kind: "account",
|
|
64869
|
+
path: "withdraw_escrow"
|
|
64870
|
+
},
|
|
64871
|
+
{
|
|
64872
|
+
kind: "account",
|
|
64873
|
+
path: "token_program"
|
|
64874
|
+
},
|
|
64875
|
+
{
|
|
64876
|
+
kind: "account",
|
|
64877
|
+
path: "assets_mint"
|
|
64878
|
+
}
|
|
64879
|
+
],
|
|
64880
|
+
program: {
|
|
64881
|
+
kind: "const",
|
|
64882
|
+
value: [
|
|
64883
|
+
140,
|
|
64884
|
+
151,
|
|
64885
|
+
37,
|
|
64886
|
+
143,
|
|
64887
|
+
78,
|
|
64888
|
+
36,
|
|
64889
|
+
137,
|
|
64890
|
+
241,
|
|
64891
|
+
187,
|
|
64892
|
+
61,
|
|
64893
|
+
16,
|
|
64894
|
+
41,
|
|
64895
|
+
20,
|
|
64896
|
+
142,
|
|
64897
|
+
13,
|
|
64898
|
+
131,
|
|
64899
|
+
11,
|
|
64900
|
+
90,
|
|
64901
|
+
19,
|
|
64902
|
+
153,
|
|
64903
|
+
218,
|
|
64904
|
+
255,
|
|
64905
|
+
16,
|
|
64906
|
+
132,
|
|
64907
|
+
4,
|
|
64908
|
+
142,
|
|
64909
|
+
123,
|
|
64910
|
+
216,
|
|
64911
|
+
219,
|
|
64912
|
+
233,
|
|
64913
|
+
248,
|
|
64914
|
+
89
|
|
64915
|
+
]
|
|
64916
|
+
}
|
|
64917
|
+
}
|
|
64918
|
+
},
|
|
64919
|
+
{
|
|
64920
|
+
name: "escrow_shares_account",
|
|
64921
|
+
docs: [
|
|
64922
|
+
"Escrow's share token account (holds shares until burned on claim)."
|
|
64923
|
+
],
|
|
64924
|
+
writable: true,
|
|
64925
|
+
pda: {
|
|
64926
|
+
seeds: [
|
|
64927
|
+
{
|
|
64928
|
+
kind: "account",
|
|
64929
|
+
path: "withdraw_escrow"
|
|
64930
|
+
},
|
|
64931
|
+
{
|
|
64932
|
+
kind: "account",
|
|
64933
|
+
path: "token_program"
|
|
64934
|
+
},
|
|
64935
|
+
{
|
|
64936
|
+
kind: "account",
|
|
64937
|
+
path: "shares_mint"
|
|
64938
|
+
}
|
|
64939
|
+
],
|
|
64940
|
+
program: {
|
|
64941
|
+
kind: "const",
|
|
64942
|
+
value: [
|
|
64943
|
+
140,
|
|
64944
|
+
151,
|
|
64945
|
+
37,
|
|
64946
|
+
143,
|
|
64947
|
+
78,
|
|
64948
|
+
36,
|
|
64949
|
+
137,
|
|
64950
|
+
241,
|
|
64951
|
+
187,
|
|
64952
|
+
61,
|
|
64953
|
+
16,
|
|
64954
|
+
41,
|
|
64955
|
+
20,
|
|
64956
|
+
142,
|
|
64957
|
+
13,
|
|
64958
|
+
131,
|
|
64959
|
+
11,
|
|
64960
|
+
90,
|
|
64961
|
+
19,
|
|
64962
|
+
153,
|
|
64963
|
+
218,
|
|
64964
|
+
255,
|
|
64965
|
+
16,
|
|
64966
|
+
132,
|
|
64967
|
+
4,
|
|
64968
|
+
142,
|
|
64969
|
+
123,
|
|
64970
|
+
216,
|
|
64971
|
+
219,
|
|
64972
|
+
233,
|
|
64973
|
+
248,
|
|
64974
|
+
89
|
|
64975
|
+
]
|
|
64976
|
+
}
|
|
64977
|
+
}
|
|
64978
|
+
},
|
|
64979
|
+
{
|
|
64980
|
+
name: "withdraw_receipt",
|
|
64981
|
+
docs: [
|
|
64982
|
+
"Withdraw receipt - tracks pending and claimable amounts (accumulates)."
|
|
64983
|
+
],
|
|
64984
|
+
writable: true,
|
|
64985
|
+
pda: {
|
|
64986
|
+
seeds: [
|
|
64987
|
+
{
|
|
64988
|
+
kind: "const",
|
|
64989
|
+
value: [
|
|
64990
|
+
119,
|
|
64991
|
+
105,
|
|
64992
|
+
116,
|
|
64993
|
+
104,
|
|
64994
|
+
100,
|
|
64995
|
+
114,
|
|
64996
|
+
97,
|
|
64997
|
+
119,
|
|
64998
|
+
95,
|
|
64999
|
+
114,
|
|
65000
|
+
101,
|
|
65001
|
+
99,
|
|
65002
|
+
101,
|
|
65003
|
+
105,
|
|
65004
|
+
112,
|
|
65005
|
+
116
|
|
65006
|
+
]
|
|
65007
|
+
},
|
|
65008
|
+
{
|
|
65009
|
+
kind: "account",
|
|
65010
|
+
path: "user"
|
|
65011
|
+
},
|
|
65012
|
+
{
|
|
65013
|
+
kind: "account",
|
|
65014
|
+
path: "lp_vault"
|
|
65015
|
+
}
|
|
65016
|
+
]
|
|
65017
|
+
}
|
|
65018
|
+
},
|
|
65019
|
+
{
|
|
65020
|
+
name: "system_program",
|
|
65021
|
+
docs: [
|
|
65022
|
+
"System program."
|
|
65023
|
+
],
|
|
65024
|
+
address: "11111111111111111111111111111111"
|
|
65025
|
+
},
|
|
65026
|
+
{
|
|
65027
|
+
name: "token_program",
|
|
65028
|
+
docs: [
|
|
65029
|
+
"Token program."
|
|
65030
|
+
]
|
|
65031
|
+
},
|
|
65032
|
+
{
|
|
65033
|
+
name: "associated_token_program",
|
|
65034
|
+
docs: [
|
|
65035
|
+
"Associated token program."
|
|
65036
|
+
],
|
|
65037
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
65038
|
+
}
|
|
65039
|
+
],
|
|
65040
|
+
args: [
|
|
65041
|
+
{
|
|
65042
|
+
name: "shares_amount",
|
|
65043
|
+
type: "u64"
|
|
65044
|
+
}
|
|
65045
|
+
]
|
|
65046
|
+
},
|
|
65047
|
+
{
|
|
65048
|
+
name: "withdraw_assets",
|
|
65049
|
+
docs: [
|
|
65050
|
+
"Withdraw assets from vault to operator wallet for investment."
|
|
65051
|
+
],
|
|
65052
|
+
discriminator: [
|
|
65053
|
+
202,
|
|
65054
|
+
105,
|
|
65055
|
+
54,
|
|
65056
|
+
155,
|
|
65057
|
+
56,
|
|
65058
|
+
33,
|
|
65059
|
+
207,
|
|
65060
|
+
254
|
|
65061
|
+
],
|
|
65062
|
+
accounts: [
|
|
65063
|
+
{
|
|
65064
|
+
name: "fund_authority",
|
|
65065
|
+
writable: true,
|
|
65066
|
+
signer: true,
|
|
65067
|
+
relations: [
|
|
65068
|
+
"lp_vault"
|
|
65069
|
+
]
|
|
65070
|
+
},
|
|
65071
|
+
{
|
|
65072
|
+
name: "lp_vault"
|
|
65073
|
+
},
|
|
65074
|
+
{
|
|
65075
|
+
name: "assets_account",
|
|
65076
|
+
writable: true,
|
|
65077
|
+
relations: [
|
|
65078
|
+
"lp_vault"
|
|
65079
|
+
]
|
|
65080
|
+
},
|
|
65081
|
+
{
|
|
65082
|
+
name: "authority_asset_ata",
|
|
65083
|
+
writable: true,
|
|
65084
|
+
pda: {
|
|
65085
|
+
seeds: [
|
|
65086
|
+
{
|
|
65087
|
+
kind: "account",
|
|
65088
|
+
path: "fund_authority"
|
|
65089
|
+
},
|
|
65090
|
+
{
|
|
65091
|
+
kind: "account",
|
|
65092
|
+
path: "token_program"
|
|
65093
|
+
},
|
|
65094
|
+
{
|
|
65095
|
+
kind: "account",
|
|
65096
|
+
path: "assets_mint"
|
|
65097
|
+
}
|
|
65098
|
+
],
|
|
65099
|
+
program: {
|
|
65100
|
+
kind: "const",
|
|
65101
|
+
value: [
|
|
65102
|
+
140,
|
|
65103
|
+
151,
|
|
65104
|
+
37,
|
|
65105
|
+
143,
|
|
65106
|
+
78,
|
|
65107
|
+
36,
|
|
65108
|
+
137,
|
|
65109
|
+
241,
|
|
65110
|
+
187,
|
|
65111
|
+
61,
|
|
65112
|
+
16,
|
|
65113
|
+
41,
|
|
65114
|
+
20,
|
|
65115
|
+
142,
|
|
65116
|
+
13,
|
|
65117
|
+
131,
|
|
65118
|
+
11,
|
|
65119
|
+
90,
|
|
65120
|
+
19,
|
|
65121
|
+
153,
|
|
65122
|
+
218,
|
|
65123
|
+
255,
|
|
65124
|
+
16,
|
|
65125
|
+
132,
|
|
65126
|
+
4,
|
|
65127
|
+
142,
|
|
65128
|
+
123,
|
|
65129
|
+
216,
|
|
65130
|
+
219,
|
|
65131
|
+
233,
|
|
65132
|
+
248,
|
|
65133
|
+
89
|
|
65134
|
+
]
|
|
65135
|
+
}
|
|
65136
|
+
}
|
|
65137
|
+
},
|
|
65138
|
+
{
|
|
65139
|
+
name: "assets_mint",
|
|
65140
|
+
relations: [
|
|
65141
|
+
"lp_vault"
|
|
65142
|
+
]
|
|
65143
|
+
},
|
|
65144
|
+
{
|
|
65145
|
+
name: "system_program",
|
|
65146
|
+
address: "11111111111111111111111111111111"
|
|
65147
|
+
},
|
|
65148
|
+
{
|
|
65149
|
+
name: "token_program"
|
|
65150
|
+
},
|
|
65151
|
+
{
|
|
65152
|
+
name: "associated_token_program",
|
|
65153
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
65154
|
+
}
|
|
65155
|
+
],
|
|
65156
|
+
args: [
|
|
65157
|
+
{
|
|
65158
|
+
name: "amount",
|
|
65159
|
+
type: "u64"
|
|
65160
|
+
}
|
|
65161
|
+
]
|
|
65162
|
+
}
|
|
65163
|
+
],
|
|
65164
|
+
accounts: [
|
|
65165
|
+
{
|
|
65166
|
+
name: "DepositReceipt",
|
|
65167
|
+
discriminator: [
|
|
65168
|
+
64,
|
|
65169
|
+
175,
|
|
65170
|
+
24,
|
|
65171
|
+
183,
|
|
65172
|
+
138,
|
|
65173
|
+
109,
|
|
65174
|
+
70,
|
|
65175
|
+
78
|
|
65176
|
+
]
|
|
65177
|
+
},
|
|
65178
|
+
{
|
|
65179
|
+
name: "GlobalConfig",
|
|
65180
|
+
discriminator: [
|
|
65181
|
+
149,
|
|
65182
|
+
8,
|
|
65183
|
+
156,
|
|
65184
|
+
202,
|
|
65185
|
+
160,
|
|
65186
|
+
252,
|
|
65187
|
+
176,
|
|
65188
|
+
217
|
|
65189
|
+
]
|
|
65190
|
+
},
|
|
65191
|
+
{
|
|
65192
|
+
name: "LpVault",
|
|
65193
|
+
discriminator: [
|
|
65194
|
+
189,
|
|
65195
|
+
45,
|
|
65196
|
+
167,
|
|
65197
|
+
23,
|
|
65198
|
+
91,
|
|
65199
|
+
118,
|
|
65200
|
+
105,
|
|
65201
|
+
190
|
|
65202
|
+
]
|
|
65203
|
+
},
|
|
65204
|
+
{
|
|
65205
|
+
name: "WithdrawEscrow",
|
|
65206
|
+
discriminator: [
|
|
65207
|
+
161,
|
|
65208
|
+
63,
|
|
65209
|
+
221,
|
|
65210
|
+
55,
|
|
65211
|
+
116,
|
|
65212
|
+
204,
|
|
65213
|
+
131,
|
|
65214
|
+
11
|
|
65215
|
+
]
|
|
65216
|
+
},
|
|
65217
|
+
{
|
|
65218
|
+
name: "WithdrawReceipt",
|
|
65219
|
+
discriminator: [
|
|
65220
|
+
132,
|
|
65221
|
+
238,
|
|
65222
|
+
44,
|
|
65223
|
+
182,
|
|
65224
|
+
207,
|
|
65225
|
+
9,
|
|
65226
|
+
124,
|
|
65227
|
+
140
|
|
65228
|
+
]
|
|
65229
|
+
},
|
|
65230
|
+
{
|
|
65231
|
+
name: "WithdrawalPolicy",
|
|
65232
|
+
discriminator: [
|
|
65233
|
+
52,
|
|
65234
|
+
231,
|
|
65235
|
+
68,
|
|
65236
|
+
59,
|
|
65237
|
+
247,
|
|
65238
|
+
250,
|
|
65239
|
+
119,
|
|
65240
|
+
244
|
|
65241
|
+
]
|
|
65242
|
+
}
|
|
65243
|
+
],
|
|
65244
|
+
events: [
|
|
65245
|
+
{
|
|
65246
|
+
name: "AdminAuthoritiesUpdated",
|
|
65247
|
+
discriminator: [
|
|
65248
|
+
1,
|
|
65249
|
+
164,
|
|
65250
|
+
87,
|
|
65251
|
+
62,
|
|
65252
|
+
157,
|
|
65253
|
+
85,
|
|
65254
|
+
1,
|
|
65255
|
+
113
|
|
65256
|
+
]
|
|
65257
|
+
},
|
|
65258
|
+
{
|
|
65259
|
+
name: "FeeConfigUpdated",
|
|
65260
|
+
discriminator: [
|
|
65261
|
+
45,
|
|
65262
|
+
50,
|
|
65263
|
+
42,
|
|
65264
|
+
173,
|
|
65265
|
+
193,
|
|
65266
|
+
67,
|
|
65267
|
+
52,
|
|
65268
|
+
244
|
|
65269
|
+
]
|
|
65270
|
+
},
|
|
65271
|
+
{
|
|
65272
|
+
name: "FeesAssessed",
|
|
65273
|
+
discriminator: [
|
|
65274
|
+
210,
|
|
65275
|
+
177,
|
|
65276
|
+
59,
|
|
65277
|
+
191,
|
|
65278
|
+
116,
|
|
65279
|
+
251,
|
|
65280
|
+
25,
|
|
65281
|
+
131
|
|
65282
|
+
]
|
|
65283
|
+
},
|
|
65284
|
+
{
|
|
65285
|
+
name: "WithdrawalFeeRetained",
|
|
65286
|
+
discriminator: [
|
|
65287
|
+
105,
|
|
65288
|
+
104,
|
|
65289
|
+
190,
|
|
65290
|
+
198,
|
|
65291
|
+
168,
|
|
65292
|
+
231,
|
|
65293
|
+
18,
|
|
65294
|
+
182
|
|
65295
|
+
]
|
|
65296
|
+
},
|
|
65297
|
+
{
|
|
65298
|
+
name: "WithdrawalFeesSettled",
|
|
65299
|
+
discriminator: [
|
|
65300
|
+
106,
|
|
65301
|
+
253,
|
|
65302
|
+
199,
|
|
65303
|
+
177,
|
|
65304
|
+
101,
|
|
65305
|
+
104,
|
|
65306
|
+
38,
|
|
65307
|
+
219
|
|
65308
|
+
]
|
|
65309
|
+
},
|
|
65310
|
+
{
|
|
65311
|
+
name: "WithdrawalPolicyUpdated",
|
|
65312
|
+
discriminator: [
|
|
65313
|
+
252,
|
|
65314
|
+
196,
|
|
65315
|
+
144,
|
|
65316
|
+
224,
|
|
65317
|
+
210,
|
|
65318
|
+
3,
|
|
65319
|
+
71,
|
|
65320
|
+
66
|
|
65321
|
+
]
|
|
65322
|
+
}
|
|
65323
|
+
],
|
|
65324
|
+
errors: [
|
|
65325
|
+
{
|
|
65326
|
+
code: 6e3,
|
|
65327
|
+
name: "ArithmeticError",
|
|
65328
|
+
msg: "Arithmetic error!"
|
|
65329
|
+
},
|
|
65330
|
+
{
|
|
65331
|
+
code: 6001,
|
|
65332
|
+
name: "ObsoleteVaultData",
|
|
65333
|
+
msg: "LpVault data is outdated!"
|
|
65334
|
+
},
|
|
65335
|
+
{
|
|
65336
|
+
code: 6002,
|
|
65337
|
+
name: "StaleNav",
|
|
65338
|
+
msg: "NAV is stale - operator must update NAV before this operation!"
|
|
65339
|
+
},
|
|
65340
|
+
{
|
|
65341
|
+
code: 6003,
|
|
65342
|
+
name: "Unauthorized",
|
|
65343
|
+
msg: "Signer is not an authority!"
|
|
65344
|
+
},
|
|
65345
|
+
{
|
|
65346
|
+
code: 6004,
|
|
65347
|
+
name: "InvalidMint",
|
|
65348
|
+
msg: "Invalid mint extension!"
|
|
65349
|
+
},
|
|
65350
|
+
{
|
|
65351
|
+
code: 6005,
|
|
65352
|
+
name: "NameTooLong",
|
|
65353
|
+
msg: "LP Vault name is too long!"
|
|
65354
|
+
},
|
|
65355
|
+
{
|
|
65356
|
+
code: 6006,
|
|
65357
|
+
name: "BlockedDeposit",
|
|
65358
|
+
msg: "Deposits are blocked - NAV is zero!"
|
|
65359
|
+
},
|
|
65360
|
+
{
|
|
65361
|
+
code: 6007,
|
|
65362
|
+
name: "InsufficientLiquidity",
|
|
65363
|
+
msg: "Insufficient liquid assets for instant withdrawal!"
|
|
65364
|
+
},
|
|
65365
|
+
{
|
|
65366
|
+
code: 6008,
|
|
65367
|
+
name: "InvalidShareAmount",
|
|
65368
|
+
msg: "Invalid share amount!"
|
|
65369
|
+
},
|
|
65370
|
+
{
|
|
65371
|
+
code: 6009,
|
|
65372
|
+
name: "InvalidDepositAmount",
|
|
65373
|
+
msg: "Invalid deposit amount!"
|
|
65374
|
+
},
|
|
65375
|
+
{
|
|
65376
|
+
code: 6010,
|
|
65377
|
+
name: "NoPendingWithdrawal",
|
|
65378
|
+
msg: "No pending withdrawal to fulfill!"
|
|
65379
|
+
},
|
|
65380
|
+
{
|
|
65381
|
+
code: 6011,
|
|
65382
|
+
name: "NoClaimableAssets",
|
|
65383
|
+
msg: "No claimable assets to withdraw!"
|
|
65384
|
+
},
|
|
65385
|
+
{
|
|
65386
|
+
code: 6012,
|
|
65387
|
+
name: "FeeRecipientNotConfigured",
|
|
65388
|
+
msg: "Fee recipient is not configured!"
|
|
65389
|
+
},
|
|
65390
|
+
{
|
|
65391
|
+
code: 6013,
|
|
65392
|
+
name: "InvalidPerformanceFeeBps",
|
|
65393
|
+
msg: "Invalid performance fee - must be <= MAX_PERFORMANCE_FEE_BPS!"
|
|
65394
|
+
},
|
|
65395
|
+
{
|
|
65396
|
+
code: 6014,
|
|
65397
|
+
name: "InvalidFeeRecipient",
|
|
65398
|
+
msg: "Invalid fee recipient account!"
|
|
65399
|
+
},
|
|
65400
|
+
{
|
|
65401
|
+
code: 6015,
|
|
65402
|
+
name: "AssessmentTooEarly",
|
|
65403
|
+
msg: "Assessment interval has not elapsed!"
|
|
65404
|
+
},
|
|
65405
|
+
{
|
|
65406
|
+
code: 6016,
|
|
65407
|
+
name: "InvalidAssessmentInterval",
|
|
65408
|
+
msg: "Invalid assessment interval!"
|
|
65409
|
+
},
|
|
65410
|
+
{
|
|
65411
|
+
code: 6017,
|
|
65412
|
+
name: "NavUpdateTooLarge",
|
|
65413
|
+
msg: "NAV update would change share price by more than the allowed maximum!"
|
|
65414
|
+
},
|
|
65415
|
+
{
|
|
65416
|
+
code: 6018,
|
|
65417
|
+
name: "InvalidWithdrawalFeeBps",
|
|
65418
|
+
msg: "Invalid withdrawal fee - must be <= MAX_WITHDRAWAL_FEE_BPS!"
|
|
65419
|
+
},
|
|
65420
|
+
{
|
|
65421
|
+
code: 6019,
|
|
65422
|
+
name: "InvalidWithdrawalCapBps",
|
|
65423
|
+
msg: "Invalid withdrawal cap - must be <= 10000 bps!"
|
|
65424
|
+
},
|
|
65425
|
+
{
|
|
65426
|
+
code: 6020,
|
|
65427
|
+
name: "HourlyWithdrawalCapExceeded",
|
|
65428
|
+
msg: "Withdrawal exceeds hourly vault capacity!"
|
|
65429
|
+
},
|
|
65430
|
+
{
|
|
65431
|
+
code: 6021,
|
|
65432
|
+
name: "DailyWithdrawalCapExceeded",
|
|
65433
|
+
msg: "Withdrawal exceeds daily vault capacity!"
|
|
65434
|
+
},
|
|
65435
|
+
{
|
|
65436
|
+
code: 6022,
|
|
65437
|
+
name: "InvalidWithdrawalPolicy",
|
|
65438
|
+
msg: "Invalid withdrawal policy account!"
|
|
65439
|
+
},
|
|
65440
|
+
{
|
|
65441
|
+
code: 6023,
|
|
65442
|
+
name: "InvalidAuthority",
|
|
65443
|
+
msg: "New authority cannot be the default (all-zeros) pubkey!"
|
|
65444
|
+
}
|
|
65445
|
+
],
|
|
65446
|
+
types: [
|
|
65447
|
+
{
|
|
65448
|
+
name: "AdminAuthoritiesUpdated",
|
|
65449
|
+
type: {
|
|
65450
|
+
kind: "struct",
|
|
65451
|
+
fields: [
|
|
65452
|
+
{
|
|
65453
|
+
name: "old_super_admin",
|
|
65454
|
+
type: "pubkey"
|
|
65455
|
+
},
|
|
65456
|
+
{
|
|
65457
|
+
name: "new_super_admin",
|
|
65458
|
+
type: "pubkey"
|
|
65459
|
+
},
|
|
65460
|
+
{
|
|
65461
|
+
name: "old_create_authority",
|
|
65462
|
+
type: "pubkey"
|
|
65463
|
+
},
|
|
65464
|
+
{
|
|
65465
|
+
name: "new_create_authority",
|
|
65466
|
+
type: "pubkey"
|
|
65467
|
+
},
|
|
65468
|
+
{
|
|
65469
|
+
name: "old_permissioned_creation",
|
|
65470
|
+
type: "bool"
|
|
65471
|
+
},
|
|
65472
|
+
{
|
|
65473
|
+
name: "new_permissioned_creation",
|
|
65474
|
+
type: "bool"
|
|
65475
|
+
}
|
|
65476
|
+
]
|
|
65477
|
+
}
|
|
65478
|
+
},
|
|
65479
|
+
{
|
|
65480
|
+
name: "DepositReceipt",
|
|
65481
|
+
type: {
|
|
65482
|
+
kind: "struct",
|
|
65483
|
+
fields: [
|
|
65484
|
+
{
|
|
65485
|
+
name: "bump",
|
|
65486
|
+
docs: [
|
|
65487
|
+
"PDA bump seed."
|
|
65488
|
+
],
|
|
65489
|
+
type: "u8"
|
|
65490
|
+
}
|
|
65491
|
+
]
|
|
65492
|
+
}
|
|
65493
|
+
},
|
|
65494
|
+
{
|
|
65495
|
+
name: "FeeConfigUpdated",
|
|
65496
|
+
type: {
|
|
65497
|
+
kind: "struct",
|
|
65498
|
+
fields: [
|
|
65499
|
+
{
|
|
65500
|
+
name: "vault",
|
|
65501
|
+
type: "pubkey"
|
|
65502
|
+
},
|
|
65503
|
+
{
|
|
65504
|
+
name: "old_fee_recipient",
|
|
65505
|
+
type: "pubkey"
|
|
65506
|
+
},
|
|
65507
|
+
{
|
|
65508
|
+
name: "new_fee_recipient",
|
|
65509
|
+
type: "pubkey"
|
|
65510
|
+
},
|
|
65511
|
+
{
|
|
65512
|
+
name: "old_fee_bps",
|
|
65513
|
+
type: "u16"
|
|
65514
|
+
},
|
|
65515
|
+
{
|
|
65516
|
+
name: "new_fee_bps",
|
|
65517
|
+
type: "u16"
|
|
65518
|
+
},
|
|
65519
|
+
{
|
|
65520
|
+
name: "assessment_interval_secs",
|
|
65521
|
+
type: "i64"
|
|
65522
|
+
}
|
|
65523
|
+
]
|
|
65524
|
+
}
|
|
65525
|
+
},
|
|
65526
|
+
{
|
|
65527
|
+
name: "FeesAssessed",
|
|
65528
|
+
type: {
|
|
65529
|
+
kind: "struct",
|
|
65530
|
+
fields: [
|
|
65531
|
+
{
|
|
65532
|
+
name: "vault",
|
|
65533
|
+
type: "pubkey"
|
|
65534
|
+
},
|
|
65535
|
+
{
|
|
65536
|
+
name: "profit_assets",
|
|
65537
|
+
type: "u64"
|
|
65538
|
+
},
|
|
65539
|
+
{
|
|
65540
|
+
name: "fee_assets",
|
|
65541
|
+
type: "u64"
|
|
65542
|
+
},
|
|
65543
|
+
{
|
|
65544
|
+
name: "fee_shares_minted",
|
|
65545
|
+
type: "u64"
|
|
65546
|
+
},
|
|
65547
|
+
{
|
|
65548
|
+
name: "new_pps",
|
|
65549
|
+
type: "u64"
|
|
65550
|
+
},
|
|
65551
|
+
{
|
|
65552
|
+
name: "checkpoint_pps",
|
|
65553
|
+
type: "u64"
|
|
65554
|
+
},
|
|
65555
|
+
{
|
|
65556
|
+
name: "timestamp",
|
|
65557
|
+
type: "i64"
|
|
65558
|
+
}
|
|
65559
|
+
]
|
|
65560
|
+
}
|
|
65561
|
+
},
|
|
65562
|
+
{
|
|
65563
|
+
name: "GlobalConfig",
|
|
65564
|
+
type: {
|
|
65565
|
+
kind: "struct",
|
|
65566
|
+
fields: [
|
|
65567
|
+
{
|
|
65568
|
+
name: "super_admin",
|
|
65569
|
+
docs: [
|
|
65570
|
+
"Key with the ability to update the GlobalConfig. Rotatable only via",
|
|
65571
|
+
"`update_admin_authorities` (gated on the program upgrade authority)."
|
|
65572
|
+
],
|
|
65573
|
+
type: "pubkey"
|
|
65574
|
+
},
|
|
65575
|
+
{
|
|
65576
|
+
name: "permissioned_creation",
|
|
65577
|
+
docs: [
|
|
65578
|
+
"When true InitializeLpVault requires create_authority to be a signer"
|
|
65579
|
+
],
|
|
65580
|
+
type: "bool"
|
|
65581
|
+
},
|
|
65582
|
+
{
|
|
65583
|
+
name: "create_authority",
|
|
65584
|
+
docs: [
|
|
65585
|
+
"The key with authority to call `InitializeLpVault`"
|
|
65586
|
+
],
|
|
65587
|
+
type: "pubkey"
|
|
65588
|
+
},
|
|
65589
|
+
{
|
|
65590
|
+
name: "bump",
|
|
65591
|
+
docs: [
|
|
65592
|
+
"Bump for increased efficiency."
|
|
65593
|
+
],
|
|
65594
|
+
type: "u8"
|
|
65595
|
+
}
|
|
65596
|
+
]
|
|
65597
|
+
}
|
|
65598
|
+
},
|
|
65599
|
+
{
|
|
65600
|
+
name: "LpVault",
|
|
65601
|
+
type: {
|
|
65602
|
+
kind: "struct",
|
|
65603
|
+
fields: [
|
|
65604
|
+
{
|
|
65605
|
+
name: "assets_account",
|
|
65606
|
+
docs: [
|
|
65607
|
+
"USDC TokenAccount where users deposit, funds agent operations."
|
|
65608
|
+
],
|
|
65609
|
+
type: "pubkey"
|
|
65610
|
+
},
|
|
65611
|
+
{
|
|
65612
|
+
name: "pending_shares_account",
|
|
65613
|
+
docs: [
|
|
65614
|
+
"TokenAccount where shares are held during queued (illiquid) withdrawals."
|
|
65615
|
+
],
|
|
65616
|
+
type: "pubkey"
|
|
65617
|
+
},
|
|
65618
|
+
{
|
|
65619
|
+
name: "shares_mint",
|
|
65620
|
+
docs: [
|
|
65621
|
+
"Derived mint (created on initialize) that represents LP tokens or shares."
|
|
65622
|
+
],
|
|
65623
|
+
type: "pubkey"
|
|
65624
|
+
},
|
|
65625
|
+
{
|
|
65626
|
+
name: "assets_mint",
|
|
65627
|
+
docs: [
|
|
65628
|
+
"Mint corresponding to the asset, most of the time USDC."
|
|
65629
|
+
],
|
|
65630
|
+
type: "pubkey"
|
|
65631
|
+
},
|
|
65632
|
+
{
|
|
65633
|
+
name: "fund_authority",
|
|
65634
|
+
docs: [
|
|
65635
|
+
"Pubkey authorized to withdraw assets from assets_account and update NAV."
|
|
65636
|
+
],
|
|
65637
|
+
type: "pubkey"
|
|
65638
|
+
},
|
|
65639
|
+
{
|
|
65640
|
+
name: "nav",
|
|
65641
|
+
docs: [
|
|
65642
|
+
"Current Net Asset Value (total vault value in asset decimals)."
|
|
65643
|
+
],
|
|
65644
|
+
type: "u64"
|
|
65645
|
+
},
|
|
65646
|
+
{
|
|
65647
|
+
name: "total_shares",
|
|
65648
|
+
docs: [
|
|
65649
|
+
"Total shares outstanding (cached for efficiency). May temporarily diverge",
|
|
65650
|
+
"from shares_mint.supply during the escrow withdrawal flow (between",
|
|
65651
|
+
"fulfill_withdrawal and complete_withdrawal)."
|
|
65652
|
+
],
|
|
65653
|
+
type: "u64"
|
|
65654
|
+
},
|
|
65655
|
+
{
|
|
65656
|
+
name: "nav_updated_at",
|
|
65657
|
+
docs: [
|
|
65658
|
+
"Timestamp for when NAV was last updated."
|
|
65659
|
+
],
|
|
65660
|
+
type: "i64"
|
|
65661
|
+
},
|
|
65662
|
+
{
|
|
65663
|
+
name: "nav_max_staleness",
|
|
65664
|
+
docs: [
|
|
65665
|
+
"Maximum NAV staleness for user operations (in seconds).",
|
|
65666
|
+
"Deposits and withdrawals fail if NAV is older than this."
|
|
65667
|
+
],
|
|
65668
|
+
type: "u64"
|
|
65669
|
+
},
|
|
65670
|
+
{
|
|
65671
|
+
name: "bump",
|
|
65672
|
+
docs: [
|
|
65673
|
+
"PDA derivation bump, stored for CU saving purposes."
|
|
65674
|
+
],
|
|
65675
|
+
type: "u8"
|
|
65676
|
+
},
|
|
65677
|
+
{
|
|
65678
|
+
name: "vault_name",
|
|
65679
|
+
type: "string"
|
|
65680
|
+
},
|
|
65681
|
+
{
|
|
65682
|
+
name: "pending_withdrawal_value",
|
|
65683
|
+
docs: [
|
|
65684
|
+
"Total value of pending withdrawals awaiting liquidity.",
|
|
65685
|
+
"When a withdrawal cannot be fulfilled instantly due to insufficient",
|
|
65686
|
+
"liquid assets, the value is tracked here. This is approximate \u2014 the",
|
|
65687
|
+
"value recorded at withdrawal time may differ from the value at",
|
|
65688
|
+
"fulfillment time (recomputed at current NAV). Used for operator",
|
|
65689
|
+
"visibility only, not for critical calculations."
|
|
65690
|
+
],
|
|
65691
|
+
type: "u64"
|
|
65692
|
+
},
|
|
65693
|
+
{
|
|
65694
|
+
name: "fee_recipient",
|
|
65695
|
+
docs: [
|
|
65696
|
+
"Shares token account that receives fee shares. Pubkey::default() = disabled."
|
|
65697
|
+
],
|
|
65698
|
+
type: "pubkey"
|
|
65699
|
+
},
|
|
65700
|
+
{
|
|
65701
|
+
name: "performance_fee_bps",
|
|
65702
|
+
docs: [
|
|
65703
|
+
"Performance fee rate in basis points (2000 = 20%). 0 = disabled."
|
|
65704
|
+
],
|
|
65705
|
+
type: "u16"
|
|
65706
|
+
},
|
|
65707
|
+
{
|
|
65708
|
+
name: "assessment_interval_secs",
|
|
65709
|
+
docs: [
|
|
65710
|
+
"How often scheduled fees are assessed (seconds). E.g., 86400 = 24h."
|
|
65711
|
+
],
|
|
65712
|
+
type: "i64"
|
|
65713
|
+
},
|
|
65714
|
+
{
|
|
65715
|
+
name: "last_assessment_timestamp",
|
|
65716
|
+
docs: [
|
|
65717
|
+
"Unix timestamp of last fee event (scheduled or withdrawal-triggered)."
|
|
65718
|
+
],
|
|
65719
|
+
type: "i64"
|
|
65720
|
+
},
|
|
65721
|
+
{
|
|
65722
|
+
name: "price_per_share_at_last_assessment",
|
|
65723
|
+
docs: [
|
|
65724
|
+
"PPS at last fee event, scaled by PRICE_SCALE. High-water mark for fees."
|
|
65725
|
+
],
|
|
65726
|
+
type: "u64"
|
|
65727
|
+
},
|
|
65728
|
+
{
|
|
65729
|
+
name: "keeper_authority",
|
|
65730
|
+
docs: [
|
|
65731
|
+
"Optional keeper authority. When set (non-default), this key can call",
|
|
65732
|
+
"fulfill_withdrawal in addition to fund_authority. Allows the keeper",
|
|
65733
|
+
"process to use a separate key from the agent/fund_authority.",
|
|
65734
|
+
"Pubkey::default() = not set (only fund_authority can fulfill)."
|
|
65735
|
+
],
|
|
65736
|
+
type: "pubkey"
|
|
65737
|
+
}
|
|
65738
|
+
]
|
|
65739
|
+
}
|
|
65740
|
+
},
|
|
65741
|
+
{
|
|
65742
|
+
name: "WithdrawEscrow",
|
|
65743
|
+
docs: [
|
|
65744
|
+
"Escrow account that holds assets and shares for a pending withdrawal.",
|
|
65745
|
+
"Each user has one escrow per vault, derived as PDA from [WITHDRAW_ESCROW_SEED, user, vault]."
|
|
65746
|
+
],
|
|
65747
|
+
type: {
|
|
65748
|
+
kind: "struct",
|
|
65749
|
+
fields: [
|
|
65750
|
+
{
|
|
65751
|
+
name: "user",
|
|
65752
|
+
docs: [
|
|
65753
|
+
"User who owns this escrow."
|
|
65754
|
+
],
|
|
65755
|
+
type: "pubkey"
|
|
65756
|
+
},
|
|
65757
|
+
{
|
|
65758
|
+
name: "lp_vault",
|
|
65759
|
+
docs: [
|
|
65760
|
+
"The vault this escrow is associated with."
|
|
65761
|
+
],
|
|
65762
|
+
type: "pubkey"
|
|
65763
|
+
},
|
|
65764
|
+
{
|
|
65765
|
+
name: "escrow_assets_account",
|
|
65766
|
+
docs: [
|
|
65767
|
+
"Token account holding escrowed assets (USDC)."
|
|
65768
|
+
],
|
|
65769
|
+
type: "pubkey"
|
|
65770
|
+
},
|
|
65771
|
+
{
|
|
65772
|
+
name: "escrow_shares_account",
|
|
65773
|
+
docs: [
|
|
65774
|
+
"Token account holding escrowed shares (for burning on claim)."
|
|
65775
|
+
],
|
|
65776
|
+
type: "pubkey"
|
|
65777
|
+
},
|
|
65778
|
+
{
|
|
65779
|
+
name: "bump",
|
|
65780
|
+
docs: [
|
|
65781
|
+
"PDA derivation bump."
|
|
65782
|
+
],
|
|
65783
|
+
type: "u8"
|
|
65784
|
+
}
|
|
65785
|
+
]
|
|
65786
|
+
}
|
|
65787
|
+
},
|
|
65788
|
+
{
|
|
65789
|
+
name: "WithdrawReceipt",
|
|
65790
|
+
type: {
|
|
65791
|
+
kind: "struct",
|
|
65792
|
+
fields: [
|
|
65793
|
+
{
|
|
65794
|
+
name: "user",
|
|
65795
|
+
docs: [
|
|
65796
|
+
"User requesting withdrawal."
|
|
65797
|
+
],
|
|
65798
|
+
type: "pubkey"
|
|
65799
|
+
},
|
|
65800
|
+
{
|
|
65801
|
+
name: "lp_vault",
|
|
65802
|
+
docs: [
|
|
65803
|
+
"Vault where the user has invested."
|
|
65804
|
+
],
|
|
65805
|
+
type: "pubkey"
|
|
65806
|
+
},
|
|
65807
|
+
{
|
|
65808
|
+
name: "pending_shares",
|
|
65809
|
+
docs: [
|
|
65810
|
+
"Shares waiting for liquidity (keeper needs to fulfill these).",
|
|
65811
|
+
"These shares are held in the escrow_shares_account."
|
|
65812
|
+
],
|
|
65813
|
+
type: "u64"
|
|
65814
|
+
},
|
|
65815
|
+
{
|
|
65816
|
+
name: "claimable_shares",
|
|
65817
|
+
docs: [
|
|
65818
|
+
"Shares that have been fulfilled and are ready to claim.",
|
|
65819
|
+
"These shares are also in escrow_shares_account, waiting to be burned on claim."
|
|
65820
|
+
],
|
|
65821
|
+
type: "u64"
|
|
65822
|
+
},
|
|
65823
|
+
{
|
|
65824
|
+
name: "claimable_assets",
|
|
65825
|
+
docs: [
|
|
65826
|
+
"Asset value ready to claim (held in escrow_assets_account)."
|
|
65827
|
+
],
|
|
65828
|
+
type: "u64"
|
|
65829
|
+
},
|
|
65830
|
+
{
|
|
65831
|
+
name: "oldest_pending_at",
|
|
65832
|
+
docs: [
|
|
65833
|
+
"Timestamp of the earliest pending withdrawal (for NAV staleness checks)."
|
|
65834
|
+
],
|
|
65835
|
+
type: "i64"
|
|
65836
|
+
},
|
|
65837
|
+
{
|
|
65838
|
+
name: "bump",
|
|
65839
|
+
docs: [
|
|
65840
|
+
"PDA derivation bump, stored for CU saving purposes."
|
|
65841
|
+
],
|
|
65842
|
+
type: "u8"
|
|
65843
|
+
}
|
|
65844
|
+
]
|
|
65845
|
+
}
|
|
65846
|
+
},
|
|
65847
|
+
{
|
|
65848
|
+
name: "WithdrawalFeeRetained",
|
|
65849
|
+
type: {
|
|
65850
|
+
kind: "struct",
|
|
65851
|
+
fields: [
|
|
65852
|
+
{
|
|
65853
|
+
name: "vault",
|
|
65854
|
+
type: "pubkey"
|
|
65855
|
+
},
|
|
65856
|
+
{
|
|
65857
|
+
name: "user",
|
|
65858
|
+
type: "pubkey"
|
|
65859
|
+
},
|
|
65860
|
+
{
|
|
65861
|
+
name: "gross_assets",
|
|
65862
|
+
type: "u64"
|
|
65863
|
+
},
|
|
65864
|
+
{
|
|
65865
|
+
name: "fee_assets",
|
|
65866
|
+
type: "u64"
|
|
65867
|
+
},
|
|
65868
|
+
{
|
|
65869
|
+
name: "net_assets",
|
|
65870
|
+
type: "u64"
|
|
65871
|
+
},
|
|
65872
|
+
{
|
|
65873
|
+
name: "withdrawal_fee_bps",
|
|
65874
|
+
type: "u16"
|
|
65875
|
+
},
|
|
65876
|
+
{
|
|
65877
|
+
name: "timestamp",
|
|
65878
|
+
type: "i64"
|
|
65879
|
+
}
|
|
65880
|
+
]
|
|
65881
|
+
}
|
|
65882
|
+
},
|
|
65883
|
+
{
|
|
65884
|
+
name: "WithdrawalFeesSettled",
|
|
65885
|
+
type: {
|
|
65886
|
+
kind: "struct",
|
|
65887
|
+
fields: [
|
|
65888
|
+
{
|
|
65889
|
+
name: "vault",
|
|
65890
|
+
type: "pubkey"
|
|
65891
|
+
},
|
|
65892
|
+
{
|
|
65893
|
+
name: "user",
|
|
65894
|
+
type: "pubkey"
|
|
65895
|
+
},
|
|
65896
|
+
{
|
|
65897
|
+
name: "shares_withdrawn",
|
|
65898
|
+
type: "u64"
|
|
65899
|
+
},
|
|
65900
|
+
{
|
|
65901
|
+
name: "asset_value",
|
|
65902
|
+
type: "u64"
|
|
65903
|
+
},
|
|
65904
|
+
{
|
|
65905
|
+
name: "fee_shares_minted",
|
|
65906
|
+
type: "u64"
|
|
65907
|
+
},
|
|
65908
|
+
{
|
|
65909
|
+
name: "proration_elapsed",
|
|
65910
|
+
type: "i64"
|
|
65911
|
+
},
|
|
65912
|
+
{
|
|
65913
|
+
name: "proration_interval",
|
|
65914
|
+
type: "i64"
|
|
65915
|
+
},
|
|
65916
|
+
{
|
|
65917
|
+
name: "pps_after_fees",
|
|
65918
|
+
type: "u64"
|
|
65919
|
+
}
|
|
65920
|
+
]
|
|
65921
|
+
}
|
|
65922
|
+
},
|
|
65923
|
+
{
|
|
65924
|
+
name: "WithdrawalPolicy",
|
|
65925
|
+
type: {
|
|
65926
|
+
kind: "struct",
|
|
65927
|
+
fields: [
|
|
65928
|
+
{
|
|
65929
|
+
name: "lp_vault",
|
|
65930
|
+
docs: [
|
|
65931
|
+
"Vault this policy belongs to."
|
|
65932
|
+
],
|
|
65933
|
+
type: "pubkey"
|
|
65934
|
+
},
|
|
65935
|
+
{
|
|
65936
|
+
name: "withdrawal_fee_bps",
|
|
65937
|
+
docs: [
|
|
65938
|
+
"Base-asset fee retained in the vault on withdrawal. 30 = 0.30%."
|
|
65939
|
+
],
|
|
65940
|
+
type: "u16"
|
|
65941
|
+
},
|
|
65942
|
+
{
|
|
65943
|
+
name: "hourly_withdrawal_cap_bps",
|
|
65944
|
+
docs: [
|
|
65945
|
+
"Max net withdrawal accepted per hour as bps of current NAV. 0 = disabled."
|
|
65946
|
+
],
|
|
65947
|
+
type: "u16"
|
|
65948
|
+
},
|
|
65949
|
+
{
|
|
65950
|
+
name: "daily_withdrawal_cap_bps",
|
|
65951
|
+
docs: [
|
|
65952
|
+
"Max net withdrawal accepted per day as bps of current NAV. 0 = disabled."
|
|
65953
|
+
],
|
|
65954
|
+
type: "u16"
|
|
65955
|
+
},
|
|
65956
|
+
{
|
|
65957
|
+
name: "hourly_withdrawn_assets",
|
|
65958
|
+
docs: [
|
|
65959
|
+
"Net withdrawn assets counted in the current hourly window."
|
|
65960
|
+
],
|
|
65961
|
+
type: "u64"
|
|
65962
|
+
},
|
|
65963
|
+
{
|
|
65964
|
+
name: "daily_withdrawn_assets",
|
|
65965
|
+
docs: [
|
|
65966
|
+
"Net withdrawn assets counted in the current daily window."
|
|
65967
|
+
],
|
|
65968
|
+
type: "u64"
|
|
65969
|
+
},
|
|
65970
|
+
{
|
|
65971
|
+
name: "hourly_window_start",
|
|
65972
|
+
docs: [
|
|
65973
|
+
"Start timestamp for the current hourly cap window."
|
|
65974
|
+
],
|
|
65975
|
+
type: "i64"
|
|
65976
|
+
},
|
|
65977
|
+
{
|
|
65978
|
+
name: "daily_window_start",
|
|
65979
|
+
docs: [
|
|
65980
|
+
"Start timestamp for the current daily cap window."
|
|
65981
|
+
],
|
|
65982
|
+
type: "i64"
|
|
65983
|
+
},
|
|
65984
|
+
{
|
|
65985
|
+
name: "bump",
|
|
65986
|
+
docs: [
|
|
65987
|
+
"PDA derivation bump."
|
|
65988
|
+
],
|
|
65989
|
+
type: "u8"
|
|
65990
|
+
}
|
|
65991
|
+
]
|
|
65992
|
+
}
|
|
65993
|
+
},
|
|
65994
|
+
{
|
|
65995
|
+
name: "WithdrawalPolicyUpdated",
|
|
65996
|
+
type: {
|
|
65997
|
+
kind: "struct",
|
|
65998
|
+
fields: [
|
|
65999
|
+
{
|
|
66000
|
+
name: "vault",
|
|
66001
|
+
type: "pubkey"
|
|
66002
|
+
},
|
|
66003
|
+
{
|
|
66004
|
+
name: "withdrawal_fee_bps",
|
|
66005
|
+
type: "u16"
|
|
66006
|
+
},
|
|
66007
|
+
{
|
|
66008
|
+
name: "hourly_withdrawal_cap_bps",
|
|
66009
|
+
type: "u16"
|
|
66010
|
+
},
|
|
66011
|
+
{
|
|
66012
|
+
name: "daily_withdrawal_cap_bps",
|
|
66013
|
+
type: "u16"
|
|
66014
|
+
},
|
|
66015
|
+
{
|
|
66016
|
+
name: "timestamp",
|
|
66017
|
+
type: "i64"
|
|
66018
|
+
}
|
|
66019
|
+
]
|
|
66020
|
+
}
|
|
66021
|
+
}
|
|
66022
|
+
]
|
|
66023
|
+
};
|
|
66024
|
+
|
|
66025
|
+
// src/vendor/gamma/idl/index.ts
|
|
66026
|
+
var GAMMA_VAULT_IDL = gamma_vault_default;
|
|
66027
|
+
function deriveGammaWithdrawalPolicy(lpVault, programId = GAMMA_VAULT_PROGRAM_ID) {
|
|
66028
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
66029
|
+
[Buffer.from(SEED_WITHDRAWAL_POLICY), lpVault.toBuffer()],
|
|
66030
|
+
programId
|
|
66031
|
+
);
|
|
66032
|
+
}
|
|
66033
|
+
function deriveGammaDepositReceipt(user, lpVault, programId = GAMMA_VAULT_PROGRAM_ID) {
|
|
66034
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
66035
|
+
[Buffer.from(SEED_DEPOSIT_RECEIPT), user.toBuffer(), lpVault.toBuffer()],
|
|
66036
|
+
programId
|
|
66037
|
+
);
|
|
66038
|
+
}
|
|
66039
|
+
function deriveGammaWithdrawEscrow(user, lpVault, programId = GAMMA_VAULT_PROGRAM_ID) {
|
|
66040
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
66041
|
+
[Buffer.from(SEED_WITHDRAW_ESCROW), user.toBuffer(), lpVault.toBuffer()],
|
|
66042
|
+
programId
|
|
66043
|
+
);
|
|
66044
|
+
}
|
|
66045
|
+
function deriveGammaWithdrawReceipt(user, lpVault, programId = GAMMA_VAULT_PROGRAM_ID) {
|
|
66046
|
+
return web3_js.PublicKey.findProgramAddressSync(
|
|
66047
|
+
[Buffer.from(SEED_WITHDRAW_RECEIPT), user.toBuffer(), lpVault.toBuffer()],
|
|
66048
|
+
programId
|
|
66049
|
+
);
|
|
66050
|
+
}
|
|
66051
|
+
function deriveGammaAta(mint, owner, tokenProgram = TOKEN_PROGRAM_ID) {
|
|
66052
|
+
return getAssociatedTokenAddressSync(
|
|
66053
|
+
mint,
|
|
66054
|
+
owner,
|
|
66055
|
+
true,
|
|
66056
|
+
tokenProgram,
|
|
66057
|
+
ASSOCIATED_TOKEN_PROGRAM_ID
|
|
66058
|
+
);
|
|
66059
|
+
}
|
|
66060
|
+
var GAMMA_ACCOUNTS_CODER = new anchor.BorshAccountsCoder(GAMMA_VAULT_IDL);
|
|
66061
|
+
var lpVaultDiscriminator = Buffer.from([189, 45, 167, 23, 91, 118, 105, 190]);
|
|
66062
|
+
var withdrawReceiptDiscriminator = Buffer.from([132, 238, 44, 182, 207, 9, 124, 140]);
|
|
66063
|
+
var toBN = (v) => BN9__default.default.isBN(v) ? v : new BN9__default.default((v ?? 0).toString());
|
|
66064
|
+
function decodeGammaLpVaultData(data, pubkey) {
|
|
66065
|
+
if (!data.subarray(0, 8).equals(lpVaultDiscriminator)) {
|
|
66066
|
+
throw new Error("invalid Gamma LpVault account discriminator");
|
|
66067
|
+
}
|
|
66068
|
+
const d = GAMMA_ACCOUNTS_CODER.decode("LpVault", data);
|
|
66069
|
+
return {
|
|
66070
|
+
pubkey,
|
|
66071
|
+
assetsAccount: d.assets_account ?? d.assetsAccount,
|
|
66072
|
+
pendingSharesAccount: d.pending_shares_account ?? d.pendingSharesAccount,
|
|
66073
|
+
sharesMint: d.shares_mint ?? d.sharesMint,
|
|
66074
|
+
assetsMint: d.assets_mint ?? d.assetsMint,
|
|
66075
|
+
fundAuthority: d.fund_authority ?? d.fundAuthority,
|
|
66076
|
+
nav: toBN(d.nav),
|
|
66077
|
+
totalShares: toBN(d.total_shares ?? d.totalShares),
|
|
66078
|
+
navUpdatedAt: toBN(d.nav_updated_at ?? d.navUpdatedAt),
|
|
66079
|
+
navMaxStaleness: toBN(d.nav_max_staleness ?? d.navMaxStaleness),
|
|
66080
|
+
bump: d.bump,
|
|
66081
|
+
vaultName: d.vault_name ?? d.vaultName,
|
|
66082
|
+
pendingWithdrawalValue: toBN(d.pending_withdrawal_value ?? d.pendingWithdrawalValue),
|
|
66083
|
+
feeRecipient: d.fee_recipient ?? d.feeRecipient,
|
|
66084
|
+
performanceFeeBps: d.performance_fee_bps ?? d.performanceFeeBps,
|
|
66085
|
+
assessmentIntervalSecs: toBN(d.assessment_interval_secs ?? d.assessmentIntervalSecs),
|
|
66086
|
+
lastAssessmentTimestamp: toBN(d.last_assessment_timestamp ?? d.lastAssessmentTimestamp),
|
|
66087
|
+
pricePerShareAtLastAssessment: toBN(
|
|
66088
|
+
d.price_per_share_at_last_assessment ?? d.pricePerShareAtLastAssessment
|
|
66089
|
+
),
|
|
66090
|
+
keeperAuthority: d.keeper_authority ?? d.keeperAuthority
|
|
66091
|
+
};
|
|
66092
|
+
}
|
|
66093
|
+
function decodeGammaWithdrawReceiptData(data, pubkey) {
|
|
66094
|
+
if (!data.subarray(0, 8).equals(withdrawReceiptDiscriminator)) {
|
|
66095
|
+
throw new Error("invalid Gamma WithdrawReceipt account discriminator");
|
|
66096
|
+
}
|
|
66097
|
+
const d = GAMMA_ACCOUNTS_CODER.decode("WithdrawReceipt", data);
|
|
66098
|
+
return {
|
|
66099
|
+
pubkey,
|
|
66100
|
+
user: d.user,
|
|
66101
|
+
lpVault: d.lp_vault ?? d.lpVault,
|
|
66102
|
+
pendingShares: toBN(d.pending_shares ?? d.pendingShares),
|
|
66103
|
+
claimableShares: toBN(d.claimable_shares ?? d.claimableShares),
|
|
66104
|
+
claimableAssets: toBN(d.claimable_assets ?? d.claimableAssets),
|
|
66105
|
+
oldestPendingAt: toBN(d.oldest_pending_at ?? d.oldestPendingAt),
|
|
66106
|
+
bump: d.bump
|
|
66107
|
+
};
|
|
66108
|
+
}
|
|
66109
|
+
var DEPOSIT_DISCRIMINATOR = Buffer.from([242, 35, 198, 137, 82, 225, 242, 182]);
|
|
66110
|
+
var WITHDRAW_DISCRIMINATOR = Buffer.from([183, 18, 70, 156, 148, 109, 161, 34]);
|
|
66111
|
+
var COMPLETE_WITHDRAWAL_DISCRIMINATOR = Buffer.from([107, 98, 134, 131, 74, 120, 174, 121]);
|
|
66112
|
+
var encodeU64 = (amount) => amount.toArrayLike(Buffer, "le", 8);
|
|
66113
|
+
var meta = (pubkey, isSigner, isWritable) => ({
|
|
66114
|
+
pubkey,
|
|
66115
|
+
isSigner,
|
|
66116
|
+
isWritable
|
|
66117
|
+
});
|
|
66118
|
+
function makeGammaDepositIx(accounts, amount) {
|
|
66119
|
+
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
66120
|
+
const associatedTokenProgram = accounts.associatedTokenProgram ?? ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
66121
|
+
const keys = [
|
|
66122
|
+
meta(accounts.user, true, true),
|
|
66123
|
+
meta(accounts.lpVault, false, true),
|
|
66124
|
+
meta(accounts.withdrawalPolicy, false, true),
|
|
66125
|
+
meta(accounts.assetsAccount, false, true),
|
|
66126
|
+
meta(accounts.userAssetAta, false, true),
|
|
66127
|
+
meta(accounts.userShareAta, false, true),
|
|
66128
|
+
meta(accounts.depositReceipt, false, true),
|
|
66129
|
+
meta(accounts.assetsMint, false, false),
|
|
66130
|
+
meta(accounts.sharesMint, false, true),
|
|
66131
|
+
meta(web3_js.SystemProgram.programId, false, false),
|
|
66132
|
+
meta(tokenProgram, false, false),
|
|
66133
|
+
meta(associatedTokenProgram, false, false)
|
|
66134
|
+
];
|
|
66135
|
+
return new web3_js.TransactionInstruction({
|
|
66136
|
+
keys,
|
|
66137
|
+
programId: GAMMA_VAULT_PROGRAM_ID,
|
|
66138
|
+
data: Buffer.concat([DEPOSIT_DISCRIMINATOR, encodeU64(amount)])
|
|
66139
|
+
});
|
|
66140
|
+
}
|
|
66141
|
+
function makeGammaWithdrawIx(accounts, sharesAmount) {
|
|
66142
|
+
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
66143
|
+
const associatedTokenProgram = accounts.associatedTokenProgram ?? ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
66144
|
+
const keys = [
|
|
66145
|
+
meta(accounts.user, true, true),
|
|
66146
|
+
meta(accounts.lpVault, false, true),
|
|
66147
|
+
meta(accounts.withdrawalPolicy, false, true),
|
|
66148
|
+
meta(accounts.assetsAccount, false, true),
|
|
66149
|
+
meta(accounts.userShareAta, false, true),
|
|
66150
|
+
meta(accounts.assetsMint, false, false),
|
|
66151
|
+
meta(accounts.sharesMint, false, true),
|
|
66152
|
+
meta(accounts.feeRecipientAccount, false, true),
|
|
66153
|
+
meta(accounts.withdrawEscrow, false, true),
|
|
66154
|
+
meta(accounts.escrowAssetsAccount, false, true),
|
|
66155
|
+
meta(accounts.escrowSharesAccount, false, true),
|
|
66156
|
+
meta(accounts.withdrawReceipt, false, true),
|
|
66157
|
+
meta(web3_js.SystemProgram.programId, false, false),
|
|
66158
|
+
meta(tokenProgram, false, false),
|
|
66159
|
+
meta(associatedTokenProgram, false, false)
|
|
66160
|
+
];
|
|
66161
|
+
return new web3_js.TransactionInstruction({
|
|
66162
|
+
keys,
|
|
66163
|
+
programId: GAMMA_VAULT_PROGRAM_ID,
|
|
66164
|
+
data: Buffer.concat([WITHDRAW_DISCRIMINATOR, encodeU64(sharesAmount)])
|
|
66165
|
+
});
|
|
66166
|
+
}
|
|
66167
|
+
function makeGammaCompleteWithdrawalIx(accounts) {
|
|
66168
|
+
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
66169
|
+
const associatedTokenProgram = accounts.associatedTokenProgram ?? ASSOCIATED_TOKEN_PROGRAM_ID;
|
|
66170
|
+
const keys = [
|
|
66171
|
+
meta(accounts.user, true, true),
|
|
66172
|
+
meta(accounts.lpVault, false, false),
|
|
66173
|
+
meta(accounts.assetsMint, false, false),
|
|
66174
|
+
meta(accounts.sharesMint, false, true),
|
|
66175
|
+
meta(accounts.userAssetAta, false, true),
|
|
66176
|
+
meta(accounts.withdrawEscrow, false, true),
|
|
66177
|
+
meta(accounts.escrowAssetsAccount, false, true),
|
|
66178
|
+
meta(accounts.escrowSharesAccount, false, true),
|
|
66179
|
+
meta(accounts.withdrawReceipt, false, true),
|
|
66180
|
+
meta(web3_js.SystemProgram.programId, false, false),
|
|
66181
|
+
meta(tokenProgram, false, false),
|
|
66182
|
+
meta(associatedTokenProgram, false, false)
|
|
66183
|
+
];
|
|
66184
|
+
return new web3_js.TransactionInstruction({
|
|
66185
|
+
keys,
|
|
66186
|
+
programId: GAMMA_VAULT_PROGRAM_ID,
|
|
66187
|
+
data: COMPLETE_WITHDRAWAL_DISCRIMINATOR
|
|
66188
|
+
});
|
|
66189
|
+
}
|
|
66190
|
+
|
|
66191
|
+
// src/vendor/klend/utils/klend/interest-rate.utils.ts
|
|
66192
|
+
function getKaminoTotalSupply(reserve) {
|
|
66193
|
+
const liquidityAvailableAmount = new Decimal3__default.default(reserve.liquidity.availableAmount.toString());
|
|
66194
|
+
const borrowedAmount = new Fraction(reserve.liquidity.borrowedAmountSf).toDecimal();
|
|
66195
|
+
const accumulatedProtocolFee = new Fraction(
|
|
66196
|
+
reserve.liquidity.accumulatedProtocolFeesSf
|
|
66197
|
+
).toDecimal();
|
|
66198
|
+
const accumulatedReferrerFees = new Fraction(
|
|
66199
|
+
reserve.liquidity.accumulatedReferrerFeesSf
|
|
66200
|
+
).toDecimal();
|
|
66201
|
+
const pendingReferrerFees = new Fraction(reserve.liquidity.pendingReferrerFeesSf).toDecimal();
|
|
66202
|
+
return liquidityAvailableAmount.add(borrowedAmount).sub(accumulatedProtocolFee).sub(accumulatedReferrerFees).sub(pendingReferrerFees);
|
|
66203
|
+
}
|
|
66204
|
+
function scaledSupplies(state) {
|
|
66205
|
+
const liqMintDecimals = new Decimal3__default.default(state.liquidity.mintDecimals.toString());
|
|
66206
|
+
const totalSupplyLamports = getKaminoTotalSupply(state);
|
|
66207
|
+
const mintTotalSupplyLam = new Decimal3__default.default(state.collateral.mintTotalSupply.toString());
|
|
66208
|
+
const liqScale = new Decimal3__default.default(10).pow(liqMintDecimals);
|
|
66209
|
+
const collScale = new Decimal3__default.default(10).pow(liqMintDecimals);
|
|
66210
|
+
const totalSupply = totalSupplyLamports.div(liqScale);
|
|
66211
|
+
const totalCollateral = mintTotalSupplyLam.div(collScale);
|
|
66212
|
+
return [totalSupply, totalCollateral];
|
|
66213
|
+
}
|
|
66214
|
+
|
|
66215
|
+
// src/vendor/klend/utils/farms/serialize.utils.ts
|
|
66216
|
+
function kaminoFarmStateToDto(farmState) {
|
|
66217
|
+
return {
|
|
66218
|
+
token: {
|
|
66219
|
+
mint: farmState.token.mint.toBase58(),
|
|
66220
|
+
decimals: farmState.token.decimals.toString()
|
|
66221
|
+
},
|
|
66222
|
+
rewardInfos: farmState.rewardInfos.map((item) => ({
|
|
66223
|
+
token: {
|
|
66224
|
+
mint: item.token.mint.toBase58(),
|
|
66225
|
+
decimals: item.token.decimals.toString()
|
|
66226
|
+
},
|
|
66227
|
+
rewardsAvailable: item.rewardsAvailable.toString(),
|
|
66228
|
+
rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
|
|
66229
|
+
rewardScheduleCurve: {
|
|
66230
|
+
points: item.rewardScheduleCurve.points.map((p) => ({
|
|
66231
|
+
tsStart: p.tsStart.toString(),
|
|
66232
|
+
rewardPerTimeUnit: p.rewardPerTimeUnit.toString()
|
|
66233
|
+
}))
|
|
66234
|
+
}
|
|
66235
|
+
}))
|
|
66236
|
+
};
|
|
66237
|
+
}
|
|
66238
|
+
var farmDiscriminator = Buffer.from([198, 102, 216, 74, 63, 66, 163, 190]);
|
|
66239
|
+
var farmLayout = borsh.struct([
|
|
66240
|
+
borsh.publicKey("farmAdmin"),
|
|
66241
|
+
borsh.publicKey("globalConfig"),
|
|
66242
|
+
borsh.struct(
|
|
66243
|
+
[
|
|
66244
|
+
borsh.publicKey("mint"),
|
|
66245
|
+
borsh.u64("decimals"),
|
|
66246
|
+
borsh.publicKey("tokenProgram"),
|
|
66247
|
+
borsh.array(borsh.u64(), 6, "padding")
|
|
66248
|
+
],
|
|
66249
|
+
"token"
|
|
66250
|
+
),
|
|
66251
|
+
borsh.array(
|
|
66252
|
+
borsh.struct([
|
|
66253
|
+
borsh.struct(
|
|
66254
|
+
[
|
|
66255
|
+
borsh.publicKey("mint"),
|
|
66256
|
+
borsh.u64("decimals"),
|
|
66257
|
+
borsh.publicKey("tokenProgram"),
|
|
66258
|
+
borsh.array(borsh.u64(), 6, "padding")
|
|
66259
|
+
],
|
|
66260
|
+
"token"
|
|
66261
|
+
),
|
|
66262
|
+
borsh.publicKey("rewardsVault"),
|
|
66263
|
+
borsh.u64("rewardsAvailable"),
|
|
66264
|
+
borsh.struct(
|
|
66265
|
+
[
|
|
66266
|
+
borsh.array(
|
|
66267
|
+
borsh.struct([borsh.u64("tsStart"), borsh.u64("rewardPerTimeUnit")]),
|
|
66268
|
+
20,
|
|
66269
|
+
"points"
|
|
66270
|
+
)
|
|
66271
|
+
],
|
|
66272
|
+
"rewardScheduleCurve"
|
|
66273
|
+
),
|
|
66274
|
+
borsh.u64("minClaimDurationSeconds"),
|
|
66275
|
+
borsh.u64("lastIssuanceTs"),
|
|
66276
|
+
borsh.u64("rewardsIssuedUnclaimed"),
|
|
66277
|
+
borsh.u64("rewardsIssuedCumulative"),
|
|
66278
|
+
borsh.u128("rewardPerShareScaled"),
|
|
66279
|
+
borsh.u64("placeholder0"),
|
|
66280
|
+
borsh.u8("rewardType"),
|
|
66281
|
+
borsh.u8("rewardsPerSecondDecimals"),
|
|
66282
|
+
borsh.array(borsh.u8(), 6, "padding0"),
|
|
66283
|
+
borsh.array(borsh.u64(), 20, "padding1")
|
|
66284
|
+
]),
|
|
66285
|
+
10,
|
|
66286
|
+
"rewardInfos"
|
|
66287
|
+
),
|
|
66288
|
+
borsh.u64("numRewardTokens"),
|
|
66289
|
+
borsh.u64("numUsers"),
|
|
66290
|
+
borsh.u64("totalStakedAmount"),
|
|
66291
|
+
borsh.publicKey("farmVault"),
|
|
66292
|
+
borsh.publicKey("farmVaultsAuthority"),
|
|
66293
|
+
borsh.u64("farmVaultsAuthorityBump"),
|
|
66294
|
+
borsh.publicKey("delegateAuthority"),
|
|
66295
|
+
borsh.u8("timeUnit"),
|
|
66296
|
+
borsh.u8("isFarmFrozen"),
|
|
66297
|
+
borsh.u8("isFarmDelegated"),
|
|
66298
|
+
borsh.array(borsh.u8(), 5, "padding0"),
|
|
66299
|
+
borsh.publicKey("withdrawAuthority"),
|
|
66300
|
+
borsh.u32("depositWarmupPeriod"),
|
|
66301
|
+
borsh.u32("withdrawalCooldownPeriod"),
|
|
66302
|
+
borsh.u128("totalActiveStakeScaled"),
|
|
66303
|
+
borsh.u128("totalPendingStakeScaled"),
|
|
66304
|
+
borsh.u64("totalPendingAmount"),
|
|
66305
|
+
borsh.u64("slashedAmountCurrent"),
|
|
66306
|
+
borsh.u64("slashedAmountCumulative"),
|
|
66307
|
+
borsh.publicKey("slashedAmountSpillAddress"),
|
|
66308
|
+
borsh.u64("lockingMode"),
|
|
66309
|
+
borsh.u64("lockingStartTimestamp"),
|
|
66310
|
+
borsh.u64("lockingDuration"),
|
|
66311
|
+
borsh.u64("lockingEarlyWithdrawalPenaltyBps"),
|
|
66312
|
+
borsh.u64("depositCapAmount"),
|
|
66313
|
+
borsh.publicKey("scopePrices"),
|
|
66314
|
+
borsh.u64("scopeOraclePriceId"),
|
|
66315
|
+
borsh.u64("scopeOracleMaxAge"),
|
|
66316
|
+
borsh.publicKey("pendingFarmAdmin"),
|
|
66317
|
+
borsh.publicKey("strategyId"),
|
|
66318
|
+
borsh.publicKey("delegatedRpsAdmin"),
|
|
66319
|
+
borsh.publicKey("vaultId"),
|
|
66320
|
+
borsh.publicKey("secondDelegatedAuthority"),
|
|
66321
|
+
borsh.array(borsh.u64(), 74, "padding")
|
|
66322
|
+
]);
|
|
66323
|
+
function decodeFarmDataRaw(data) {
|
|
66324
|
+
if (!data.slice(0, 8).equals(farmDiscriminator)) {
|
|
66325
|
+
throw new Error("invalid account discriminator");
|
|
66326
|
+
}
|
|
66327
|
+
const dec = farmLayout.decode(data.slice(8));
|
|
66328
|
+
return dec;
|
|
66329
|
+
}
|
|
66330
|
+
function dtoToKaminoFarmState(dto) {
|
|
66331
|
+
return {
|
|
66332
|
+
token: {
|
|
66333
|
+
mint: new web3_js.PublicKey(dto.token.mint),
|
|
66334
|
+
decimals: new BN9__default.default(dto.token.decimals)
|
|
66335
|
+
},
|
|
66336
|
+
rewardInfos: dto.rewardInfos.map((item) => ({
|
|
66337
|
+
token: {
|
|
66338
|
+
mint: new web3_js.PublicKey(item.token.mint),
|
|
66339
|
+
decimals: new BN9__default.default(item.token.decimals)
|
|
66340
|
+
},
|
|
66341
|
+
rewardsAvailable: new BN9__default.default(item.rewardsAvailable),
|
|
66342
|
+
rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
|
|
66343
|
+
rewardScheduleCurve: {
|
|
66344
|
+
points: item.rewardScheduleCurve.points.map((p) => ({
|
|
66345
|
+
tsStart: new BN9__default.default(p.tsStart),
|
|
66346
|
+
rewardPerTimeUnit: new BN9__default.default(p.rewardPerTimeUnit)
|
|
66347
|
+
}))
|
|
66348
|
+
}
|
|
66349
|
+
}))
|
|
66350
|
+
};
|
|
66351
|
+
}
|
|
66352
|
+
var KAMINO_PROGRAM_ID = new web3_js.PublicKey("KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD");
|
|
66353
|
+
var FARMS_PROGRAM_ID2 = new web3_js.PublicKey("FarmsPZpWu9i7Kky8tPN37rs2TpmMrAZrC7S7vJa91Hr");
|
|
66354
|
+
function encodeU642(value) {
|
|
66355
|
+
const buf = Buffer.alloc(8);
|
|
66356
|
+
value.toArrayLike(Buffer, "le", 8).copy(buf);
|
|
66357
|
+
return buf;
|
|
66358
|
+
}
|
|
66359
|
+
function encodeU8(value) {
|
|
66360
|
+
const buf = Buffer.alloc(1);
|
|
66361
|
+
buf.writeUInt8(value, 0);
|
|
66362
|
+
return buf;
|
|
66363
|
+
}
|
|
66364
|
+
function encodeBool(value) {
|
|
66365
|
+
const buf = Buffer.alloc(1);
|
|
66366
|
+
buf.writeUInt8(value ? 1 : 0, 0);
|
|
66367
|
+
return buf;
|
|
66368
|
+
}
|
|
66369
|
+
function encodeOptionBool(value) {
|
|
66370
|
+
if (value === null || value === void 0) {
|
|
66371
|
+
return Buffer.from([0]);
|
|
66372
|
+
}
|
|
66373
|
+
return Buffer.concat([Buffer.from([1]), encodeBool(value)]);
|
|
66374
|
+
}
|
|
66375
|
+
function encodeOptionU8(value) {
|
|
66376
|
+
if (value === null || value === void 0) {
|
|
66377
|
+
return Buffer.from([0]);
|
|
66378
|
+
}
|
|
66379
|
+
return Buffer.concat([Buffer.from([1]), encodeU8(value)]);
|
|
66380
|
+
}
|
|
66381
|
+
function encodePublicKey(pubkey) {
|
|
66382
|
+
return Buffer.from(pubkey.toBytes());
|
|
66383
|
+
}
|
|
66384
|
+
var DISCRIMINATORS = {
|
|
66385
|
+
MARGINFI_ACCOUNT_INITIALIZE: Buffer.from([43, 78, 61, 255, 148, 52, 249, 154]),
|
|
66386
|
+
KAMINO_DEPOSIT: Buffer.from([237, 8, 188, 187, 115, 99, 49, 85]),
|
|
66387
|
+
LENDING_ACCOUNT_DEPOSIT: Buffer.from([171, 94, 235, 103, 82, 64, 212, 140]),
|
|
66388
|
+
LENDING_ACCOUNT_REPAY: Buffer.from([79, 209, 172, 177, 222, 51, 173, 151]),
|
|
66389
|
+
KAMINO_WITHDRAW: Buffer.from([199, 101, 41, 45, 213, 98, 224, 200]),
|
|
66390
|
+
LENDING_ACCOUNT_WITHDRAW: Buffer.from([36, 72, 74, 19, 210, 210, 192, 192]),
|
|
66391
|
+
LENDING_ACCOUNT_BORROW: Buffer.from([4, 126, 116, 53, 48, 5, 212, 31]),
|
|
66392
|
+
LENDING_ACCOUNT_LIQUIDATE: Buffer.from([214, 169, 151, 213, 251, 167, 86, 219]),
|
|
66393
|
+
LENDING_POOL_ADD_BANK: Buffer.from([215, 68, 72, 78, 208, 218, 103, 182]),
|
|
66394
|
+
LENDING_POOL_CONFIGURE_BANK: Buffer.from([121, 173, 156, 40, 93, 148, 56, 237]),
|
|
66395
|
+
LENDING_ACCOUNT_START_FLASHLOAN: Buffer.from([14, 131, 33, 220, 81, 186, 180, 107]),
|
|
66396
|
+
LENDING_ACCOUNT_END_FLASHLOAN: Buffer.from([105, 124, 201, 106, 153, 2, 8, 156]),
|
|
66397
|
+
TRANSFER_TO_NEW_ACCOUNT: Buffer.from([28, 79, 129, 231, 169, 69, 69, 65]),
|
|
66398
|
+
MARGINFI_GROUP_INITIALIZE: Buffer.from([255, 67, 67, 26, 94, 31, 34, 20]),
|
|
66399
|
+
MARGINFI_ACCOUNT_CLOSE: Buffer.from([186, 221, 93, 34, 50, 97, 194, 241]),
|
|
66400
|
+
LENDING_POOL_ADD_BANK_PERMISSIONLESS: Buffer.from([127, 187, 121, 34, 187, 167, 238, 102]),
|
|
66401
|
+
LENDING_POOL_CONFIGURE_BANK_ORACLE: Buffer.from([209, 82, 255, 171, 124, 21, 71, 81]),
|
|
66402
|
+
LENDING_ACCOUNT_PULSE_HEALTH: Buffer.from([186, 52, 117, 97, 34, 74, 39, 253]),
|
|
66403
|
+
LENDING_ACCOUNT_SORT_BALANCES: Buffer.from([187, 194, 110, 84, 82, 170, 204, 9]),
|
|
66404
|
+
DRIFT_DEPOSIT: Buffer.from([252, 63, 250, 201, 98, 55, 130, 12]),
|
|
66405
|
+
DRIFT_WITHDRAW: Buffer.from([86, 59, 186, 123, 183, 181, 234, 137])
|
|
66406
|
+
};
|
|
66407
|
+
function makeInitMarginfiAccountIx2(programId, accounts) {
|
|
66408
|
+
const keys = [
|
|
66409
|
+
{ pubkey: accounts.marginfiGroup, isSigner: false, isWritable: false },
|
|
66410
|
+
{ pubkey: accounts.marginfiAccount, isSigner: true, isWritable: true },
|
|
66411
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
66412
|
+
{ pubkey: accounts.feePayer, isSigner: true, isWritable: true },
|
|
66413
|
+
{
|
|
66414
|
+
pubkey: accounts.systemProgram || web3_js.SystemProgram.programId,
|
|
66415
|
+
isSigner: false,
|
|
66416
|
+
isWritable: false
|
|
66417
|
+
}
|
|
66418
|
+
];
|
|
66419
|
+
return new web3_js.TransactionInstruction({
|
|
66420
|
+
keys,
|
|
66421
|
+
programId,
|
|
66422
|
+
data: DISCRIMINATORS.MARGINFI_ACCOUNT_INITIALIZE
|
|
66423
|
+
});
|
|
66424
|
+
}
|
|
66425
|
+
function makeDepositIx2(programId, accounts, args, remainingAccounts = []) {
|
|
66426
|
+
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
66427
|
+
const keys = [
|
|
66428
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
66429
|
+
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
66430
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
66431
|
+
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
66432
|
+
{ pubkey: accounts.signerTokenAccount, isSigner: false, isWritable: true },
|
|
66433
|
+
{
|
|
66434
|
+
pubkey: accounts.liquidityVault ?? liquidityVault,
|
|
66435
|
+
isSigner: false,
|
|
66436
|
+
isWritable: true
|
|
66437
|
+
},
|
|
66438
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
66439
|
+
];
|
|
66440
|
+
keys.push(...remainingAccounts);
|
|
66441
|
+
const data = Buffer.concat([
|
|
66442
|
+
DISCRIMINATORS.LENDING_ACCOUNT_DEPOSIT,
|
|
66443
|
+
encodeU642(args.amount),
|
|
66444
|
+
encodeOptionBool(args.depositUpToLimit ?? null)
|
|
66445
|
+
]);
|
|
66446
|
+
return new web3_js.TransactionInstruction({
|
|
66447
|
+
keys,
|
|
66448
|
+
programId,
|
|
66449
|
+
data
|
|
66450
|
+
});
|
|
66451
|
+
}
|
|
66452
|
+
function makeRepayIx2(programId, accounts, args, remainingAccounts = []) {
|
|
66453
|
+
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
66454
|
+
const keys = [
|
|
66455
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
66456
|
+
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
66457
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
66458
|
+
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
66459
|
+
{ pubkey: accounts.signerTokenAccount, isSigner: false, isWritable: true },
|
|
66460
|
+
{ pubkey: liquidityVault, isSigner: false, isWritable: true },
|
|
66461
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
66462
|
+
];
|
|
66463
|
+
keys.push(...remainingAccounts);
|
|
66464
|
+
const data = Buffer.concat([
|
|
66465
|
+
DISCRIMINATORS.LENDING_ACCOUNT_REPAY,
|
|
66466
|
+
encodeU642(args.amount),
|
|
66467
|
+
encodeOptionBool(args.repayAll ?? null)
|
|
66468
|
+
]);
|
|
66469
|
+
return new web3_js.TransactionInstruction({
|
|
66470
|
+
keys,
|
|
66471
|
+
programId,
|
|
66472
|
+
data
|
|
66473
|
+
});
|
|
66474
|
+
}
|
|
66475
|
+
function makeWithdrawIx2(programId, accounts, args, remainingAccounts = []) {
|
|
66476
|
+
const [bankLiquidityVaultAuthority] = deriveBankLiquidityVaultAuthority(programId, accounts.bank);
|
|
66477
|
+
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
66478
|
+
const keys = [
|
|
66479
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
66480
|
+
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
66481
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
66482
|
+
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
66483
|
+
{
|
|
66484
|
+
pubkey: accounts.destinationTokenAccount,
|
|
66485
|
+
isSigner: false,
|
|
66486
|
+
isWritable: true
|
|
66487
|
+
},
|
|
66488
|
+
{ pubkey: bankLiquidityVaultAuthority, isSigner: false, isWritable: false },
|
|
66489
|
+
{ pubkey: liquidityVault, isSigner: false, isWritable: true },
|
|
66490
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
66491
|
+
];
|
|
66492
|
+
keys.push(...remainingAccounts);
|
|
66493
|
+
const data = Buffer.concat([
|
|
66494
|
+
DISCRIMINATORS.LENDING_ACCOUNT_WITHDRAW,
|
|
66495
|
+
encodeU642(args.amount),
|
|
66496
|
+
encodeOptionBool(args.withdrawAll ?? null)
|
|
66497
|
+
]);
|
|
66498
|
+
return new web3_js.TransactionInstruction({
|
|
66499
|
+
keys,
|
|
66500
|
+
programId,
|
|
66501
|
+
data
|
|
66502
|
+
});
|
|
66503
|
+
}
|
|
66504
|
+
function makeBorrowIx2(programId, accounts, args, remainingAccounts = []) {
|
|
66505
|
+
const [bankLiquidityVaultAuthority] = deriveBankLiquidityVaultAuthority(programId, accounts.bank);
|
|
66506
|
+
const [liquidityVault] = deriveBankLiquidityVault(programId, accounts.bank);
|
|
66507
|
+
const keys = [
|
|
66508
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
66509
|
+
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
66510
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
66511
|
+
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
66512
|
+
{
|
|
66513
|
+
pubkey: accounts.destinationTokenAccount,
|
|
66514
|
+
isSigner: false,
|
|
66515
|
+
isWritable: true
|
|
66516
|
+
},
|
|
66517
|
+
{ pubkey: bankLiquidityVaultAuthority, isSigner: false, isWritable: false },
|
|
66518
|
+
{ pubkey: liquidityVault, isSigner: false, isWritable: true },
|
|
66519
|
+
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }
|
|
66520
|
+
];
|
|
66521
|
+
keys.push(...remainingAccounts);
|
|
66522
|
+
const data = Buffer.concat([DISCRIMINATORS.LENDING_ACCOUNT_BORROW, encodeU642(args.amount)]);
|
|
66523
|
+
return new web3_js.TransactionInstruction({
|
|
66524
|
+
keys,
|
|
66525
|
+
programId,
|
|
66526
|
+
data
|
|
66527
|
+
});
|
|
66528
|
+
}
|
|
66529
|
+
function makeBeginFlashLoanIx2(programId, accounts, args) {
|
|
66530
|
+
const keys = [
|
|
66531
|
+
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
66532
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
66533
|
+
{
|
|
66534
|
+
pubkey: web3_js.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
66535
|
+
// hardcoded address from IDL
|
|
66536
|
+
isSigner: false,
|
|
66537
|
+
isWritable: false
|
|
66538
|
+
}
|
|
66539
|
+
];
|
|
66540
|
+
const data = Buffer.concat([
|
|
66541
|
+
DISCRIMINATORS.LENDING_ACCOUNT_START_FLASHLOAN,
|
|
66542
|
+
encodeU642(args.endIndex)
|
|
66543
|
+
]);
|
|
66544
|
+
return new web3_js.TransactionInstruction({
|
|
66545
|
+
keys,
|
|
66546
|
+
programId,
|
|
66547
|
+
data
|
|
66548
|
+
});
|
|
66549
|
+
}
|
|
66550
|
+
function makeEndFlashLoanIx2(programId, accounts, remainingAccounts = []) {
|
|
66551
|
+
const keys = [
|
|
66552
|
+
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
66553
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false }
|
|
66554
|
+
];
|
|
66555
|
+
keys.push(...remainingAccounts);
|
|
66556
|
+
return new web3_js.TransactionInstruction({
|
|
66557
|
+
keys,
|
|
66558
|
+
programId,
|
|
66559
|
+
data: DISCRIMINATORS.LENDING_ACCOUNT_END_FLASHLOAN
|
|
66560
|
+
});
|
|
66561
|
+
}
|
|
66562
|
+
function makeKaminoDepositIx2(programId, accounts, args, remainingAccounts = []) {
|
|
66563
|
+
const liquidityVaultAuthority = deriveBankLiquidityVaultAuthority(programId, accounts.bank)[0];
|
|
66564
|
+
const liquidityVault = deriveBankLiquidityVault(programId, accounts.bank)[0];
|
|
66565
|
+
const keys = [
|
|
66566
|
+
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
66567
|
+
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
66568
|
+
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
|
|
66569
|
+
{ pubkey: accounts.bank, isSigner: false, isWritable: true },
|
|
66570
|
+
{ pubkey: accounts.signerTokenAccount, isSigner: false, isWritable: true },
|
|
66571
|
+
{
|
|
66572
|
+
pubkey: liquidityVaultAuthority,
|
|
66573
|
+
isSigner: false,
|
|
66574
|
+
isWritable: true
|
|
66575
|
+
},
|
|
66576
|
+
{ pubkey: liquidityVault, isSigner: false, isWritable: true },
|
|
66577
|
+
{ pubkey: accounts.integrationAcc2, isSigner: false, isWritable: true },
|
|
66578
|
+
{ pubkey: accounts.lendingMarket, isSigner: false, isWritable: false },
|
|
66579
|
+
{
|
|
66580
|
+
pubkey: accounts.lendingMarketAuthority,
|
|
66581
|
+
isSigner: false,
|
|
66582
|
+
isWritable: false
|
|
66583
|
+
},
|
|
66584
|
+
{ pubkey: accounts.integrationAcc1, isSigner: false, isWritable: true },
|
|
66585
|
+
{ pubkey: accounts.mint, isSigner: false, isWritable: false },
|
|
66586
|
+
{
|
|
66587
|
+
pubkey: accounts.reserveLiquiditySupply,
|
|
66588
|
+
isSigner: false,
|
|
66589
|
+
isWritable: true
|
|
66590
|
+
},
|
|
66591
|
+
{
|
|
66592
|
+
pubkey: accounts.reserveCollateralMint,
|
|
66593
|
+
isSigner: false,
|
|
66594
|
+
isWritable: true
|
|
66595
|
+
},
|
|
66596
|
+
{
|
|
66597
|
+
pubkey: accounts.reserveDestinationDepositCollateral,
|
|
66598
|
+
isSigner: false,
|
|
66599
|
+
isWritable: true
|
|
66600
|
+
}
|
|
66601
|
+
];
|
|
66602
|
+
if (accounts.obligationFarmUserState) {
|
|
66603
|
+
keys.push({
|
|
66604
|
+
pubkey: accounts.obligationFarmUserState,
|
|
66605
|
+
isSigner: false,
|
|
66606
|
+
isWritable: true
|
|
66607
|
+
});
|
|
66608
|
+
}
|
|
66609
|
+
if (accounts.reserveFarmState) {
|
|
66610
|
+
keys.push({
|
|
66611
|
+
pubkey: accounts.reserveFarmState,
|
|
66612
|
+
isSigner: false,
|
|
66613
|
+
isWritable: true
|
|
63228
66614
|
});
|
|
63229
66615
|
}
|
|
63230
66616
|
keys.push(
|
|
@@ -63241,7 +66627,7 @@ function makeKaminoDepositIx2(programId, accounts, args, remainingAccounts = [])
|
|
|
63241
66627
|
keys.push(...remainingAccounts);
|
|
63242
66628
|
const data = Buffer.concat([
|
|
63243
66629
|
DISCRIMINATORS.KAMINO_DEPOSIT,
|
|
63244
|
-
|
|
66630
|
+
encodeU642(args.amount),
|
|
63245
66631
|
encodeOptionBool(args.refreshReserve ?? null)
|
|
63246
66632
|
]);
|
|
63247
66633
|
return new web3_js.TransactionInstruction({ keys, programId, data });
|
|
@@ -63319,7 +66705,7 @@ function makeKaminoWithdrawIx2(programId, accounts, args, remainingAccounts = []
|
|
|
63319
66705
|
const flags = (args.isFinalWithdrawal ? 1 : 0) | (args.refreshReserve ? 2 : 0);
|
|
63320
66706
|
const data = Buffer.concat([
|
|
63321
66707
|
DISCRIMINATORS.KAMINO_WITHDRAW,
|
|
63322
|
-
|
|
66708
|
+
encodeU642(args.amount),
|
|
63323
66709
|
encodeOptionU8(flags === 0 ? null : flags)
|
|
63324
66710
|
]);
|
|
63325
66711
|
return new web3_js.TransactionInstruction({ keys, programId, data });
|
|
@@ -63352,7 +66738,7 @@ function makeLendingAccountLiquidateIx2(programId, accounts, args, remainingAcco
|
|
|
63352
66738
|
keys.push(...remainingAccounts);
|
|
63353
66739
|
const data = Buffer.concat([
|
|
63354
66740
|
DISCRIMINATORS.LENDING_ACCOUNT_LIQUIDATE,
|
|
63355
|
-
|
|
66741
|
+
encodeU642(args.assetAmount),
|
|
63356
66742
|
Buffer.from([args.liquidateeAccounts]),
|
|
63357
66743
|
Buffer.from([args.liquidatorAccounts])
|
|
63358
66744
|
]);
|
|
@@ -63510,7 +66896,7 @@ function makeDriftDepositIx2(programId, accounts, args) {
|
|
|
63510
66896
|
{ pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
|
|
63511
66897
|
{ pubkey: accounts.systemProgram, isSigner: false, isWritable: false }
|
|
63512
66898
|
);
|
|
63513
|
-
const data = Buffer.concat([DISCRIMINATORS.DRIFT_DEPOSIT,
|
|
66899
|
+
const data = Buffer.concat([DISCRIMINATORS.DRIFT_DEPOSIT, encodeU642(args.amount)]);
|
|
63514
66900
|
return new web3_js.TransactionInstruction({ keys, programId, data });
|
|
63515
66901
|
}
|
|
63516
66902
|
function makeDriftWithdrawIx2(programId, accounts, args, remainingAccounts = []) {
|
|
@@ -63596,7 +66982,7 @@ function makeDriftWithdrawIx2(programId, accounts, args, remainingAccounts = [])
|
|
|
63596
66982
|
keys.push(...remainingAccounts);
|
|
63597
66983
|
const data = Buffer.concat([
|
|
63598
66984
|
DISCRIMINATORS.DRIFT_WITHDRAW,
|
|
63599
|
-
|
|
66985
|
+
encodeU642(args.amount),
|
|
63600
66986
|
encodeBool(args.withdrawAll)
|
|
63601
66987
|
]);
|
|
63602
66988
|
return new web3_js.TransactionInstruction({ keys, programId, data });
|
|
@@ -63636,7 +67022,7 @@ function makePoolAddPermissionlessStakedBankIx2(programId, accounts, remainingAc
|
|
|
63636
67022
|
keys.push(...remainingAccounts);
|
|
63637
67023
|
const data = Buffer.concat([
|
|
63638
67024
|
DISCRIMINATORS.LENDING_POOL_ADD_BANK_PERMISSIONLESS,
|
|
63639
|
-
|
|
67025
|
+
encodeU642(args.seed || new BN9__default.default(0))
|
|
63640
67026
|
]);
|
|
63641
67027
|
return new web3_js.TransactionInstruction({
|
|
63642
67028
|
keys,
|
|
@@ -66681,14 +70067,14 @@ function computeV0TxSize(ixs, payerKey, luts) {
|
|
|
66681
70067
|
if (!keyMap.has(progStr)) {
|
|
66682
70068
|
keyMap.set(progStr, { isSigner: false, isWritable: false });
|
|
66683
70069
|
}
|
|
66684
|
-
for (const
|
|
66685
|
-
const keyStr =
|
|
70070
|
+
for (const meta2 of ix.keys) {
|
|
70071
|
+
const keyStr = meta2.pubkey.toBase58();
|
|
66686
70072
|
const existing = keyMap.get(keyStr);
|
|
66687
70073
|
if (existing) {
|
|
66688
|
-
existing.isSigner = existing.isSigner ||
|
|
66689
|
-
existing.isWritable = existing.isWritable ||
|
|
70074
|
+
existing.isSigner = existing.isSigner || meta2.isSigner;
|
|
70075
|
+
existing.isWritable = existing.isWritable || meta2.isWritable;
|
|
66690
70076
|
} else {
|
|
66691
|
-
keyMap.set(keyStr, { isSigner:
|
|
70077
|
+
keyMap.set(keyStr, { isSigner: meta2.isSigner, isWritable: meta2.isWritable });
|
|
66692
70078
|
}
|
|
66693
70079
|
}
|
|
66694
70080
|
}
|
|
@@ -70724,6 +74110,13 @@ async function computeSmartCrank({
|
|
|
70724
74110
|
isCrankable: true
|
|
70725
74111
|
});
|
|
70726
74112
|
}
|
|
74113
|
+
const activeEmodeWeightsByBank = computeLowestEmodeWeights(
|
|
74114
|
+
computeActiveEmodePairs(
|
|
74115
|
+
getEmodePairs(Array.from(bankMap.values())),
|
|
74116
|
+
liabilityBalances.map((b) => b.bankPk),
|
|
74117
|
+
assetBalances.map((b) => b.bankPk)
|
|
74118
|
+
)
|
|
74119
|
+
);
|
|
70727
74120
|
const getBanks = (balances) => balances.map((b) => bankMap.get(b.bankPk.toBase58())).filter((bank) => bank !== void 0);
|
|
70728
74121
|
const projectedAssetBanks = getBanks(assetBalances);
|
|
70729
74122
|
const liabilityBanks = getBanks(liabilityBalances);
|
|
@@ -70808,7 +74201,8 @@ async function computeSmartCrank({
|
|
|
70808
74201
|
oraclePricesByBank: oraclePrices,
|
|
70809
74202
|
assetBanks: nonSWBAssets.map((b) => b.address),
|
|
70810
74203
|
marginRequirement: 0 /* Initial */,
|
|
70811
|
-
assetShareValueMultiplierByBank
|
|
74204
|
+
assetShareValueMultiplierByBank,
|
|
74205
|
+
activeEmodeWeightsByBank
|
|
70812
74206
|
});
|
|
70813
74207
|
const healthDiff = nonSWBAssetsHealth.minus(totalLiabilitiesInitHealth);
|
|
70814
74208
|
if (healthDiff.gt(0)) {
|
|
@@ -70848,7 +74242,8 @@ async function computeSmartCrank({
|
|
|
70848
74242
|
oraclePricesByBank: oraclePrices,
|
|
70849
74243
|
assetBanks: allAvailableAssetAddresses,
|
|
70850
74244
|
marginRequirement: 0 /* Initial */,
|
|
70851
|
-
assetShareValueMultiplierByBank
|
|
74245
|
+
assetShareValueMultiplierByBank,
|
|
74246
|
+
activeEmodeWeightsByBank
|
|
70852
74247
|
});
|
|
70853
74248
|
const healthWithAllAssets = allAssetsHealth.minus(totalLiabilitiesInitHealth);
|
|
70854
74249
|
if (!healthWithAllAssets.gt(0)) {
|
|
@@ -70885,7 +74280,8 @@ async function computeSmartCrank({
|
|
|
70885
74280
|
oraclePricesByBank: oraclePrices,
|
|
70886
74281
|
assetBanks: [...nonSWBAssetAddresses, ...comboAddresses],
|
|
70887
74282
|
marginRequirement: 0 /* Initial */,
|
|
70888
|
-
assetShareValueMultiplierByBank
|
|
74283
|
+
assetShareValueMultiplierByBank,
|
|
74284
|
+
activeEmodeWeightsByBank
|
|
70889
74285
|
});
|
|
70890
74286
|
const health = comboHealth.minus(totalLiabilitiesInitHealth);
|
|
70891
74287
|
if (!health.gt(0)) continue;
|
|
@@ -73311,6 +76707,274 @@ async function makeMergeStakeAccountsTx(params) {
|
|
|
73311
76707
|
type: "MERGE_STAKE_ACCOUNTS" /* MERGE_STAKE_ACCOUNTS */
|
|
73312
76708
|
});
|
|
73313
76709
|
}
|
|
76710
|
+
|
|
76711
|
+
// src/services/vaults/utils/fetch.utils.ts
|
|
76712
|
+
async function fetchGammaLpVault(connection, lpVault) {
|
|
76713
|
+
const info = await connection.getAccountInfo(lpVault);
|
|
76714
|
+
if (!info) {
|
|
76715
|
+
throw new Error(`Gamma LpVault account not found: ${lpVault.toBase58()}`);
|
|
76716
|
+
}
|
|
76717
|
+
return decodeGammaLpVaultData(info.data, lpVault);
|
|
76718
|
+
}
|
|
76719
|
+
async function fetchGammaWithdrawReceipt(connection, user, lpVault) {
|
|
76720
|
+
const [receipt] = deriveGammaWithdrawReceipt(user, lpVault);
|
|
76721
|
+
const info = await connection.getAccountInfo(receipt);
|
|
76722
|
+
if (!info) return null;
|
|
76723
|
+
return decodeGammaWithdrawReceiptData(info.data, receipt);
|
|
76724
|
+
}
|
|
76725
|
+
async function resolveVaultTokenProgram(connection, assetsMint) {
|
|
76726
|
+
const info = await connection.getAccountInfo(assetsMint);
|
|
76727
|
+
if (info && info.owner.equals(TOKEN_2022_PROGRAM_ID)) {
|
|
76728
|
+
return TOKEN_2022_PROGRAM_ID;
|
|
76729
|
+
}
|
|
76730
|
+
return TOKEN_PROGRAM_ID;
|
|
76731
|
+
}
|
|
76732
|
+
async function makeVaultDepositIx(params) {
|
|
76733
|
+
const { amount, user, lpVault, connection } = params;
|
|
76734
|
+
const vault = await fetchGammaLpVault(connection, lpVault);
|
|
76735
|
+
const tokenProgram = params.tokenProgram ?? await resolveVaultTokenProgram(connection, vault.assetsMint);
|
|
76736
|
+
const [withdrawalPolicy] = deriveGammaWithdrawalPolicy(lpVault);
|
|
76737
|
+
const [depositReceipt] = deriveGammaDepositReceipt(user, lpVault);
|
|
76738
|
+
const userAssetAta = deriveGammaAta(vault.assetsMint, user, tokenProgram);
|
|
76739
|
+
const userShareAta = deriveGammaAta(vault.sharesMint, user, tokenProgram);
|
|
76740
|
+
const amountNative = new BN9__default.default(new BigNumber3__default.default(amount).toFixed(0));
|
|
76741
|
+
const wrapIxs = vault.assetsMint.equals(WSOL_MINT) ? makeWrapSolIxs(user, new BigNumber3__default.default(amountNative.toString()).shiftedBy(-9)) : [];
|
|
76742
|
+
const createShareAtaIx = createAssociatedTokenAccountIdempotentInstruction(
|
|
76743
|
+
user,
|
|
76744
|
+
userShareAta,
|
|
76745
|
+
user,
|
|
76746
|
+
vault.sharesMint,
|
|
76747
|
+
tokenProgram
|
|
76748
|
+
);
|
|
76749
|
+
const ix = makeGammaDepositIx(
|
|
76750
|
+
{
|
|
76751
|
+
user,
|
|
76752
|
+
lpVault,
|
|
76753
|
+
withdrawalPolicy,
|
|
76754
|
+
assetsAccount: vault.assetsAccount,
|
|
76755
|
+
userAssetAta,
|
|
76756
|
+
userShareAta,
|
|
76757
|
+
depositReceipt,
|
|
76758
|
+
assetsMint: vault.assetsMint,
|
|
76759
|
+
sharesMint: vault.sharesMint,
|
|
76760
|
+
tokenProgram
|
|
76761
|
+
},
|
|
76762
|
+
amountNative
|
|
76763
|
+
);
|
|
76764
|
+
const instructions2 = [
|
|
76765
|
+
...wrapIxs,
|
|
76766
|
+
createShareAtaIx,
|
|
76767
|
+
ix
|
|
76768
|
+
];
|
|
76769
|
+
return { instructions: instructions2, keys: [] };
|
|
76770
|
+
}
|
|
76771
|
+
async function makeVaultDepositTx(params) {
|
|
76772
|
+
const { connection, user, luts, blockhash: providedBlockhash } = params;
|
|
76773
|
+
const { instructions: instructions2, keys } = await makeVaultDepositIx(params);
|
|
76774
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
76775
|
+
const message = new web3_js.TransactionMessage({
|
|
76776
|
+
payerKey: user,
|
|
76777
|
+
recentBlockhash: blockhash,
|
|
76778
|
+
instructions: instructions2
|
|
76779
|
+
}).compileToV0Message(luts);
|
|
76780
|
+
const tx = new web3_js.VersionedTransaction(message);
|
|
76781
|
+
return addTransactionMetadata(tx, {
|
|
76782
|
+
signers: keys,
|
|
76783
|
+
addressLookupTables: luts,
|
|
76784
|
+
type: "VAULT_DEPOSIT" /* VAULT_DEPOSIT */
|
|
76785
|
+
});
|
|
76786
|
+
}
|
|
76787
|
+
async function makeVaultDepositWithSwapTx(params) {
|
|
76788
|
+
const {
|
|
76789
|
+
user,
|
|
76790
|
+
lpVault,
|
|
76791
|
+
connection,
|
|
76792
|
+
inputMint,
|
|
76793
|
+
inputAmount,
|
|
76794
|
+
inputDecimals,
|
|
76795
|
+
swapOpts,
|
|
76796
|
+
swapEngineRunner,
|
|
76797
|
+
luts,
|
|
76798
|
+
blockhash: providedBlockhash
|
|
76799
|
+
} = params;
|
|
76800
|
+
const vault = await fetchGammaLpVault(connection, lpVault);
|
|
76801
|
+
const mintInfo = await connection.getAccountInfo(vault.assetsMint);
|
|
76802
|
+
if (!mintInfo) {
|
|
76803
|
+
throw new Error(`Vault asset mint not found: ${vault.assetsMint.toBase58()}`);
|
|
76804
|
+
}
|
|
76805
|
+
const tokenProgram = params.tokenProgram ?? (mintInfo.owner.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID);
|
|
76806
|
+
const assetDecimals = mintInfo.data[44];
|
|
76807
|
+
const [withdrawalPolicy] = deriveGammaWithdrawalPolicy(lpVault);
|
|
76808
|
+
const [depositReceipt] = deriveGammaDepositReceipt(user, lpVault);
|
|
76809
|
+
const userAssetAta = deriveGammaAta(vault.assetsMint, user, tokenProgram);
|
|
76810
|
+
const userShareAta = deriveGammaAta(vault.sharesMint, user, tokenProgram);
|
|
76811
|
+
const createShareAtaIx = createAssociatedTokenAccountIdempotentInstruction(
|
|
76812
|
+
user,
|
|
76813
|
+
userShareAta,
|
|
76814
|
+
user,
|
|
76815
|
+
vault.sharesMint,
|
|
76816
|
+
tokenProgram
|
|
76817
|
+
);
|
|
76818
|
+
const depositAccounts = {
|
|
76819
|
+
user,
|
|
76820
|
+
lpVault,
|
|
76821
|
+
withdrawalPolicy,
|
|
76822
|
+
assetsAccount: vault.assetsAccount,
|
|
76823
|
+
userAssetAta,
|
|
76824
|
+
userShareAta,
|
|
76825
|
+
depositReceipt,
|
|
76826
|
+
assetsMint: vault.assetsMint,
|
|
76827
|
+
sharesMint: vault.sharesMint,
|
|
76828
|
+
tokenProgram
|
|
76829
|
+
};
|
|
76830
|
+
const inputAmountBn = new BigNumber3__default.default(inputAmount);
|
|
76831
|
+
const isNativeSol = new web3_js.PublicKey(inputMint).equals(WSOL_MINT);
|
|
76832
|
+
const wrapIxs = isNativeSol ? makeWrapSolIxs(user, inputAmountBn) : [];
|
|
76833
|
+
const amountNative = uiToNative(inputAmountBn, inputDecimals);
|
|
76834
|
+
const placeholderDepositIx = makeGammaDepositIx(depositAccounts, new BN9__default.default(0));
|
|
76835
|
+
const runEngine = swapEngineRunner ?? runSwapEngine;
|
|
76836
|
+
const engineResult = await runEngine({
|
|
76837
|
+
inputMint,
|
|
76838
|
+
outputMint: vault.assetsMint.toBase58(),
|
|
76839
|
+
amountNative: amountNative.toNumber(),
|
|
76840
|
+
inputDecimals,
|
|
76841
|
+
outputDecimals: assetDecimals,
|
|
76842
|
+
...swapEngineQuoteFieldsFromOpts(swapOpts),
|
|
76843
|
+
taker: user,
|
|
76844
|
+
destinationTokenAccount: userAssetAta,
|
|
76845
|
+
connection,
|
|
76846
|
+
footprint: {
|
|
76847
|
+
instructions: [...wrapIxs, createShareAtaIx, placeholderDepositIx],
|
|
76848
|
+
luts: luts ?? [],
|
|
76849
|
+
payer: user,
|
|
76850
|
+
// Non-flashloan single tx: the swap may use the full tx budget.
|
|
76851
|
+
sizeConstraint: MAX_TX_SIZE,
|
|
76852
|
+
maxSwapTotalAccounts: MAX_ACCOUNT_LOCKS
|
|
76853
|
+
},
|
|
76854
|
+
providers: swapEngineProvidersFromOpts(swapOpts)
|
|
76855
|
+
});
|
|
76856
|
+
const depositIx = makeGammaDepositIx(
|
|
76857
|
+
depositAccounts,
|
|
76858
|
+
engineResult.outputAmountNative
|
|
76859
|
+
);
|
|
76860
|
+
const instructions2 = [
|
|
76861
|
+
...wrapIxs,
|
|
76862
|
+
createShareAtaIx,
|
|
76863
|
+
...engineResult.setupInstructions,
|
|
76864
|
+
...engineResult.swapInstructions,
|
|
76865
|
+
depositIx
|
|
76866
|
+
];
|
|
76867
|
+
const allLuts = [...luts ?? [], ...engineResult.swapLuts];
|
|
76868
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
76869
|
+
const message = new web3_js.TransactionMessage({
|
|
76870
|
+
payerKey: user,
|
|
76871
|
+
recentBlockhash: blockhash,
|
|
76872
|
+
instructions: instructions2
|
|
76873
|
+
}).compileToV0Message(allLuts);
|
|
76874
|
+
const tx = new web3_js.VersionedTransaction(message);
|
|
76875
|
+
if (getTxSize(tx) > MAX_TX_SIZE || getTotalAccountKeys(tx) > MAX_ACCOUNT_LOCKS) {
|
|
76876
|
+
throw new Error(
|
|
76877
|
+
"vault deposit-with-swap: swap route too large to fit in one transaction"
|
|
76878
|
+
);
|
|
76879
|
+
}
|
|
76880
|
+
return {
|
|
76881
|
+
transaction: addTransactionMetadata(tx, {
|
|
76882
|
+
signers: [],
|
|
76883
|
+
addressLookupTables: allLuts,
|
|
76884
|
+
type: "VAULT_DEPOSIT" /* VAULT_DEPOSIT */
|
|
76885
|
+
}),
|
|
76886
|
+
quoteResponse: engineResult.quoteResponse,
|
|
76887
|
+
destinationAmount: nativeToUi(engineResult.outputAmountNative, assetDecimals)
|
|
76888
|
+
};
|
|
76889
|
+
}
|
|
76890
|
+
async function makeVaultWithdrawIx(params) {
|
|
76891
|
+
const { sharesAmount, user, lpVault, connection } = params;
|
|
76892
|
+
const vault = await fetchGammaLpVault(connection, lpVault);
|
|
76893
|
+
const tokenProgram = params.tokenProgram ?? await resolveVaultTokenProgram(connection, vault.assetsMint);
|
|
76894
|
+
const [withdrawalPolicy] = deriveGammaWithdrawalPolicy(lpVault);
|
|
76895
|
+
const [withdrawEscrow] = deriveGammaWithdrawEscrow(user, lpVault);
|
|
76896
|
+
const [withdrawReceipt] = deriveGammaWithdrawReceipt(user, lpVault);
|
|
76897
|
+
const userShareAta = deriveGammaAta(vault.sharesMint, user, tokenProgram);
|
|
76898
|
+
const feeRecipientAccount = deriveGammaAta(vault.assetsMint, vault.feeRecipient, tokenProgram);
|
|
76899
|
+
const escrowAssetsAccount = deriveGammaAta(vault.assetsMint, withdrawEscrow, tokenProgram);
|
|
76900
|
+
const escrowSharesAccount = deriveGammaAta(vault.sharesMint, withdrawEscrow, tokenProgram);
|
|
76901
|
+
const sharesNative = new BN9__default.default(new BigNumber3__default.default(sharesAmount).toFixed(0));
|
|
76902
|
+
const ix = makeGammaWithdrawIx(
|
|
76903
|
+
{
|
|
76904
|
+
user,
|
|
76905
|
+
lpVault,
|
|
76906
|
+
withdrawalPolicy,
|
|
76907
|
+
assetsAccount: vault.assetsAccount,
|
|
76908
|
+
userShareAta,
|
|
76909
|
+
assetsMint: vault.assetsMint,
|
|
76910
|
+
sharesMint: vault.sharesMint,
|
|
76911
|
+
feeRecipientAccount,
|
|
76912
|
+
withdrawEscrow,
|
|
76913
|
+
escrowAssetsAccount,
|
|
76914
|
+
escrowSharesAccount,
|
|
76915
|
+
withdrawReceipt,
|
|
76916
|
+
tokenProgram
|
|
76917
|
+
},
|
|
76918
|
+
sharesNative
|
|
76919
|
+
);
|
|
76920
|
+
const instructions2 = [ix];
|
|
76921
|
+
return { instructions: instructions2, keys: [] };
|
|
76922
|
+
}
|
|
76923
|
+
async function makeVaultWithdrawTx(params) {
|
|
76924
|
+
const { connection, user, luts, blockhash: providedBlockhash } = params;
|
|
76925
|
+
const { instructions: instructions2, keys } = await makeVaultWithdrawIx(params);
|
|
76926
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
76927
|
+
const message = new web3_js.TransactionMessage({
|
|
76928
|
+
payerKey: user,
|
|
76929
|
+
recentBlockhash: blockhash,
|
|
76930
|
+
instructions: instructions2
|
|
76931
|
+
}).compileToV0Message(luts);
|
|
76932
|
+
const tx = new web3_js.VersionedTransaction(message);
|
|
76933
|
+
return addTransactionMetadata(tx, {
|
|
76934
|
+
signers: keys,
|
|
76935
|
+
addressLookupTables: luts,
|
|
76936
|
+
type: "VAULT_WITHDRAW" /* VAULT_WITHDRAW */
|
|
76937
|
+
});
|
|
76938
|
+
}
|
|
76939
|
+
async function makeVaultCompleteWithdrawalIx(params) {
|
|
76940
|
+
const { user, lpVault, connection } = params;
|
|
76941
|
+
const vault = await fetchGammaLpVault(connection, lpVault);
|
|
76942
|
+
const tokenProgram = params.tokenProgram ?? await resolveVaultTokenProgram(connection, vault.assetsMint);
|
|
76943
|
+
const [withdrawEscrow] = deriveGammaWithdrawEscrow(user, lpVault);
|
|
76944
|
+
const [withdrawReceipt] = deriveGammaWithdrawReceipt(user, lpVault);
|
|
76945
|
+
const userAssetAta = deriveGammaAta(vault.assetsMint, user, tokenProgram);
|
|
76946
|
+
const escrowAssetsAccount = deriveGammaAta(vault.assetsMint, withdrawEscrow, tokenProgram);
|
|
76947
|
+
const escrowSharesAccount = deriveGammaAta(vault.sharesMint, withdrawEscrow, tokenProgram);
|
|
76948
|
+
const ix = makeGammaCompleteWithdrawalIx({
|
|
76949
|
+
user,
|
|
76950
|
+
lpVault,
|
|
76951
|
+
assetsMint: vault.assetsMint,
|
|
76952
|
+
sharesMint: vault.sharesMint,
|
|
76953
|
+
userAssetAta,
|
|
76954
|
+
withdrawEscrow,
|
|
76955
|
+
escrowAssetsAccount,
|
|
76956
|
+
escrowSharesAccount,
|
|
76957
|
+
withdrawReceipt,
|
|
76958
|
+
tokenProgram
|
|
76959
|
+
});
|
|
76960
|
+
return { instructions: [ix], keys: [] };
|
|
76961
|
+
}
|
|
76962
|
+
async function makeVaultCompleteWithdrawalTx(params) {
|
|
76963
|
+
const { connection, user, luts, blockhash: providedBlockhash } = params;
|
|
76964
|
+
const { instructions: instructions2, keys } = await makeVaultCompleteWithdrawalIx(params);
|
|
76965
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
76966
|
+
const message = new web3_js.TransactionMessage({
|
|
76967
|
+
payerKey: user,
|
|
76968
|
+
recentBlockhash: blockhash,
|
|
76969
|
+
instructions: instructions2
|
|
76970
|
+
}).compileToV0Message(luts);
|
|
76971
|
+
const tx = new web3_js.VersionedTransaction(message);
|
|
76972
|
+
return addTransactionMetadata(tx, {
|
|
76973
|
+
signers: keys,
|
|
76974
|
+
addressLookupTables: luts,
|
|
76975
|
+
type: "VAULT_COMPLETE_WITHDRAWAL" /* VAULT_COMPLETE_WITHDRAWAL */
|
|
76976
|
+
});
|
|
76977
|
+
}
|
|
73314
76978
|
async function getKaminoMetadata(options) {
|
|
73315
76979
|
const kaminoBanks = options.banks.filter((b) => b.config.assetTag === 3 /* KAMINO */);
|
|
73316
76980
|
const DEFAULT_PUBKEY = web3_js.PublicKey.default;
|
|
@@ -75366,6 +79030,8 @@ exports.emodeSettingsRawToDto = emodeSettingsRawToDto;
|
|
|
75366
79030
|
exports.extractPythOracleKeys = extractPythOracleKeys;
|
|
75367
79031
|
exports.fetchBank = fetchBank;
|
|
75368
79032
|
exports.fetchBankIntegrationMetadata = fetchBankIntegrationMetadata;
|
|
79033
|
+
exports.fetchGammaLpVault = fetchGammaLpVault;
|
|
79034
|
+
exports.fetchGammaWithdrawReceipt = fetchGammaWithdrawReceipt;
|
|
75369
79035
|
exports.fetchMarginfiAccountActiveBalancesForBank = fetchMarginfiAccountActiveBalancesForBank;
|
|
75370
79036
|
exports.fetchMarginfiAccountAddresses = fetchMarginfiAccountAddresses;
|
|
75371
79037
|
exports.fetchMarginfiAccountAddressesHoldingBank = fetchMarginfiAccountAddressesHoldingBank;
|
|
@@ -75507,6 +79173,13 @@ exports.makeUnwrapSolIx = makeUnwrapSolIx;
|
|
|
75507
79173
|
exports.makeUpdateDriftMarketIxs = makeUpdateDriftMarketIxs;
|
|
75508
79174
|
exports.makeUpdateJupLendRateIxs = makeUpdateJupLendRateIxs;
|
|
75509
79175
|
exports.makeUpdateSwbFeedIx = makeUpdateSwbFeedIx;
|
|
79176
|
+
exports.makeVaultCompleteWithdrawalIx = makeVaultCompleteWithdrawalIx;
|
|
79177
|
+
exports.makeVaultCompleteWithdrawalTx = makeVaultCompleteWithdrawalTx;
|
|
79178
|
+
exports.makeVaultDepositIx = makeVaultDepositIx;
|
|
79179
|
+
exports.makeVaultDepositTx = makeVaultDepositTx;
|
|
79180
|
+
exports.makeVaultDepositWithSwapTx = makeVaultDepositWithSwapTx;
|
|
79181
|
+
exports.makeVaultWithdrawIx = makeVaultWithdrawIx;
|
|
79182
|
+
exports.makeVaultWithdrawTx = makeVaultWithdrawTx;
|
|
75510
79183
|
exports.makeVersionedTransaction = makeVersionedTransaction;
|
|
75511
79184
|
exports.makeWithdrawIx = makeWithdrawIx3;
|
|
75512
79185
|
exports.makeWithdrawTx = makeWithdrawTx;
|
|
@@ -75539,6 +79212,7 @@ exports.partitionBanksByCrankability = partitionBanksByCrankability;
|
|
|
75539
79212
|
exports.patchDepositAmount = patchDepositAmount;
|
|
75540
79213
|
exports.resolveAmount = resolveAmount;
|
|
75541
79214
|
exports.resolveBridgeBanks = resolveBridgeBanks;
|
|
79215
|
+
exports.resolveVaultTokenProgram = resolveVaultTokenProgram;
|
|
75542
79216
|
exports.runSwapEngine = runSwapEngine;
|
|
75543
79217
|
exports.selectLutsForAccountAction = selectLutsForAccountAction;
|
|
75544
79218
|
exports.selectLutsForBanks = selectLutsForBanks;
|