@affluent-org/sdk 0.0.4 → 0.0.5

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.
Files changed (29) hide show
  1. package/dist/common/transform.d.ts +93 -0
  2. package/dist/common/transform.js +351 -0
  3. package/dist/common/types.d.ts +144 -0
  4. package/dist/common/types.js +11 -0
  5. package/dist/contracts/oracle/redstone-onchain-oracle/type.d.ts +1 -1
  6. package/dist/services/composite-oracle/codec.d.ts +76 -0
  7. package/dist/services/composite-oracle/codec.js +281 -0
  8. package/dist/services/composite-oracle/computation.d.ts +9 -15
  9. package/dist/services/composite-oracle/computation.js +44 -36
  10. package/dist/services/composite-oracle/index.d.ts +2 -2
  11. package/dist/services/composite-oracle/index.js +2 -2
  12. package/dist/services/composite-oracle/query.d.ts +6 -6
  13. package/dist/services/composite-oracle/query.js +7 -46
  14. package/dist/services/pool/computation.d.ts +3 -9
  15. package/dist/services/pool/computation.js +16 -30
  16. package/dist/services/pool/oracle.d.ts +2 -2
  17. package/dist/services/pool/query.d.ts +1 -1
  18. package/dist/services/rfq-auction/oracle.d.ts +2 -2
  19. package/dist/services/rfq-batch/oracle.d.ts +2 -2
  20. package/dist/services/share-vault/index.d.ts +2 -32
  21. package/dist/services/share-vault/query.d.ts +5 -32
  22. package/dist/services/share-vault/query.js +25 -12
  23. package/dist/services/strategy-vault/index.d.ts +9 -134
  24. package/dist/services/strategy-vault/index.js +5 -1
  25. package/dist/services/strategy-vault/oracle.d.ts +3 -3
  26. package/dist/services/strategy-vault/query.d.ts +14 -143
  27. package/dist/services/strategy-vault/query.js +28 -40
  28. package/dist/utils/risk_calculator/risk_calculator.d.ts +3 -3
  29. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { PoolState } from "../../contracts/core/pool/type";
2
2
  import { AccountState, AccountAssetState } from "../../contracts/core/account/type";
