@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,84 @@
|
|
|
1
|
+
import type { DataFor, Hex, NetworkEnum } from '@1inch/sdk-core';
|
|
2
|
+
import { Address, HexString } from '@1inch/sdk-core';
|
|
3
|
+
import { MakerTraits } from './maker-traits';
|
|
4
|
+
import { SwapVmProgram } from './programs';
|
|
5
|
+
/**
|
|
6
|
+
* Internal ABI-ready representation of an order.
|
|
7
|
+
*
|
|
8
|
+
* 💡 Gotcha:
|
|
9
|
+
* - `traits` is already the packed `uint256` produced by `MakerTraits.encode`.
|
|
10
|
+
* - `data` is the raw concatenation `hooksData.concat(program)` used for on-chain VM execution.
|
|
11
|
+
*
|
|
12
|
+
* This is the exact shape used for:
|
|
13
|
+
* - `encodeAbiParameters([Order.ABI], [builtOrder])`
|
|
14
|
+
* - EIP-712 message payload in `hash()`.
|
|
15
|
+
*/
|
|
16
|
+
type BuiltOrder = {
|
|
17
|
+
maker: Hex;
|
|
18
|
+
traits: bigint;
|
|
19
|
+
data: Hex;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Representation of a SwapVM order.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Order {
|
|
25
|
+
readonly maker: Address;
|
|
26
|
+
readonly traits: MakerTraits;
|
|
27
|
+
readonly program: SwapVmProgram;
|
|
28
|
+
static ABI: {
|
|
29
|
+
readonly type: "tuple";
|
|
30
|
+
readonly components: readonly [{
|
|
31
|
+
readonly name: "maker";
|
|
32
|
+
readonly type: "address";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "traits";
|
|
35
|
+
readonly type: "uint256";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "data";
|
|
38
|
+
readonly type: "bytes";
|
|
39
|
+
}];
|
|
40
|
+
};
|
|
41
|
+
constructor(maker: Address, traits: MakerTraits, program: SwapVmProgram);
|
|
42
|
+
static new(params: DataFor<Order>): Order;
|
|
43
|
+
/**
|
|
44
|
+
* Reconstructs an `Order` from its ABI-encoded representation.
|
|
45
|
+
*
|
|
46
|
+
* 🎯 Non-obvious:
|
|
47
|
+
* - Any change to how `MakerTraits` packs `hooksData` must preserve the contract that
|
|
48
|
+
* `hooksDataEndsAtByte(traits)` points exactly to the start of the program, or decoding will drift.
|
|
49
|
+
*/
|
|
50
|
+
static decode(encoded: HexString): Order;
|
|
51
|
+
/**
|
|
52
|
+
* Computes an order hash used for signing or as a deterministic order identifier.
|
|
53
|
+
*
|
|
54
|
+
* Hashing modes:
|
|
55
|
+
* - Aqua mode (`traits.useAquaInsteadOfSignature === true`):
|
|
56
|
+
* - Returns `keccak256(encode())`.
|
|
57
|
+
* - Ignores provided `domain` completely.
|
|
58
|
+
* - EIP-712 signature mode (`useAquaInsteadOfSignature === false`):
|
|
59
|
+
* - Requires a `domain`; if missing, an assertion error is thrown.
|
|
60
|
+
*
|
|
61
|
+
* ⚠️ IMPORTANT:
|
|
62
|
+
* - Callers must ensure they pass the same `domain` parameters that the verifier
|
|
63
|
+
* uses on-chain; mismatches will produce hashes that cannot be verified.
|
|
64
|
+
*/
|
|
65
|
+
hash(domain?: {
|
|
66
|
+
chainId: NetworkEnum;
|
|
67
|
+
name: string;
|
|
68
|
+
verifyingContract: Address;
|
|
69
|
+
version: string;
|
|
70
|
+
}): HexString;
|
|
71
|
+
/**
|
|
72
|
+
* ABI-encodes the order into the exact bytes blob expected by on-chain contracts.
|
|
73
|
+
*
|
|
74
|
+
* Usage:
|
|
75
|
+
* - Input to `keccak256` in Aqua mode (`hash()`).
|
|
76
|
+
* - Payload for contract methods expecting an `Order` tuple.
|
|
77
|
+
*/
|
|
78
|
+
encode(): HexString;
|
|
79
|
+
/**
|
|
80
|
+
* Produces the ABI-ready `BuiltOrder` tuple`.
|
|
81
|
+
*/
|
|
82
|
+
build(): BuiltOrder;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { DataFor, Hex, NetworkEnum } from '@1inch/sdk-core';
|
|
2
|
+
import { Address, HexString } from '@1inch/sdk-core';
|
|
3
|
+
import { MakerTraits } from './maker-traits';
|
|
4
|
+
import { SwapVmProgram } from './programs';
|
|
5
|
+
/**
|
|
6
|
+
* Internal ABI-ready representation of an order.
|
|
7
|
+
*
|
|
8
|
+
* 💡 Gotcha:
|
|
9
|
+
* - `traits` is already the packed `uint256` produced by `MakerTraits.encode`.
|
|
10
|
+
* - `data` is the raw concatenation `hooksData.concat(program)` used for on-chain VM execution.
|
|
11
|
+
*
|
|
12
|
+
* This is the exact shape used for:
|
|
13
|
+
* - `encodeAbiParameters([Order.ABI], [builtOrder])`
|
|
14
|
+
* - EIP-712 message payload in `hash()`.
|
|
15
|
+
*/
|
|
16
|
+
type BuiltOrder = {
|
|
17
|
+
maker: Hex;
|
|
18
|
+
traits: bigint;
|
|
19
|
+
data: Hex;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Representation of a SwapVM order.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Order {
|
|
25
|
+
readonly maker: Address;
|
|
26
|
+
readonly traits: MakerTraits;
|
|
27
|
+
readonly program: SwapVmProgram;
|
|
28
|
+
static ABI: {
|
|
29
|
+
readonly type: "tuple";
|
|
30
|
+
readonly components: readonly [{
|
|
31
|
+
readonly name: "maker";
|
|
32
|
+
readonly type: "address";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "traits";
|
|
35
|
+
readonly type: "uint256";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "data";
|
|
38
|
+
readonly type: "bytes";
|
|
39
|
+
}];
|
|
40
|
+
};
|
|
41
|
+
constructor(maker: Address, traits: MakerTraits, program: SwapVmProgram);
|
|
42
|
+
static new(params: DataFor<Order>): Order;
|
|
43
|
+
/**
|
|
44
|
+
* Reconstructs an `Order` from its ABI-encoded representation.
|
|
45
|
+
*
|
|
46
|
+
* 🎯 Non-obvious:
|
|
47
|
+
* - Any change to how `MakerTraits` packs `hooksData` must preserve the contract that
|
|
48
|
+
* `hooksDataEndsAtByte(traits)` points exactly to the start of the program, or decoding will drift.
|
|
49
|
+
*/
|
|
50
|
+
static decode(encoded: HexString): Order;
|
|
51
|
+
/**
|
|
52
|
+
* Computes an order hash used for signing or as a deterministic order identifier.
|
|
53
|
+
*
|
|
54
|
+
* Hashing modes:
|
|
55
|
+
* - Aqua mode (`traits.useAquaInsteadOfSignature === true`):
|
|
56
|
+
* - Returns `keccak256(encode())`.
|
|
57
|
+
* - Ignores provided `domain` completely.
|
|
58
|
+
* - EIP-712 signature mode (`useAquaInsteadOfSignature === false`):
|
|
59
|
+
* - Requires a `domain`; if missing, an assertion error is thrown.
|
|
60
|
+
*
|
|
61
|
+
* ⚠️ IMPORTANT:
|
|
62
|
+
* - Callers must ensure they pass the same `domain` parameters that the verifier
|
|
63
|
+
* uses on-chain; mismatches will produce hashes that cannot be verified.
|
|
64
|
+
*/
|
|
65
|
+
hash(domain?: {
|
|
66
|
+
chainId: NetworkEnum;
|
|
67
|
+
name: string;
|
|
68
|
+
verifyingContract: Address;
|
|
69
|
+
version: string;
|
|
70
|
+
}): HexString;
|
|
71
|
+
/**
|
|
72
|
+
* ABI-encodes the order into the exact bytes blob expected by on-chain contracts.
|
|
73
|
+
*
|
|
74
|
+
* Usage:
|
|
75
|
+
* - Input to `keccak256` in Aqua mode (`hash()`).
|
|
76
|
+
* - Payload for contract methods expecting an `Order` tuple.
|
|
77
|
+
*/
|
|
78
|
+
encode(): HexString;
|
|
79
|
+
/**
|
|
80
|
+
* Produces the ABI-ready `BuiltOrder` tuple`.
|
|
81
|
+
*/
|
|
82
|
+
build(): BuiltOrder;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
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 controls from '../instructions/controls';
|
|
5
|
+
import * as concentrate from '../instructions/concentrate';
|
|
6
|
+
import * as decay from '../instructions/decay';
|
|
7
|
+
import * as fee from '../instructions/fee';
|
|
8
|
+
export declare class AquaProgramBuilder extends ProgramBuilder {
|
|
9
|
+
constructor();
|
|
10
|
+
static decode(program: SwapVmProgram): AquaProgramBuilder;
|
|
11
|
+
/**
|
|
12
|
+
* Enables debug mode for the program
|
|
13
|
+
* WARNING: Debug instructions will throw an error if debug mode is not enabled
|
|
14
|
+
*/
|
|
15
|
+
withDebug(): this;
|
|
16
|
+
/**
|
|
17
|
+
* Unconditional jump to specified program counter
|
|
18
|
+
**/
|
|
19
|
+
jump(data: DataFor<controls.JumpArgs>): this;
|
|
20
|
+
/**
|
|
21
|
+
* Jumps if tokenIn is the specified token
|
|
22
|
+
**/
|
|
23
|
+
jumpIfTokenIn(data: DataFor<controls.JumpIfTokenArgs>): this;
|
|
24
|
+
/**
|
|
25
|
+
* Jumps if tokenOut is the specified token
|
|
26
|
+
**/
|
|
27
|
+
jumpIfTokenOut(data: DataFor<controls.JumpIfTokenArgs>): this;
|
|
28
|
+
/**
|
|
29
|
+
* Reverts if the deadline has been reached
|
|
30
|
+
**/
|
|
31
|
+
deadline(data: DataFor<controls.DeadlineArgs>): this;
|
|
32
|
+
/**
|
|
33
|
+
* Requires taker to hold any amount of specified token (supports NFTs)
|
|
34
|
+
**/
|
|
35
|
+
onlyTakerTokenBalanceNonZero(data: DataFor<controls.OnlyTakerTokenBalanceNonZeroArgs>): this;
|
|
36
|
+
/**
|
|
37
|
+
* Requires taker to hold at least specified amount of token
|
|
38
|
+
**/
|
|
39
|
+
onlyTakerTokenBalanceGte(data: DataFor<controls.OnlyTakerTokenBalanceGteArgs>): this;
|
|
40
|
+
/**
|
|
41
|
+
* Requires taker to hold at least specified share of token's total supply
|
|
42
|
+
**/
|
|
43
|
+
onlyTakerTokenSupplyShareGte(data: DataFor<controls.OnlyTakerTokenSupplyShareGteArgs>): this;
|
|
44
|
+
/**
|
|
45
|
+
* No-op instruction used to add uniqueness to order hashes (prevents replay attacks)
|
|
46
|
+
**/
|
|
47
|
+
salt(data: DataFor<controls.SaltArgs>): this;
|
|
48
|
+
/**
|
|
49
|
+
* Basic swap using constant product formula (x*y=k)
|
|
50
|
+
**/
|
|
51
|
+
xycSwapXD(): this;
|
|
52
|
+
/**
|
|
53
|
+
* Concentrates liquidity within price bounds for multiple tokens
|
|
54
|
+
**/
|
|
55
|
+
concentrateGrowLiquidityXD(data: DataFor<concentrate.ConcentrateGrowLiquidityXDArgs>): this;
|
|
56
|
+
/**
|
|
57
|
+
* Concentrates liquidity within price bounds for two tokens
|
|
58
|
+
**/
|
|
59
|
+
concentrateGrowLiquidity2D(data: DataFor<concentrate.ConcentrateGrowLiquidity2DArgs>): this;
|
|
60
|
+
/**
|
|
61
|
+
* Applies time-based decay to balance adjustments
|
|
62
|
+
**/
|
|
63
|
+
decayXD(data: DataFor<decay.DecayXDArgs>): this;
|
|
64
|
+
/**
|
|
65
|
+
* Applies fee to amountIn
|
|
66
|
+
**/
|
|
67
|
+
flatFeeAmountInXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
68
|
+
/**
|
|
69
|
+
* Applies fee to amountOut
|
|
70
|
+
**/
|
|
71
|
+
flatFeeAmountOutXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
72
|
+
/**
|
|
73
|
+
* Applies progressive fee to amountIn
|
|
74
|
+
**/
|
|
75
|
+
progressiveFeeInXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
76
|
+
/**
|
|
77
|
+
* Applies progressive fee to amountOut
|
|
78
|
+
**/
|
|
79
|
+
progressiveFeeOutXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
80
|
+
/**
|
|
81
|
+
* Applies protocol fee to amountOut with direct transfer
|
|
82
|
+
**/
|
|
83
|
+
protocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
|
|
84
|
+
/**
|
|
85
|
+
* Applies protocol fee to amountOut through Aqua protocol
|
|
86
|
+
**/
|
|
87
|
+
aquaProtocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
|
|
88
|
+
/**
|
|
89
|
+
* DEBUG: Prints current swap registers (amounts and tokens)
|
|
90
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
91
|
+
*/
|
|
92
|
+
debugPrintSwapRegisters(): this;
|
|
93
|
+
/**
|
|
94
|
+
* DEBUG: Prints current swap query state
|
|
95
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
96
|
+
*/
|
|
97
|
+
debugPrintSwapQuery(): this;
|
|
98
|
+
/**
|
|
99
|
+
* DEBUG: Prints execution context information
|
|
100
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
101
|
+
*/
|
|
102
|
+
debugPrintContext(): this;
|
|
103
|
+
/**
|
|
104
|
+
* DEBUG: Prints calculated amount for swap
|
|
105
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
106
|
+
*/
|
|
107
|
+
debugPrintAmountForSwap(): this;
|
|
108
|
+
/**
|
|
109
|
+
* DEBUG: Prints current free memory pointer value
|
|
110
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
111
|
+
*/
|
|
112
|
+
debugPrintFreeMemoryPointer(): this;
|
|
113
|
+
/**
|
|
114
|
+
* DEBUG: Prints remaining gas
|
|
115
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
116
|
+
*/
|
|
117
|
+
debugPrintGasLeft(): this;
|
|
118
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
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 controls from '../instructions/controls';
|
|
5
|
+
import * as concentrate from '../instructions/concentrate';
|
|
6
|
+
import * as decay from '../instructions/decay';
|
|
7
|
+
import * as fee from '../instructions/fee';
|
|
8
|
+
export declare class AquaProgramBuilder extends ProgramBuilder {
|
|
9
|
+
constructor();
|
|
10
|
+
static decode(program: SwapVmProgram): AquaProgramBuilder;
|
|
11
|
+
/**
|
|
12
|
+
* Enables debug mode for the program
|
|
13
|
+
* WARNING: Debug instructions will throw an error if debug mode is not enabled
|
|
14
|
+
*/
|
|
15
|
+
withDebug(): this;
|
|
16
|
+
/**
|
|
17
|
+
* Unconditional jump to specified program counter
|
|
18
|
+
**/
|
|
19
|
+
jump(data: DataFor<controls.JumpArgs>): this;
|
|
20
|
+
/**
|
|
21
|
+
* Jumps if tokenIn is the specified token
|
|
22
|
+
**/
|
|
23
|
+
jumpIfTokenIn(data: DataFor<controls.JumpIfTokenArgs>): this;
|
|
24
|
+
/**
|
|
25
|
+
* Jumps if tokenOut is the specified token
|
|
26
|
+
**/
|
|
27
|
+
jumpIfTokenOut(data: DataFor<controls.JumpIfTokenArgs>): this;
|
|
28
|
+
/**
|
|
29
|
+
* Reverts if the deadline has been reached
|
|
30
|
+
**/
|
|
31
|
+
deadline(data: DataFor<controls.DeadlineArgs>): this;
|
|
32
|
+
/**
|
|
33
|
+
* Requires taker to hold any amount of specified token (supports NFTs)
|
|
34
|
+
**/
|
|
35
|
+
onlyTakerTokenBalanceNonZero(data: DataFor<controls.OnlyTakerTokenBalanceNonZeroArgs>): this;
|
|
36
|
+
/**
|
|
37
|
+
* Requires taker to hold at least specified amount of token
|
|
38
|
+
**/
|
|
39
|
+
onlyTakerTokenBalanceGte(data: DataFor<controls.OnlyTakerTokenBalanceGteArgs>): this;
|
|
40
|
+
/**
|
|
41
|
+
* Requires taker to hold at least specified share of token's total supply
|
|
42
|
+
**/
|
|
43
|
+
onlyTakerTokenSupplyShareGte(data: DataFor<controls.OnlyTakerTokenSupplyShareGteArgs>): this;
|
|
44
|
+
/**
|
|
45
|
+
* No-op instruction used to add uniqueness to order hashes (prevents replay attacks)
|
|
46
|
+
**/
|
|
47
|
+
salt(data: DataFor<controls.SaltArgs>): this;
|
|
48
|
+
/**
|
|
49
|
+
* Basic swap using constant product formula (x*y=k)
|
|
50
|
+
**/
|
|
51
|
+
xycSwapXD(): this;
|
|
52
|
+
/**
|
|
53
|
+
* Concentrates liquidity within price bounds for multiple tokens
|
|
54
|
+
**/
|
|
55
|
+
concentrateGrowLiquidityXD(data: DataFor<concentrate.ConcentrateGrowLiquidityXDArgs>): this;
|
|
56
|
+
/**
|
|
57
|
+
* Concentrates liquidity within price bounds for two tokens
|
|
58
|
+
**/
|
|
59
|
+
concentrateGrowLiquidity2D(data: DataFor<concentrate.ConcentrateGrowLiquidity2DArgs>): this;
|
|
60
|
+
/**
|
|
61
|
+
* Applies time-based decay to balance adjustments
|
|
62
|
+
**/
|
|
63
|
+
decayXD(data: DataFor<decay.DecayXDArgs>): this;
|
|
64
|
+
/**
|
|
65
|
+
* Applies fee to amountIn
|
|
66
|
+
**/
|
|
67
|
+
flatFeeAmountInXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
68
|
+
/**
|
|
69
|
+
* Applies fee to amountOut
|
|
70
|
+
**/
|
|
71
|
+
flatFeeAmountOutXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
72
|
+
/**
|
|
73
|
+
* Applies progressive fee to amountIn
|
|
74
|
+
**/
|
|
75
|
+
progressiveFeeInXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
76
|
+
/**
|
|
77
|
+
* Applies progressive fee to amountOut
|
|
78
|
+
**/
|
|
79
|
+
progressiveFeeOutXD(data: DataFor<fee.FlatFeeArgs>): this;
|
|
80
|
+
/**
|
|
81
|
+
* Applies protocol fee to amountOut with direct transfer
|
|
82
|
+
**/
|
|
83
|
+
protocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
|
|
84
|
+
/**
|
|
85
|
+
* Applies protocol fee to amountOut through Aqua protocol
|
|
86
|
+
**/
|
|
87
|
+
aquaProtocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
|
|
88
|
+
/**
|
|
89
|
+
* DEBUG: Prints current swap registers (amounts and tokens)
|
|
90
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
91
|
+
*/
|
|
92
|
+
debugPrintSwapRegisters(): this;
|
|
93
|
+
/**
|
|
94
|
+
* DEBUG: Prints current swap query state
|
|
95
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
96
|
+
*/
|
|
97
|
+
debugPrintSwapQuery(): this;
|
|
98
|
+
/**
|
|
99
|
+
* DEBUG: Prints execution context information
|
|
100
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
101
|
+
*/
|
|
102
|
+
debugPrintContext(): this;
|
|
103
|
+
/**
|
|
104
|
+
* DEBUG: Prints calculated amount for swap
|
|
105
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
106
|
+
*/
|
|
107
|
+
debugPrintAmountForSwap(): this;
|
|
108
|
+
/**
|
|
109
|
+
* DEBUG: Prints current free memory pointer value
|
|
110
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
111
|
+
*/
|
|
112
|
+
debugPrintFreeMemoryPointer(): this;
|
|
113
|
+
/**
|
|
114
|
+
* DEBUG: Prints remaining gas
|
|
115
|
+
* WARNING: Requires withDebug() to be called first, otherwise will throw an error
|
|
116
|
+
*/
|
|
117
|
+
debugPrintGasLeft(): this;
|
|
118
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SwapVmProgram } from './swap-vm-program';
|
|
2
|
+
import type { IArgsData, IInstruction, IOpcode } from '../instructions';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for building SwapVM programs
|
|
5
|
+
**/
|
|
6
|
+
export declare class ProgramBuilder {
|
|
7
|
+
protected readonly ixsSet: IOpcode[];
|
|
8
|
+
protected program: IInstruction<IArgsData>[];
|
|
9
|
+
constructor(ixsSet: IOpcode[]);
|
|
10
|
+
/**
|
|
11
|
+
* Decodes a SwapVM program into builder instructions
|
|
12
|
+
**/
|
|
13
|
+
decode(program: SwapVmProgram): this;
|
|
14
|
+
/**
|
|
15
|
+
* Builds the SwapVM program bytecode from accumulated instructions
|
|
16
|
+
**/
|
|
17
|
+
build(): SwapVmProgram;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the current list of instructions in the program
|
|
20
|
+
**/
|
|
21
|
+
getInstructions(): Array<IInstruction>;
|
|
22
|
+
/**
|
|
23
|
+
* Adds an instruction to the program with validation
|
|
24
|
+
**/
|
|
25
|
+
add(ix: IInstruction): this;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SwapVmProgram } from './swap-vm-program';
|
|
2
|
+
import type { IArgsData, IInstruction, IOpcode } from '../instructions';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for building SwapVM programs
|
|
5
|
+
**/
|
|
6
|
+
export declare class ProgramBuilder {
|
|
7
|
+
protected readonly ixsSet: IOpcode[];
|
|
8
|
+
protected program: IInstruction<IArgsData>[];
|
|
9
|
+
constructor(ixsSet: IOpcode[]);
|
|
10
|
+
/**
|
|
11
|
+
* Decodes a SwapVM program into builder instructions
|
|
12
|
+
**/
|
|
13
|
+
decode(program: SwapVmProgram): this;
|
|
14
|
+
/**
|
|
15
|
+
* Builds the SwapVM program bytecode from accumulated instructions
|
|
16
|
+
**/
|
|
17
|
+
build(): SwapVmProgram;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the current list of instructions in the program
|
|
20
|
+
**/
|
|
21
|
+
getInstructions(): Array<IInstruction>;
|
|
22
|
+
/**
|
|
23
|
+
* Adds an instruction to the program with validation
|
|
24
|
+
**/
|
|
25
|
+
add(ix: IInstruction): this;
|
|
26
|
+
}
|
|
@@ -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
|
+
}
|