@1inch/swap-vm-sdk 0.1.0 → 0.1.2-rc.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.
Files changed (84) hide show
  1. package/README.md +26 -25
  2. package/dist/abi/SwapVM.abi.d.mts +76 -0
  3. package/dist/abi/SwapVM.abi.d.ts +76 -0
  4. package/dist/index.js +641 -367
  5. package/dist/index.mjs +642 -370
  6. package/dist/swap-vm/instructions/concentrate/bigint-sqrt.d.mts +1 -0
  7. package/dist/swap-vm/instructions/concentrate/bigint-sqrt.d.ts +1 -0
  8. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.mts +16 -7
  9. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.ts +16 -7
  10. package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-calculator/types.d.mts +39 -0
  11. package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-calculator/types.d.ts +39 -0
  12. package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-math/concentrate-liquidity-math.d.mts +51 -0
  13. package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-math/concentrate-liquidity-math.d.ts +51 -0
  14. package/dist/swap-vm/instructions/concentrate/index.d.mts +4 -4
  15. package/dist/swap-vm/instructions/concentrate/index.d.ts +4 -4
  16. package/dist/swap-vm/instructions/concentrate/opcodes.d.mts +0 -5
  17. package/dist/swap-vm/instructions/concentrate/opcodes.d.ts +0 -5
  18. package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.mts +1 -2
  19. package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.ts +1 -2
  20. package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args-coder.d.mts +7 -0
  21. package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args-coder.d.ts +7 -0
  22. package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args.d.mts +13 -0
  23. package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args.d.ts +13 -0
  24. package/dist/swap-vm/instructions/fee/{flat-fee-args-coder.d.mts → flat-fee/flat-fee-args-coder.d.mts} +1 -1
  25. package/dist/swap-vm/instructions/fee/{flat-fee-args-coder.d.ts → flat-fee/flat-fee-args-coder.d.ts} +1 -1
  26. package/dist/swap-vm/instructions/fee/{flat-fee-args.d.mts → flat-fee/flat-fee-args.d.mts} +2 -2
  27. package/dist/swap-vm/instructions/fee/{flat-fee-args.d.ts → flat-fee/flat-fee-args.d.ts} +2 -2
  28. package/dist/swap-vm/instructions/fee/index.d.mts +3 -2
  29. package/dist/swap-vm/instructions/fee/index.d.ts +3 -2
  30. package/dist/swap-vm/instructions/fee/opcodes.d.mts +28 -8
  31. package/dist/swap-vm/instructions/fee/opcodes.d.ts +28 -8
  32. package/dist/swap-vm/instructions/fee/{protocol-fee-args-coder.d.mts → protocol-fee/protocol-fee-args-coder.d.mts} +1 -1
  33. package/dist/swap-vm/instructions/fee/{protocol-fee-args-coder.d.ts → protocol-fee/protocol-fee-args-coder.d.ts} +1 -1
  34. package/dist/swap-vm/instructions/fee/{protocol-fee-args.d.mts → protocol-fee/protocol-fee-args.d.mts} +3 -3
  35. package/dist/swap-vm/instructions/fee/{protocol-fee-args.d.ts → protocol-fee/protocol-fee-args.d.ts} +3 -3
  36. package/dist/swap-vm/instructions/index.d.mts +2 -1
  37. package/dist/swap-vm/instructions/index.d.ts +2 -1
  38. package/dist/swap-vm/instructions/pegged-swap/index.d.mts +3 -0
  39. package/dist/swap-vm/instructions/pegged-swap/index.d.ts +3 -0
  40. package/dist/swap-vm/instructions/pegged-swap/opcodes.d.mts +5 -0
  41. package/dist/swap-vm/instructions/pegged-swap/opcodes.d.ts +5 -0
  42. package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args-coder.d.mts +7 -0
  43. package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args-coder.d.ts +7 -0
  44. package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args.d.mts +29 -0
  45. package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args.d.ts +29 -0
  46. package/dist/swap-vm/instructions/pegged-swap/rate-resolver.d.mts +1 -0
  47. package/dist/swap-vm/instructions/pegged-swap/rate-resolver.d.ts +1 -0
  48. package/dist/swap-vm/instructions/pegged-swap/types.d.mts +6 -0
  49. package/dist/swap-vm/instructions/pegged-swap/types.d.ts +6 -0
  50. package/dist/swap-vm/programs/aqua-program-builder.d.mts +13 -16
  51. package/dist/swap-vm/programs/aqua-program-builder.d.ts +13 -16
  52. package/dist/swap-vm/programs/regular-program-builder.d.mts +21 -9
  53. package/dist/swap-vm/programs/regular-program-builder.d.ts +21 -9
  54. package/dist/swap-vm/strategies/aqua-amm-strategy.d.mts +2 -19
  55. package/dist/swap-vm/strategies/aqua-amm-strategy.d.ts +2 -19
  56. package/dist/swap-vm/strategies/aqua-pegged-amm-strategy.d.mts +11 -0
  57. package/dist/swap-vm/strategies/aqua-pegged-amm-strategy.d.ts +11 -0
  58. package/dist/swap-vm/strategies/aqua-xyc-amm-strategy.d.mts +11 -0
  59. package/dist/swap-vm/strategies/aqua-xyc-amm-strategy.d.ts +11 -0
  60. package/dist/swap-vm/strategies/index.d.mts +3 -0
  61. package/dist/swap-vm/strategies/index.d.ts +3 -0
  62. package/dist/swap-vm/strategies/types.d.mts +19 -0
  63. package/dist/swap-vm/strategies/types.d.ts +19 -0
  64. package/dist/swap-vm/taker-traits.d.mts +12 -2
  65. package/dist/swap-vm/taker-traits.d.ts +12 -2
  66. package/package.json +18 -18
  67. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.mts +0 -7
  68. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.ts +0 -7
  69. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.mts +0 -17
  70. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.ts +0 -17
  71. package/dist/swap-vm/instructions/concentrate/types.d.mts +0 -5
  72. package/dist/swap-vm/instructions/concentrate/types.d.ts +0 -5
  73. package/dist/swap-vm/instructions/concentrate/utils.d.mts +0 -4
  74. package/dist/swap-vm/instructions/concentrate/utils.d.ts +0 -4
  75. package/dist/swap-vm/instructions/stable-swap/index.d.mts +0 -2
  76. package/dist/swap-vm/instructions/stable-swap/index.d.ts +0 -2
  77. package/dist/swap-vm/instructions/stable-swap/opcodes.d.mts +0 -4
  78. package/dist/swap-vm/instructions/stable-swap/opcodes.d.ts +0 -4
  79. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.mts +0 -7
  80. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.ts +0 -7
  81. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.mts +0 -25
  82. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.ts +0 -25
  83. package/dist/swap-vm/types.d.mts +0 -22
  84. package/dist/swap-vm/types.d.ts +0 -22
