@coffer_so/sdk 1.0.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/LICENSE +21 -0
- package/README.md +283 -0
- package/dist/clients/AdminClient.d.ts +194 -0
- package/dist/clients/AdminClient.d.ts.map +1 -0
- package/dist/clients/AdminClient.js +482 -0
- package/dist/clients/AdminClient.js.map +1 -0
- package/dist/clients/CofferBackendClient.d.ts +877 -0
- package/dist/clients/CofferBackendClient.d.ts.map +1 -0
- package/dist/clients/CofferBackendClient.js +536 -0
- package/dist/clients/CofferBackendClient.js.map +1 -0
- package/dist/clients/CubeBackendClient.d.ts +877 -0
- package/dist/clients/CubeBackendClient.d.ts.map +1 -0
- package/dist/clients/CubeBackendClient.js +536 -0
- package/dist/clients/CubeBackendClient.js.map +1 -0
- package/dist/clients/CubicPoolClient.d.ts +120 -0
- package/dist/clients/CubicPoolClient.d.ts.map +1 -0
- package/dist/clients/CubicPoolClient.js +687 -0
- package/dist/clients/CubicPoolClient.js.map +1 -0
- package/dist/clients/PoolFactoryClient.d.ts +53 -0
- package/dist/clients/PoolFactoryClient.d.ts.map +1 -0
- package/dist/clients/PoolFactoryClient.js +91 -0
- package/dist/clients/PoolFactoryClient.js.map +1 -0
- package/dist/clients/RpcClient.d.ts +49 -0
- package/dist/clients/RpcClient.d.ts.map +1 -0
- package/dist/clients/RpcClient.js +135 -0
- package/dist/clients/RpcClient.js.map +1 -0
- package/dist/clients/SingleTokenDepositClient.d.ts +67 -0
- package/dist/clients/SingleTokenDepositClient.d.ts.map +1 -0
- package/dist/clients/SingleTokenDepositClient.js +105 -0
- package/dist/clients/SingleTokenDepositClient.js.map +1 -0
- package/dist/clients/contract-instructions.d.ts +24 -0
- package/dist/clients/contract-instructions.d.ts.map +1 -0
- package/dist/clients/contract-instructions.js +130 -0
- package/dist/clients/contract-instructions.js.map +1 -0
- package/dist/clients/index.d.ts +10 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +26 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/quote-math.d.ts +15 -0
- package/dist/clients/quote-math.d.ts.map +1 -0
- package/dist/clients/quote-math.js +98 -0
- package/dist/clients/quote-math.js.map +1 -0
- package/dist/clients/tx-builders.d.ts +231 -0
- package/dist/clients/tx-builders.d.ts.map +1 -0
- package/dist/clients/tx-builders.js +861 -0
- package/dist/clients/tx-builders.js.map +1 -0
- package/dist/clients/versioned.d.ts +34 -0
- package/dist/clients/versioned.d.ts.map +1 -0
- package/dist/clients/versioned.js +55 -0
- package/dist/clients/versioned.js.map +1 -0
- package/dist/config/index.d.ts +65 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +75 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/networks.d.ts +12 -0
- package/dist/config/networks.d.ts.map +1 -0
- package/dist/config/networks.js +51 -0
- package/dist/config/networks.js.map +1 -0
- package/dist/config/tokens.d.ts +19 -0
- package/dist/config/tokens.d.ts.map +1 -0
- package/dist/config/tokens.js +43 -0
- package/dist/config/tokens.js.map +1 -0
- package/dist/idl/cubic_pool.json +4203 -0
- package/dist/idl/index.d.ts +1769 -0
- package/dist/idl/index.d.ts.map +1 -0
- package/dist/idl/index.js +18 -0
- package/dist/idl/index.js.map +1 -0
- package/dist/idl/protocol_admin.json +2615 -0
- package/dist/idl/single_token_liquidity.json +1121 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +206 -0
- package/dist/index.js.map +1 -0
- package/dist/math/cubicMath.d.ts +40 -0
- package/dist/math/cubicMath.d.ts.map +1 -0
- package/dist/math/cubicMath.js +82 -0
- package/dist/math/cubicMath.js.map +1 -0
- package/dist/math/fixedPoint.d.ts +19 -0
- package/dist/math/fixedPoint.d.ts.map +1 -0
- package/dist/math/fixedPoint.js +86 -0
- package/dist/math/fixedPoint.js.map +1 -0
- package/dist/math/index.d.ts +9 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math/index.js +30 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/logExp.d.ts +6 -0
- package/dist/math/logExp.d.ts.map +1 -0
- package/dist/math/logExp.js +68 -0
- package/dist/math/logExp.js.map +1 -0
- package/dist/math/lpLoss.d.ts +44 -0
- package/dist/math/lpLoss.d.ts.map +1 -0
- package/dist/math/lpLoss.js +103 -0
- package/dist/math/lpLoss.js.map +1 -0
- package/dist/math/maxSelloff.d.ts +164 -0
- package/dist/math/maxSelloff.d.ts.map +1 -0
- package/dist/math/maxSelloff.js +397 -0
- package/dist/math/maxSelloff.js.map +1 -0
- package/dist/math/singleToken.d.ts +54 -0
- package/dist/math/singleToken.d.ts.map +1 -0
- package/dist/math/singleToken.js +188 -0
- package/dist/math/singleToken.js.map +1 -0
- package/dist/math/slippage.d.ts +13 -0
- package/dist/math/slippage.d.ts.map +1 -0
- package/dist/math/slippage.js +44 -0
- package/dist/math/slippage.js.map +1 -0
- package/dist/math/surgeFee.d.ts +24 -0
- package/dist/math/surgeFee.d.ts.map +1 -0
- package/dist/math/surgeFee.js +85 -0
- package/dist/math/surgeFee.js.map +1 -0
- package/dist/math/weightedMath.d.ts +20 -0
- package/dist/math/weightedMath.d.ts.map +1 -0
- package/dist/math/weightedMath.js +66 -0
- package/dist/math/weightedMath.js.map +1 -0
- package/dist/parsers/borsh.d.ts +28 -0
- package/dist/parsers/borsh.d.ts.map +1 -0
- package/dist/parsers/borsh.js +104 -0
- package/dist/parsers/borsh.js.map +1 -0
- package/dist/parsers/contracts.d.ts +26 -0
- package/dist/parsers/contracts.d.ts.map +1 -0
- package/dist/parsers/contracts.js +62 -0
- package/dist/parsers/contracts.js.map +1 -0
- package/dist/parsers/events.d.ts +3 -0
- package/dist/parsers/events.d.ts.map +1 -0
- package/dist/parsers/events.js +281 -0
- package/dist/parsers/events.js.map +1 -0
- package/dist/parsers/index.d.ts +6 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +22 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/mintAccount.d.ts +24 -0
- package/dist/parsers/mintAccount.d.ts.map +1 -0
- package/dist/parsers/mintAccount.js +27 -0
- package/dist/parsers/mintAccount.js.map +1 -0
- package/dist/parsers/poolAccount.d.ts +141 -0
- package/dist/parsers/poolAccount.d.ts.map +1 -0
- package/dist/parsers/poolAccount.js +224 -0
- package/dist/parsers/poolAccount.js.map +1 -0
- package/dist/types/contracts.d.ts +1340 -0
- package/dist/types/contracts.d.ts.map +1 -0
- package/dist/types/contracts.js +3 -0
- package/dist/types/contracts.js.map +1 -0
- package/dist/types/events.d.ts +172 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +3 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +22 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/pool.d.ts +149 -0
- package/dist/types/pool.d.ts.map +1 -0
- package/dist/types/pool.js +3 -0
- package/dist/types/pool.js.map +1 -0
- package/dist/types/result.d.ts +24 -0
- package/dist/types/result.d.ts.map +1 -0
- package/dist/types/result.js +11 -0
- package/dist/types/result.js.map +1 -0
- package/dist/types/tx.d.ts +261 -0
- package/dist/types/tx.d.ts.map +1 -0
- package/dist/types/tx.js +3 -0
- package/dist/types/tx.js.map +1 -0
- package/dist/utils/errors.d.ts +44 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +192 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/extensions.d.ts +98 -0
- package/dist/utils/extensions.d.ts.map +1 -0
- package/dist/utils/extensions.js +187 -0
- package/dist/utils/extensions.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/pda.d.ts +8 -0
- package/dist/utils/pda.d.ts.map +1 -0
- package/dist/utils/pda.js +27 -0
- package/dist/utils/pda.js.map +1 -0
- package/dist/utils/retry.d.ts +22 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +62 -0
- package/dist/utils/retry.js.map +1 -0
- package/package.json +54 -0
- package/src/clients/AdminClient.ts +608 -0
- package/src/clients/CofferBackendClient.ts +1413 -0
- package/src/clients/CubicPoolClient.ts +719 -0
- package/src/clients/PoolFactoryClient.ts +110 -0
- package/src/clients/RpcClient.ts +195 -0
- package/src/clients/SingleTokenDepositClient.ts +143 -0
- package/src/clients/contract-instructions.ts +115 -0
- package/src/clients/index.ts +9 -0
- package/src/clients/quote-math.ts +81 -0
- package/src/clients/tx-builders.ts +1096 -0
- package/src/clients/versioned.ts +80 -0
- package/src/config/index.ts +111 -0
- package/src/config/networks.ts +71 -0
- package/src/config/tokens.ts +52 -0
- package/src/idl/cubic_pool.json +4203 -0
- package/src/idl/index.ts +13 -0
- package/src/idl/protocol_admin.json +2615 -0
- package/src/idl/single_token_liquidity.json +1121 -0
- package/src/index.ts +262 -0
- package/src/math/cubicMath.ts +92 -0
- package/src/math/fixedPoint.ts +71 -0
- package/src/math/index.ts +13 -0
- package/src/math/logExp.ts +61 -0
- package/src/math/lpLoss.ts +160 -0
- package/src/math/maxSelloff.ts +564 -0
- package/src/math/singleToken.ts +251 -0
- package/src/math/slippage.ts +38 -0
- package/src/math/surgeFee.ts +101 -0
- package/src/math/weightedMath.ts +64 -0
- package/src/parsers/borsh.ts +106 -0
- package/src/parsers/contracts.ts +64 -0
- package/src/parsers/events.ts +275 -0
- package/src/parsers/index.ts +5 -0
- package/src/parsers/mintAccount.ts +44 -0
- package/src/parsers/poolAccount.ts +372 -0
- package/src/types/contracts.ts +238 -0
- package/src/types/events.ts +198 -0
- package/src/types/index.ts +5 -0
- package/src/types/pool.ts +147 -0
- package/src/types/result.ts +51 -0
- package/src/types/tx.ts +278 -0
- package/src/utils/errors.ts +210 -0
- package/src/utils/extensions.ts +196 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/pda.ts +58 -0
- package/src/utils/retry.ts +85 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// Generated from src/idl/*.json by scripts/generate-contract-types.cjs. Do not edit.
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
import { PublicKey } from "@solana/web3.js";
|
|
4
|
+
|
|
5
|
+
export interface ContractTypes {
|
|
6
|
+
"cubicPool": {
|
|
7
|
+
"AssetConfig": { "mint": PublicKey; "token_program": PublicKey; "normalized_weight": BN; "max_selloff_pct": number; "max_selloff_period_length": number; "variable_fee_threshold_pct": number; "variable_fee_slope_low_pct": number; "variable_fee_slope_high_pct": number; "is_active": boolean; "variable_fee_slope_mid_pct": number; "variable_fee_kink_pct": number };
|
|
8
|
+
"AssetDynamics": { "virtual_balance": BN; "actual_balance": BN; "protocol_fees_owed": BN; "previous_selloff": BN; "current_selloff": BN; "window_start_timestamp": BN; "selloff_vb_snapshot": BN };
|
|
9
|
+
"BannedExtensionsUpdated": { "config": PublicKey; "authority": PublicKey; "old_value": BN; "new_value": BN; "timestamp": BN; "old_hard_value": BN; "new_hard_value": BN };
|
|
10
|
+
"ConfigInitialized": { "config": PublicKey; "protocol_admin": PublicKey; "default_protocol_fee_rate": number; "banned_extensions": BN; "payer": PublicKey; "timestamp": BN };
|
|
11
|
+
"CubicPool": { "config": PublicKey; "bump": number; "token_count": number; "pool_id": BN; "swap_fee_rate": number; "protocol_fee_rate": number; "created_at": BN; "pool_enabled": boolean; "swaps_enabled": boolean; "pool_admin": PublicKey; "pending_pool_admin": PublicKey; "range_manager": PublicKey; "range_manager_enabled": boolean; "range_manager_max_vb_change_pct": number; "range_manager_max_weight_change_pct": number; "range_manager_min_update_interval_secs": number; "range_manager_last_updated": BN; "tokens": Array<ContractTypes["cubicPool"]["TokenSlot"]>; "lookup_table": PublicKey; "banned_extensions": BN; "range_manager_max_leverage_bps": number; "range_manager_min_leverage_bps": number; "reserved": Array<number> };
|
|
12
|
+
"CubicPoolConfig": { "protocol_admin": PublicKey; "pending_protocol_admin": PublicKey; "default_protocol_fee_rate": number; "banned_extensions": BN; "hard_banned_extensions": BN; "reserved": Array<number> };
|
|
13
|
+
"DebugLiquidityWithdrawn": { "pool": PublicKey; "authority": PublicKey; "token_amounts": Array<BN>; "timestamp": BN };
|
|
14
|
+
"LiquidityAdded": { "pool": PublicKey; "user": PublicKey; "token_amounts": Array<BN>; "bpt_amount": BN; "timestamp": BN };
|
|
15
|
+
"LiquidityRemoved": { "pool": PublicKey; "user": PublicKey; "bpt_amount": BN; "token_amounts": Array<BN>; "timestamp": BN };
|
|
16
|
+
"MaxSelloffSet": { "pool": PublicKey; "authority": PublicKey; "max_selloff_pct": Array<number>; "max_selloff_period_length": Array<number>; "fee_threshold_pct": Array<number>; "fee_slope_low_pct": Array<number>; "fee_slope_high_pct": Array<number>; "timestamp": BN; "old_max_selloff_pct": Array<number>; "old_max_selloff_period_length": Array<number>; "old_fee_threshold_pct": Array<number>; "old_fee_slope_low_pct": Array<number>; "old_fee_slope_high_pct": Array<number> };
|
|
17
|
+
"MaxSelloffWindowAdvanced": { "pool": PublicKey; "token_index": number; "effective_selloff": BN; "max_selloff_cap": BN; "vb_snapshot": BN; "previous_selloff": BN; "current_selloff": BN; "window_start_timestamp": BN; "timestamp": BN };
|
|
18
|
+
"PoolAdminDisabled": { "pool": PublicKey; "old_admin": PublicKey; "timestamp": BN };
|
|
19
|
+
"PoolAdminTransferCancelled": { "pool": PublicKey; "admin": PublicKey; "cancelled_pending": PublicKey; "timestamp": BN };
|
|
20
|
+
"PoolAdminTransferInitiated": { "pool": PublicKey; "current_admin": PublicKey; "pending_admin": PublicKey; "timestamp": BN };
|
|
21
|
+
"PoolAdminTransferred": { "pool": PublicKey; "old_admin": PublicKey; "new_admin": PublicKey; "timestamp": BN };
|
|
22
|
+
"PoolAltInitialized": { "pool": PublicKey; "lookup_table": PublicKey; "authority": PublicKey; "address_count": number; "timestamp": BN };
|
|
23
|
+
"PoolEnabledUpdated": { "pool": PublicKey; "authority": PublicKey; "old_value": boolean; "new_value": boolean; "timestamp": BN };
|
|
24
|
+
"PoolInfo": { "pool": PublicKey; "config": PublicKey; "bpt_mint": PublicKey; "token_count": number; "pool_id": BN; "tokens": Array<PublicKey>; "token_vaults": Array<PublicKey>; "normalized_weights": Array<BN>; "virtual_balances": Array<BN>; "actual_balances": Array<BN>; "protocol_fees_owed": Array<BN>; "swap_fee_rate": number; "protocol_fee_rate": number; "pool_enabled": boolean; "swaps_enabled": boolean; "token_programs": Array<PublicKey>; "timestamp": BN };
|
|
25
|
+
"PoolInitialized": { "pool": PublicKey; "config": PublicKey; "token_count": number; "bpt_mint": PublicKey; "timestamp": BN; "banned_extensions": BN };
|
|
26
|
+
"PoolMigratedToV5": { "pool": PublicKey; "authority": PublicKey; "token_count": number; "reactivated": number; "timestamp": BN };
|
|
27
|
+
"PoolSolWithdrawn": { "source": PublicKey; "authority": PublicKey; "recipient": PublicKey; "amount": BN; "timestamp": BN };
|
|
28
|
+
"PoolStateLog": { "pool": PublicKey; "virtual_balances": Array<BN>; "actual_balances": Array<BN>; "protocol_fees_owed": Array<BN>; "timestamp": BN };
|
|
29
|
+
"ProtocolAdminTransferCancelled": { "config": PublicKey; "admin": PublicKey; "cancelled_pending": PublicKey; "timestamp": BN };
|
|
30
|
+
"ProtocolAdminTransferInitiated": { "config": PublicKey; "current_admin": PublicKey; "pending_admin": PublicKey; "timestamp": BN };
|
|
31
|
+
"ProtocolAdminTransferred": { "config": PublicKey; "old_admin": PublicKey; "new_admin": PublicKey; "timestamp": BN };
|
|
32
|
+
"ProtocolFeeRateUpdated": { "pool": PublicKey; "old_rate": number; "new_rate": number; "timestamp": BN; "authority": PublicKey };
|
|
33
|
+
"ProtocolFeesCollected": { "pool": PublicKey; "authority": PublicKey; "token_amounts": Array<BN>; "timestamp": BN };
|
|
34
|
+
"RangeManagerConfigSet": { "pool": PublicKey; "authority": PublicKey; "max_vb_change_pct": number; "max_weight_change_pct": number; "min_update_interval_secs": number; "timestamp": BN; "old_max_vb_change_pct": number; "old_max_weight_change_pct": number; "old_min_update_interval_secs": number; "old_max_leverage_bps": number; "new_max_leverage_bps": number };
|
|
35
|
+
"RangeManagerSet": { "pool": PublicKey; "authority": PublicKey; "old_manager": PublicKey; "new_manager": PublicKey; "enabled": boolean; "timestamp": BN; "old_enabled": boolean; "new_enabled": boolean };
|
|
36
|
+
"RangeManagerUpdated": { "pool": PublicKey; "manager": PublicKey; "vb_indices": Buffer; "vb_new_values": Array<BN>; "weight_indices": Buffer; "weight_new_values": Array<BN>; "timestamp": BN };
|
|
37
|
+
"SelloffParams": { "max_selloff_pct": number; "period_length": number; "fee_threshold_pct": number; "fee_slope_low_pct": number; "fee_slope_high_pct": number; "fee_slope_mid_pct": number; "fee_kink_pct": number };
|
|
38
|
+
"Swap": { "pool": PublicKey; "user": PublicKey; "token_in": PublicKey; "token_out": PublicKey; "amount_in": BN; "amount_out": BN; "fee_amount": BN; "protocol_fee_amount": BN; "timestamp": BN; "surge_fee_amount": BN };
|
|
39
|
+
"SwapFeeRateUpdated": { "pool": PublicKey; "old_rate": number; "new_rate": number; "timestamp": BN; "authority": PublicKey };
|
|
40
|
+
"SwapsEnabledUpdated": { "pool": PublicKey; "authority": PublicKey; "old_value": boolean; "new_value": boolean; "timestamp": BN };
|
|
41
|
+
"TokenActiveSet": { "pool": PublicKey; "authority": PublicKey; "token_index": number; "old_value": boolean; "new_value": boolean; "timestamp": BN };
|
|
42
|
+
"TokenChange": { "index": number; "expected_current": BN; "new_value": BN };
|
|
43
|
+
"TokenSlot": { "config": ContractTypes["cubicPool"]["AssetConfig"]; "dynamics": ContractTypes["cubicPool"]["AssetDynamics"] };
|
|
44
|
+
};
|
|
45
|
+
"protocolAdmin": {
|
|
46
|
+
"AdminTransferCancelled": { "treasury": PublicKey; "admin": PublicKey; "cancelled_pending": PublicKey; "timestamp": BN };
|
|
47
|
+
"AdminTransferInitiated": { "treasury": PublicKey; "current_admin": PublicKey; "pending_admin": PublicKey; "timestamp": BN };
|
|
48
|
+
"AdminTransferred": { "treasury": PublicKey; "old_admin": PublicKey; "new_admin": PublicKey; "timestamp": BN };
|
|
49
|
+
"FundsWithdrawn": { "treasury": PublicKey; "admin": PublicKey; "mint": PublicKey; "recipient": PublicKey; "amount": BN; "timestamp": BN };
|
|
50
|
+
"PoolAltInitializedByTreasury": { "treasury": PublicKey; "pool": PublicKey; "lookup_table": PublicKey; "admin": PublicKey; "timestamp": BN };
|
|
51
|
+
"PoolBannedExtensionsSet": { "treasury": PublicKey; "config": PublicKey; "banned_extensions": BN; "timestamp": BN; "old_banned_extensions": BN; "new_banned_extensions": BN; "admin": PublicKey };
|
|
52
|
+
"PoolConfigInitialized": { "treasury": PublicKey; "config": PublicKey; "default_protocol_fee_rate": number; "timestamp": BN };
|
|
53
|
+
"PoolDebugWithdrawn": { "treasury": PublicKey; "pool": PublicKey; "timestamp": BN };
|
|
54
|
+
"PoolEnabledSet": { "treasury": PublicKey; "pool": PublicKey; "enabled": boolean; "timestamp": BN; "old_enabled": boolean; "new_enabled": boolean; "admin": PublicKey };
|
|
55
|
+
"PoolFeesCollected": { "treasury": PublicKey; "pool": PublicKey; "timestamp": BN };
|
|
56
|
+
"PoolProtocolAdminTransferAccepted": { "treasury": PublicKey; "config": PublicKey; "timestamp": BN };
|
|
57
|
+
"PoolProtocolAdminTransferCancelled": { "treasury": PublicKey; "config": PublicKey; "timestamp": BN };
|
|
58
|
+
"PoolProtocolAdminTransferInitiated": { "treasury": PublicKey; "config": PublicKey; "new_admin": PublicKey; "timestamp": BN };
|
|
59
|
+
"PoolProtocolFeeRateSet": { "treasury": PublicKey; "pool": PublicKey; "protocol_fee_rate": number; "timestamp": BN; "old_rate": number; "new_rate": number; "admin": PublicKey };
|
|
60
|
+
"PoolSolWithdrawnViaTreasury": { "treasury": PublicKey; "admin": PublicKey; "source": PublicKey; "recipient": PublicKey; "amount": BN; "timestamp": BN };
|
|
61
|
+
"PoolSwapsEnabledSet": { "treasury": PublicKey; "pool": PublicKey; "enabled": boolean; "timestamp": BN; "old_enabled": boolean; "new_enabled": boolean; "admin": PublicKey };
|
|
62
|
+
"PoolTokenActiveSet": { "treasury": PublicKey; "pool": PublicKey; "authority": PublicKey; "token_index": number; "is_active": boolean; "timestamp": BN; "old_is_active": boolean; "new_is_active": boolean };
|
|
63
|
+
"PoolsFrozen": { "treasury": PublicKey; "authority": PublicKey; "pool_count": number; "timestamp": BN; "pools": Array<PublicKey>; "old_enabled": Array<boolean> };
|
|
64
|
+
"PoolsUnfrozen": { "treasury": PublicKey; "authority": PublicKey; "pool_count": number; "timestamp": BN; "pools": Array<PublicKey>; "old_enabled": Array<boolean> };
|
|
65
|
+
"ProgramClosed": { "treasury": PublicKey; "program": PublicKey; "recipient": PublicKey; "timestamp": BN };
|
|
66
|
+
"ProgramFrozen": { "treasury": PublicKey; "programdata": PublicKey; "timestamp": BN };
|
|
67
|
+
"ProgramUpgraded": { "treasury": PublicKey; "program": PublicKey; "timestamp": BN };
|
|
68
|
+
"SolWithdrawn": { "treasury": PublicKey; "admin": PublicKey; "recipient": PublicKey; "amount": BN; "timestamp": BN };
|
|
69
|
+
"StldSolWithdrawnViaTreasury": { "treasury": PublicKey; "admin": PublicKey; "source": PublicKey; "recipient": PublicKey; "amount": BN; "timestamp": BN };
|
|
70
|
+
"SupervisorSet": { "treasury": PublicKey; "admin": PublicKey; "old_supervisor": PublicKey; "new_supervisor": PublicKey; "timestamp": BN };
|
|
71
|
+
"TokenRegistered": { "treasury": PublicKey; "mint": PublicKey; "vault": PublicKey; "token_index": number; "timestamp": BN };
|
|
72
|
+
"Treasury": { "admin": PublicKey; "pending_admin": PublicKey; "bump": number; "token_count": number; "token_mints": Array<PublicKey>; "token_vaults": Array<PublicKey>; "created_at": BN; "reserved": Array<number>; "supervisor": PublicKey };
|
|
73
|
+
"TreasuryInitialized": { "treasury": PublicKey; "admin": PublicKey; "timestamp": BN };
|
|
74
|
+
"UpgradeAuthorityTransferred": { "treasury": PublicKey; "programdata": PublicKey; "new_authority": PublicKey; "timestamp": BN; "old_authority": PublicKey };
|
|
75
|
+
};
|
|
76
|
+
"singleTokenLiquidity": {
|
|
77
|
+
"AssetConfig": { "mint": PublicKey; "token_program": PublicKey; "normalized_weight": BN; "max_selloff_pct": number; "max_selloff_period_length": number; "variable_fee_threshold_pct": number; "variable_fee_slope_low_pct": number; "variable_fee_slope_high_pct": number; "is_active": boolean; "variable_fee_slope_mid_pct": number; "variable_fee_kink_pct": number };
|
|
78
|
+
"AssetDynamics": { "virtual_balance": BN; "actual_balance": BN; "protocol_fees_owed": BN; "previous_selloff": BN; "current_selloff": BN; "window_start_timestamp": BN; "selloff_vb_snapshot": BN };
|
|
79
|
+
"CubicPool": { "config": PublicKey; "bump": number; "token_count": number; "pool_id": BN; "swap_fee_rate": number; "protocol_fee_rate": number; "created_at": BN; "pool_enabled": boolean; "swaps_enabled": boolean; "pool_admin": PublicKey; "pending_pool_admin": PublicKey; "range_manager": PublicKey; "range_manager_enabled": boolean; "range_manager_max_vb_change_pct": number; "range_manager_max_weight_change_pct": number; "range_manager_min_update_interval_secs": number; "range_manager_last_updated": BN; "tokens": Array<ContractTypes["singleTokenLiquidity"]["TokenSlot"]>; "lookup_table": PublicKey; "banned_extensions": BN; "range_manager_max_leverage_bps": number; "range_manager_min_leverage_bps": number; "reserved": Array<number> };
|
|
80
|
+
"CubicPoolConfig": { "protocol_admin": PublicKey; "pending_protocol_admin": PublicKey; "default_protocol_fee_rate": number; "banned_extensions": BN; "hard_banned_extensions": BN; "reserved": Array<number> };
|
|
81
|
+
"SingleTokenDeposit": { "helper": PublicKey; "pool": PublicKey; "user": PublicKey; "token_in_index": number; "amount_in": BN; "allocations": Array<BN>; "deposited_amounts": Array<BN>; "bpt_received": BN; "dust_refunded": Array<BN>; "timestamp": BN };
|
|
82
|
+
"StldSolWithdrawn": { "source": PublicKey; "authority": PublicKey; "recipient": PublicKey; "amount": BN; "timestamp": BN };
|
|
83
|
+
"TokenSlot": { "config": ContractTypes["singleTokenLiquidity"]["AssetConfig"]; "dynamics": ContractTypes["singleTokenLiquidity"]["AssetDynamics"] };
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface ContractInstructionMap {
|
|
88
|
+
"cubicPool": {
|
|
89
|
+
"accept_pool_admin_transfer": { args: Record<string, never>; accounts: { "pool": PublicKey; "new_admin": PublicKey } };
|
|
90
|
+
"accept_protocol_admin_transfer": { args: Record<string, never>; accounts: { "config": PublicKey; "new_admin": PublicKey } };
|
|
91
|
+
"add_liquidity": { args: { "token_amounts": Array<BN>; "minimum_bpt_amount": BN }; accounts: { "pool": PublicKey; "bpt_mint": PublicKey; "user_bpt_account": PublicKey; "user": PublicKey; "token_program": PublicKey } };
|
|
92
|
+
"cancel_pool_admin_transfer": { args: Record<string, never>; accounts: { "pool": PublicKey; "authority": PublicKey } };
|
|
93
|
+
"cancel_protocol_admin_transfer": { args: Record<string, never>; accounts: { "config": PublicKey; "authority": PublicKey } };
|
|
94
|
+
"collect_protocol_fees": { args: Record<string, never>; accounts: { "config": PublicKey; "pool": PublicKey; "authority": PublicKey } };
|
|
95
|
+
"debug_withdraw_liquidity": { args: { "token_amounts": Array<BN> }; accounts: { "config": PublicKey; "pool": PublicKey; "authority": PublicKey } };
|
|
96
|
+
"disable_pool_admin": { args: Record<string, never>; accounts: { "pool": PublicKey; "authority": PublicKey } };
|
|
97
|
+
"get_pool_info": { args: Record<string, never>; accounts: { "pool": PublicKey } };
|
|
98
|
+
"initialize_config": { args: { "default_protocol_fee_rate": number }; accounts: { "config": PublicKey; "protocol_admin_treasury": PublicKey; "payer": PublicKey; "system_program": PublicKey } };
|
|
99
|
+
"initialize_cubic_pool": { args: { "normalized_weights": Array<BN>; "initial_virtual_balances": Array<BN>; "swap_fee_rate": number; "pool_id": BN; "banned_extensions_override": BN | null }; accounts: { "config": PublicKey; "pool": PublicKey; "bpt_mint": PublicKey; "payer": PublicKey; "token_program": PublicKey; "associated_token_program": PublicKey; "system_program": PublicKey } };
|
|
100
|
+
"initialize_pool_alt": { args: { "recent_slot": BN }; accounts: { "pool": PublicKey; "config": PublicKey; "authority": PublicKey; "payer": PublicKey; "lookup_table": PublicKey; "system_program": PublicKey; "alt_program": PublicKey } };
|
|
101
|
+
"initiate_pool_admin_transfer": { args: { "new_admin": PublicKey }; accounts: { "pool": PublicKey; "authority": PublicKey } };
|
|
102
|
+
"initiate_protocol_admin_transfer": { args: { "new_admin": PublicKey }; accounts: { "config": PublicKey; "authority": PublicKey } };
|
|
103
|
+
"migrate_to_v5": { args: { "reactivate_tokens": boolean }; accounts: { "pool": PublicKey; "config": PublicKey; "authority": PublicKey; "system_program": PublicKey } };
|
|
104
|
+
"range_manager_update": { args: { "vb_changes": Array<ContractTypes["cubicPool"]["TokenChange"]>; "weight_changes": Array<ContractTypes["cubicPool"]["TokenChange"]> }; accounts: { "pool": PublicKey; "authority": PublicKey } };
|
|
105
|
+
"remove_liquidity": { args: { "bpt_amount": BN; "minimum_token_amounts": Array<BN> }; accounts: { "pool": PublicKey; "bpt_mint": PublicKey; "user_bpt_account": PublicKey; "user": PublicKey; "token_program": PublicKey } };
|
|
106
|
+
"set_banned_extensions": { args: { "banned_extensions": BN; "hard_banned_extensions": BN }; accounts: { "config": PublicKey; "authority": PublicKey } };
|
|
107
|
+
"set_max_selloff": { args: { "params": Array<ContractTypes["cubicPool"]["SelloffParams"]> }; accounts: { "pool": PublicKey; "authority": PublicKey } };
|
|
108
|
+
"set_pool_enabled": { args: { "enabled": boolean }; accounts: { "config": PublicKey; "pool": PublicKey; "authority": PublicKey } };
|
|
109
|
+
"set_protocol_fee_rate": { args: { "protocol_fee_rate": number }; accounts: { "config": PublicKey; "pool": PublicKey; "authority": PublicKey } };
|
|
110
|
+
"set_range_manager": { args: { "new_manager": PublicKey; "enabled": boolean }; accounts: { "config": PublicKey; "pool": PublicKey; "authority": PublicKey } };
|
|
111
|
+
"set_range_manager_config": { args: { "max_vb_change_pct": number; "max_weight_change_pct": number; "min_update_interval_secs": number; "max_leverage_bps": number; "min_leverage_bps": number }; accounts: { "pool": PublicKey; "authority": PublicKey } };
|
|
112
|
+
"set_swap_fee_rate": { args: { "swap_fee_rate": number }; accounts: { "pool": PublicKey; "authority": PublicKey } };
|
|
113
|
+
"set_swaps_enabled": { args: { "enabled": boolean }; accounts: { "config": PublicKey; "pool": PublicKey; "authority": PublicKey } };
|
|
114
|
+
"set_token_active": { args: { "token_index": number; "is_active": boolean }; accounts: { "config": PublicKey; "pool": PublicKey; "authority": PublicKey } };
|
|
115
|
+
"swap": { args: { "amount_in": BN; "minimum_amount_out": BN; "token_in_index": number; "token_out_index": number }; accounts: { "pool": PublicKey; "token_mint_in": PublicKey; "token_mint_out": PublicKey; "user_token_account_in": PublicKey; "user_token_account_out": PublicKey; "vault_in": PublicKey; "vault_out": PublicKey; "user": PublicKey; "token_program_in": PublicKey; "token_program_out": PublicKey } };
|
|
116
|
+
"withdraw_sol": { args: { "amount": BN }; accounts: { "config": PublicKey; "source": PublicKey; "recipient": PublicKey; "authority": PublicKey } };
|
|
117
|
+
};
|
|
118
|
+
"protocolAdmin": {
|
|
119
|
+
"accept_admin_transfer": { args: Record<string, never>; accounts: { "treasury": PublicKey; "new_admin": PublicKey } };
|
|
120
|
+
"cancel_admin_transfer": { args: Record<string, never>; accounts: { "treasury": PublicKey; "admin": PublicKey } };
|
|
121
|
+
"close_pool_program": { args: Record<string, never>; accounts: { "treasury": PublicKey; "admin": PublicKey; "programdata": PublicKey; "program_to_close": PublicKey; "recipient": PublicKey; "bpf_loader_upgradeable": PublicKey } };
|
|
122
|
+
"freeze_pool_program": { args: Record<string, never>; accounts: { "treasury": PublicKey; "admin": PublicKey; "program": PublicKey; "programdata": PublicKey; "bpf_loader_upgradeable": PublicKey } };
|
|
123
|
+
"freeze_pools": { args: Record<string, never>; accounts: { "treasury": PublicKey; "authority": PublicKey; "cubic_pool_program": PublicKey } };
|
|
124
|
+
"initialize": { args: { "admin": PublicKey }; accounts: { "treasury": PublicKey; "payer": PublicKey; "program_data": PublicKey; "system_program": PublicKey } };
|
|
125
|
+
"initiate_admin_transfer": { args: { "new_admin": PublicKey }; accounts: { "treasury": PublicKey; "admin": PublicKey } };
|
|
126
|
+
"pool_accept_protocol_admin_transfer": { args: Record<string, never>; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "cubic_pool_program": PublicKey } };
|
|
127
|
+
"pool_cancel_protocol_admin_transfer": { args: Record<string, never>; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "cubic_pool_program": PublicKey } };
|
|
128
|
+
"pool_collect_protocol_fees": { args: Record<string, never>; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "pool": PublicKey; "cubic_pool_program": PublicKey } };
|
|
129
|
+
"pool_debug_withdraw_liquidity": { args: { "token_amounts": Array<BN> }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "pool": PublicKey; "cubic_pool_program": PublicKey } };
|
|
130
|
+
"pool_initialize_alt": { args: { "recent_slot": BN }; accounts: { "treasury": PublicKey; "admin": PublicKey; "pool": PublicKey; "config": PublicKey; "lookup_table": PublicKey; "system_program": PublicKey; "alt_program": PublicKey; "cubic_pool_program": PublicKey } };
|
|
131
|
+
"pool_initialize_config": { args: { "default_protocol_fee_rate": number }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "cubic_pool_program": PublicKey; "system_program": PublicKey } };
|
|
132
|
+
"pool_initiate_protocol_admin_transfer": { args: { "new_admin": PublicKey }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "cubic_pool_program": PublicKey } };
|
|
133
|
+
"pool_migrate_to_v5": { args: { "reactivate_tokens": boolean }; accounts: { "treasury": PublicKey; "admin": PublicKey; "pool": PublicKey; "config": PublicKey; "system_program": PublicKey; "cubic_pool_program": PublicKey } };
|
|
134
|
+
"pool_set_banned_extensions": { args: { "banned_extensions": BN; "hard_banned_extensions": BN }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "cubic_pool_program": PublicKey } };
|
|
135
|
+
"pool_set_pool_enabled": { args: { "enabled": boolean }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "pool": PublicKey; "cubic_pool_program": PublicKey } };
|
|
136
|
+
"pool_set_protocol_fee_rate": { args: { "protocol_fee_rate": number }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "pool": PublicKey; "cubic_pool_program": PublicKey } };
|
|
137
|
+
"pool_set_swaps_enabled": { args: { "enabled": boolean }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "pool": PublicKey; "cubic_pool_program": PublicKey } };
|
|
138
|
+
"pool_set_token_active": { args: { "token_index": number; "is_active": boolean }; accounts: { "treasury": PublicKey; "authority": PublicKey; "config": PublicKey; "pool": PublicKey; "cubic_pool_program": PublicKey } };
|
|
139
|
+
"pool_withdraw_sol": { args: { "amount": BN }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "source": PublicKey; "recipient": PublicKey; "cubic_pool_program": PublicKey } };
|
|
140
|
+
"register_token": { args: Record<string, never>; accounts: { "treasury": PublicKey; "mint": PublicKey; "vault": PublicKey; "admin": PublicKey; "token_program": PublicKey; "system_program": PublicKey } };
|
|
141
|
+
"set_supervisor": { args: { "new_supervisor": PublicKey }; accounts: { "treasury": PublicKey; "admin": PublicKey; "system_program": PublicKey } };
|
|
142
|
+
"stld_withdraw_sol": { args: { "amount": BN }; accounts: { "treasury": PublicKey; "admin": PublicKey; "config": PublicKey; "pool": PublicKey; "source": PublicKey; "recipient": PublicKey; "system_program": PublicKey; "stld_program": PublicKey } };
|
|
143
|
+
"transfer_upgrade_authority": { args: Record<string, never>; accounts: { "treasury": PublicKey; "admin": PublicKey; "program": PublicKey; "programdata": PublicKey; "new_authority": PublicKey; "bpf_loader_upgradeable": PublicKey } };
|
|
144
|
+
"unfreeze_pools": { args: Record<string, never>; accounts: { "treasury": PublicKey; "authority": PublicKey; "cubic_pool_program": PublicKey } };
|
|
145
|
+
"upgrade_pool_program": { args: Record<string, never>; accounts: { "treasury": PublicKey; "admin": PublicKey; "programdata": PublicKey; "program_to_upgrade": PublicKey; "buffer": PublicKey; "spill": PublicKey; "rent": PublicKey; "clock": PublicKey; "bpf_loader_upgradeable": PublicKey } };
|
|
146
|
+
"withdraw": { args: { "amount": BN }; accounts: { "treasury": PublicKey; "vault": PublicKey; "recipient": PublicKey; "admin": PublicKey; "token_program": PublicKey } };
|
|
147
|
+
"withdraw_sol": { args: { "amount": BN }; accounts: { "treasury": PublicKey; "admin": PublicKey; "recipient": PublicKey } };
|
|
148
|
+
};
|
|
149
|
+
"singleTokenLiquidity": {
|
|
150
|
+
"deposit_single_token": { args: { "amount_in": BN; "token_in_index": number; "minimum_bpt_amount": BN }; accounts: { "pool": PublicKey; "helper": PublicKey; "bpt_mint": PublicKey; "helper_bpt_account": PublicKey; "user_bpt_account": PublicKey; "user": PublicKey; "cubic_pool_program": PublicKey; "bpt_token_program": PublicKey } };
|
|
151
|
+
"withdraw_sol": { args: { "amount": BN }; accounts: { "config": PublicKey; "pool": PublicKey; "source": PublicKey; "recipient": PublicKey; "authority": PublicKey; "system_program": PublicKey } };
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ContractAccountMap {
|
|
156
|
+
"cubicPool": {
|
|
157
|
+
"CubicPool": ContractTypes["cubicPool"]["CubicPool"];
|
|
158
|
+
"CubicPoolConfig": ContractTypes["cubicPool"]["CubicPoolConfig"];
|
|
159
|
+
};
|
|
160
|
+
"protocolAdmin": {
|
|
161
|
+
"Treasury": ContractTypes["protocolAdmin"]["Treasury"];
|
|
162
|
+
};
|
|
163
|
+
"singleTokenLiquidity": {
|
|
164
|
+
"CubicPool": ContractTypes["singleTokenLiquidity"]["CubicPool"];
|
|
165
|
+
"CubicPoolConfig": ContractTypes["singleTokenLiquidity"]["CubicPoolConfig"];
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface ContractEventMap {
|
|
170
|
+
"cubicPool": {
|
|
171
|
+
"BannedExtensionsUpdated": ContractTypes["cubicPool"]["BannedExtensionsUpdated"];
|
|
172
|
+
"ConfigInitialized": ContractTypes["cubicPool"]["ConfigInitialized"];
|
|
173
|
+
"DebugLiquidityWithdrawn": ContractTypes["cubicPool"]["DebugLiquidityWithdrawn"];
|
|
174
|
+
"LiquidityAdded": ContractTypes["cubicPool"]["LiquidityAdded"];
|
|
175
|
+
"LiquidityRemoved": ContractTypes["cubicPool"]["LiquidityRemoved"];
|
|
176
|
+
"MaxSelloffSet": ContractTypes["cubicPool"]["MaxSelloffSet"];
|
|
177
|
+
"MaxSelloffWindowAdvanced": ContractTypes["cubicPool"]["MaxSelloffWindowAdvanced"];
|
|
178
|
+
"PoolAdminDisabled": ContractTypes["cubicPool"]["PoolAdminDisabled"];
|
|
179
|
+
"PoolAdminTransferCancelled": ContractTypes["cubicPool"]["PoolAdminTransferCancelled"];
|
|
180
|
+
"PoolAdminTransferInitiated": ContractTypes["cubicPool"]["PoolAdminTransferInitiated"];
|
|
181
|
+
"PoolAdminTransferred": ContractTypes["cubicPool"]["PoolAdminTransferred"];
|
|
182
|
+
"PoolAltInitialized": ContractTypes["cubicPool"]["PoolAltInitialized"];
|
|
183
|
+
"PoolEnabledUpdated": ContractTypes["cubicPool"]["PoolEnabledUpdated"];
|
|
184
|
+
"PoolInfo": ContractTypes["cubicPool"]["PoolInfo"];
|
|
185
|
+
"PoolInitialized": ContractTypes["cubicPool"]["PoolInitialized"];
|
|
186
|
+
"PoolMigratedToV5": ContractTypes["cubicPool"]["PoolMigratedToV5"];
|
|
187
|
+
"PoolSolWithdrawn": ContractTypes["cubicPool"]["PoolSolWithdrawn"];
|
|
188
|
+
"PoolStateLog": ContractTypes["cubicPool"]["PoolStateLog"];
|
|
189
|
+
"ProtocolAdminTransferCancelled": ContractTypes["cubicPool"]["ProtocolAdminTransferCancelled"];
|
|
190
|
+
"ProtocolAdminTransferInitiated": ContractTypes["cubicPool"]["ProtocolAdminTransferInitiated"];
|
|
191
|
+
"ProtocolAdminTransferred": ContractTypes["cubicPool"]["ProtocolAdminTransferred"];
|
|
192
|
+
"ProtocolFeeRateUpdated": ContractTypes["cubicPool"]["ProtocolFeeRateUpdated"];
|
|
193
|
+
"ProtocolFeesCollected": ContractTypes["cubicPool"]["ProtocolFeesCollected"];
|
|
194
|
+
"RangeManagerConfigSet": ContractTypes["cubicPool"]["RangeManagerConfigSet"];
|
|
195
|
+
"RangeManagerSet": ContractTypes["cubicPool"]["RangeManagerSet"];
|
|
196
|
+
"RangeManagerUpdated": ContractTypes["cubicPool"]["RangeManagerUpdated"];
|
|
197
|
+
"Swap": ContractTypes["cubicPool"]["Swap"];
|
|
198
|
+
"SwapFeeRateUpdated": ContractTypes["cubicPool"]["SwapFeeRateUpdated"];
|
|
199
|
+
"SwapsEnabledUpdated": ContractTypes["cubicPool"]["SwapsEnabledUpdated"];
|
|
200
|
+
"TokenActiveSet": ContractTypes["cubicPool"]["TokenActiveSet"];
|
|
201
|
+
};
|
|
202
|
+
"protocolAdmin": {
|
|
203
|
+
"AdminTransferCancelled": ContractTypes["protocolAdmin"]["AdminTransferCancelled"];
|
|
204
|
+
"AdminTransferInitiated": ContractTypes["protocolAdmin"]["AdminTransferInitiated"];
|
|
205
|
+
"AdminTransferred": ContractTypes["protocolAdmin"]["AdminTransferred"];
|
|
206
|
+
"FundsWithdrawn": ContractTypes["protocolAdmin"]["FundsWithdrawn"];
|
|
207
|
+
"PoolAltInitializedByTreasury": ContractTypes["protocolAdmin"]["PoolAltInitializedByTreasury"];
|
|
208
|
+
"PoolBannedExtensionsSet": ContractTypes["protocolAdmin"]["PoolBannedExtensionsSet"];
|
|
209
|
+
"PoolConfigInitialized": ContractTypes["protocolAdmin"]["PoolConfigInitialized"];
|
|
210
|
+
"PoolDebugWithdrawn": ContractTypes["protocolAdmin"]["PoolDebugWithdrawn"];
|
|
211
|
+
"PoolEnabledSet": ContractTypes["protocolAdmin"]["PoolEnabledSet"];
|
|
212
|
+
"PoolFeesCollected": ContractTypes["protocolAdmin"]["PoolFeesCollected"];
|
|
213
|
+
"PoolProtocolAdminTransferAccepted": ContractTypes["protocolAdmin"]["PoolProtocolAdminTransferAccepted"];
|
|
214
|
+
"PoolProtocolAdminTransferCancelled": ContractTypes["protocolAdmin"]["PoolProtocolAdminTransferCancelled"];
|
|
215
|
+
"PoolProtocolAdminTransferInitiated": ContractTypes["protocolAdmin"]["PoolProtocolAdminTransferInitiated"];
|
|
216
|
+
"PoolProtocolFeeRateSet": ContractTypes["protocolAdmin"]["PoolProtocolFeeRateSet"];
|
|
217
|
+
"PoolSolWithdrawnViaTreasury": ContractTypes["protocolAdmin"]["PoolSolWithdrawnViaTreasury"];
|
|
218
|
+
"PoolSwapsEnabledSet": ContractTypes["protocolAdmin"]["PoolSwapsEnabledSet"];
|
|
219
|
+
"PoolTokenActiveSet": ContractTypes["protocolAdmin"]["PoolTokenActiveSet"];
|
|
220
|
+
"PoolsFrozen": ContractTypes["protocolAdmin"]["PoolsFrozen"];
|
|
221
|
+
"PoolsUnfrozen": ContractTypes["protocolAdmin"]["PoolsUnfrozen"];
|
|
222
|
+
"ProgramClosed": ContractTypes["protocolAdmin"]["ProgramClosed"];
|
|
223
|
+
"ProgramFrozen": ContractTypes["protocolAdmin"]["ProgramFrozen"];
|
|
224
|
+
"ProgramUpgraded": ContractTypes["protocolAdmin"]["ProgramUpgraded"];
|
|
225
|
+
"SolWithdrawn": ContractTypes["protocolAdmin"]["SolWithdrawn"];
|
|
226
|
+
"StldSolWithdrawnViaTreasury": ContractTypes["protocolAdmin"]["StldSolWithdrawnViaTreasury"];
|
|
227
|
+
"SupervisorSet": ContractTypes["protocolAdmin"]["SupervisorSet"];
|
|
228
|
+
"TokenRegistered": ContractTypes["protocolAdmin"]["TokenRegistered"];
|
|
229
|
+
"TreasuryInitialized": ContractTypes["protocolAdmin"]["TreasuryInitialized"];
|
|
230
|
+
"UpgradeAuthorityTransferred": ContractTypes["protocolAdmin"]["UpgradeAuthorityTransferred"];
|
|
231
|
+
};
|
|
232
|
+
"singleTokenLiquidity": {
|
|
233
|
+
"SingleTokenDeposit": ContractTypes["singleTokenLiquidity"]["SingleTokenDeposit"];
|
|
234
|
+
"StldSolWithdrawn": ContractTypes["singleTokenLiquidity"]["StldSolWithdrawn"];
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type ContractProgram = keyof ContractInstructionMap;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
|
|
4
|
+
export type CubicPoolEvent =
|
|
5
|
+
| PoolInitializedEvent
|
|
6
|
+
| SwapEvent
|
|
7
|
+
| LiquidityAddedEvent
|
|
8
|
+
| LiquidityRemovedEvent
|
|
9
|
+
| ProtocolFeesCollectedEvent
|
|
10
|
+
| PoolEnabledUpdatedEvent
|
|
11
|
+
| SwapsEnabledUpdatedEvent
|
|
12
|
+
| SingleTokenDepositEvent
|
|
13
|
+
| PoolStateLogEvent
|
|
14
|
+
| MaxSelloffWindowAdvancedEvent
|
|
15
|
+
| BannedExtensionsUpdatedEvent
|
|
16
|
+
| AdditionalContractEvent
|
|
17
|
+
| UnknownEvent;
|
|
18
|
+
|
|
19
|
+
export interface PoolInitializedEvent {
|
|
20
|
+
kind: "PoolInitialized";
|
|
21
|
+
pool: PublicKey;
|
|
22
|
+
config: PublicKey;
|
|
23
|
+
tokenCount: number;
|
|
24
|
+
bptMint: PublicKey;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
/**
|
|
27
|
+
* Effective Token-2022 banned-extensions bitmap this pool's tokens were
|
|
28
|
+
* vetted against at creation (creator override OR-ed with the protocol's
|
|
29
|
+
* hard floor, or the parent config's default).
|
|
30
|
+
*
|
|
31
|
+
* Appended to the event in v5.1 — decodes as `0` for logs emitted by an
|
|
32
|
+
* older deployment, which is indistinguishable from a genuinely
|
|
33
|
+
* permissive `0`. Prefer the pool account's `bannedExtensions` field when
|
|
34
|
+
* the distinction matters.
|
|
35
|
+
*/
|
|
36
|
+
bannedExtensions: BN;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface SwapEvent {
|
|
40
|
+
kind: "Swap";
|
|
41
|
+
pool: PublicKey;
|
|
42
|
+
user: PublicKey;
|
|
43
|
+
tokenIn: PublicKey;
|
|
44
|
+
tokenOut: PublicKey;
|
|
45
|
+
amountIn: BN;
|
|
46
|
+
amountOut: BN;
|
|
47
|
+
feeAmount: BN;
|
|
48
|
+
protocolFeeAmount: BN;
|
|
49
|
+
/**
|
|
50
|
+
* Variable sell-off surge fee taken from the OUTPUT token and routed
|
|
51
|
+
* 100% to the protocol bucket. `0` in the common case.
|
|
52
|
+
*
|
|
53
|
+
* ⚠ On the wire this field sits AFTER `timestamp`, not before it (see
|
|
54
|
+
* the `Swap` type in the IDL). The ordering here is presentational only.
|
|
55
|
+
*/
|
|
56
|
+
surgeFeeAmount: BN;
|
|
57
|
+
timestamp: number;
|
|
58
|
+
/** Legacy compatibility field; the deployed without-SF event omits transfer
|
|
59
|
+
* fees, so this is zero for current events. No transfer-fee support is implied.
|
|
60
|
+
*/
|
|
61
|
+
transferFeeIn: BN;
|
|
62
|
+
/** Legacy compatibility field; zero for the deployed without-SF event. */
|
|
63
|
+
transferFeeOut: BN;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface LiquidityAddedEvent {
|
|
67
|
+
kind: "LiquidityAdded";
|
|
68
|
+
pool: PublicKey;
|
|
69
|
+
user: PublicKey;
|
|
70
|
+
tokenAmounts: BN[];
|
|
71
|
+
bptAmount: BN;
|
|
72
|
+
timestamp: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface LiquidityRemovedEvent {
|
|
76
|
+
kind: "LiquidityRemoved";
|
|
77
|
+
pool: PublicKey;
|
|
78
|
+
user: PublicKey;
|
|
79
|
+
bptAmount: BN;
|
|
80
|
+
tokenAmounts: BN[];
|
|
81
|
+
timestamp: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface ProtocolFeesCollectedEvent {
|
|
85
|
+
kind: "ProtocolFeesCollected";
|
|
86
|
+
pool: PublicKey;
|
|
87
|
+
authority: PublicKey;
|
|
88
|
+
tokenAmounts: BN[];
|
|
89
|
+
timestamp: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface PoolEnabledUpdatedEvent {
|
|
93
|
+
kind: "PoolEnabledUpdated";
|
|
94
|
+
pool: PublicKey;
|
|
95
|
+
authority: PublicKey;
|
|
96
|
+
oldValue: boolean;
|
|
97
|
+
newValue: boolean;
|
|
98
|
+
timestamp: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface SwapsEnabledUpdatedEvent {
|
|
102
|
+
kind: "SwapsEnabledUpdated";
|
|
103
|
+
pool: PublicKey;
|
|
104
|
+
authority: PublicKey;
|
|
105
|
+
oldValue: boolean;
|
|
106
|
+
newValue: boolean;
|
|
107
|
+
timestamp: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface SingleTokenDepositEvent {
|
|
111
|
+
kind: "SingleTokenDeposit";
|
|
112
|
+
helper: PublicKey;
|
|
113
|
+
pool: PublicKey;
|
|
114
|
+
user: PublicKey;
|
|
115
|
+
tokenInIndex: number;
|
|
116
|
+
amountIn: BN;
|
|
117
|
+
/** Per-token share of `amountIn` routed into each internal swap leg. */
|
|
118
|
+
allocations: BN[];
|
|
119
|
+
/** Per-token amounts actually passed to `add_liquidity`. */
|
|
120
|
+
depositedAmounts: BN[];
|
|
121
|
+
bptReceived: BN;
|
|
122
|
+
/**
|
|
123
|
+
* Per-token dust returned to the user after the proportional join,
|
|
124
|
+
* index-aligned with the pool's tokens.
|
|
125
|
+
*
|
|
126
|
+
* ⚠ Was a scalar `u64` before v5.1 — the helper only ever refunded the
|
|
127
|
+
* input token. It now refunds leftovers of every token, so this is a
|
|
128
|
+
* `Vec<u64>` on the wire and a `BN[]` here. Consumers summing "dust" must
|
|
129
|
+
* NOT add these together: each entry is denominated in a different mint.
|
|
130
|
+
*/
|
|
131
|
+
dustRefunded: BN[];
|
|
132
|
+
timestamp: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* `set_banned_extensions` / `pool_set_banned_extensions` audit trail.
|
|
137
|
+
*
|
|
138
|
+
* `hard*` values are the protocol-level floor a pool creator's per-pool
|
|
139
|
+
* override can never clear (`PermanentDelegate`, `TransferHook`, …); the
|
|
140
|
+
* plain values are the config's default policy for new pools.
|
|
141
|
+
*/
|
|
142
|
+
export interface BannedExtensionsUpdatedEvent {
|
|
143
|
+
kind: "BannedExtensionsUpdated";
|
|
144
|
+
config: PublicKey;
|
|
145
|
+
authority: PublicKey;
|
|
146
|
+
oldValue: BN;
|
|
147
|
+
newValue: BN;
|
|
148
|
+
timestamp: number;
|
|
149
|
+
/** New in v5.1 — `0` for logs emitted by an older deployment. */
|
|
150
|
+
oldHardValue: BN;
|
|
151
|
+
/** New in v5.1 — `0` for logs emitted by an older deployment. */
|
|
152
|
+
newHardValue: BN;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface PoolStateLogEvent {
|
|
156
|
+
kind: "PoolStateLog";
|
|
157
|
+
pool: PublicKey;
|
|
158
|
+
virtualBalances: BN[];
|
|
159
|
+
actualBalances: BN[];
|
|
160
|
+
protocolFeesOwed: BN[];
|
|
161
|
+
timestamp: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface MaxSelloffWindowAdvancedEvent {
|
|
165
|
+
kind: "MaxSelloffWindowAdvanced";
|
|
166
|
+
pool: PublicKey;
|
|
167
|
+
tokenIndex: number;
|
|
168
|
+
effectiveSelloff: BN;
|
|
169
|
+
maxSelloffCap: BN;
|
|
170
|
+
vbSnapshot: BN;
|
|
171
|
+
previousSelloff: BN;
|
|
172
|
+
currentSelloff: BN;
|
|
173
|
+
windowStartTimestamp: number;
|
|
174
|
+
timestamp: number;
|
|
175
|
+
/**
|
|
176
|
+
* Window fill % = `effectiveSelloff / maxSelloffCap`. When this ratio
|
|
177
|
+
* reaches 1.0 the sell-off cap for the window is fully consumed.
|
|
178
|
+
*/
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface UnknownEvent {
|
|
182
|
+
kind: "Unknown";
|
|
183
|
+
name: string;
|
|
184
|
+
data: Record<string, unknown>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Additional current-ABI events, with the camelCase fields used by the legacy
|
|
188
|
+
* event API. Use parseContractEvents for exact IDL names and BN timestamps.
|
|
189
|
+
*/
|
|
190
|
+
type CamelCase<S extends string> = S extends `${infer Head}_${infer Tail}` ? `${Head}${Capitalize<CamelCase<Tail>>}` : S;
|
|
191
|
+
type CamelEventData<T> = { [K in keyof T as K extends string ? CamelCase<K> : K]: K extends "timestamp" ? number : T[K] };
|
|
192
|
+
type ExistingEventName = "PoolInitialized" | "Swap" | "LiquidityAdded" | "LiquidityRemoved" | "ProtocolFeesCollected" | "PoolEnabledUpdated" | "SwapsEnabledUpdated" | "SingleTokenDeposit" | "PoolStateLog" | "MaxSelloffWindowAdvanced" | "BannedExtensionsUpdated";
|
|
193
|
+
export type AdditionalContractEvent = {
|
|
194
|
+
[P in keyof import("./contracts").ContractEventMap]: {
|
|
195
|
+
[E in Exclude<keyof import("./contracts").ContractEventMap[P], ExistingEventName>]:
|
|
196
|
+
{ kind: E } & CamelEventData<import("./contracts").ContractEventMap[P][E]>
|
|
197
|
+
}[Exclude<keyof import("./contracts").ContractEventMap[P], ExistingEventName>]
|
|
198
|
+
}[keyof import("./contracts").ContractEventMap];
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
import { TokenInfo } from "../config/tokens";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A single token slot inside a Cubic Pool, enriched with off-chain metadata
|
|
7
|
+
* (ticker, logo, coingeckoId) when available.
|
|
8
|
+
*/
|
|
9
|
+
export interface PoolTokenInfo {
|
|
10
|
+
index: number;
|
|
11
|
+
mint: PublicKey;
|
|
12
|
+
tokenProgram: PublicKey;
|
|
13
|
+
decimals: number;
|
|
14
|
+
/** Basis points, sum across all tokens == 10_000. */
|
|
15
|
+
weightBps: number;
|
|
16
|
+
/** In native token units (u64). */
|
|
17
|
+
virtualBalance: BN;
|
|
18
|
+
actualBalance: BN;
|
|
19
|
+
protocolFeesOwed: BN;
|
|
20
|
+
/** PDA: ATA(pool, mint, tokenProgram). */
|
|
21
|
+
vault: PublicKey;
|
|
22
|
+
/** Cached off-chain metadata; `undefined` if no registry hit. */
|
|
23
|
+
metadata?: TokenInfo;
|
|
24
|
+
/** factBalance / virtBalance as a float, for display/math. */
|
|
25
|
+
concentration: number;
|
|
26
|
+
/**
|
|
27
|
+
* Per-token input kill switch. When `false`, swaps with THIS token as
|
|
28
|
+
* input revert (`TokenInactive`); it can still be a swap output and
|
|
29
|
+
* liquidity ops are unaffected. Defaults to `true`.
|
|
30
|
+
*/
|
|
31
|
+
isActive: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Max cumulative sell volume per window, as a percent of virtual balance
|
|
34
|
+
* (`PERCENT_SCALE` units; 10_000 = 100%). `0` ⇒ no cap.
|
|
35
|
+
*/
|
|
36
|
+
maxSelloffPct: number;
|
|
37
|
+
maxSelloffPeriodLength?: number;
|
|
38
|
+
variableFeeThresholdPct?: number;
|
|
39
|
+
variableFeeSlopeLowPct?: number;
|
|
40
|
+
variableFeeSlopeHighPct?: number;
|
|
41
|
+
previousSelloff?: BN;
|
|
42
|
+
currentSelloff?: BN;
|
|
43
|
+
windowStartTimestamp?: BN;
|
|
44
|
+
selloffVbSnapshot?: BN;
|
|
45
|
+
/**
|
|
46
|
+
* Surge fee at the curve's KINK (`PERCENT_SCALE` units). New in v5.1 —
|
|
47
|
+
* `0` on pools written by the older program.
|
|
48
|
+
*/
|
|
49
|
+
variableFeeSlopeMidPct?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Window fill at which the surge curve kinks, in WHOLE PERCENT (0..=100),
|
|
52
|
+
* not `PERCENT_SCALE` units. `0` ⇒ no kink (single straight line, which is
|
|
53
|
+
* how every pre-v5.1 pool behaves). New in v5.1.
|
|
54
|
+
*/
|
|
55
|
+
variableFeeKinkPct?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Token-2022 extension discriminants present on this token's mint
|
|
58
|
+
* (`[]` for classic SPL Token mints). See `MintExtension`.
|
|
59
|
+
*/
|
|
60
|
+
extensions?: number[];
|
|
61
|
+
/**
|
|
62
|
+
* Subset of `extensions` the AMM cannot move (transfer fee, transfer
|
|
63
|
+
* hook, non-transferable, pausable, or unknown types). Non-empty ⇒ every quote / build that touches
|
|
64
|
+
* this token is refused with `unsupported_token_extension`.
|
|
65
|
+
*/
|
|
66
|
+
unsupportedExtensions?: number[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Parsed operational pool state returned by `CubicPoolClient.sync()`.
|
|
71
|
+
* Padding and unused token slots are available through decodePoolAccount;
|
|
72
|
+
* decodeContractAccount preserves the complete exact ABI shape.
|
|
73
|
+
*/
|
|
74
|
+
export interface PoolInfo {
|
|
75
|
+
/**
|
|
76
|
+
* Indices of tokens with a non-empty `unsupportedExtensions`. Empty for a
|
|
77
|
+
* pool without runtime-incompatible mints. Swap/add/remove guards check
|
|
78
|
+
* affected transfer legs; the STLD instruction builder checks all mints.
|
|
79
|
+
*/
|
|
80
|
+
unsupportedTokenIndices?: number[];
|
|
81
|
+
/** Pool PDA address. */
|
|
82
|
+
address: PublicKey;
|
|
83
|
+
/** Pool config account referenced by the pool. */
|
|
84
|
+
config: PublicKey;
|
|
85
|
+
/** `Account<CubicPool>.bump`. */
|
|
86
|
+
bump: number;
|
|
87
|
+
/** Integer identifier salt. Pools under the same config differ by pool_id. */
|
|
88
|
+
poolId: BN;
|
|
89
|
+
tokenCount: number;
|
|
90
|
+
tokens: PoolTokenInfo[];
|
|
91
|
+
bptMint: PublicKey;
|
|
92
|
+
/** Owner program of the BPT mint; classic Token for older manually supplied snapshots. */
|
|
93
|
+
bptTokenProgram?: PublicKey;
|
|
94
|
+
poolAdmin?: PublicKey;
|
|
95
|
+
pendingPoolAdmin?: PublicKey;
|
|
96
|
+
rangeManager?: PublicKey;
|
|
97
|
+
rangeManagerEnabled?: boolean;
|
|
98
|
+
rangeManagerMaxVbChangePct?: number;
|
|
99
|
+
rangeManagerMaxWeightChangePct?: number;
|
|
100
|
+
rangeManagerMinUpdateIntervalSecs?: number;
|
|
101
|
+
rangeManagerLastUpdated?: BN;
|
|
102
|
+
/** Solana Clock timestamp at sync, used for time-dependent selloff quotes. */
|
|
103
|
+
chainTimestamp?: number;
|
|
104
|
+
/** Total supply of BPT tokens at snapshot time. */
|
|
105
|
+
bptTotalSupply: BN;
|
|
106
|
+
/** Hundredths-of-basis-point units (1_000_000 == 100 %). */
|
|
107
|
+
swapFeeRate: number;
|
|
108
|
+
/** Basis points (10_000 == 100 %). */
|
|
109
|
+
protocolFeeRate: number;
|
|
110
|
+
poolEnabled: boolean;
|
|
111
|
+
swapsEnabled: boolean;
|
|
112
|
+
createdAt: number;
|
|
113
|
+
/**
|
|
114
|
+
* Per-pool Address Lookup Table. `PublicKey.default` ⇒ no ALT provisioned
|
|
115
|
+
* yet (call `initialize_pool_alt` to bootstrap). When set and non-default,
|
|
116
|
+
* v0-tx builders compress per-token accounts via this ALT.
|
|
117
|
+
*/
|
|
118
|
+
lookupTable: PublicKey;
|
|
119
|
+
/**
|
|
120
|
+
* Effective Token-2022 banned-extensions bitmap this pool's tokens were
|
|
121
|
+
* vetted against at creation. `0` ⇒ nothing banned (permissive — rug risk;
|
|
122
|
+
* surface to users before they deposit).
|
|
123
|
+
*/
|
|
124
|
+
bannedExtensions: BN;
|
|
125
|
+
/**
|
|
126
|
+
* Absolute UPPER bound on `virtual_balance / actual_balance` the range
|
|
127
|
+
* manager may leave a token at, in basis points (10_000 = 1.0×). `0` ⇒
|
|
128
|
+
* band disabled. New in v5.1 — `0` on pools written by the older program.
|
|
129
|
+
*/
|
|
130
|
+
rangeManagerMaxLeverageBps?: number;
|
|
131
|
+
/**
|
|
132
|
+
* Absolute LOWER bound on the same ratio, same units. `0` ⇒ floor
|
|
133
|
+
* disabled. New in v5.1.
|
|
134
|
+
*/
|
|
135
|
+
rangeManagerMinLeverageBps?: number;
|
|
136
|
+
/** Unix timestamp (ms) when sync() ran. Useful for staleness checks. */
|
|
137
|
+
syncedAt: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface PoolSummary {
|
|
141
|
+
address: string;
|
|
142
|
+
tvlUsd?: number;
|
|
143
|
+
volume24hUsd?: number;
|
|
144
|
+
feeApr7d?: number;
|
|
145
|
+
poolEnabled: boolean;
|
|
146
|
+
tokens: Array<{ mint: string; symbol?: string; weightBps: number }>;
|
|
147
|
+
}
|