@paraswap/dex-lib 4.7.11-native.5 → 4.7.11-native.7

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 (146) hide show
  1. package/build/dex/balancer-v3/balancer-v3-pool.js +2 -2
  2. package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -1
  3. package/build/dex/balancer-v3/getOnChainState.d.ts +2 -1
  4. package/build/dex/balancer-v3/getOnChainState.js +44 -30
  5. package/build/dex/balancer-v3/getOnChainState.js.map +1 -1
  6. package/build/dex/idle-dao/idle-dao.d.ts +1 -0
  7. package/build/dex/idle-dao/idle-dao.js +23 -11
  8. package/build/dex/idle-dao/idle-dao.js.map +1 -1
  9. package/build/dex/maker-psm/maker-psm.d.ts +4 -41
  10. package/build/dex/maker-psm/maker-psm.js +40 -143
  11. package/build/dex/maker-psm/maker-psm.js.map +1 -1
  12. package/build/dex/native/native.d.ts +0 -1
  13. package/build/dex/native/native.js +0 -8
  14. package/build/dex/native/native.js.map +1 -1
  15. package/build/executor/types.d.ts +1 -2
  16. package/build/executor/types.js +0 -1
  17. package/build/executor/types.js.map +1 -1
  18. package/package.json +1 -1
  19. package/build/abi/PendleRouterStatic.json +0 -19
  20. package/build/abi/apex-defi/ApexDefiFactory.abi.json +0 -1749
  21. package/build/abi/apex-defi/ApexDefiRouter.abi.json +0 -1120
  22. package/build/abi/apex-defi/ApexDefiToken.abi.json +0 -229
  23. package/build/abi/apex-defi/ApexDefiWrapper.abi.json +0 -92
  24. package/build/abi/apex-defi/ApexDefiWrapperFactory.abi.json +0 -1107
  25. package/build/abi/pangolin-v3/PangolinV3StateMulticall.abi.json +0 -796
  26. package/build/abi/pendle/pendle-deployer.abi.json +0 -520
  27. package/build/abi/pendle/pendle-oracle.abi.json +0 -413
  28. package/build/abi/ring-v2/few-wrapped-token.json +0 -587
  29. package/build/abi/ring-v2/ring-v2-factory.json +0 -125
  30. package/build/abi/ring-v2/ring-v2-pool.json +0 -461
  31. package/build/abi/ring-v2/ring-v2-router.json +0 -332
  32. package/build/abi/stabull/stabull-curve.json +0 -738
  33. package/build/abi/stabull/stabull-router.json +0 -76
  34. package/build/abi/uniswap-v4/hooks/SpotDynamicFeeManager.json +0 -26
  35. package/build/abi/uniswap-v4/hooks/SpotHook.json +0 -54
  36. package/build/abi/uniswap-v4/hooks/SpotPolicyManager.json +0 -45
  37. package/build/abi/uniswap-v4/hooks/cabalcoin-hook.abi.json +0 -682
  38. package/build/abi/uniswap-v4/hooks/fee-hook.abi.json +0 -1335
  39. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.d.ts +0 -29
  40. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.js +0 -153
  41. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying-factory.js.map +0 -1
  42. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.d.ts +0 -40
  43. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js +0 -323
  44. package/build/dex/aave-pt-to-underlying/aave-pt-to-underlying.js.map +0 -1
  45. package/build/dex/aave-pt-to-underlying/config.d.ts +0 -3
  46. package/build/dex/aave-pt-to-underlying/config.js +0 -24
  47. package/build/dex/aave-pt-to-underlying/config.js.map +0 -1
  48. package/build/dex/aave-pt-to-underlying/constants.d.ts +0 -2
  49. package/build/dex/aave-pt-to-underlying/constants.js +0 -6
  50. package/build/dex/aave-pt-to-underlying/constants.js.map +0 -1
  51. package/build/dex/aave-pt-to-underlying/types.d.ts +0 -24
  52. package/build/dex/aave-pt-to-underlying/types.js +0 -3
  53. package/build/dex/aave-pt-to-underlying/types.js.map +0 -1
  54. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.d.ts +0 -39
  55. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js +0 -244
  56. package/build/dex/aave-pt-to-usdc/aave-pt-to-usdc.js.map +0 -1
  57. package/build/dex/aave-pt-to-usdc/config.d.ts +0 -3
  58. package/build/dex/aave-pt-to-usdc/config.js +0 -47
  59. package/build/dex/aave-pt-to-usdc/config.js.map +0 -1
  60. package/build/dex/aave-pt-to-usdc/constants.d.ts +0 -2
  61. package/build/dex/aave-pt-to-usdc/constants.js +0 -6
  62. package/build/dex/aave-pt-to-usdc/constants.js.map +0 -1
  63. package/build/dex/aave-pt-to-usdc/types.d.ts +0 -22
  64. package/build/dex/aave-pt-to-usdc/types.js +0 -3
  65. package/build/dex/aave-pt-to-usdc/types.js.map +0 -1
  66. package/build/dex/apex-defi/apex-defi-factory.d.ts +0 -26
  67. package/build/dex/apex-defi/apex-defi-factory.js +0 -53
  68. package/build/dex/apex-defi/apex-defi-factory.js.map +0 -1
  69. package/build/dex/apex-defi/apex-defi-pool.d.ts +0 -55
  70. package/build/dex/apex-defi/apex-defi-pool.js +0 -247
  71. package/build/dex/apex-defi/apex-defi-pool.js.map +0 -1
  72. package/build/dex/apex-defi/apex-defi-wrapper-factory.d.ts +0 -57
  73. package/build/dex/apex-defi/apex-defi-wrapper-factory.js +0 -250
  74. package/build/dex/apex-defi/apex-defi-wrapper-factory.js.map +0 -1
  75. package/build/dex/apex-defi/apex-defi.d.ts +0 -97
  76. package/build/dex/apex-defi/apex-defi.js +0 -1021
  77. package/build/dex/apex-defi/apex-defi.js.map +0 -1
  78. package/build/dex/apex-defi/config.d.ts +0 -4
  79. package/build/dex/apex-defi/config.js +0 -138
  80. package/build/dex/apex-defi/config.js.map +0 -1
  81. package/build/dex/apex-defi/types.d.ts +0 -32
  82. package/build/dex/apex-defi/types.js +0 -3
  83. package/build/dex/apex-defi/types.js.map +0 -1
  84. package/build/dex/apex-defi/utils.d.ts +0 -46
  85. package/build/dex/apex-defi/utils.js +0 -133
  86. package/build/dex/apex-defi/utils.js.map +0 -1
  87. package/build/dex/miro-migrator/miro-migrator-state.d.ts +0 -27
  88. package/build/dex/miro-migrator/miro-migrator-state.js +0 -89
  89. package/build/dex/miro-migrator/miro-migrator-state.js.map +0 -1
  90. package/build/dex/stabull/config.d.ts +0 -3
  91. package/build/dex/stabull/config.js +0 -177
  92. package/build/dex/stabull/config.js.map +0 -1
  93. package/build/dex/stabull/stabull-pool.d.ts +0 -46
  94. package/build/dex/stabull/stabull-pool.js +0 -113
  95. package/build/dex/stabull/stabull-pool.js.map +0 -1
  96. package/build/dex/stabull/stabull.d.ts +0 -55
  97. package/build/dex/stabull/stabull.js +0 -286
  98. package/build/dex/stabull/stabull.js.map +0 -1
  99. package/build/dex/stabull/types.d.ts +0 -21
  100. package/build/dex/stabull/types.js +0 -3
  101. package/build/dex/stabull/types.js.map +0 -1
  102. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.d.ts +0 -4
  103. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js +0 -56
  104. package/build/dex/uniswap-v3/forks/pangolin-v3/utils.js.map +0 -1
  105. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.d.ts +0 -7
  106. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js +0 -28
  107. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/cabalcoin-hook-pool.js.map +0 -1
  108. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.d.ts +0 -0
  109. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js +0 -2
  110. package/build/dex/uniswap-v4/hooks/cabalcoin-hook/types.js.map +0 -1
  111. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.d.ts +0 -7
  112. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js +0 -28
  113. package/build/dex/uniswap-v4/hooks/fee-hook/fee-hook-pool.js.map +0 -1
  114. package/build/dex/uniswap-v4/hooks/fee-hook/types.d.ts +0 -0
  115. package/build/dex/uniswap-v4/hooks/fee-hook/types.js +0 -2
  116. package/build/dex/uniswap-v4/hooks/fee-hook/types.js.map +0 -1
  117. package/build/dex/uniswap-v4/hooks/index.d.ts +0 -1
  118. package/build/dex/uniswap-v4/hooks/index.js +0 -9
  119. package/build/dex/uniswap-v4/hooks/index.js.map +0 -1
  120. package/build/dex/uniswap-v4/hooks/spot.d.ts +0 -15
  121. package/build/dex/uniswap-v4/hooks/spot.js +0 -109
  122. package/build/dex/uniswap-v4/hooks/spot.js.map +0 -1
  123. package/build/dex/uniswap-v4/hooks/template.d.ts +0 -150
  124. package/build/dex/uniswap-v4/hooks/template.js +0 -104
  125. package/build/dex/uniswap-v4/hooks/template.js.map +0 -1
  126. package/build/dex/usdc-transmuter/usdc-transmuter-pool.d.ts +0 -26
  127. package/build/dex/usdc-transmuter/usdc-transmuter-pool.js +0 -75
  128. package/build/dex/usdc-transmuter/usdc-transmuter-pool.js.map +0 -1
  129. package/build/dex/usual/usual-usdc-usdc.d.ts +0 -17
  130. package/build/dex/usual/usual-usdc-usdc.js +0 -59
  131. package/build/dex/usual/usual-usdc-usdc.js.map +0 -1
  132. package/build/dex/yo/config.d.ts +0 -3
  133. package/build/dex/yo/config.js +0 -21
  134. package/build/dex/yo/config.js.map +0 -1
  135. package/build/dex/yo/types.d.ts +0 -13
  136. package/build/dex/yo/types.js +0 -3
  137. package/build/dex/yo/types.js.map +0 -1
  138. package/build/dex/yo/yo-pool.d.ts +0 -13
  139. package/build/dex/yo/yo-pool.js +0 -26
  140. package/build/dex/yo/yo-pool.js.map +0 -1
  141. package/build/dex/yo/yo.d.ts +0 -39
  142. package/build/dex/yo/yo.js +0 -248
  143. package/build/dex/yo/yo.js.map +0 -1
  144. package/build/implementations/api-paraswap-sdk.d.ts +0 -25
  145. package/build/implementations/api-paraswap-sdk.js +0 -102
  146. package/build/implementations/api-paraswap-sdk.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"spot.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/spot.ts"],"names":[],"mappings":";;;;;;AAAA,yCAA0C;AAG1C,gGAAsE;AACtE,kHAAwF;AACxF,0HAAgG;AAEhG,yCAOoB;AAsBpB,MAAa,QAAS,SAAQ,4BAAiB;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B,CAAC,CAAC,CAAC,CACpD,CAAC;QACF,MAAM,YAAY,GAAG,OAAO,CAC1B,iBAAiB,CAAC,KAAK,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAChD,CAAC;QAEF,MAAM,gBAAgB,GAAG,WAA+B,CAAC;QACzD,MAAM,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC,UAAU,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,MAAM,QAAQ,GAAG,MAAM,CACrB,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,CAAC,CAAC,CACpD,CAAC;QAEF,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;QAC9C,MAAM,aAAa,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,GAAG,QAAQ,CAAC;QAEpE,MAAM,KAAK,GAAG;YACZ,WAAW;YACX,aAAa;YACb,cAAc;SACf,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA7KD,4BA6KC"}