@@ -0,0 +1 @@
1
+ export declare function bigintSqrt(value: bigint): bigint;
@@ -0,0 +1 @@
1
+ export declare function bigintSqrt(value: bigint): bigint;
@@ -1,18 +1,27 @@
1
- import type { Address, HexString } from '@1inch/sdk-core';
1
+ import type { HexString } from '@1inch/sdk-core';
2
2
  import type { IArgsData } from '../types';
3
+ export declare const ONE_E18: bigint;
3
4
  /**
4
- * Arguments for concentrateGrowLiquidity2D instruction with two deltas
5
+ * Arguments for concentrateGrowLiquidity2D instruction
6
+ * Contract encodes sqrtPriceMin and sqrtPriceMax (2 × uint256, 64 bytes)
7
+ * P = tokenGt/tokenLt; sqrt(P) in 1e18 fixed-point
5
8
  * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/XYCConcentrate.sol#L172
6
9
  **/
7
10
  export declare class ConcentrateGrowLiquidity2DArgs implements IArgsData {
8
- readonly deltaLt: bigint;
9
- readonly deltaGt: bigint;
11
+ readonly sqrtPriceMin: bigint;
12
+ readonly sqrtPriceMax: bigint;
10
13
  static readonly CODER: any;
11
- constructor(deltaLt: bigint, deltaGt: bigint);
14
+ constructor(sqrtPriceMin: bigint, sqrtPriceMax: bigint);
12
15
  /**
13
- * Helper to create args from token addresses and deltas (handles ordering)
16
+ * Build args from sqrt prices (1e18 fixed-point).
17
+ * sqrtPriceMin/Max = sqrt(P) where P = tokenGt/tokenLt.
14
18
  **/
15
- static fromTokenDeltas(tokenA: Address, tokenB: Address, deltaA: bigint, deltaB: bigint): ConcentrateGrowLiquidity2DArgs;
19
+ static fromSqrtPrices(sqrtPriceMin: bigint, sqrtPriceMax: bigint): ConcentrateGrowLiquidity2DArgs;
20
+ /**
21
+ * Build args from raw prices P_min, P_max (1e18 fixed-point).
22
+ * Computes sqrtPrice = sqrt(P * 1e18) so that (sqrtPrice/1e18)^2 = P/1e18.
23
+ **/
24
+ static fromRawPrices(rawPriceMin: bigint, rawPriceMax: bigint): ConcentrateGrowLiquidity2DArgs;
16
25
  /**
17
26
  * Decodes hex data into ConcentrateGrowLiquidity2DArgs instance
18
27
  **/
@@ -1,18 +1,27 @@
1
- import type { Address, HexString } from '@1inch/sdk-core';
1
+ import type { HexString } from '@1inch/sdk-core';
2
2
  import type { IArgsData } from '../types';
3
+ export declare const ONE_E18: bigint;
3
4
  /**
4
- * Arguments for concentrateGrowLiquidity2D instruction with two deltas
5
+ * Arguments for concentrateGrowLiquidity2D instruction
6
+ * Contract encodes sqrtPriceMin and sqrtPriceMax (2 × uint256, 64 bytes)
7
+ * P = tokenGt/tokenLt; sqrt(P) in 1e18 fixed-point
5
8
  * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/XYCConcentrate.sol#L172
6
9
  **/
7
10
  export declare class ConcentrateGrowLiquidity2DArgs implements IArgsData {
8
- readonly deltaLt: bigint;
9
- readonly deltaGt: bigint;
11
+ readonly sqrtPriceMin: bigint;
12
+ readonly sqrtPriceMax: bigint;
10
13
  static readonly CODER: any;
11
- constructor(deltaLt: bigint, deltaGt: bigint);
14
+ constructor(sqrtPriceMin: bigint, sqrtPriceMax: bigint);
12
15
  /**
13
- * Helper to create args from token addresses and deltas (handles ordering)
16
+ * Build args from sqrt prices (1e18 fixed-point).
17
+ * sqrtPriceMin/Max = sqrt(P) where P = tokenGt/tokenLt.
14
18
  **/
15
- static fromTokenDeltas(tokenA: Address, tokenB: Address, deltaA: bigint, deltaB: bigint): ConcentrateGrowLiquidity2DArgs;
19
+ static fromSqrtPrices(sqrtPriceMin: bigint, sqrtPriceMax: bigint): ConcentrateGrowLiquidity2DArgs;
20
+ /**
21
+ * Build args from raw prices P_min, P_max (1e18 fixed-point).
22
+ * Computes sqrtPrice = sqrt(P * 1e18) so that (sqrtPrice/1e18)^2 = P/1e18.
23
+ **/
24
+ static fromRawPrices(rawPriceMin: bigint, rawPriceMax: bigint): ConcentrateGrowLiquidity2DArgs;
16
25
  /**
17
26
  * Decodes hex data into ConcentrateGrowLiquidity2DArgs instance
18
27
  **/
@@ -0,0 +1,39 @@
1
+ import type { Address } from '@1inch/sdk-core';
2
+ /**
3
+ * Per-token input for the calculator: address, decimals, and the maximum amount
4
+ * the user is willing to allocate (used by computeMaxAllocation).
5
+ */
6
+ export type ConcentrateTokenInfo = {
7
+ address: Address;
8
+ decimals: bigint;
9
+ maxAvailableLiquidity: bigint;
10
+ };
11
+ /**
12
+ * Price range in "raw" form: each price is quote token per 1 unit of the other token,
13
+ * scaled by 10^(token0Decimals + token1Decimals). minPrice < spotPrice < maxPrice.
14
+ */
15
+ export type ScaledPrices = {
16
+ quoteToken: Address;
17
+ minPriceRaw: bigint;
18
+ spotPriceRaw: bigint;
19
+ maxPriceRaw: bigint;
20
+ };
21
+ /**
22
+ * Result of allocation: sqrt prices and the token0/token1 reserves
23
+ * (raw amounts) to use for the concentrated liquidity position.
24
+ */
25
+ export type ConcentratedLiquidityInfo = {
26
+ sqrtPriceMin: bigint;
27
+ sqrtPriceSpot: bigint;
28
+ sqrtPriceMax: bigint;
29
+ token0Reserve: bigint;
30
+ token1Reserve: bigint;
31
+ };
32
+ /**
33
+ * Constructor argument: the two tokens (tokenA, tokenB). Order is arbitrary;
34
+ * token0/token1 are derived by address comparison.
35
+ */
36
+ export type ConcentrateLiquidityCalculatorArgs = {
37
+ tokenA: ConcentrateTokenInfo;
38
+ tokenB: ConcentrateTokenInfo;
39
+ };
@@ -0,0 +1,39 @@
1
+ import type { Address } from '@1inch/sdk-core';
2
+ /**
3
+ * Per-token input for the calculator: address, decimals, and the maximum amount
4
+ * the user is willing to allocate (used by computeMaxAllocation).
5
+ */
6
+ export type ConcentrateTokenInfo = {
7
+ address: Address;
8
+ decimals: bigint;
9
+ maxAvailableLiquidity: bigint;
10
+ };
11
+ /**
12
+ * Price range in "raw" form: each price is quote token per 1 unit of the other token,
13
+ * scaled by 10^(token0Decimals + token1Decimals). minPrice < spotPrice < maxPrice.
14
+ */
15
+ export type ScaledPrices = {
16
+ quoteToken: Address;
17
+ minPriceRaw: bigint;
18
+ spotPriceRaw: bigint;
19
+ maxPriceRaw: bigint;
20
+ };
21
+ /**
22
+ * Result of allocation: sqrt prices and the token0/token1 reserves
23
+ * (raw amounts) to use for the concentrated liquidity position.
24
+ */
25
+ export type ConcentratedLiquidityInfo = {
26
+ sqrtPriceMin: bigint;
27
+ sqrtPriceSpot: bigint;
28
+ sqrtPriceMax: bigint;
29
+ token0Reserve: bigint;
30
+ token1Reserve: bigint;
31
+ };
32
+ /**
33
+ * Constructor argument: the two tokens (tokenA, tokenB). Order is arbitrary;
34
+ * token0/token1 are derived by address comparison.
35
+ */
36
+ export type ConcentrateLiquidityCalculatorArgs = {
37
+ tokenA: ConcentrateTokenInfo;
38
+ tokenB: ConcentrateTokenInfo;
39
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Compute max achievable L from available token amounts at a given spot price.
3
+ * Takes the minimum of L implied by each token, then returns the resulting
4
+ * targetL and the actual amounts (actualLt, actualGt) needed.
5
+ *
6
+ * Mirrors XYCConcentrateArgsBuilder.computeLiquidityFromAmounts in XYCConcentrate.sol.
7
+ *
8
+ * @param availableLt Available amount of token with lower address
9
+ * @param availableGt Available amount of token with higher address
10
+ * @param sqrtPspot sqrt(P_spot) in 1e18 fixed-point
11
+ * @param sqrtPmin sqrt(P_min) in 1e18 fixed-point
12
+ * @param sqrtPmax sqrt(P_max) in 1e18 fixed-point
13
+ * @returns { targetL, actualLt, actualGt } max L and amounts actually needed (<= available)
14
+ */
15
+ export declare function computeLiquidityFromAmounts(availableLt: bigint, availableGt: bigint, sqrtPspot: bigint, sqrtPmin: bigint, sqrtPmax: bigint): {
16
+ targetL: bigint;
17
+ actualLt: bigint;
18
+ actualGt: bigint;
19
+ };
20
+ /**
21
+ * Compute the initial balances for given L, P_spot, P_min, P_max:
22
+ * bLt = L * (sqrtPmax - sqrtPspot) / (sqrtPmax * sqrtPspot / ONE)
23
+ * bGt = L * (sqrtPspot - sqrtPmin)
24
+ *
25
+ * Mirrors XYCConcentrateArgsBuilder.computeBalances in XYCConcentrate.sol.
26
+ *
27
+ * @param targetL Liquidity L (1e18 scale implied by ONE)
28
+ * @param sqrtPspot sqrt(P_spot) in 1e18 fixed-point
29
+ * @param sqrtPmin sqrt(P_min) in 1e18 fixed-point
30
+ * @param sqrtPmax sqrt(P_max) in 1e18 fixed-point
31
+ * @returns { bLt, bGt } amounts of tokenLt and tokenGt for the given L and prices
32
+ */
33
+ export declare function computeBalances(targetL: bigint, sqrtPspot: bigint, sqrtPmin: bigint, sqrtPmax: bigint): {
34
+ bLt: bigint;
35
+ bGt: bigint;
36
+ };
37
+ /**
38
+ * Compute the implied spot price and liquidity from real balances and price bounds.
39
+ *
40
+ * Mirrors XYCConcentrateArgsBuilder.computeLiquidityAndPrice in XYCConcentrate.sol.
41
+ *
42
+ * @param balanceLt Real balance of the token with lower address
43
+ * @param balanceGt Real balance of the token with higher address
44
+ * @param sqrtPriceMin sqrt(P_min) in 1e18 fixed-point
45
+ * @param sqrtPriceMax sqrt(P_max) in 1e18 fixed-point
46
+ * @returns { liquidity, sqrtPriceSpot } L and implied sqrt(P_spot) in 1e18 fixed-point
47
+ */
48
+ export declare function computeLiquidityAndPrice(balanceLt: bigint, balanceGt: bigint, sqrtPriceMin: bigint, sqrtPriceMax: bigint): {
49
+ liquidity: bigint;
50
+ sqrtPriceSpot: bigint;
51
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Compute max achievable L from available token amounts at a given spot price.
3
+ * Takes the minimum of L implied by each token, then returns the resulting
4
+ * targetL and the actual amounts (actualLt, actualGt) needed.
5
+ *
6
+ * Mirrors XYCConcentrateArgsBuilder.computeLiquidityFromAmounts in XYCConcentrate.sol.
7
+ *
8
+ * @param availableLt Available amount of token with lower address
9
+ * @param availableGt Available amount of token with higher address
10
+ * @param sqrtPspot sqrt(P_spot) in 1e18 fixed-point
11
+ * @param sqrtPmin sqrt(P_min) in 1e18 fixed-point
12
+ * @param sqrtPmax sqrt(P_max) in 1e18 fixed-point
13
+ * @returns { targetL, actualLt, actualGt } max L and amounts actually needed (<= available)
14
+ */
15
+ export declare function computeLiquidityFromAmounts(availableLt: bigint, availableGt: bigint, sqrtPspot: bigint, sqrtPmin: bigint, sqrtPmax: bigint): {
16
+ targetL: bigint;
17
+ actualLt: bigint;
18
+ actualGt: bigint;
19
+ };
20
+ /**
21
+ * Compute the initial balances for given L, P_spot, P_min, P_max:
22
+ * bLt = L * (sqrtPmax - sqrtPspot) / (sqrtPmax * sqrtPspot / ONE)
23
+ * bGt = L * (sqrtPspot - sqrtPmin)
24
+ *
25
+ * Mirrors XYCConcentrateArgsBuilder.computeBalances in XYCConcentrate.sol.
26
+ *
27
+ * @param targetL Liquidity L (1e18 scale implied by ONE)
28
+ * @param sqrtPspot sqrt(P_spot) in 1e18 fixed-point
29
+ * @param sqrtPmin sqrt(P_min) in 1e18 fixed-point
30
+ * @param sqrtPmax sqrt(P_max) in 1e18 fixed-point
31
+ * @returns { bLt, bGt } amounts of tokenLt and tokenGt for the given L and prices
32
+ */
33
+ export declare function computeBalances(targetL: bigint, sqrtPspot: bigint, sqrtPmin: bigint, sqrtPmax: bigint): {
34
+ bLt: bigint;
35
+ bGt: bigint;
36
+ };
37
+ /**
38
+ * Compute the implied spot price and liquidity from real balances and price bounds.
39
+ *
40
+ * Mirrors XYCConcentrateArgsBuilder.computeLiquidityAndPrice in XYCConcentrate.sol.
41
+ *
42
+ * @param balanceLt Real balance of the token with lower address
43
+ * @param balanceGt Real balance of the token with higher address
44
+ * @param sqrtPriceMin sqrt(P_min) in 1e18 fixed-point
45
+ * @param sqrtPriceMax sqrt(P_max) in 1e18 fixed-point
46
+ * @returns { liquidity, sqrtPriceSpot } L and implied sqrt(P_spot) in 1e18 fixed-point
47
+ */
48
+ export declare function computeLiquidityAndPrice(balanceLt: bigint, balanceGt: bigint, sqrtPriceMin: bigint, sqrtPriceMax: bigint): {
49
+ liquidity: bigint;
50
+ sqrtPriceSpot: bigint;
51
+ };
@@ -1,5 +1,5 @@
1
1
  export * from './opcodes';
2
- export { ConcentrateGrowLiquidityXDArgs } from './concentrate-grow-liquidity-xd-args';
3
- export { ConcentrateGrowLiquidity2DArgs } from './concentrate-grow-liquidity-2d-args';
4
- export type { TokenDelta } from './types';
5
- export * from './utils';
2
+ export { ConcentrateGrowLiquidity2DArgs, ONE_E18 } from './concentrate-grow-liquidity-2d-args';
3
+ export { computeLiquidityFromAmounts, computeBalances, computeLiquidityAndPrice, } from './concentrate-liquidity-math/concentrate-liquidity-math';
4
+ export type { ConcentrateTokenInfo, ScaledPrices, ConcentratedLiquidityInfo, } from './concentrate-liquidity-calculator/types';
5
+ export * from './bigint-sqrt';
@@ -1,5 +1,5 @@
1
1
  export * from './opcodes';
2
- export { ConcentrateGrowLiquidityXDArgs } from './concentrate-grow-liquidity-xd-args';
3
- export { ConcentrateGrowLiquidity2DArgs } from './concentrate-grow-liquidity-2d-args';
4
- export type { TokenDelta } from './types';
5
- export * from './utils';
2
+ export { ConcentrateGrowLiquidity2DArgs, ONE_E18 } from './concentrate-grow-liquidity-2d-args';
3
+ export { computeLiquidityFromAmounts, computeBalances, computeLiquidityAndPrice, } from './concentrate-liquidity-math/concentrate-liquidity-math';
4
+ export type { ConcentrateTokenInfo, ScaledPrices, ConcentratedLiquidityInfo, } from './concentrate-liquidity-calculator/types';
5
+ export * from './bigint-sqrt';
@@ -1,8 +1,3 @@
1
- /**
2
- * Concentrates liquidity within price bounds for multiple tokens
3
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/XYCConcentrate.sol#L139
4
- **/
5
- export declare const concentrateGrowLiquidityXD: any;
6
1
  /**
7
2
  * Concentrates liquidity within price bounds for two tokens
8
3
  * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/XYCConcentrate.sol#L172
@@ -1,8 +1,3 @@
1
- /**
2
- * Concentrates liquidity within price bounds for multiple tokens
3
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/XYCConcentrate.sol#L139
4
- **/
5
- export declare const concentrateGrowLiquidityXD: any;
6
1
  /**
7
2
  * Concentrates liquidity within price bounds for two tokens
8
3
  * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/XYCConcentrate.sol#L172
@@ -11,7 +11,6 @@ import type { IArgsData } from '../types';
11
11
  * - Only works for 1=>0 swaps (token1 to token0)
12
12
  *
13
13
  * The decay factor determines the price reduction rate:
14
- * - 1.0e18 = no decay (constant price)
15
14
  * - 0.999e18 = 0.1% decay per second
16
15
  * - 0.99e18 = 1% decay per second
17
16
  * - 0.9e18 = 10% decay per second
@@ -33,7 +32,7 @@ export declare class DutchAuctionArgs implements IArgsData {
33
32
  /**
34
33
  * startTime - auction start time (uint40)
35
34
  * duration - auction duration in seconds (uint16)
36
- * decayFactor - price decay per second, 1e18 = no decay (uint32)
35
+ * decayFactor - price decay per second, 1e18 = no decay (uint64)
37
36
  **/
38
37
  constructor(startTime: bigint, duration: bigint, decayFactor: bigint);
39
38
  /**
@@ -11,7 +11,6 @@ import type { IArgsData } from '../types';
11
11
  * - Only works for 1=>0 swaps (token1 to token0)
12
12
  *
13
13
  * The decay factor determines the price reduction rate:
14
- * - 1.0e18 = no decay (constant price)
15
14
  * - 0.999e18 = 0.1% decay per second
16
15
  * - 0.99e18 = 1% decay per second
17
16
  * - 0.9e18 = 10% decay per second
@@ -33,7 +32,7 @@ export declare class DutchAuctionArgs implements IArgsData {
33
32
  /**
34
33
  * startTime - auction start time (uint40)
35
34
  * duration - auction duration in seconds (uint16)
36
- * decayFactor - price decay per second, 1e18 = no decay (uint32)
35
+ * decayFactor - price decay per second, 1e18 = no decay (uint64)
37
36
  **/
38
37
  constructor(startTime: bigint, duration: bigint, decayFactor: bigint);
39
38
  /**
@@ -0,0 +1,7 @@
1
+ import { HexString } from '@1inch/sdk-core';
2
+ import { DynamicProtocolFeeArgs } from './dynamic-protocol-fee-args';
3
+ import type { IArgsCoder } from '../../types';
4
+ export declare class DynamicProtocolFeeArgsCoder implements IArgsCoder<DynamicProtocolFeeArgs> {
5
+ encode(args: DynamicProtocolFeeArgs): HexString;
6
+ decode(data: HexString): DynamicProtocolFeeArgs;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { HexString } from '@1inch/sdk-core';
2
+ import { DynamicProtocolFeeArgs } from './dynamic-protocol-fee-args';
3
+ import type { IArgsCoder } from '../../types';
4
+ export declare class DynamicProtocolFeeArgsCoder implements IArgsCoder<DynamicProtocolFeeArgs> {
5
+ encode(args: DynamicProtocolFeeArgs): HexString;
6
+ decode(data: HexString): DynamicProtocolFeeArgs;
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { Address, HexString } from '@1inch/sdk-core';
2
+ import type { IArgsData } from '../../types';
3
+ /**
4
+ * Arguments for dynamic protocol fee instructions (dynamicProtocolFeeAmountInXD, aquaDynamicProtocolFeeAmountInXD).
5
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol
6
+ **/
7
+ export declare class DynamicProtocolFeeArgs implements IArgsData {
8
+ readonly feeProvider: Address;
9
+ static readonly CODER: any;
10
+ constructor(feeProvider: Address);
11
+ static decode(data: HexString): DynamicProtocolFeeArgs;
12
+ toJSON(): Record<string, unknown>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import type { Address, HexString } from '@1inch/sdk-core';
2
+ import type { IArgsData } from '../../types';
3
+ /**
4
+ * Arguments for dynamic protocol fee instructions (dynamicProtocolFeeAmountInXD, aquaDynamicProtocolFeeAmountInXD).
5
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol
6
+ **/
7
+ export declare class DynamicProtocolFeeArgs implements IArgsData {
8
+ readonly feeProvider: Address;
9
+ static readonly CODER: any;
10
+ constructor(feeProvider: Address);
11
+ static decode(data: HexString): DynamicProtocolFeeArgs;
12
+ toJSON(): Record<string, unknown>;
13
+ }
@@ -1,6 +1,6 @@
1
1
  import { HexString } from '@1inch/sdk-core';
2
2
  import { FlatFeeArgs } from './flat-fee-args';
3
- import type { IArgsCoder } from '../types';
3
+ import type { IArgsCoder } from '../../types';
4
4
  export declare class FlatFeeArgsCoder implements IArgsCoder<FlatFeeArgs> {
5
5
  encode(args: FlatFeeArgs): HexString;
6
6
  decode(data: HexString): FlatFeeArgs;
@@ -1,6 +1,6 @@
1
1
  import { HexString } from '@1inch/sdk-core';
2
2
  import { FlatFeeArgs } from './flat-fee-args';
3
- import type { IArgsCoder } from '../types';
3
+ import type { IArgsCoder } from '../../types';
4
4
  export declare class FlatFeeArgsCoder implements IArgsCoder<FlatFeeArgs> {
5
5
  encode(args: FlatFeeArgs): HexString;
6
6
  decode(data: HexString): FlatFeeArgs;
@@ -1,7 +1,7 @@
1
1
  import type { HexString } from '@1inch/sdk-core';
2
- import type { IArgsData } from '../types';
2
+ import type { IArgsData } from '../../types';
3
3
  /**
4
- * Arguments for flat fee instructions (flatFeeXD, flatFeeAmountInXD, flatFeeAmountOutXD, progressiveFeeXD)
4
+ * Arguments for flat fee instructions (flatFeeAmountInXD)
5
5
  * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L66
6
6
  **/
7
7
  export declare class FlatFeeArgs implements IArgsData {
@@ -1,7 +1,7 @@
1
1
  import type { HexString } from '@1inch/sdk-core';
2
- import type { IArgsData } from '../types';
2
+ import type { IArgsData } from '../../types';
3
3
  /**
4
- * Arguments for flat fee instructions (flatFeeXD, flatFeeAmountInXD, flatFeeAmountOutXD, progressiveFeeXD)
4
+ * Arguments for flat fee instructions (flatFeeAmountInXD)
5
5
  * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L66
6
6
  **/
7
7
  export declare class FlatFeeArgs implements IArgsData {
@@ -1,3 +1,4 @@
1
1
  export * from './opcodes';
2
- export { FlatFeeArgs } from './flat-fee-args';
3
- export { ProtocolFeeArgs } from './protocol-fee-args';
2
+ export { FlatFeeArgs } from './flat-fee/flat-fee-args';
3
+ export { ProtocolFeeArgs } from './protocol-fee/protocol-fee-args';
4
+ export { DynamicProtocolFeeArgs } from './dynamic-protocol-fee/dynamic-protocol-fee-args';
@@ -1,3 +1,4 @@
1
1
  export * from './opcodes';
2
- export { FlatFeeArgs } from './flat-fee-args';
3
- export { ProtocolFeeArgs } from './protocol-fee-args';
2
+ export { FlatFeeArgs } from './flat-fee/flat-fee-args';
3
+ export { ProtocolFeeArgs } from './protocol-fee/protocol-fee-args';
4
+ export { DynamicProtocolFeeArgs } from './dynamic-protocol-fee/dynamic-protocol-fee-args';
@@ -1,30 +1,50 @@
1
1
  /**
2
2
  * Applies fee to amountIn
3
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L66
3
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L72
4
4
  **/
5
5
  export declare const flatFeeAmountInXD: any;
6
+ /**
7
+ * Protocol fee on amountIn (feeBps + to). Fee transferred from maker to recipient.
8
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L101
9
+ **/
10
+ export declare const protocolFeeAmountInXD: any;
11
+ /**
12
+ * Protocol fee on amountIn for Aqua (feeBps + to). Pulls from maker's Aqua balance.
13
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L121
14
+ **/
15
+ export declare const aquaProtocolFeeAmountInXD: any;
16
+ /**
17
+ * Dynamic protocol fee: args = feeProvider address (20 bytes).
18
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L148
19
+ **/
20
+ export declare const dynamicProtocolFeeAmountInXD: any;
21
+ /**
22
+ * Dynamic protocol fee for Aqua: args = feeProvider address (20 bytes).
23
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L197
24
+ **/
25
+ export declare const aquaDynamicProtocolFeeAmountInXD: any;
6
26
  /**
7
27
  * Applies fee to amountOut
8
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L72
28
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L40
9
29
  **/
10
30
  export declare const flatFeeAmountOutXD: any;
11
31
  /**
12
32
  * Applies progressive fee to amountIn
13
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L78
33
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L46
14
34
  **/
15
35
  export declare const progressiveFeeInXD: any;
16
36
  /**
17
37
  * Applies progressive fee to amountOut
18
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L106
38
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L74
19
39
  **/
20
40
  export declare const progressiveFeeOutXD: any;
21
41
  /**
22
- * Applies protocol fee to amountOut with direct transfer
23
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L102
42
+ * Protocol fee on amountOut (feeBps + to). Fee transferred from maker to recipient.
43
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L107
24
44
  **/
25
45
  export declare const protocolFeeAmountOutXD: any;
26
46
  /**
27
- * Applies protocol fee to amountOut through Aqua protocol
28
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L110
47
+ * Protocol fee on amountOut (feeBps + to) for Aqua (feeBps + to). Pulls from maker's Aqua balance.
48
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L122
29
49
  **/
30
50
  export declare const aquaProtocolFeeAmountOutXD: any;
@@ -1,30 +1,50 @@
1
1
  /**
2
2
  * Applies fee to amountIn
3
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L66
3
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L72
4
4
  **/
5
5
  export declare const flatFeeAmountInXD: any;
6
+ /**
7
+ * Protocol fee on amountIn (feeBps + to). Fee transferred from maker to recipient.
8
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L101
9
+ **/
10
+ export declare const protocolFeeAmountInXD: any;
11
+ /**
12
+ * Protocol fee on amountIn for Aqua (feeBps + to). Pulls from maker's Aqua balance.
13
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L121
14
+ **/
15
+ export declare const aquaProtocolFeeAmountInXD: any;
16
+ /**
17
+ * Dynamic protocol fee: args = feeProvider address (20 bytes).
18
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L148
19
+ **/
20
+ export declare const dynamicProtocolFeeAmountInXD: any;
21
+ /**
22
+ * Dynamic protocol fee for Aqua: args = feeProvider address (20 bytes).
23
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L197
24
+ **/
25
+ export declare const aquaDynamicProtocolFeeAmountInXD: any;
6
26
  /**
7
27
  * Applies fee to amountOut
8
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L72
28
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L40
9
29
  **/
10
30
  export declare const flatFeeAmountOutXD: any;
11
31
  /**
12
32
  * Applies progressive fee to amountIn
13
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L78
33
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L46
14
34
  **/
15
35
  export declare const progressiveFeeInXD: any;
16
36
  /**
17
37
  * Applies progressive fee to amountOut
18
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L106
38
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L74
19
39
  **/
20
40
  export declare const progressiveFeeOutXD: any;
21
41
  /**
22
- * Applies protocol fee to amountOut with direct transfer
23
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L102
42
+ * Protocol fee on amountOut (feeBps + to). Fee transferred from maker to recipient.
43
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L107
24
44
  **/
25
45
  export declare const protocolFeeAmountOutXD: any;
26
46
  /**
27
- * Applies protocol fee to amountOut through Aqua protocol
28
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L110
47
+ * Protocol fee on amountOut (feeBps + to) for Aqua (feeBps + to). Pulls from maker's Aqua balance.
48
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/FeeExperimental.sol#L122
29
49
  **/
30
50
  export declare const aquaProtocolFeeAmountOutXD: any;
@@ -1,6 +1,6 @@
1
1
  import { HexString } from '@1inch/sdk-core';
2
2
  import { ProtocolFeeArgs } from './protocol-fee-args';
3
- import type { IArgsCoder } from '../types';
3
+ import type { IArgsCoder } from '../../types';
4
4
  export declare class ProtocolFeeArgsCoder implements IArgsCoder<ProtocolFeeArgs> {
5
5
  encode(args: ProtocolFeeArgs): HexString;
6
6
  decode(data: HexString): ProtocolFeeArgs;
@@ -1,6 +1,6 @@
1
1
  import { HexString } from '@1inch/sdk-core';
2
2
  import { ProtocolFeeArgs } from './protocol-fee-args';
3
- import type { IArgsCoder } from '../types';
3
+ import type { IArgsCoder } from '../../types';
4
4
  export declare class ProtocolFeeArgsCoder implements IArgsCoder<ProtocolFeeArgs> {
5
5
  encode(args: ProtocolFeeArgs): HexString;
6
6
  decode(data: HexString): ProtocolFeeArgs;
@@ -1,8 +1,8 @@
1
1
  import type { Address, HexString } from '@1inch/sdk-core';
2
- import type { IArgsData } from '../types';
2
+ import type { IArgsData } from '../../types';
3
3
  /**
4
- * Arguments for protocol fee instructions (protocolFeeAmountOutXD, aquaProtocolFeeAmountOutXD)
5
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L102
4
+ * Arguments for protocol fee instructions (protocolFeeAmountInXD, aquaProtocolFeeAmountInXD)
5
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L101
6
6
  **/
7
7
  export declare class ProtocolFeeArgs implements IArgsData {
8
8
  readonly fee: bigint;
@@ -1,8 +1,8 @@
1
1
  import type { Address, HexString } from '@1inch/sdk-core';
2
- import type { IArgsData } from '../types';
2
+ import type { IArgsData } from '../../types';
3
3
  /**
4
- * Arguments for protocol fee instructions (protocolFeeAmountOutXD, aquaProtocolFeeAmountOutXD)
5
- * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L102
4
+ * Arguments for protocol fee instructions (protocolFeeAmountInXD, aquaProtocolFeeAmountInXD)
5
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/Fee.sol#L101
6
6
  **/
7
7
  export declare class ProtocolFeeArgs implements IArgsData {
8
8
  readonly fee: bigint;
@@ -14,9 +14,10 @@ export * as dutchAuction from './dutch-auction';
14
14
  export * as oraclePriceAdjuster from './oracle-price-adjuster';
15
15
  export * as baseFeeAdjuster from './base-fee-adjuster';
16
16
  export * as twapSwap from './twap-swap';
17
- export * as stableSwap from './stable-swap';
17
+ export * as stableSwap from './pegged-swap';
18
18
  export * as fee from './fee';
19
19
  export * as extruction from './extruction';
20
+ export * as peggedSwap from './pegged-swap';
20
21
  /**
21
22
  * Regular opcodes array - matching SwapVM contract exactly (44 opcodes)
22
23
  * @see https://github.com/1inch/swap-vm/blob/main/src/opcodes/Opcodes.sol#L46