3
- import { Prices, VaultCompositions, SyntheticCompositions } from "../composite-oracle/types";
3
+ import { Prices, VaultCompositions, SyntheticCompositions, IAmountPosition } from "../../common/types";
4
4
  export type HealthResult = {
5
5
  result: boolean;
6
6
  healthy: boolean;
@@ -25,11 +25,6 @@ export type MaxWithdrawableResult = {
25
25
  beforeAccountHealth?: HealthResult;
26
26
  afterAccountHealth?: HealthResult;
27
27
  };
28
- type Position = {
29
- supply: bigint;
30
- borrow: bigint;
31
- };
32
- type PositionMap = Record<string, Position>;
33
28
  /**
34
29
  * Simulate interest accrual on pool data
35
30
  */
@@ -57,9 +52,9 @@ export declare function applyDelta(accountData: AccountState, delta: Record<stri
57
52
  * - SYNTHETIC2: LP-TON-USDT(100) → TON(50) + USDT(50)
58
53
  * - VAULT: StrategyVault(100) → TON(30) + USDT(70)
59
54
  *
60
- * 같은 native asset 여러 경로로 나오면 누적됨
55
+ * Same native asset from multiple paths will be accumulated
61
56
  */
62
- export declare function decomposePositions(positions: Record<string, AccountAssetState>, syntheticCompositions: SyntheticCompositions, vaultCompositions?: VaultCompositions): PositionMap;
57
+ export declare function decomposePositions(positions: Record<string, AccountAssetState>, syntheticCompositions: SyntheticCompositions, vaultCompositions?: VaultCompositions): Record<string, IAmountPosition>;
63
58
  /** @deprecated Use decomposePositions instead */
64
59
  export declare const decomposeAccountStatus: typeof decomposePositions;
65
60
  /**
@@ -72,4 +67,3 @@ export declare function calculateRisk(decomposedAccountStatus: Record<string, Om
72
67
  * Takes pre-fetched pool data, account status, and prices
73
68
  */
74
69
  export declare function isHealthyFromData(poolData: PoolState, accountStatus: Record<string, AccountAssetState>, prices: Prices, syntheticCompositions: SyntheticCompositions, vaultCompositions?: VaultCompositions): HealthResult;
75
- export {};
@@ -12,8 +12,9 @@ exports.isHealthyFromData = isHealthyFromData;
12
12
  const core_1 = require("@ton/core");
13
13
  const pool_1 = require("../../contracts/core/pool");
14
14
  const account_1 = require("../../contracts/core/account");
15
- const types_1 = require("../composite-oracle/types");
15
+ const types_1 = require("../../common/types");
16
16
  const utils_1 = require("../../contracts/common/utils");
17
+ const transform_1 = require("../../common/transform");
17
18
  // ============================================================
18
19
  // Position Decomposition Helpers
19
20
  // ============================================================
@@ -23,7 +24,7 @@ const utils_1 = require("../../contracts/common/utils");
23
24
  */
24
25
  function tryDecomposeAsset(asset, position, syntheticCompositions, vaultCompositions) {
25
26
  const data = syntheticCompositions[asset];
26
- // SYNTHETIC1: stTON, tsTON 같은 단일 underlying asset
27
+ // SYNTHETIC1: single underlying asset (e.g. stTON, tsTON)
27
28
  if (data?.assetType === types_1.CompositeAssetType.SYNTHETIC1 &&
28
29
  "underlyingReserve" in data &&
29
30
  data.underlyingReserve &&
@@ -31,14 +32,10 @@ function tryDecomposeAsset(asset, position, syntheticCompositions, vaultComposit
31
32
  const ratio = data.underlyingReserve;
32
33
  const total = data.totalSupply;
33
34
  return [
34
- {
35
- address: (0, utils_1.toAddress)(data.underlyingAddress),
36
- supply: (position.supply * ratio) / total,
37
- borrow: (position.borrow * ratio) / total,
38
- },
35
+ new transform_1.AmountPositionWithAddress((0, utils_1.toAddress)(data.underlyingAddress), (position.supply * ratio) / total, (position.borrow * ratio) / total),
39
36
  ];
40
37
  }
41
- // SYNTHETIC2: LP 토큰 같은 2개 underlying assets
38
+ // SYNTHETIC2: two underlying assets (e.g. LP tokens)
42
39
  if (data?.assetType === types_1.CompositeAssetType.SYNTHETIC2 &&
43
40
  "underlying0Reserve" in data &&
44
41
  data.underlying0Reserve &&
@@ -46,28 +43,17 @@ function tryDecomposeAsset(asset, position, syntheticCompositions, vaultComposit
46
43
  data.totalSupply) {
47
44
  const total = data.totalSupply;
48
45
  return [
49
- {
50
- address: (0, utils_1.toAddress)(data.underlying0Address),
51
- supply: (position.supply * data.underlying0Reserve) / total,
52
- borrow: (position.borrow * data.underlying0Reserve) / total,
53
- },
54
- {
55
- address: (0, utils_1.toAddress)(data.underlying1Address),
56
- supply: (position.supply * data.underlying1Reserve) / total,
57
- borrow: (position.borrow * data.underlying1Reserve) / total,
58
- },
46
+ new transform_1.AmountPositionWithAddress((0, utils_1.toAddress)(data.underlying0Address), (position.supply * data.underlying0Reserve) / total, (position.borrow * data.underlying0Reserve) / total),
47
+ new transform_1.AmountPositionWithAddress((0, utils_1.toAddress)(data.underlying1Address), (position.supply * data.underlying1Reserve) / total, (position.borrow * data.underlying1Reserve) / total),
59
48
  ];
60
49
  }
61
- // VAULT: Strategy Vault - decomposed positions 사용
50
+ // VAULT: Strategy Vault - uses decomposed positions
62
51
  const vault = vaultCompositions[asset];
63
52
  if (vault) {
64
53
  const { decomposed, totalSupply } = vault;
65
- return Object.entries(decomposed).map(([addr, pos]) => ({
66
- address: core_1.Address.parse(addr),
67
- // Vault는 supply/borrow 교차됨
68
- supply: (position.supply * pos.supply + position.borrow * pos.borrow) / totalSupply,
69
- borrow: (position.supply * pos.borrow + position.borrow * pos.supply) / totalSupply,
70
- }));
54
+ return Object.entries(decomposed).map(([addr, pos]) => new transform_1.AmountPositionWithAddress(core_1.Address.parse(addr),
55
+ // Vault supply/borrow cross each other
56
+ (position.supply * pos.supply + position.borrow * pos.borrow) / totalSupply, (position.supply * pos.borrow + position.borrow * pos.supply) / totalSupply));
71
57
  }
72
58
  return null; // Native asset
73
59
  }
@@ -111,21 +97,21 @@ function applyDelta(accountData, delta) {
111
97
  * - SYNTHETIC2: LP-TON-USDT(100) → TON(50) + USDT(50)
112
98
  * - VAULT: StrategyVault(100) → TON(30) + USDT(70)
113
99
  *
114
- * 같은 native asset 여러 경로로 나오면 누적됨
100
+ * Same native asset from multiple paths will be accumulated
115
101
  */
116
102
  function decomposePositions(positions, syntheticCompositions, vaultCompositions = {}) {
117
103
  const accumulatedPositions = {};
118
- const queue = [...Object.values(positions)];
104
+ const queue = [...Object.values(positions)].map(position => transform_1.AmountPositionWithAddress.from(position));
119
105
  while (queue.length > 0) {
120
106
  const current = queue.shift();
121
107
  if (current.supply === 0n && current.borrow === 0n)
122
108
  continue;
123
- // 모든 에셋을 누적 (synthetic/vault/native 모두)
109
+ // Accumulate all assets (synthetic/vault/native)
124
110
  const asset = current.address.toString();
125
- accumulatedPositions[asset] ??= { supply: 0n, borrow: 0n };
111
+ accumulatedPositions[asset] ??= new transform_1.AmountPosition(0n, 0n);
126
112
  accumulatedPositions[asset].supply += current.supply;
127
113
  accumulatedPositions[asset].borrow += current.borrow;
128
- // decompose 가능하면 underlying queue에 추가
114
+ // If decomposable, add underlying to queue
129
115
  const decomposed = tryDecomposeAsset(asset, current, syntheticCompositions, vaultCompositions);
130
116
  if (decomposed) {
131
117
  queue.push(...decomposed);
@@ -2,12 +2,12 @@ import { Cell } from "@ton/core";
2
2
  import { AffluentContext } from "../../context";
3
3
  import { AddressInput, AddressLike } from "../../contracts/common/type";
4
4
  import { PoolState } from "../../contracts/core/pool/type";
5
- import { VaultPositions } from "../composite-oracle/types";
5
+ import { IVaultStateContext } from "../../common/types";
6
6
  /**
7
7
  * Build oracle params Cell from pre-fetched vault positions
8
8
  * Pure computation - no network calls
9
9
  */
10
- export declare function buildOracleParamsCellFromData(assets: string[], oracleConfig: any, vaultPositions: VaultPositions): Promise<Cell>;
10
+ export declare function buildOracleParamsCellFromData(assets: string[], oracleConfig: any, vaultPositions: Record<string, IVaultStateContext>): Promise<Cell>;
11
11
  /**
12
12
  * Get oracle params for a pool operation
13
13
  * Fetches account data and builds oracle params
@@ -5,7 +5,7 @@ import { Pool } from "../../contracts/core/pool";
5
5
  import { PoolState } from "../../contracts/core/pool/type";
6
6
  import { Account } from "../../contracts/core/account";
7
7
  import { AccountState, AccountAssetState } from "../../contracts/core/account/type";
8
- import { VaultCompositions, Prices } from "../composite-oracle/types";
8
+ import { VaultCompositions, Prices } from "../../common/types";
9
9
  import { HealthResult, MaxBorrowableResult, MaxWithdrawableResult } from "./computation";
10
10
  /**
11
11
  * Get Pool contract instance
@@ -2,13 +2,13 @@ import { Cell } from "@ton/core";
2
2
  import { AffluentContext } from "../../context";
3
3
  import { AddressInput, AddressLike } from "../../contracts/common/type";
4
4
  import { StrategyVaultState } from "../../contracts/vault/strategy-vault";
5
- import { VaultPositions } from "../composite-oracle/types";
5
+ import { IVaultStateContext } from "../../common/types";
6
6
  export { OracleExposures, createOracleExposures } from "../composite-oracle/computation";
7
7
  /**
8
8
  * Build oracle params Cell from pre-fetched data
9
9
  * Pure computation - no network calls
10
10
  */
11
- export declare function buildOracleParamsCellFromData(assets: string[], oracleConfig: any, vaultPositions: VaultPositions): Promise<Cell>;
11
+ export declare function buildOracleParamsCellFromData(assets: string[], oracleConfig: any, vaultPositions: Record<string, IVaultStateContext>): Promise<Cell>;
12
12
  /**
13
13
  * Get oracle params for RFQ auction settlement
14
14
  */
@@ -2,13 +2,13 @@ import { Cell } from "@ton/core";
2
2
  import { AffluentContext } from "../../context";
3
3
  import { AddressInput } from "../../contracts/common/type";
4
4
  import { OracleExposures } from "../composite-oracle/computation";
5
- import { VaultPositions } from "../composite-oracle/types";
5
+ import { IVaultStateContext } from "../../common/types";
6
6
  export { OracleExposures, createOracleExposures } from "../composite-oracle/computation";
7
7
  /**
8
8
  * Build oracle params Cell from pre-fetched vault positions
9
9
  * Pure computation - no network calls
10
10
  */
11
- export declare function buildOracleParamsCellFromData(assetAddresses: string[], oracleConfig: any, vaultPositions: VaultPositions): Promise<{
11
+ export declare function buildOracleParamsCellFromData(assetAddresses: string[], oracleConfig: any, vaultPositions: Record<string, IVaultStateContext>): Promise<{
12
12
  oracleParams: Cell;
13
13
  bucket: OracleExposures;
14
14
  }>;
@@ -88,38 +88,8 @@ export declare class ShareVaultServiceV1 {
88
88
  queryId: bigint | undefined;
89
89
  }>;
90
90
  getValuationContext(vaultAddress: AddressInput): Promise<{
91
- storage: {
92
- totalSupply: bigint;
93
- owner: Address | null;
94
- manager: Address | null;
95
- asset: Address;
96
- balance: bigint;
97
- cash: bigint;
98
- totalTargetWeight: bigint;
99
- nextAggregatorIndex: bigint;
100
- isWtonVault: boolean;
101
- assetWallet: Address | null;
102
- whitelistedPools: Record<string, {
103
- isWhitelisted: boolean;
104
- targetWeight: bigint;
105
- supply: bigint;
106
- } & {
107
- address: Address;
108
- }>;
109
- minimumGasFee: {
110
- supply: bigint;
111
- withdraw: bigint;
112
- factorialSupply: bigint;
113
- factorialWithdraw: bigint;
114
- mintVaultShareTokens: bigint;
115
- };
116
- code: import("@ton/core").Cell;
117
- address: Address;
118
- };
119
- totalSupply: bigint;
120
- asset: Address;
121
- reserve: bigint;
122
- poolPositions: Record<string, query.PoolInfoForShareVault>;
91
+ vaultStateContext: import("../../common/transform").VaultStateContext;
92
+ amountContext: import("../../common/transform").VaultAmountContext;
123
93
  netAmount: bigint;
124
94
  exr: number;
125
95
  }>;
@@ -4,6 +4,8 @@ import { AddressInput, AddressLike } from "../../contracts/common/type";
4
4
  import { ShareVault, ShareVaultState } from "../../contracts/vault/share-vault";
5
5
  import { JettonWallet } from "../../contracts/jetton/jetton-wallet";
6
6
  import { PoolInfoForShareVault } from "./type";
7
+ import { VaultStateContext } from "../../common/transform";
8
+ import { PoolState } from "../../contracts/core/pool/type";
7
9
  export { PoolInfoForShareVault, PoolTuple } from "./type";
8
10
  /**
9
11
  * Get ShareVault contract instance
@@ -25,39 +27,10 @@ export declare function getVaultWallet(ctx: AffluentContext, vaultAddress: Addre
25
27
  * Get pool info for all whitelisted pools
26
28
  */
27
29
  export declare function getPoolInfoForShareVault(ctx: AffluentContext, vaultData: ShareVaultState): Promise<Record<string, PoolInfoForShareVault>>;
30
+ export declare function getPoolDataForShareVault(ctx: AffluentContext, vaultAddress: AddressInput): Promise<Record<string, PoolState>>;
28
31
  export declare function getValuationContext(ctx: AffluentContext, vaultAddress: AddressInput): Promise<{
29
- storage: {
30
- totalSupply: bigint;
31
- owner: Address | null;
32
- manager: Address | null;
33
- asset: Address;
34
- balance: bigint;
35
- cash: bigint;
36
- totalTargetWeight: bigint;
37
- nextAggregatorIndex: bigint;
38
- isWtonVault: boolean;
39
- assetWallet: Address | null;
40
- whitelistedPools: Record<string, {
41
- isWhitelisted: boolean;
42
- targetWeight: bigint;
43
- supply: bigint;
44
- } & {
45
- address: Address;
46
- }>;
47
- minimumGasFee: {
48
- supply: bigint;
49
- withdraw: bigint;
50
- factorialSupply: bigint;
51
- factorialWithdraw: bigint;
52
- mintVaultShareTokens: bigint;
53
- };
54
- code: import("@ton/core").Cell;
55
- address: Address;
56
- };
57
- totalSupply: bigint;
58
- asset: Address;
59
- reserve: bigint;
60
- poolPositions: Record<string, PoolInfoForShareVault>;
32
+ vaultStateContext: VaultStateContext;
33
+ amountContext: import("../../common/transform").VaultAmountContext;
61
34
  netAmount: bigint;
62
35
  exr: number;
63
36
  }>;
@@ -38,6 +38,7 @@ exports.getVaultData = getVaultData;
38
38
  exports.getVaultWalletAddress = getVaultWalletAddress;
39
39
  exports.getVaultWallet = getVaultWallet;
40
40
  exports.getPoolInfoForShareVault = getPoolInfoForShareVault;
41
+ exports.getPoolDataForShareVault = getPoolDataForShareVault;
41
42
  exports.getValuationContext = getValuationContext;
42
43
  exports.getEXR = getEXR;
43
44
  const core_1 = require("@ton/core");
@@ -45,7 +46,7 @@ const utils_1 = require("../../contracts/common/utils");
45
46
  const share_vault_1 = require("../../contracts/vault/share-vault");
46
47
  const pool_1 = require("../../contracts/core/pool");
47
48
  const jetton_wallet_1 = require("../../contracts/jetton/jetton-wallet");
48
- const computation_1 = require("./computation");
49
+ const transform_1 = require("../../common/transform");
49
50
  /**
50
51
  * Get ShareVault contract instance
51
52
  */
@@ -109,23 +110,35 @@ async function getPoolInfoForShareVault(ctx, vaultData) {
109
110
  }
110
111
  return poolInfo;
111
112
  }
112
- async function getValuationContext(ctx, vaultAddress) {
113
+ async function getPoolDataForShareVault(ctx, vaultAddress) {
113
114
  const vault = getVault(ctx, vaultAddress);
114
115
  const vaultData = await vault.getVaultData();
115
- const poolInfo = await getPoolInfoForShareVault(ctx, vaultData);
116
- const exrInfo = (0, computation_1.getExchangeRate)(vaultData, poolInfo);
116
+ const poolAddresses = Object.keys(vaultData.whitelistedPools);
117
+ const poolDataEntriesPromises = poolAddresses.map(async (poolAddress) => {
118
+ const pool = ctx.getByContract(pool_1.Pool, core_1.Address.parse(poolAddress));
119
+ return [poolAddress, await pool.getPoolData()];
120
+ });
121
+ const poolDataEntries = await Promise.all(poolDataEntriesPromises);
122
+ return Object.fromEntries(poolDataEntries);
123
+ }
124
+ async function getValuationContext(ctx, vaultAddress) {
125
+ const vault = ctx.getByContract(share_vault_1.ShareVault, (0, utils_1.toAddress)(vaultAddress));
126
+ const vaultData = await vault.getVaultData();
127
+ const poolPositions = await getPoolDataForShareVault(ctx, vaultAddress);
128
+ const poolContexts = {};
129
+ Object.entries(poolPositions).forEach(([poolAddress, poolState]) => poolContexts[poolAddress] = transform_1.PoolContext.fromPoolState(poolState));
130
+ const vaultStateContext = transform_1.VaultStateContext.fromShareVaultState(vaultData);
131
+ const amountContext = vaultStateContext.toAmountContext(poolContexts);
132
+ const netAmount = amountContext.net()[vaultData.asset.toString()].net();
117
133
  return {
118
- storage: vaultData,
119
- totalSupply: vaultData.totalSupply,
120
- asset: vaultData.asset,
121
- reserve: vaultData.cash,
122
- poolPositions: poolInfo,
123
- netAmount: exrInfo.netAmount,
124
- exr: exrInfo.exr,
134
+ vaultStateContext,
135
+ amountContext,
136
+ netAmount,
137
+ exr: Number(netAmount) / Number(vaultData.totalSupply),
125
138
  };
126
139
  }
127
140
  async function getEXR(ctx, vaultAddress) {
128
- return getValuationContext(ctx, vaultAddress).then((vaultCtx) => {
141
+ return getValuationContext(ctx, (0, utils_1.toAddress)(vaultAddress)).then((vaultCtx) => {
129
142
  return vaultCtx.exr;
130
143
  });
131
144
  }
@@ -2122,142 +2122,17 @@ export declare class StrategyVaultV1 {
2122
2122
  queryId: bigint;
2123
2123
  }>;
2124
2124
  getValuationContext(vaultAddress: AddressLike): Promise<{
2125
- storage: {
2126
- globalDepositValueCap: bigint;
2127
- withdrawFeeRate: number;
2128
- queueWithdrawFeeRate: number;
2129
- depositQueueManager: import("../../contracts/vault/strategy-vault").QueueManager;
2130
- withdrawQueueManager: import("../../contracts/vault/strategy-vault").QueueManager;
2131
- interactiveVaultDict: Record<string, import("../../contracts/vault/strategy-vault").InteractiveVaultConfigItem>;
2132
- xchainConnectorAddress: import("@ton/core").Address | null;
2133
- xchainConfig: Record<string, {
2134
- connected: boolean;
2135
- xchainAccountAddress: bigint;
2136
- oftConfig: Map<string, {
2137
- destinationAddress: import("@ton/core").Address;
2138
- forwardGas: bigint;
2139
- forwardPayload?: import("@ton/core").Cell | null;
2140
- lzTransferFeeRate?: bigint;
2141
- }> | null;
2142
- strategyConfig: Map<bigint, {
2143
- isExecutable: boolean;
2144
- }> | null;
2145
- afterStrategyConfig: Map<bigint, {
2146
- isExecutable: boolean;
2147
- }> | null;
2148
- lzGasFee: bigint;
2149
- }>;
2150
- xchainUpdateHash: bigint;
2151
- owner: import("@ton/core").Address;
2152
- manager: import("@ton/core").Address;
2153
- assets: Record<string, import("../../contracts/vault/strategy-vault").AssetV2>;
2154
- factorialPools: Record<string, import("../../contracts/vault/strategy-vault").FactorialPool>;
2155
- aggregatorIndex: bigint;
2156
- content: import("@ton/core").Cell;
2157
- totalSupply: bigint;
2158
- oracleConfig: import("@ton/core").Cell | import("../../contracts/oracle/redstone-onchain-oracle/type").RedstoneOnchainOracleConfig | import("../../contracts/oracle/redstone-oracle/type").RedstonOracleConfig;
2159
- rfqConfig: {
2160
- priceDeviationTolerance: number;
2161
- rfqEventEmitterAddress: string | null;
2162
- } | null;
2163
- gasConfig: Record<string, bigint> | null;
2164
- isPrivateVault: boolean;
2165
- depositCloseTimestamp: number;
2166
- withdrawOpenTimestamp: number;
2167
- whitelistedMinters: import("@ton/core").Dictionary<import("@ton/core").Address, Boolean>;
2168
- lastCollectTime: number;
2169
- managementFeeRatePerYear: number;
2170
- protocolFeeRatePerYear: number;
2171
- collectedManagementFee: bigint;
2172
- collectedProtocolFee: bigint;
2173
- rfqCode: import("@ton/core").Cell;
2174
- walletCode: import("@ton/core").Cell;
2175
- dataAggregatorCode: import("@ton/core").Cell;
2176
- protocolFeeManagerAddress: import("@ton/core").Address;
2177
- rfqIndex: bigint;
2178
- isExecutingStrategy: boolean;
2179
- maxLeverageRatio: number;
2180
- assetWalletDict: Record<string, string>;
2181
- walletAssetDict: Record<string, string>;
2182
- managementFeeRecipientAddress: import("@ton/core").Address | null;
2183
- guardianAddress: import("@ton/core").Address | null;
2184
- timelock: bigint;
2185
- pendingOwnerActionIndex: bigint;
2186
- pendingOwnerActionCount: bigint;
2187
- pendingOwnerAction: any;
2188
- getFactorialPoolAsset: (poolAddress: import("@ton/core").Address, assetAddress: import("@ton/core").Address) => import("../../contracts/vault/strategy-vault").FactorialPoolShare;
2189
- getAsset: (assetAddress: import("@ton/core").Address) => import("../../contracts/vault/strategy-vault").AssetV2;
2190
- version: string;
2191
- address: import("@ton/core").Address;
2192
- balance: bigint;
2193
- code: import("@ton/core").Cell;
2194
- } | {
2195
- globalDepositValueCap: bigint;
2196
- withdrawFeeRate: number;
2197
- queueWithdrawFeeRate: number;
2198
- depositQueueManager: import("../../contracts/vault/strategy-vault").QueueManager;
2199
- withdrawQueueManager: import("../../contracts/vault/strategy-vault").QueueManager;
2200
- interactiveVaultDict: Record<string, import("../../contracts/vault/strategy-vault").InteractiveVaultConfigItem>;
2201
- xchainConnectorAddress: null;
2202
- xchainConfig: null;
2203
- xchainUpdateHash: bigint;
2204
- owner: import("@ton/core").Address;
2205
- manager: import("@ton/core").Address;
2206
- assets: Record<string, import("../../contracts/vault/strategy-vault").AssetV2>;
2207
- factorialPools: Record<string, import("../../contracts/vault/strategy-vault").FactorialPool>;
2208
- aggregatorIndex: bigint;
2209
- content: import("@ton/core").Cell;
2210
- totalSupply: bigint;
2211
- oracleConfig: import("@ton/core").Cell | import("../../contracts/oracle/redstone-onchain-oracle/type").RedstoneOnchainOracleConfig | import("../../contracts/oracle/redstone-oracle/type").RedstonOracleConfig;
2212
- rfqConfig: {
2213
- priceDeviationTolerance: number;
2214
- rfqEventEmitterAddress: string | null;
2215
- } | null;
2216
- gasConfig: Record<string, bigint> | null;
2217
- isPrivateVault: boolean;
2218
- depositCloseTimestamp: number;
2219
- withdrawOpenTimestamp: number;
2220
- whitelistedMinters: import("@ton/core").Dictionary<import("@ton/core").Address, Boolean>;
2221
- lastCollectTime: number;
2222
- managementFeeRatePerYear: number;
2223
- protocolFeeRatePerYear: number;
2224
- collectedManagementFee: bigint;
2225
- collectedProtocolFee: bigint;
2226
- rfqCode: import("@ton/core").Cell;
2227
- walletCode: import("@ton/core").Cell;
2228
- dataAggregatorCode: import("@ton/core").Cell;
2229
- protocolFeeManagerAddress: import("@ton/core").Address;
2230
- rfqIndex: bigint;
2231
- isExecutingStrategy: boolean;
2232
- maxLeverageRatio: number;
2233
- assetWalletDict: Record<string, string>;
2234
- walletAssetDict: Record<string, string>;
2235
- managementFeeRecipientAddress: import("@ton/core").Address | null;
2236
- guardianAddress: import("@ton/core").Address | null;
2237
- timelock: bigint;
2238
- pendingOwnerActionIndex: bigint;
2239
- pendingOwnerActionCount: bigint;
2240
- pendingOwnerAction: any;
2241
- getFactorialPoolAsset: (poolAddress: import("@ton/core").Address, assetAddress: import("@ton/core").Address) => import("../../contracts/vault/strategy-vault").FactorialPoolShare;
2242
- getAsset: (assetAddress: import("@ton/core").Address) => import("../../contracts/vault/strategy-vault").AssetV2;
2243
- version: string;
2244
- address: import("@ton/core").Address;
2245
- balance: bigint;
2246
- code: import("@ton/core").Cell;
2247
- };
2248
- totalSupply: bigint;
2249
- reserves: {
2250
- [k: string]: bigint;
2125
+ vaultStateContext: import("../../common/transform").VaultStateContext;
2126
+ amountContext: import("../../common/transform").VaultAmountContext;
2127
+ valueContext: import("../../common/transform").VaultValueContext;
2128
+ nativeValueDecomposedContext: import("../../common/transform").VaultNativeValueDecomposedContext;
2129
+ nativeAmountDecomposedContext: import("../../common/transform").VaultNativeAmountDecomposedContext;
2130
+ priceInfo: import("../composite-oracle").CompositeOracleResult & {
2131
+ targetVaultAddress: string;
2132
+ price: bigint;
2251
2133
  };
2252
- poolPositions: Record<string, Record<string, {
2253
- supplyShare: bigint;
2254
- supplyAmount: bigint;
2255
- borrowShare: bigint;
2256
- borrowAmount: bigint;
2257
- }>>;
2258
- price: bigint;
2259
- priceInfo: import("../composite-oracle").Prices;
2260
2134
  }>;
2261
2135
  getPrice(vaultAddress: AddressLike): Promise<bigint>;
2262
2136
  getUnderlyingPrices(vaultAddress: AddressLike): Promise<any>;
2137
+ getNativeAmountDecomposedContext(vaultAddress: AddressLike): Promise<import("../../common/transform").VaultNativeAmountDecomposedContext>;
2263
2138
  }
@@ -48,6 +48,7 @@ const manager = __importStar(require("./manager"));
48
48
  exports.manager = manager;
49
49
  const user = __importStar(require("./user"));
50
50
  exports.user = user;
51
+ const utils_1 = require("../../contracts/common/utils");
51
52
  var send_msg_2 = require("../../lib/send-msg");
52
53
  Object.defineProperty(exports, "sendMsg", { enumerable: true, get: function () { return send_msg_2.sendMsg; } });
53
54
  var computation_1 = require("../../contracts/vault/strategy-vault/computation");
@@ -265,7 +266,7 @@ class StrategyVaultV1 {
265
266
  return (0, send_msg_1.sendMsg)(sender, user.createCancelWithdrawQueueMsg(this.ctx, params));
266
267
  }
267
268
  async getValuationContext(vaultAddress) {
268
- return query.getValuationContext(this.ctx, vaultAddress);
269
+ return query.getValuationContext(this.ctx, (0, utils_1.toAddress)(vaultAddress));
269
270
  }
270
271
  async getPrice(vaultAddress) {
271
272
  return query.getPrice(this.ctx, vaultAddress);
@@ -273,5 +274,8 @@ class StrategyVaultV1 {
273
274
  async getUnderlyingPrices(vaultAddress) {
274
275
  return query.getUnderlyingPrices(this.ctx, vaultAddress);
275
276
  }
277
+ async getNativeAmountDecomposedContext(vaultAddress) {
278
+ return query.getNativeAmountDecomposedContext(this.ctx, vaultAddress);
279
+ }
276
280
  }
277
281
  exports.StrategyVaultV1 = StrategyVaultV1;
@@ -4,18 +4,18 @@ import { AddressInput, AddressLike } from "../../contracts/common/type";
4
4
  import { StrategyVaultState } from "../../contracts/vault/strategy-vault";
5
5
  import { PoolState } from "../../contracts/core/pool/type";
6
6
  import { OracleExposures } from "../composite-oracle/computation";
7
- import { VaultPositions } from "../composite-oracle/types";
7
+ import { IVaultStateContext } from "../../common/types";
8
8
  export { OracleExposures, createOracleExposures } from "../composite-oracle/computation";
9
9
  /**
10
10
  * Build oracle params Cell from pre-fetched data
11
11
  * Pure computation - no network calls
12
12
  */
13
- export declare function buildOracleParamsCellFromData(assets: string[], oracleConfig: any, vaultPositions: VaultPositions, extraPools?: string[]): Promise<Cell>;
13
+ export declare function buildOracleParamsCellFromData(assets: string[], oracleConfig: any, vaultPositions: Record<string, IVaultStateContext>, extraPools?: string[]): Promise<Cell>;
14
14
  /**
15
15
  * Build oracle params with bucket from pre-fetched data
16
16
  * Pure computation - no network calls
17
17
  */
18
- export declare function buildOracleParamsWithBucketFromData(assets: string[], oracleConfig: any, vaultPositions: VaultPositions, initialBucket?: OracleExposures, extraPools?: string[]): {
18
+ export declare function buildOracleParamsWithBucketFromData(assets: string[], oracleConfig: any, vaultPositions: Record<string, IVaultStateContext>, initialBucket?: OracleExposures, extraPools?: string[]): {
19
19
  oracleParamsPromise: Promise<Cell>;
20
20
  bucket: OracleExposures;
21
21
  };