@1inch/swap-vm-sdk 0.1.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 +103 -0
- package/README.md +584 -0
- package/dist/abi/SwapVM.abi.d.mts +403 -0
- package/dist/abi/SwapVM.abi.d.ts +403 -0
- package/dist/abi/index.d.mts +1 -0
- package/dist/abi/index.d.ts +1 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3842 -0
- package/dist/index.mjs +3777 -0
- package/dist/swap-vm/index.d.mts +6 -0
- package/dist/swap-vm/index.d.ts +6 -0
- package/dist/swap-vm/instructions/balances/balances-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/balances/balances-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/balances/balances-args.d.mts +17 -0
- package/dist/swap-vm/instructions/balances/balances-args.d.ts +17 -0
- package/dist/swap-vm/instructions/balances/index.d.mts +3 -0
- package/dist/swap-vm/instructions/balances/index.d.ts +3 -0
- package/dist/swap-vm/instructions/balances/opcodes.d.mts +12 -0
- package/dist/swap-vm/instructions/balances/opcodes.d.ts +12 -0
- package/dist/swap-vm/instructions/balances/types.d.mts +5 -0
- package/dist/swap-vm/instructions/balances/types.d.ts +5 -0
- package/dist/swap-vm/instructions/base-fee-adjuster/base-fee-adjuster-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/base-fee-adjuster/base-fee-adjuster-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/base-fee-adjuster/base-fee-adjuster-args.d.mts +40 -0
- package/dist/swap-vm/instructions/base-fee-adjuster/base-fee-adjuster-args.d.ts +40 -0
- package/dist/swap-vm/instructions/base-fee-adjuster/index.d.mts +2 -0
- package/dist/swap-vm/instructions/base-fee-adjuster/index.d.ts +2 -0
- package/dist/swap-vm/instructions/base-fee-adjuster/opcodes.d.mts +5 -0
- package/dist/swap-vm/instructions/base-fee-adjuster/opcodes.d.ts +5 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.mts +21 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.ts +21 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.mts +17 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.ts +17 -0
- package/dist/swap-vm/instructions/concentrate/index.d.mts +5 -0
- package/dist/swap-vm/instructions/concentrate/index.d.ts +5 -0
- package/dist/swap-vm/instructions/concentrate/opcodes.d.mts +10 -0
- package/dist/swap-vm/instructions/concentrate/opcodes.d.ts +10 -0
- package/dist/swap-vm/instructions/concentrate/types.d.mts +5 -0
- package/dist/swap-vm/instructions/concentrate/types.d.ts +5 -0
- package/dist/swap-vm/instructions/concentrate/utils.d.mts +4 -0
- package/dist/swap-vm/instructions/concentrate/utils.d.ts +4 -0
- package/dist/swap-vm/instructions/controls/deadline-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/controls/deadline-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/controls/deadline-args.d.mts +9 -0
- package/dist/swap-vm/instructions/controls/deadline-args.d.ts +9 -0
- package/dist/swap-vm/instructions/controls/index.d.mts +8 -0
- package/dist/swap-vm/instructions/controls/index.d.ts +8 -0
- package/dist/swap-vm/instructions/controls/jump-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/controls/jump-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/controls/jump-args.d.mts +16 -0
- package/dist/swap-vm/instructions/controls/jump-args.d.ts +16 -0
- package/dist/swap-vm/instructions/controls/jump-if-token-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/controls/jump-if-token-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/controls/jump-if-token-args.d.mts +10 -0
- package/dist/swap-vm/instructions/controls/jump-if-token-args.d.ts +10 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-balance-gte-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-balance-gte-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-balance-gte-args.d.mts +17 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-balance-gte-args.d.ts +17 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-balance-non-zero-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-balance-non-zero-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-balance-non-zero-args.d.mts +16 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-balance-non-zero-args.d.ts +16 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-supply-share-gte-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-supply-share-gte-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-supply-share-gte-args.d.mts +18 -0
- package/dist/swap-vm/instructions/controls/only-taker-token-supply-share-gte-args.d.ts +18 -0
- package/dist/swap-vm/instructions/controls/opcodes.d.mts +36 -0
- package/dist/swap-vm/instructions/controls/opcodes.d.ts +36 -0
- package/dist/swap-vm/instructions/controls/salt-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/controls/salt-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/controls/salt-args.d.mts +16 -0
- package/dist/swap-vm/instructions/controls/salt-args.d.ts +16 -0
- package/dist/swap-vm/instructions/debug/debug-args.d.mts +8 -0
- package/dist/swap-vm/instructions/debug/debug-args.d.ts +8 -0
- package/dist/swap-vm/instructions/debug/debug-empty-args.d.mts +19 -0
- package/dist/swap-vm/instructions/debug/debug-empty-args.d.ts +19 -0
- package/dist/swap-vm/instructions/debug/opcodes.d.mts +18 -0
- package/dist/swap-vm/instructions/debug/opcodes.d.ts +18 -0
- package/dist/swap-vm/instructions/debug/print-amount-for-swap.d.mts +16 -0
- package/dist/swap-vm/instructions/debug/print-amount-for-swap.d.ts +16 -0
- package/dist/swap-vm/instructions/debug/print-context.d.mts +16 -0
- package/dist/swap-vm/instructions/debug/print-context.d.ts +16 -0
- package/dist/swap-vm/instructions/debug/print-free-memory-pointer.d.mts +16 -0
- package/dist/swap-vm/instructions/debug/print-free-memory-pointer.d.ts +16 -0
- package/dist/swap-vm/instructions/debug/print-gas-left.d.mts +16 -0
- package/dist/swap-vm/instructions/debug/print-gas-left.d.ts +16 -0
- package/dist/swap-vm/instructions/debug/print-swap-query.d.mts +16 -0
- package/dist/swap-vm/instructions/debug/print-swap-query.d.ts +16 -0
- package/dist/swap-vm/instructions/debug/print-swap-registers.d.mts +16 -0
- package/dist/swap-vm/instructions/debug/print-swap-registers.d.ts +16 -0
- package/dist/swap-vm/instructions/decay/decay-xd-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/decay/decay-xd-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/decay/decay-xd-args.d.mts +16 -0
- package/dist/swap-vm/instructions/decay/decay-xd-args.d.ts +16 -0
- package/dist/swap-vm/instructions/decay/index.d.mts +2 -0
- package/dist/swap-vm/instructions/decay/index.d.ts +2 -0
- package/dist/swap-vm/instructions/decay/opcodes.d.mts +5 -0
- package/dist/swap-vm/instructions/decay/opcodes.d.ts +5 -0
- package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.mts +44 -0
- package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.ts +44 -0
- package/dist/swap-vm/instructions/dutch-auction/index.d.mts +2 -0
- package/dist/swap-vm/instructions/dutch-auction/index.d.ts +2 -0
- package/dist/swap-vm/instructions/dutch-auction/opcodes.d.mts +10 -0
- package/dist/swap-vm/instructions/dutch-auction/opcodes.d.ts +10 -0
- package/dist/swap-vm/instructions/empty.d.mts +13 -0
- package/dist/swap-vm/instructions/empty.d.ts +13 -0
- package/dist/swap-vm/instructions/extruction/extruction-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/extruction/extruction-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/extruction/extruction-args.d.mts +21 -0
- package/dist/swap-vm/instructions/extruction/extruction-args.d.ts +21 -0
- package/dist/swap-vm/instructions/extruction/index.d.mts +2 -0
- package/dist/swap-vm/instructions/extruction/index.d.ts +2 -0
- package/dist/swap-vm/instructions/extruction/opcodes.d.mts +5 -0
- package/dist/swap-vm/instructions/extruction/opcodes.d.ts +5 -0
- package/dist/swap-vm/instructions/fee/flat-fee-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/fee/flat-fee-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/fee/flat-fee-args.d.mts +28 -0
- package/dist/swap-vm/instructions/fee/flat-fee-args.d.ts +28 -0
- package/dist/swap-vm/instructions/fee/index.d.mts +3 -0
- package/dist/swap-vm/instructions/fee/index.d.ts +3 -0
- package/dist/swap-vm/instructions/fee/opcodes.d.mts +30 -0
- package/dist/swap-vm/instructions/fee/opcodes.d.ts +30 -0
- package/dist/swap-vm/instructions/fee/protocol-fee-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/fee/protocol-fee-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/fee/protocol-fee-args.d.mts +35 -0
- package/dist/swap-vm/instructions/fee/protocol-fee-args.d.ts +35 -0
- package/dist/swap-vm/instructions/index.d.mts +29 -0
- package/dist/swap-vm/instructions/index.d.ts +29 -0
- package/dist/swap-vm/instructions/instruction.d.mts +7 -0
- package/dist/swap-vm/instructions/instruction.d.ts +7 -0
- package/dist/swap-vm/instructions/invalidators/index.d.mts +4 -0
- package/dist/swap-vm/instructions/invalidators/index.d.ts +4 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-bit-1d-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-bit-1d-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-bit-1d-args.d.mts +16 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-bit-1d-args.d.ts +16 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-token-in-1d-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-token-in-1d-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-token-in-1d-args.d.mts +8 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-token-in-1d-args.d.ts +8 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-token-out-1d-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-token-out-1d-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-token-out-1d-args.d.mts +8 -0
- package/dist/swap-vm/instructions/invalidators/invalidate-token-out-1d-args.d.ts +8 -0
- package/dist/swap-vm/instructions/invalidators/opcodes.d.mts +15 -0
- package/dist/swap-vm/instructions/invalidators/opcodes.d.ts +15 -0
- package/dist/swap-vm/instructions/limit-swap/index.d.mts +2 -0
- package/dist/swap-vm/instructions/limit-swap/index.d.ts +2 -0
- package/dist/swap-vm/instructions/limit-swap/limit-swap-direction-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/limit-swap/limit-swap-direction-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/limit-swap/limit-swap-direction-args.d.mts +24 -0
- package/dist/swap-vm/instructions/limit-swap/limit-swap-direction-args.d.ts +24 -0
- package/dist/swap-vm/instructions/limit-swap/opcodes.d.mts +10 -0
- package/dist/swap-vm/instructions/limit-swap/opcodes.d.ts +10 -0
- package/dist/swap-vm/instructions/min-rate/index.d.mts +2 -0
- package/dist/swap-vm/instructions/min-rate/index.d.ts +2 -0
- package/dist/swap-vm/instructions/min-rate/min-rate-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/min-rate/min-rate-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/min-rate/min-rate-args.d.mts +22 -0
- package/dist/swap-vm/instructions/min-rate/min-rate-args.d.ts +22 -0
- package/dist/swap-vm/instructions/min-rate/opcodes.d.mts +10 -0
- package/dist/swap-vm/instructions/min-rate/opcodes.d.ts +10 -0
- package/dist/swap-vm/instructions/opcode.d.mts +8 -0
- package/dist/swap-vm/instructions/opcode.d.ts +8 -0
- package/dist/swap-vm/instructions/oracle-price-adjuster/index.d.mts +2 -0
- package/dist/swap-vm/instructions/oracle-price-adjuster/index.d.ts +2 -0
- package/dist/swap-vm/instructions/oracle-price-adjuster/opcodes.d.mts +5 -0
- package/dist/swap-vm/instructions/oracle-price-adjuster/opcodes.d.ts +5 -0
- package/dist/swap-vm/instructions/oracle-price-adjuster/oracle-price-adjuster-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/oracle-price-adjuster/oracle-price-adjuster-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/oracle-price-adjuster/oracle-price-adjuster-args.d.mts +41 -0
- package/dist/swap-vm/instructions/oracle-price-adjuster/oracle-price-adjuster-args.d.ts +41 -0
- package/dist/swap-vm/instructions/stable-swap/index.d.mts +2 -0
- package/dist/swap-vm/instructions/stable-swap/index.d.ts +2 -0
- package/dist/swap-vm/instructions/stable-swap/opcodes.d.mts +4 -0
- package/dist/swap-vm/instructions/stable-swap/opcodes.d.ts +4 -0
- package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.mts +25 -0
- package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.ts +25 -0
- package/dist/swap-vm/instructions/twap-swap/index.d.mts +2 -0
- package/dist/swap-vm/instructions/twap-swap/index.d.ts +2 -0
- package/dist/swap-vm/instructions/twap-swap/opcodes.d.mts +5 -0
- package/dist/swap-vm/instructions/twap-swap/opcodes.d.ts +5 -0
- package/dist/swap-vm/instructions/twap-swap/twap-swap-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/twap-swap/twap-swap-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/twap-swap/twap-swap-args.d.mts +71 -0
- package/dist/swap-vm/instructions/twap-swap/twap-swap-args.d.ts +71 -0
- package/dist/swap-vm/instructions/types.d.mts +18 -0
- package/dist/swap-vm/instructions/types.d.ts +18 -0
- package/dist/swap-vm/instructions/xyc-swap/index.d.mts +2 -0
- package/dist/swap-vm/instructions/xyc-swap/index.d.ts +2 -0
- package/dist/swap-vm/instructions/xyc-swap/opcodes.d.mts +5 -0
- package/dist/swap-vm/instructions/xyc-swap/opcodes.d.ts +5 -0
- package/dist/swap-vm/instructions/xyc-swap/xyc-swap-xd-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/xyc-swap/xyc-swap-xd-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/xyc-swap/xyc-swap-xd-args.d.mts +15 -0
- package/dist/swap-vm/instructions/xyc-swap/xyc-swap-xd-args.d.ts +15 -0
- package/dist/swap-vm/maker-traits.d.mts +206 -0
- package/dist/swap-vm/maker-traits.d.ts +206 -0
- package/dist/swap-vm/order.d.mts +84 -0
- package/dist/swap-vm/order.d.ts +84 -0
- package/dist/swap-vm/programs/aqua-program-builder.d.mts +118 -0
- package/dist/swap-vm/programs/aqua-program-builder.d.ts +118 -0
- package/dist/swap-vm/programs/index.d.mts +4 -0
- package/dist/swap-vm/programs/index.d.ts +4 -0
- package/dist/swap-vm/programs/program-builder.d.mts +26 -0
- package/dist/swap-vm/programs/program-builder.d.ts +26 -0
- package/dist/swap-vm/programs/regular-program-builder.d.mts +187 -0
- package/dist/swap-vm/programs/regular-program-builder.d.ts +187 -0
- package/dist/swap-vm/programs/swap-vm-program.d.mts +6 -0
- package/dist/swap-vm/programs/swap-vm-program.d.ts +6 -0
- package/dist/swap-vm/strategies/aqua-amm-strategy.d.mts +32 -0
- package/dist/swap-vm/strategies/aqua-amm-strategy.d.ts +32 -0
- package/dist/swap-vm/strategies/index.d.mts +1 -0
- package/dist/swap-vm/strategies/index.d.ts +1 -0
- package/dist/swap-vm/taker-traits.d.mts +214 -0
- package/dist/swap-vm/taker-traits.d.ts +214 -0
- package/dist/swap-vm/types.d.mts +22 -0
- package/dist/swap-vm/types.d.ts +22 -0
- package/dist/swap-vm-contract/constants.d.mts +13 -0
- package/dist/swap-vm-contract/constants.d.ts +13 -0
- package/dist/swap-vm-contract/events/index.d.mts +1 -0
- package/dist/swap-vm-contract/events/index.d.ts +1 -0
- package/dist/swap-vm-contract/events/swapped-event.d.mts +19 -0
- package/dist/swap-vm-contract/events/swapped-event.d.ts +19 -0
- package/dist/swap-vm-contract/index.d.mts +4 -0
- package/dist/swap-vm-contract/index.d.ts +4 -0
- package/dist/swap-vm-contract/swap-vm-contract.d.mts +38 -0
- package/dist/swap-vm-contract/swap-vm-contract.d.ts +38 -0
- package/dist/swap-vm-contract/types.d.mts +22 -0
- package/dist/swap-vm-contract/types.d.ts +22 -0
- package/package.json +72 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { DataFor } from '@1inch/sdk-core';
|
|
2
|
+
import { ProgramBuilder } from './program-builder';
|
|
3
|
+
import type { SwapVmProgram } from './swap-vm-program';
|
|
4
|
+
import * as balances from '../instructions/balances';
|
|
5
|
+
import * as controls from '../instructions/controls';
|
|
6
|
+
import * as invalidators from '../instructions/invalidators';
|
|
7
|
+
import * as concentrate from '../instructions/concentrate';
|
|
8
|
+
import * as decay from '../instructions/decay';
|
|
9
|
+
import * as limitSwap from '../instructions/limit-swap';
|
|
10
|
+
import * as minRate from '../instructions/min-rate';
|
|
11
|
+
import * as dutchAuction from '../instructions/dutch-auction';
|
|
12
|
+
import * as oraclePriceAdjuster from '../instructions/oracle-price-adjuster';
|
|
13
|
+
import * as baseFeeAdjuster from '../instructions/base-fee-adjuster';
|
|
14
|
+
import * as twapSwap from '../instructions/twap-swap';
|
|
15
|
+
import * as fee from '../instructions/fee';
|
|
16
|
+
import * as extruction from '../instructions/extruction';
|
|
17
|
+
export declare class RegularProgramBuilder extends ProgramBuilder {
|
|
18
|
+
constructor();
|
|
19
|
+
static decode(program: SwapVmProgram): RegularProgramBuilder;
|
|
20
|
+
/**
|
|
21
|
+
* Enables debug mode for the program
|
|
22
|
+
* WARNING: Debug instructions will throw an error if debug mode is not enabled
|
|
23
|
+
*/
|
|
24
|
+
withDebug(): this;
|
|
25
|
+
/**
|
|
26
|
+
* Sets initial token balances for the swap program
|
|
27
|
+
**/
|
|
28
|
+
staticBalancesXD(data: DataFor<balances.BalancesArgs>): this;
|
|
29
|
+
/**
|
|
30
|
+
* Reads token balances from program data or contract storage
|
|
31
|
+
**/
|
|
32
|
+
dynamicBalancesXD(data: DataFor<balances.BalancesArgs>): this;
|
|
33
|
+
/**
|
|
34
|
+
* Unconditional jump to specified program counter
|
|
35
|
+
**/
|
|
36
|
+
jump(data: DataFor<controls.JumpArgs>): this;
|
|
37
|
+
/**
|
|
38
|
+
* Jumps if tokenIn is the specified token
|
|
39
|
+
**/
|
|
40
|
+
jumpIfTokenIn(data: DataFor<controls.JumpIfTokenArgs>): this;
|
|
41
|
+
/**
|
|
42
|
+
* Jumps if tokenOut is the specified token
|
|
43
|
+
**/
|
|
44
|
+
jumpIfTokenOut(data: DataFor<controls.JumpIfTokenArgs>): this;
|
|
45
|
+
/**
|
|
46
|
+
* Reverts if the deadline has been reached
|
|
47
|
+
**/
|
|
48
|
+
deadline(data: DataFor<controls.DeadlineArgs>): this;
|
|
49
|
+
/**
|
|
50
|
+
* Requires taker to hold any amount of specified token (supports NFTs)
|
|
51
|
+
**/
|
|
52
|
+
onlyTakerTokenBalanceNonZero(data: DataFor<controls.OnlyTakerTokenBalanceNonZeroArgs>): this;
|
|
53
|
+
/**
|
|
54
|
+
* Requires taker to hold at least specified amount of token
|
|
55
|
+
**/
|
|
56
|
+
onlyTakerTokenBalanceGte(data: DataFor<controls.OnlyTakerTokenBalanceGteArgs>): this;
|
|
57
|
+
/**
|
|
58
|
+
* Requires taker to hold at least specified share of token's total supply
|
|
59
|
+
**/
|
|
60
|
+
onlyTakerTokenSupplyShareGte(data: DataFor<controls.OnlyTakerTokenSupplyShareGteArgs>): this;
|
|
61
|
+
/**
|
|
62
|
+
* No-op instruction used to add uniqueness to order hashes (prevents replay attacks)
|
|
63
|
+
**/
|
|
64
|
+
salt(data: DataFor<controls.SaltArgs>): this;
|
|
65
|
+
/**
|
|
66
|
+
* Invalidates a specific bit index for order uniqueness
|
|
67
|
+
**/
|
|
68
|
+
invalidateBit1D(data: DataFor<invalidators.InvalidateBit1DArgs>): this;
|
|
69
|
+
/**
|
|
70
|
+
* Invalidates order by token input to prevent re-use
|
|
71
|
+
**/
|
|
72
|
+
invalidateTokenIn1D(): this;
|
|
73
|
+
/**
|
|
74
|
+
* Invalidates order by token output to prevent re-use
|
|
75
|
+
**/
|
|
76
|
+
invalidateTokenOut1D(): this;
|
|
77
|
+
/**
|
|
78
|
+
* Basic swap using constant product formula (x*y=k)
|
|
79
|
+
**/
|
|
80
|
+
xycSwapXD(): this;
|
|
81
|
+
/**
|
|
82
|
+
* Concentrates liquidity within price bounds for multiple tokens
|
|
83
|
+
**/
|
|
84
|
+
concentrateGrowLiquidityXD(data: DataFor<concentrate.ConcentrateGrowLiquidityXDArgs>): this;
|
|
85
|
+
/**
|
|
86
|
+
* Concentrates liquidity within price bounds for two tokens
|
|
87
|
+
**/
|
|
88
|
+
concentrateGrowLiquidity2D(data: DataFor<concentrate.ConcentrateGrowLiquidity2DArgs>): this;
|
|
89
|
+
/**
|
|
90
|
+
* Applies time-based decay to balance adjustments
|
|
91
|
+
**/
|
|
92
|
+
decayXD(data: DataFor<decay.DecayXDArgs>): this;
|
|
93
|
+
/**
|
|
94
|
+
* Limit order swap with proportional execution
|
|
95
|
+
**/
|
|
96
|
+
limitSwap1D(data: DataFor<limitSwap.LimitSwapDirectionArgs>): this;
|
|
97
|
+
/**
|
|
98
|
+
* Limit order swap requiring full amount execution
|
|
99
|
+
**/
|
|
100
|
+
limitSwapOnlyFull1D(data: DataFor<limitSwap.LimitSwapDirectionArgs>): this;
|
|
101
|
+
/**
|
|
102
|
+
* Enforces minimum exchange rate or reverts
|
|
103
|
+
**/
|
|
104
|
+
requireMinRate1D(data: DataFor<minRate.MinRateArgs>): this;
|
|
105
|
+
/**
|
|
106
|
+
* Adjusts swap amounts to meet minimum rate if needed
|
|
107
|
+
**/
|
|
108
|
+
adjustMinRate1D(data: DataFor<minRate.MinRateArgs>): this;
|
|
109
|
+
/**
|
|
110
|
+
* Dutch auction with time-based decay on amountIn
|
|
111
|
+
**/
|
|
112
|
+
dutchAuctionBalanceIn1D(data: DataFor<dutchAuction.DutchAuctionArgs>): this;
|
|
113
|
+
/**
|
|
114
|
+
* Dutch auction with time-based decay on amountOut
|
|
115
|
+
**/
|
|
116
|
+
dutchAuctionBalanceOut1D(data: DataFor<dutchAuction.DutchAuctionArgs>): this;
|
|
117
|
+
/**
|
|
118
|
+
* Adjusts swap prices based on Chainlink oracle feeds
|
|
119
|
+
**/
|
|
120
|
+
oraclePriceAdjuster1D(data: DataFor<oraclePriceAdjuster.OraclePriceAdjusterArgs>): this;
|
|
121
|
+
/**
|
|
122
|
+
* Adjusts swap prices based on network gas costs
|
|
123
|
+
**/
|
|
124
|
+
baseFeeAdjuster1D(data: DataFor<baseFeeAdjuster.BaseFeeAdjusterArgs>): this;
|
|
125
|
+
/**
|
|
126
|
+
* TWAP trading with exponential dutch auction and illiquidity handling
|
|
127
|
+
**/
|
|
128
|
+
twap(data: DataFor<twapSwap.TWAPSwapArgs>): this;
|
|
129
|
+
/**
|
|
130
|
+
* Calls external contract to perform custom logic
|
|
131
|
+
**/
|
|
132
|
+
extruction(data: DataFor<extruction.ExtructionArgs>): this;
|
|
133
|
+
/**
|
|
134
|
+
* Applies fee to amountIn
|
|
135
|
+
**/
|
|
136
|
+
flatFeeAmountInXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
137
|
+
/**
|
|
138
|
+
* Applies fee to amountOut
|
|
139
|
+
**/
|
|
140
|
+
flatFeeAmountOutXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
141
|
+
/**
|
|
142
|
+
* Applies progressive fee to amountIn
|
|
143
|
+
**/
|
|
144
|
+
progressiveFeeInXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
145
|
+
/**
|
|
146
|
+
* Applies progressive fee to amountOut
|
|
147
|
+
**/
|
|
148
|
+
progressiveFeeOutXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
149
|
+
/**
|
|
150
|
+
* Applies protocol fee to amountOut with direct transfer
|
|
151
|
+
**/
|
|
152
|
+
protocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
|
|
153
|
+
/**
|
|
154
|
+
* Applies protocol fee to amountOut through Aqua protocol
|
|
155
|
+
**/
|
|
156
|
+
aquaProtocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
|
|
157
|
+
/**
|
|
158
|
+
* DEBUG: Prints current swap registers (amounts and tokens)
|
|
159
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
160
|
+
*/
|
|
161
|
+
debugPrintSwapRegisters(): this;
|
|
162
|
+
/**
|
|
163
|
+
* DEBUG: Prints current swap query state
|
|
164
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
165
|
+
*/
|
|
166
|
+
debugPrintSwapQuery(): this;
|
|
167
|
+
/**
|
|
168
|
+
* DEBUG: Prints execution context information
|
|
169
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
170
|
+
*/
|
|
171
|
+
debugPrintContext(): this;
|
|
172
|
+
/**
|
|
173
|
+
* DEBUG: Prints calculated amount for swap
|
|
174
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
175
|
+
*/
|
|
176
|
+
debugPrintAmountForSwap(): this;
|
|
177
|
+
/**
|
|
178
|
+
* DEBUG: Prints current free memory pointer value
|
|
179
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
180
|
+
*/
|
|
181
|
+
debugPrintFreeMemoryPointer(): this;
|
|
182
|
+
/**
|
|
183
|
+
* DEBUG: Prints remaining gas
|
|
184
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
185
|
+
*/
|
|
186
|
+
debugPrintGasLeft(): this;
|
|
187
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Address } from '@1inch/sdk-core';
|
|
2
|
+
import type { SwapVmProgram } from '../programs';
|
|
3
|
+
/**
|
|
4
|
+
* Aqua AMM Strategy builder that mirrors AquaAMM.sol
|
|
5
|
+
* @see https://github.com/1inch/swap-vm/blob/main/src/strategies/AquaAMM.sol
|
|
6
|
+
*/
|
|
7
|
+
export declare class AquaAMMStrategy {
|
|
8
|
+
readonly tokenA: Address;
|
|
9
|
+
readonly tokenB: Address;
|
|
10
|
+
feeBpsIn?: number;
|
|
11
|
+
deltas?: {
|
|
12
|
+
a: bigint;
|
|
13
|
+
b: bigint;
|
|
14
|
+
};
|
|
15
|
+
decayPeriod?: bigint;
|
|
16
|
+
protocolFee?: {
|
|
17
|
+
bps: number;
|
|
18
|
+
receiver: Address;
|
|
19
|
+
};
|
|
20
|
+
salt?: bigint;
|
|
21
|
+
constructor(tokenA: Address, tokenB: Address);
|
|
22
|
+
static new(tokens: {
|
|
23
|
+
tokenA: Address;
|
|
24
|
+
tokenB: Address;
|
|
25
|
+
}): AquaAMMStrategy;
|
|
26
|
+
withProtocolFee(bps: number, receiver: Address): this;
|
|
27
|
+
withDeltas(a: bigint, b: bigint): this;
|
|
28
|
+
withDecayPeriod(decayPeriod: bigint): this;
|
|
29
|
+
withFeeTokenIn(bps: number): this;
|
|
30
|
+
withSalt(salt: bigint): this;
|
|
31
|
+
build(): SwapVmProgram;
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Address } from '@1inch/sdk-core';
|
|
2
|
+
import type { SwapVmProgram } from '../programs';
|
|
3
|
+
/**
|
|
4
|
+
* Aqua AMM Strategy builder that mirrors AquaAMM.sol
|
|
5
|
+
* @see https://github.com/1inch/swap-vm/blob/main/src/strategies/AquaAMM.sol
|
|
6
|
+
*/
|
|
7
|
+
export declare class AquaAMMStrategy {
|
|
8
|
+
readonly tokenA: Address;
|
|
9
|
+
readonly tokenB: Address;
|
|
10
|
+
feeBpsIn?: number;
|
|
11
|
+
deltas?: {
|
|
12
|
+
a: bigint;
|
|
13
|
+
b: bigint;
|
|
14
|
+
};
|
|
15
|
+
decayPeriod?: bigint;
|
|
16
|
+
protocolFee?: {
|
|
17
|
+
bps: number;
|
|
18
|
+
receiver: Address;
|
|
19
|
+
};
|
|
20
|
+
salt?: bigint;
|
|
21
|
+
constructor(tokenA: Address, tokenB: Address);
|
|
22
|
+
static new(tokens: {
|
|
23
|
+
tokenA: Address;
|
|
24
|
+
tokenB: Address;
|
|
25
|
+
}): AquaAMMStrategy;
|
|
26
|
+
withProtocolFee(bps: number, receiver: Address): this;
|
|
27
|
+
withDeltas(a: bigint, b: bigint): this;
|
|
28
|
+
withDecayPeriod(decayPeriod: bigint): this;
|
|
29
|
+
withFeeTokenIn(bps: number): this;
|
|
30
|
+
withSalt(salt: bigint): this;
|
|
31
|
+
build(): SwapVmProgram;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './aqua-amm-strategy';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './aqua-amm-strategy';
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import type { DataFor } from '@1inch/sdk-core';
|
|
2
|
+
import { Address, HexString } from '@1inch/sdk-core';
|
|
3
|
+
/**
|
|
4
|
+
* TakerTraits encodes taker-specific parameters and flags for swap execution.
|
|
5
|
+
* It defines how the taker wants the swap to be executed, including thresholds,
|
|
6
|
+
* callbacks, hooks, and other execution parameters.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TakerTraits {
|
|
9
|
+
/**
|
|
10
|
+
* If true, the taker specifies the exact input amount.
|
|
11
|
+
* If false, the taker specifies the exact output amount.
|
|
12
|
+
*/
|
|
13
|
+
readonly exactIn: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* If true, WETH proceeds are unwrapped into native currency when
|
|
16
|
+
* the order is settled.
|
|
17
|
+
*/
|
|
18
|
+
readonly shouldUnwrap: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* If true, enables pre-transfer-in callback to the taker contract.
|
|
21
|
+
* The callback flag is automatically set based on preTransferInCallbackData presence.
|
|
22
|
+
*/
|
|
23
|
+
readonly preTransferInCallbackEnabled: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* If true, enables pre-transfer-out callback to the taker contract.
|
|
26
|
+
* The callback flag is automatically set based on preTransferOutCallbackData presence.
|
|
27
|
+
*/
|
|
28
|
+
readonly preTransferOutCallbackEnabled: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* If true, requires the exact threshold amount (no slippage tolerance).
|
|
31
|
+
* If false, allows better rates than threshold.
|
|
32
|
+
*/
|
|
33
|
+
readonly strictThreshold: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* If true, the first transfer is from the taker.
|
|
36
|
+
* If false, it may be from another source (e.g., via Aqua).
|
|
37
|
+
*/
|
|
38
|
+
readonly firstTransferFromTaker: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* If true, uses transferFrom and Aqua push mechanism.
|
|
41
|
+
* If false, uses standard transfer mechanism.
|
|
42
|
+
*/
|
|
43
|
+
readonly useTransferFromAndAquaPush: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Minimum output amount (for exactIn) or maximum input amount (for exactOut).
|
|
46
|
+
* Set to 0n for no threshold.
|
|
47
|
+
*/
|
|
48
|
+
readonly threshold: bigint;
|
|
49
|
+
/**
|
|
50
|
+
* Custom receiver address for the swap output.
|
|
51
|
+
* Defaults to zero address (meaning taker receives funds).
|
|
52
|
+
*/
|
|
53
|
+
readonly customReceiver: Address;
|
|
54
|
+
/**
|
|
55
|
+
* Optional data passed to the maker's pre-transfer-in hook.
|
|
56
|
+
*/
|
|
57
|
+
readonly preTransferInHookData: HexString;
|
|
58
|
+
/**
|
|
59
|
+
* Optional data passed to the maker's post-transfer-in hook.
|
|
60
|
+
*/
|
|
61
|
+
readonly postTransferInHookData: HexString;
|
|
62
|
+
/**
|
|
63
|
+
* Optional data passed to the maker's pre-transfer-out hook.
|
|
64
|
+
*/
|
|
65
|
+
readonly preTransferOutHookData: HexString;
|
|
66
|
+
/**
|
|
67
|
+
* Optional data passed to the maker's post-transfer-out hook.
|
|
68
|
+
*/
|
|
69
|
+
readonly postTransferOutHookData: HexString;
|
|
70
|
+
/**
|
|
71
|
+
* Optional callback data for taker's pre-transfer-in callback.
|
|
72
|
+
*/
|
|
73
|
+
readonly preTransferInCallbackData: HexString;
|
|
74
|
+
/**
|
|
75
|
+
* Optional callback data for taker's pre-transfer-out callback.
|
|
76
|
+
*/
|
|
77
|
+
readonly preTransferOutCallbackData: HexString;
|
|
78
|
+
/**
|
|
79
|
+
* Optional arguments for VM instructions execution.
|
|
80
|
+
*/
|
|
81
|
+
readonly instructionsArgs: HexString;
|
|
82
|
+
/**
|
|
83
|
+
* ECDSA signature for order validation (65 bytes typically).
|
|
84
|
+
* Can be empty when using Aqua authentication.
|
|
85
|
+
*/
|
|
86
|
+
readonly signature: HexString;
|
|
87
|
+
private static readonly IS_EXACT_IN_BIT_FLAG;
|
|
88
|
+
private static readonly SHOULD_UNWRAP_BIT_FLAG;
|
|
89
|
+
private static readonly HAS_PRE_TRANSFER_IN_CALLBACK_BIT_FLAG;
|
|
90
|
+
private static readonly HAS_PRE_TRANSFER_OUT_CALLBACK_BIT_FLAG;
|
|
91
|
+
private static readonly IS_STRICT_THRESHOLD_BIT_FLAG;
|
|
92
|
+
private static readonly IS_FIRST_TRANSFER_FROM_TAKER_BIT_FLAG;
|
|
93
|
+
private static readonly USE_TRANSFER_FROM_AND_AQUA_PUSH_FLAG;
|
|
94
|
+
constructor(
|
|
95
|
+
/**
|
|
96
|
+
* If true, the taker specifies the exact input amount.
|
|
97
|
+
* If false, the taker specifies the exact output amount.
|
|
98
|
+
*/
|
|
99
|
+
exactIn: boolean,
|
|
100
|
+
/**
|
|
101
|
+
* If true, WETH proceeds are unwrapped into native currency when
|
|
102
|
+
* the order is settled.
|
|
103
|
+
*/
|
|
104
|
+
shouldUnwrap: boolean,
|
|
105
|
+
/**
|
|
106
|
+
* If true, enables pre-transfer-in callback to the taker contract.
|
|
107
|
+
* The callback flag is automatically set based on preTransferInCallbackData presence.
|
|
108
|
+
*/
|
|
109
|
+
preTransferInCallbackEnabled: boolean,
|
|
110
|
+
/**
|
|
111
|
+
* If true, enables pre-transfer-out callback to the taker contract.
|
|
112
|
+
* The callback flag is automatically set based on preTransferOutCallbackData presence.
|
|
113
|
+
*/
|
|
114
|
+
preTransferOutCallbackEnabled: boolean,
|
|
115
|
+
/**
|
|
116
|
+
* If true, requires the exact threshold amount (no slippage tolerance).
|
|
117
|
+
* If false, allows better rates than threshold.
|
|
118
|
+
*/
|
|
119
|
+
strictThreshold: boolean,
|
|
120
|
+
/**
|
|
121
|
+
* If true, the first transfer is from the taker.
|
|
122
|
+
* If false, it may be from another source (e.g., via Aqua).
|
|
123
|
+
*/
|
|
124
|
+
firstTransferFromTaker: boolean,
|
|
125
|
+
/**
|
|
126
|
+
* If true, uses transferFrom and Aqua push mechanism.
|
|
127
|
+
* If false, uses standard transfer mechanism.
|
|
128
|
+
*/
|
|
129
|
+
useTransferFromAndAquaPush: boolean,
|
|
130
|
+
/**
|
|
131
|
+
* Minimum output amount (for exactIn) or maximum input amount (for exactOut).
|
|
132
|
+
* Set to 0n for no threshold.
|
|
133
|
+
*/
|
|
134
|
+
threshold?: bigint,
|
|
135
|
+
/**
|
|
136
|
+
* Custom receiver address for the swap output.
|
|
137
|
+
* Defaults to zero address (meaning taker receives funds).
|
|
138
|
+
*/
|
|
139
|
+
customReceiver?: Address,
|
|
140
|
+
/**
|
|
141
|
+
* Optional data passed to the maker's pre-transfer-in hook.
|
|
142
|
+
*/
|
|
143
|
+
preTransferInHookData?: HexString,
|
|
144
|
+
/**
|
|
145
|
+
* Optional data passed to the maker's post-transfer-in hook.
|
|
146
|
+
*/
|
|
147
|
+
postTransferInHookData?: HexString,
|
|
148
|
+
/**
|
|
149
|
+
* Optional data passed to the maker's pre-transfer-out hook.
|
|
150
|
+
*/
|
|
151
|
+
preTransferOutHookData?: HexString,
|
|
152
|
+
/**
|
|
153
|
+
* Optional data passed to the maker's post-transfer-out hook.
|
|
154
|
+
*/
|
|
155
|
+
postTransferOutHookData?: HexString,
|
|
156
|
+
/**
|
|
157
|
+
* Optional callback data for taker's pre-transfer-in callback.
|
|
158
|
+
*/
|
|
159
|
+
preTransferInCallbackData?: HexString,
|
|
160
|
+
/**
|
|
161
|
+
* Optional callback data for taker's pre-transfer-out callback.
|
|
162
|
+
*/
|
|
163
|
+
preTransferOutCallbackData?: HexString,
|
|
164
|
+
/**
|
|
165
|
+
* Optional arguments for VM instructions execution.
|
|
166
|
+
*/
|
|
167
|
+
instructionsArgs?: HexString,
|
|
168
|
+
/**
|
|
169
|
+
* ECDSA signature for order validation (65 bytes typically).
|
|
170
|
+
* Can be empty when using Aqua authentication.
|
|
171
|
+
*/
|
|
172
|
+
signature?: HexString);
|
|
173
|
+
/**
|
|
174
|
+
* Creates a new TakerTraits instance with the specified data.
|
|
175
|
+
* Provides default values for unspecified fields.
|
|
176
|
+
*/
|
|
177
|
+
static new(data?: Partial<DataFor<TakerTraits>>): TakerTraits;
|
|
178
|
+
/**
|
|
179
|
+
* Creates a default TakerTraits instance with standard settings.
|
|
180
|
+
* - exactIn mode
|
|
181
|
+
* - No unwrapping
|
|
182
|
+
* - No callbacks
|
|
183
|
+
* - No custom receiver
|
|
184
|
+
* - transferFromAndAquaPush enabled
|
|
185
|
+
*/
|
|
186
|
+
static default(): TakerTraits;
|
|
187
|
+
/**
|
|
188
|
+
* Decodes a packed TakerTraits from a hex string.
|
|
189
|
+
* The packed format consists of:
|
|
190
|
+
* - 18 bytes: 9 uint16 offsets for data sections
|
|
191
|
+
* - 2 bytes: uint16 flags
|
|
192
|
+
* - Variable: data sections (threshold, to, hook data, callback data, etc.)
|
|
193
|
+
* - Variable: signature
|
|
194
|
+
*/
|
|
195
|
+
static decode(packed: HexString): TakerTraits;
|
|
196
|
+
/**
|
|
197
|
+
* Creates a new instance with updated fields.
|
|
198
|
+
* Useful for creating modified versions of existing TakerTraits.
|
|
199
|
+
*/
|
|
200
|
+
with(data: Partial<DataFor<TakerTraits>>): this;
|
|
201
|
+
/**
|
|
202
|
+
* Encodes the TakerTraits into a packed hex string format.
|
|
203
|
+
* The encoding includes offsets, flags, data sections, and signature.
|
|
204
|
+
* Callback flags are automatically set based on callback data presence.
|
|
205
|
+
*/
|
|
206
|
+
encode(): HexString;
|
|
207
|
+
/**
|
|
208
|
+
* Validates the swap amounts against the threshold settings.
|
|
209
|
+
* @param amountIn - The input amount of the swap
|
|
210
|
+
* @param amountOut - The output amount of the swap
|
|
211
|
+
* @throws Error if the amounts don't meet the threshold requirements
|
|
212
|
+
*/
|
|
213
|
+
validate(amountIn: bigint, amountOut: bigint): void;
|
|
214
|
+
}
|