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