@@ -1,150 +0,0 @@
1
- import { SwapSide } from '@paraswap/core';
2
- import { DeepReadonly } from 'ts-essentials';
3
- import { IDexHelper } from '../../../dex-helper';
4
- import { Address, Log, Logger } from '../../../types';
5
- import { Pool, PoolState, SubgraphPool } from '../types';
6
- /**
7
- * Hook permission bits used by the Uniswap v4 hook address encoding.
8
- * They match https://docs.uniswap.org/contracts/v4/concepts/hooks#permissions.
9
- * Re-using Kyber's mapping so downstream teams have a familiar API.
10
- */
11
- export declare enum HookPermission {
12
- AFTER_REMOVE_LIQUIDITY_RETURNS_DELTA = 0,
13
- AFTER_ADD_LIQUIDITY_RETURNS_DELTA = 1,
14
- AFTER_SWAP_RETURNS_DELTA = 2,
15
- BEFORE_SWAP_RETURNS_DELTA = 3,
16
- AFTER_DONATE = 4,
17
- BEFORE_DONATE = 5,
18
- AFTER_SWAP = 6,
19
- BEFORE_SWAP = 7,
20
- AFTER_REMOVE_LIQUIDITY = 8,
21
- BEFORE_REMOVE_LIQUIDITY = 9,
22
- AFTER_ADD_LIQUIDITY = 10,
23
- BEFORE_ADD_LIQUIDITY = 11,
24
- AFTER_INITIALIZE = 12,
25
- BEFORE_INITIALIZE = 13
26
- }
27
- export declare const hasHookPermission: (address: Address, permission: HookPermission) => boolean;
28
- export declare const canBeforeSwap: (address: Address) => boolean;
29
- export declare const canAfterSwap: (address: Address) => boolean;
30
- export type HookFactoryParams = {
31
- dexHelper: IDexHelper;
32
- dexKey: string;
33
- logger: Logger;
34
- network: number;
35
- hookAddress: Address;
36
- };
37
- export type HookBootstrapParams = HookFactoryParams & {
38
- pool: SubgraphPool;
39
- };
40
- export type HookStateContext = HookFactoryParams & {
41
- pool: Pool;
42
- poolState: DeepReadonly<PoolState>;
43
- blockNumber: number;
44
- };
45
- export type HookBeforeSwapParams = HookStateContext & {
46
- amountSpecified: bigint;
47
- zeroForOne: boolean;
48
- side: SwapSide;
49
- };
50
- export type HookBeforeSwapResult = {
51
- /**
52
- * Optional override for the amount specified that will be forwarded to pool math.
53
- * Useful for hooks that deduct their own fee prior to the swap.
54
- */
55
- amountSpecified?: bigint;
56
- /**
57
- * Override for lpFee if the hook is dynamically adjusting the pool fee.
58
- */
59
- lpFeeOverride?: bigint;
60
- /**
61
- * Extra calldata that needs to be appended to router.swap parameters.
62
- */
63
- hookData?: string;
64
- /**
65
- * Optional state patch that will be merged in-memory before simulation continues.
66
- */
67
- statePatch?: Partial<PoolState>;
68
- /**
69
- * Free-form metadata (e.g. diagnostics, gas estimates) propagated to afterSwap.
70
- */
71
- metadata?: Record<string, unknown>;
72
- };
73
- export type HookAfterSwapParams = HookStateContext & {
74
- amountIn: bigint;
75
- amountOut: bigint;
76
- zeroForOne: boolean;
77
- side: SwapSide;
78
- metadata?: Record<string, unknown>;
79
- };
80
- export type HookAfterSwapResult = {
81
- deltaAmountIn?: bigint;
82
- deltaAmountOut?: bigint;
83
- statePatch?: Partial<PoolState>;
84
- };
85
- export type HookEventParams = HookFactoryParams & {
86
- pool: Pool;
87
- poolState: PoolState;
88
- eventName: string;
89
- eventArgs: any;
90
- log: Log;
91
- blockNumber: number;
92
- };
93
- export interface IUniswapV4Hook {
94
- readonly name: string;
95
- readonly hookAddress: Address;
96
- readonly description?: string;
97
- /**
98
- * Optional hook-level initialization invoked once after the pool list is fetched.
99
- */
100
- bootstrap?(params: HookBootstrapParams): Promise<void>;
101
- /**
102
- * Allows hooks to filter pools beyond address equality (e.g. min TVL, custom fee).
103
- */
104
- supportsPool(pool: SubgraphPool): boolean;
105
- /**
106
- * Gives hooks a chance to enrich pool state (e.g. fetch additional storage slots).
107
- */
108
- extendPoolState?(context: HookStateContext): Promise<Partial<PoolState> | void>;
109
- /**
110
- * Invoked before SwapMath is executed to let hooks override inputs or provide hookData.
111
- */
112
- beforeSwap?(params: HookBeforeSwapParams): Promise<HookBeforeSwapResult | void>;
113
- /**
114
- * Invoked after pool math completes so hooks can settle their internal accounting.
115
- */
116
- afterSwap?(params: HookAfterSwapParams): Promise<HookAfterSwapResult | void>;
117
- /**
118
- * Hooks may request direct access to PoolManager events for bespoke state sync.
119
- */
120
- handlePoolEvent?(params: HookEventParams): Promise<Partial<PoolState> | void>;
121
- /**
122
- * Destroy internal caches.
123
- */
124
- destroy?(): void;
125
- }
126
- export declare abstract class BaseUniswapV4Hook implements IUniswapV4Hook {
127
- readonly hookAddress: Address;
128
- readonly name: string;
129
- protected readonly params: HookFactoryParams;
130
- readonly description?: string;
131
- protected constructor(hookAddress: Address, name: string, params: HookFactoryParams);
132
- bootstrap(_params: HookBootstrapParams): Promise<void>;
133
- supportsPool(pool: SubgraphPool): boolean;
134
- extendPoolState(_context: HookStateContext): Promise<Partial<PoolState> | void>;
135
- beforeSwap(_params: HookBeforeSwapParams): Promise<HookBeforeSwapResult | void>;
136
- afterSwap(_params: HookAfterSwapParams): Promise<HookAfterSwapResult | void>;
137
- handlePoolEvent(_params: HookEventParams): Promise<Partial<PoolState> | void>;
138
- destroy(): void;
139
- protected get logger(): Logger;
140
- protected get dexHelper(): IDexHelper;
141
- }
142
- export type HookFactory = (params: HookFactoryParams) => IUniswapV4Hook;
143
- export declare class UniswapV4HookRegistry {
144
- private readonly factories;
145
- registerFactory(address: Address, factory: HookFactory): this;
146
- unregisterFactory(address: Address): boolean;
147
- getFactory(address: Address): HookFactory | undefined;
148
- createHook(address: Address, params: Omit<HookFactoryParams, 'hookAddress'>): IUniswapV4Hook | undefined;
149
- }
150
- export declare const uniswapV4HookRegistry: UniswapV4HookRegistry;
@@ -1,104 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uniswapV4HookRegistry = exports.UniswapV4HookRegistry = exports.BaseUniswapV4Hook = exports.canAfterSwap = exports.canBeforeSwap = exports.hasHookPermission = exports.HookPermission = void 0;
4
- /**
5
- * Hook permission bits used by the Uniswap v4 hook address encoding.
6
- * They match https://docs.uniswap.org/contracts/v4/concepts/hooks#permissions.
7
- * Re-using Kyber's mapping so downstream teams have a familiar API.
8
- */
9
- var HookPermission;
10
- (function (HookPermission) {
11
- HookPermission[HookPermission["AFTER_REMOVE_LIQUIDITY_RETURNS_DELTA"] = 0] = "AFTER_REMOVE_LIQUIDITY_RETURNS_DELTA";
12
- HookPermission[HookPermission["AFTER_ADD_LIQUIDITY_RETURNS_DELTA"] = 1] = "AFTER_ADD_LIQUIDITY_RETURNS_DELTA";
13
- HookPermission[HookPermission["AFTER_SWAP_RETURNS_DELTA"] = 2] = "AFTER_SWAP_RETURNS_DELTA";
14
- HookPermission[HookPermission["BEFORE_SWAP_RETURNS_DELTA"] = 3] = "BEFORE_SWAP_RETURNS_DELTA";
15
- HookPermission[HookPermission["AFTER_DONATE"] = 4] = "AFTER_DONATE";
16
- HookPermission[HookPermission["BEFORE_DONATE"] = 5] = "BEFORE_DONATE";
17
- HookPermission[HookPermission["AFTER_SWAP"] = 6] = "AFTER_SWAP";
18
- HookPermission[HookPermission["BEFORE_SWAP"] = 7] = "BEFORE_SWAP";
19
- HookPermission[HookPermission["AFTER_REMOVE_LIQUIDITY"] = 8] = "AFTER_REMOVE_LIQUIDITY";
20
- HookPermission[HookPermission["BEFORE_REMOVE_LIQUIDITY"] = 9] = "BEFORE_REMOVE_LIQUIDITY";
21
- HookPermission[HookPermission["AFTER_ADD_LIQUIDITY"] = 10] = "AFTER_ADD_LIQUIDITY";
22
- HookPermission[HookPermission["BEFORE_ADD_LIQUIDITY"] = 11] = "BEFORE_ADD_LIQUIDITY";
23
- HookPermission[HookPermission["AFTER_INITIALIZE"] = 12] = "AFTER_INITIALIZE";
24
- HookPermission[HookPermission["BEFORE_INITIALIZE"] = 13] = "BEFORE_INITIALIZE";
25
- })(HookPermission || (exports.HookPermission = HookPermission = {}));
26
- const ADDRESS_HEX_PREFIX = '0x';
27
- const normalizeAddress = (address) => address.toLowerCase().startsWith(ADDRESS_HEX_PREFIX)
28
- ? address.toLowerCase()
29
- : `${ADDRESS_HEX_PREFIX}${address.toLowerCase()}`;
30
- const decodePermissionBits = (address) => {
31
- const normalized = normalizeAddress(address).slice(2).padStart(40, '0');
32
- const lastTwoBytes = normalized.slice(-4);
33
- return parseInt(lastTwoBytes, 16);
34
- };
35
- const hasHookPermission = (address, permission) => {
36
- const bits = decodePermissionBits(address);
37
- return (bits & (1 << permission)) !== 0;
38
- };
39
- exports.hasHookPermission = hasHookPermission;
40
- const canBeforeSwap = (address) => (0, exports.hasHookPermission)(address, HookPermission.BEFORE_SWAP);
41
- exports.canBeforeSwap = canBeforeSwap;
42
- const canAfterSwap = (address) => (0, exports.hasHookPermission)(address, HookPermission.AFTER_SWAP);
43
- exports.canAfterSwap = canAfterSwap;
44
- class BaseUniswapV4Hook {
45
- hookAddress;
46
- name;
47
- params;
48
- description;
49
- constructor(hookAddress, name, params) {
50
- this.hookAddress = hookAddress;
51
- this.name = name;
52
- this.params = params;
53
- }
54
- async bootstrap(_params) {
55
- // No-op by default.
56
- }
57
- supportsPool(pool) {
58
- return normalizeAddress(pool.hooks) === normalizeAddress(this.hookAddress);
59
- }
60
- async extendPoolState(_context) {
61
- return undefined;
62
- }
63
- async beforeSwap(_params) {
64
- return undefined;
65
- }
66
- async afterSwap(_params) {
67
- return undefined;
68
- }
69
- async handlePoolEvent(_params) {
70
- return undefined;
71
- }
72
- destroy() {
73
- // No-op by default.
74
- }
75
- get logger() {
76
- return this.params.logger;
77
- }
78
- get dexHelper() {
79
- return this.params.dexHelper;
80
- }
81
- }
82
- exports.BaseUniswapV4Hook = BaseUniswapV4Hook;
83
- class UniswapV4HookRegistry {
84
- factories = new Map();
85
- registerFactory(address, factory) {
86
- this.factories.set(normalizeAddress(address), factory);
87
- return this;
88
- }
89
- unregisterFactory(address) {
90
- return this.factories.delete(normalizeAddress(address));
91
- }
92
- getFactory(address) {
93
- return this.factories.get(normalizeAddress(address));
94
- }
95
- createHook(address, params) {
96
- const factory = this.getFactory(address);
97
- if (!factory)
98
- return undefined;
99
- return factory({ ...params, hookAddress: normalizeAddress(address) });
100
- }
101
- }
102
- exports.UniswapV4HookRegistry = UniswapV4HookRegistry;
103
- exports.uniswapV4HookRegistry = new UniswapV4HookRegistry();
104
- //# sourceMappingURL=template.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/template.ts"],"names":[],"mappings":";;;AAOA;;;;GAIG;AACH,IAAY,cAeX;AAfD,WAAY,cAAc;IACxB,mHAAwC,CAAA;IACxC,6GAAqC,CAAA;IACrC,2FAA4B,CAAA;IAC5B,6FAA6B,CAAA;IAC7B,mEAAgB,CAAA;IAChB,qEAAiB,CAAA;IACjB,+DAAc,CAAA;IACd,iEAAe,CAAA;IACf,uFAA0B,CAAA;IAC1B,yFAA2B,CAAA;IAC3B,kFAAwB,CAAA;IACxB,oFAAyB,CAAA;IACzB,4EAAqB,CA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,CAAC;IAC1D,CAAC;IAED,UAAU,CAAC,OAAgB;QACzB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,UAAU,CACR,OAAgB,EAChB,MAA8C;QAE9C,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,OAAO,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACxE,CAAC;CACF;AAxBD,sDAwBC;AAEY,QAAA,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
@@ -1,26 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { DeepReadonly } from 'ts-essentials';
3
- import { Log, Logger } from '../../types';
4
- import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
- import { IDexHelper } from '../../dex-helper/idex-helper';
6
- import { PoolState } from './types';
7
- import { Contract } from 'ethers';
8
- export declare class UsdcTransmuterEventPool extends StatefulEventSubscriber<PoolState> {
9
- readonly parentName: string;
10
- protected network: number;
11
- protected dexHelper: IDexHelper;
12
- protected usdcTransmuterAddress: string;
13
- protected usdcAddress: string;
14
- protected usdcTransmuterIface: Interface;
15
- protected usdcContract: Contract;
16
- handlers: {
17
- [event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => DeepReadonly<PoolState> | null;
18
- };
19
- logDecoder: (log: Log) => any;
20
- constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, usdcTransmuterAddress: string, usdcAddress: string, usdcTransmuterIface?: Interface, usdcContract?: Contract);
21
- protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
22
- generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<PoolState>>;
23
- getOrGenerateState(blockNumber: number): Promise<PoolState>;
24
- handleDeposit(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
25
- handleWithdrawal(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): DeepReadonly<PoolState> | null;
26
- }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UsdcTransmuterEventPool = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const utils_1 = require("../../utils");
9
- const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
10
- const usdc_transmuter_abi_json_1 = __importDefault(require("../../abi/usdc-transmuter/usdc-transmuter.abi.json"));
11
- const utils_2 = require("../../lib/tokens/utils");
12
- const ethers_1 = require("ethers");
13
- class UsdcTransmuterEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
14
- parentName;
15
- network;
16
- dexHelper;
17
- usdcTransmuterAddress;
18
- usdcAddress;
19
- usdcTransmuterIface;
20
- usdcContract;
21
- handlers = {};
22
- logDecoder;
23
- constructor(parentName, network, dexHelper, logger, usdcTransmuterAddress, usdcAddress, usdcTransmuterIface = new abi_1.Interface(usdc_transmuter_abi_json_1.default), usdcContract = new ethers_1.Contract(usdcAddress, utils_2.erc20Iface, dexHelper.provider)) {
24
- super(parentName, 'usdc', dexHelper, logger);
25
- this.parentName = parentName;
26
- this.network = network;
27
- this.dexHelper = dexHelper;
28
- this.usdcTransmuterAddress = usdcTransmuterAddress;
29
- this.usdcAddress = usdcAddress;
30
- this.usdcTransmuterIface = usdcTransmuterIface;
31
- this.usdcContract = usdcContract;
32
- this.logDecoder = (log) => this.usdcTransmuterIface.parseLog(log);
33
- this.addressesSubscribed = [usdcTransmuterAddress];
34
- this.handlers['Deposit'] = this.handleDeposit.bind(this);
35
- this.handlers['Withdraw'] = this.handleWithdrawal.bind(this);
36
- }
37
- processLog(state, log) {
38
- try {
39
- const event = this.logDecoder(log);
40
- if (event.name in this.handlers) {
41
- return this.handlers[event.name](event, state, log);
42
- }
43
- }
44
- catch (e) {
45
- (0, utils_1.catchParseLogError)(e, this.logger);
46
- }
47
- return null;
48
- }
49
- async generateState(blockNumber = 'latest') {
50
- const balance = await this.usdcContract.balanceOf(this.usdcTransmuterAddress, { blockTag: blockNumber });
51
- return {
52
- balance: balance.toBigInt(),
53
- };
54
- }
55
- async getOrGenerateState(blockNumber) {
56
- let state = this.getState(blockNumber);
57
- if (!state) {
58
- state = await this.generateState(blockNumber);
59
- this.setState(state, blockNumber);
60
- }
61
- return state;
62
- }
63
- handleDeposit(event, state, log) {
64
- return {
65
- balance: state.balance + event.args.amount.toBigInt(),
66
- };
67
- }
68
- handleWithdrawal(event, state, log) {
69
- return {
70
- balance: state.balance - event.args.amount.toBigInt(),
71
- };
72
- }
73
- }
74
- exports.UsdcTransmuterEventPool = UsdcTransmuterEventPool;
75
- //# sourceMappingURL=usdc-transmuter-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usdc-transmuter-pool.js","sourceRoot":"","sources":["../../../src/dex/usdc-transmuter/usdc-transmuter-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAG/C,uCAAiD;AACjD,+EAA0E;AAG1E,kHAAmF;AACnF,kDAAoD;AACpD,mCAAkC;AAElC,MAAa,uBAAwB,SAAQ,mDAAkC;IAYlE;IACC;IACA;IAEA;IACA;IACA;IACA;IAlBZ,QAAQ,GAMJ,EAAE,CAAC;IAEP,UAAU,CAAoB;IAE9B,YACW,UAAkB,EACjB,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,qBAA6B,EAC7B,WAAmB,EACnB,sBAAsB,IAAI,eAAS,CAAC,kCAAiB,CAAC,EACtD,eAAe,IAAI,iBAAQ,CACnC,WAAW,EACX,kBAAU,EACV,SAAS,CAAC,QAAQ,CACnB;QAED,KAAK,CAAC,UAAU,EAAE,MAAM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AC,SAAS,CAC/C,IAAI,CAAC,qBAAqB,EAC1B,EAAE,QAAQ,EAAE,WAAW,EAAE,CAC1B,CAAC;QAEF,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE;SAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,WAAmB;QAC1C,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa,CACX,KAAU,EACV,KAA8B,EAC9B,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;SACtD,CAAC;IACJ,CAAC;IAED,gBAAgB,CACd,KAAU,EACV,KAA8B,EAC9B,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;SACtD,CAAC;IACJ,CAAC;CACF;AA3FD,0DA2FC"}
@@ -1,17 +0,0 @@
1
- import { Address, DexExchangeParam, NumberAsString } from '../../types';
2
- import { Network, SwapSide } from '../../constants';
3
- import { IDexHelper } from '../../dex-helper/idex-helper';
4
- import { Interface } from '@ethersproject/abi';
5
- import { Usual } from './usual';
6
- export declare class UsualUSDCUsdc extends Usual {
7
- readonly network: Network;
8
- readonly dexKey: string;
9
- readonly dexHelper: IDexHelper;
10
- static dexKeysWithNetwork: {
11
- key: string;
12
- networks: Network[];
13
- }[];
14
- usualUsdcIface: Interface;
15
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
16
- getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: {}, side: SwapSide): Promise<DexExchangeParam>;
17
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UsualUSDCUsdc = void 0;
7
- const constants_1 = require("../../constants");
8
- const abi_1 = require("@ethersproject/abi");
9
- const usual_1 = require("./usual");
10
- const utils_1 = require("../../utils");
11
- const utils_2 = require("../../executor/utils");
12
- const abi_json_1 = __importDefault(require("../../abi/usual-usual-usdc/abi.json"));
13
- const Config = {
14
- UsualUSDCUsdc: {
15
- [constants_1.Network.MAINNET]: {
16
- fromToken: {
17
- address: '0xb672B3976bAa3952bFb2eCE8eeFB784f8daB1424', // Usual USDC
18
- decimals: 6,
19
- },
20
- toToken: {
21
- address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
22
- decimals: 6,
23
- },
24
- },
25
- },
26
- };
27
- class UsualUSDCUsdc extends usual_1.Usual {
28
- network;
29
- dexKey;
30
- dexHelper;
31
- static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(Config);
32
- usualUsdcIface;
33
- constructor(network, dexKey, dexHelper) {
34
- super(network, dexKey, dexHelper, Config[dexKey][network]);
35
- this.network = network;
36
- this.dexKey = dexKey;
37
- this.dexHelper = dexHelper;
38
- this.usualUsdcIface = new abi_1.Interface(abi_json_1.default);
39
- }
40
- async getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
41
- if (this.isFromToken(srcToken) && this.isToToken(destToken)) {
42
- const UNWRAP_FUNCTION = 'unwrap(address,uint256)';
43
- const amount = side === constants_1.SwapSide.SELL ? srcAmount : destAmount;
44
- const exchangeData = this.usualUsdcIface.encodeFunctionData(UNWRAP_FUNCTION, [recipient, amount]);
45
- return {
46
- needWrapNative: false,
47
- dexFuncHasRecipient: true,
48
- exchangeData,
49
- targetExchange: this.config.fromToken.address,
50
- returnAmountPos: side === constants_1.SwapSide.SELL
51
- ? (0, utils_2.extractReturnAmountPosition)(this.usualUsdcIface, UNWRAP_FUNCTION)
52
- : undefined,
53
- };
54
- }
55
- throw new Error('LOGIC ERROR');
56
- }
57
- }
58
- exports.UsualUSDCUsdc = UsualUSDCUsdc;
59
- //# sourceMappingURL=usual-usdc-usdc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usual-usdc-usdc.js","sourceRoot":"","sources":["../../../src/dex/usual/usual-usdc-usdc.ts"],"names":[],"mappings":";;;;;;AAMA,+CAAoD;AAGpD,4CAA6D;AAC7D,mCAAgC;AAChC,uCAAoD;AACpD,gDAAmE;AACnE,mFAAiE;AAEjE,MAAM,MAAM,GAA4B;IACtC,aAAa,EAAE;QACb,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,SAAS,EAAE;gBACT,OAAO,EAAE,4CAA4C,EAAE,aAAa;gBACpE,QAAQ,EAAE,CAAC;aACZ;YACD,OAAO,EAAE;gBACP,OAAO,EAAE,4CAA4C,EAAE,OAAO;gBAC9D,QAAQ,EAAE,CAAC;aACZ;SACF;KACF;CACF,CAAC;AAEF,MAAa,aAAc,SAAQ,aAAK;IAO3B;IACA;IACA;IARJ,MAAM,CAAC,kBAAkB,GAC9B,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;IAEhC,cAAc,CAAY;IAE1B,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB;QAE9B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAJlD,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QAG9B,IAAI,CAAC,cAAc,GAAG,IAAI,eAAS,CAAC,kBAAgC,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,WAAW,CACf,QAAiB,EACjB,SAAkB,EAClB,SAAyB,EACzB,UAA0B,EAC1B,SAAkB,EAClB,IAAQ,EACR,IAAc;QAEd,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5D,MAAM,eAAe,GAAG,yBAAyB,CAAC;YAClD,MAAM,MAAM,GAAG,IAAI,KAAK,oBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;YAE/D,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,kBAAkB,CACzD,eAAe,EACf,CAAC,SAAS,EAAE,MAAM,CAAC,CACpB,CAAC;YAEF,OAAO;gBACL,cAAc,EAAE,KAAK;gBACrB,mBAAmB,EAAE,IAAI;gBACzB,YAAY;gBACZ,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO;gBAC7C,eAAe,EACb,IAAI,KAAK,oBAAQ,CAAC,IAAI;oBACpB,CAAC,CAAC,IAAA,mCAA2B,EAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC;oBACnE,CAAC,CAAC,SAAS;aAChB,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;;AA9CH,sCA+CC"}
@@ -1,3 +0,0 @@
1
- import { DexParams } from './types';
2
- import { DexConfigMap } from '../../types';
3
- export declare const YoConfig: DexConfigMap<DexParams>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.YoConfig = void 0;
4
- const constants_1 = require("../../constants");
5
- exports.YoConfig = {
6
- yoETH: {
7
- [constants_1.Network.BASE]: {
8
- vault: '0x3a43aec53490cb9fa922847385d82fe25d0e9de7',
9
- asset: '0x4200000000000000000000000000000000000006',
10
- decimals: 18,
11
- },
12
- },
13
- yoUSD: {
14
- [constants_1.Network.BASE]: {
15
- vault: '0x0000000f2eb9f69274678c76222b35eec7588a65',
16
- asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
17
- decimals: 6,
18
- },
19
- },
20
- };
21
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/yo/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,QAAQ,GAA4B;IAC/C,KAAK,EAAE;QACL,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;YACd,KAAK,EAAE,4CAA4C;YACnD,KAAK,EAAE,4CAA4C;YACnD,QAAQ,EAAE,EAAE;SACb;KACF;IACD,KAAK,EAAE;QACL,CAAC,mBAAO,CAAC,IAAI,CAAC,EAAE;YACd,KAAK,EAAE,4CAA4C;YACnD,KAAK,EAAE,4CAA4C;YACnD,QAAQ,EAAE,CAAC;SACZ;KACF;CACF,CAAC"}
@@ -1,13 +0,0 @@
1
- import { Address } from '../../types';
2
- export type YoData = {
3
- exchange: Address;
4
- state: {
5
- totalShares: string;
6
- totalAssets: string;
7
- };
8
- };
9
- export type DexParams = {
10
- vault: string;
11
- asset: string;
12
- decimals: number;
13
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/yo/types.ts"],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- import { Interface } from '@ethersproject/abi';
2
- import { Logger, Address } from '../../types';
3
- import { IDexHelper } from '../../dex-helper/idex-helper';
4
- import { ERC4626EventPool } from '../erc4626/erc-4626-pool';
5
- import { Network } from '../../constants';
6
- import { ERC4626PoolState } from '../erc4626/types';
7
- export declare class YoEventPool extends ERC4626EventPool {
8
- readonly parentName: string;
9
- protected network: Network;
10
- protected dexHelper: IDexHelper;
11
- constructor(parentName: string, network: Network, dexHelper: IDexHelper, logger: Logger, vault: Address, asset: Address, cooldownEnabled?: boolean, yoIface?: Interface);
12
- withdrawRedeemAllowed(state: ERC4626PoolState): boolean;
13
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.YoEventPool = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const erc_4626_pool_1 = require("../erc4626/erc-4626-pool");
9
- const ERC4626_json_1 = __importDefault(require("../../abi/ERC4626.json"));
10
- const constants_1 = require("../erc4626/constants");
11
- class YoEventPool extends erc_4626_pool_1.ERC4626EventPool {
12
- parentName;
13
- network;
14
- dexHelper;
15
- constructor(parentName, network, dexHelper, logger, vault, asset, cooldownEnabled = false, yoIface = new abi_1.Interface(ERC4626_json_1.default)) {
16
- super(parentName, network, `${vault}_${asset}`, dexHelper, vault, asset, yoIface, logger, constants_1.DEPOSIT_TOPIC, constants_1.WITHDRAW_TOPIC, constants_1.TRANSFER_TOPIC, cooldownEnabled);
17
- this.parentName = parentName;
18
- this.network = network;
19
- this.dexHelper = dexHelper;
20
- }
21
- withdrawRedeemAllowed(state) {
22
- return true;
23
- }
24
- }
25
- exports.YoEventPool = YoEventPool;
26
- //# sourceMappingURL=yo-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"yo-pool.js","sourceRoot":"","sources":["../../../src/dex/yo/yo-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAG/C,4DAA4D;AAE5D,0EAAiD;AACjD,oDAI8B;AAG9B,MAAa,WAAY,SAAQ,gCAAgB;IAEpC;IACC;IACA;IAHZ,YACW,UAAkB,EACjB,OAAgB,EAChB,SAAqB,EAC/B,MAAc,EACd,KAAc,EACd,KAAc,EACd,kBAA2B,KAAK,EAChC,OAAO,GAAG,IAAI,eAAS,CAAC,sBAAW,CAAC;QAEpC,KAAK,CACH,UAAU,EACV,OAAO,EACP,GAAG,KAAK,IAAI,KAAK,EAAE,EACnB,SAAS,EACT,KAAK,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,yBAAa,EACb,0BAAc,EACd,0BAAc,EACd,eAAe,CAChB,CAAC;QAtBO,eAAU,GAAV,UAAU,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAS;QAChB,cAAS,GAAT,SAAS,CAAY;IAqBjC,CAAC;IAED,qBAAqB,CAAC,KAAuB;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9BD,kCA8BC"}
@@ -1,39 +0,0 @@
1
- import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger, NumberAsString, DexExchangeParam } from '../../types';
2
- import { SwapSide, Network } from '../../constants';
3
- import { IDex, Context } from '../idex';
4
- import { IDexHelper } from '../../dex-helper/idex-helper';
5
- import { YoData } from './types';
6
- import { YoEventPool } from './yo-pool';
7
- import { ERC4626 } from '../erc4626/erc4626';
8
- import { Interface } from '@ethersproject/abi';
9
- export declare enum ERC4626Functions {
10
- deposit = "deposit",
11
- redeem = "redeem",
12
- withdraw = "withdraw",
13
- mint = "mint"
14
- }
15
- export declare class Yo extends ERC4626 implements IDex<YoData> {
16
- readonly network: Network;
17
- readonly dexKey: string;
18
- readonly dexHelper: IDexHelper;
19
- readonly vault: string;
20
- readonly asset: string;
21
- readonly decimals: number;
22
- readonly erc4626Interface: Interface;
23
- readonly needWrapNative = true;
24
- readonly isFeeOnTransferSupported = false;
25
- static dexKeysWithNetwork: {
26
- key: string;
27
- networks: Network[];
28
- }[];
29
- logger: Logger;
30
- readonly eventPool: YoEventPool;
31
- constructor(network: Network, dexKey: string, dexHelper: IDexHelper, vault?: string, asset?: string, decimals?: number, erc4626Interface?: Interface);
32
- getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number): Promise<null | ExchangePrices<YoData>>;
33
- getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: YoData, side: SwapSide): Promise<SimpleExchangeParam>;
34
- getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: YoData, side: SwapSide, _: Context, executorAddress: Address): Promise<DexExchangeParam>;
35
- getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: YoData, side: SwapSide): AdapterExchangeParam;
36
- getCalldataGasCost(_poolPrices: PoolPrices<YoData>): number | number[];
37
- updatePoolState(): Promise<void>;
38
- getTopPoolsForToken(tokenAddress: Address, _limit: number): Promise<PoolLiquidity[]>;
39
- }