@paraswap/dex-lib 4.7.15-executor-build-os-arm.0 → 4.7.16
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/build/abi/pharaoh-v3/PharaohV3Factory.abi.json +0 -310
- package/build/abi/uniswap-v4/hooks/arena/arena-fee-helper.abi.json +476 -0
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/uniswap-v3/config.js +38 -34
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/uniswap-v3/forks/pharaoh-v3/pharaoh-v3-pool.js +2 -5
- package/build/dex/uniswap-v3/forks/pharaoh-v3/pharaoh-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/forks/pharaoh-v3/pharaoh-v3.js +9 -15
- package/build/dex/uniswap-v3/forks/pharaoh-v3/pharaoh-v3.js.map +1 -1
- package/build/dex/uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream-pool.d.ts +2 -2
- package/build/dex/uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +2 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.js +3 -1
- package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +2 -2
- package/build/dex/uniswap-v3/uniswap-v3.js +1 -1
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/uniswap-v4/hooks/arena/arena-hook.d.ts +17 -0
- package/build/dex/uniswap-v4/hooks/arena/arena-hook.js +97 -0
- package/build/dex/uniswap-v4/hooks/arena/arena-hook.js.map +1 -0
- package/build/dex/uniswap-v4/hooks/arena.d.ts +6 -0
- package/build/dex/uniswap-v4/hooks/arena.js +10 -0
- package/build/dex/uniswap-v4/hooks/arena.js.map +1 -0
- package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.d.ts +0 -0
- package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.js +2 -0
- package/build/dex/uniswap-v4/hooks/base-fee/base-fee-hook.js.map +1 -0
- package/build/dex/uniswap-v4/hooks/index.d.ts +16 -1
- package/build/dex/uniswap-v4/hooks/index.js +34 -6
- package/build/dex/uniswap-v4/hooks/index.js.map +1 -1
- package/build/dex/uniswap-v4/hooks/types.d.ts +50 -0
- package/build/dex/uniswap-v4/hooks/types.js +3 -0
- package/build/dex/uniswap-v4/hooks/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,97 @@
|
|
|
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.ArenaHook = void 0;
|
|
7
|
+
const __1 = require("..");
|
|
8
|
+
const ethers_1 = require("ethers");
|
|
9
|
+
const arena_fee_helper_abi_json_1 = __importDefault(require("../../../../abi/uniswap-v4/hooks/arena/arena-fee-helper.abi.json"));
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const ARENA_FEE_HELPER_ADDRESS = '0x537505DA49b4249b576fc8d00028bfDdf6189077';
|
|
12
|
+
class ArenaHook extends __1.BaseHook {
|
|
13
|
+
dexHelper;
|
|
14
|
+
arenaFeeHelper;
|
|
15
|
+
deployers = new Set();
|
|
16
|
+
constructor(dexHelper, arenaFeeHelper = new ethers_1.Contract(ARENA_FEE_HELPER_ADDRESS, arena_fee_helper_abi_json_1.default, dexHelper.provider)) {
|
|
17
|
+
super();
|
|
18
|
+
this.dexHelper = dexHelper;
|
|
19
|
+
this.arenaFeeHelper = arenaFeeHelper;
|
|
20
|
+
}
|
|
21
|
+
name() {
|
|
22
|
+
return 'ArenaHook';
|
|
23
|
+
}
|
|
24
|
+
setDeployer(address, enabled) {
|
|
25
|
+
if (enabled)
|
|
26
|
+
this.deployers.add(address.toLowerCase());
|
|
27
|
+
else
|
|
28
|
+
this.deployers.delete(address.toLowerCase());
|
|
29
|
+
}
|
|
30
|
+
async getHookPermissions() {
|
|
31
|
+
return {
|
|
32
|
+
beforeInitialize: true,
|
|
33
|
+
afterInitialize: false,
|
|
34
|
+
beforeAddLiquidity: false,
|
|
35
|
+
afterAddLiquidity: false,
|
|
36
|
+
beforeRemoveLiquidity: false,
|
|
37
|
+
afterRemoveLiquidity: false,
|
|
38
|
+
beforeSwap: false,
|
|
39
|
+
afterSwap: true,
|
|
40
|
+
beforeDonate: false,
|
|
41
|
+
afterDonate: false,
|
|
42
|
+
beforeSwapReturnDelta: false,
|
|
43
|
+
afterSwapReturnDelta: true,
|
|
44
|
+
afterAddLiquidityReturnDelta: false,
|
|
45
|
+
afterRemoveLiquidityReturnDelta: false,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async beforeInitialize(sender, key, sqrtPriceX96) {
|
|
49
|
+
if (!this.deployers.has(sender.toLowerCase())) {
|
|
50
|
+
throw new Error('Only deployer can call this function');
|
|
51
|
+
}
|
|
52
|
+
return '0x00000000'; // matches Solidity returning the selector
|
|
53
|
+
}
|
|
54
|
+
async afterSwap(sender, key, params, delta, hookData) {
|
|
55
|
+
// Determine unspecified output (same logic as Solidity)
|
|
56
|
+
const zeroForOne = params.zeroForOne;
|
|
57
|
+
const amountSpecified = BigInt(params.amountSpecified);
|
|
58
|
+
const isOutput0 = amountSpecified < 0n === zeroForOne;
|
|
59
|
+
const unspecifiedDelta = isOutput0 ? delta.amount0 : delta.amount1;
|
|
60
|
+
let output = unspecifiedDelta;
|
|
61
|
+
if (output === 0n)
|
|
62
|
+
return ['0x00000000', 0n];
|
|
63
|
+
if (output < 0n)
|
|
64
|
+
output = -output;
|
|
65
|
+
// Retrieve total fee ppm for this pool
|
|
66
|
+
const totalFeePpm = await this.arenaFeeHelper.getTotalFeePpm((0, utils_1.toId)(key));
|
|
67
|
+
if (totalFeePpm === 0) {
|
|
68
|
+
return ['0x00000000', 0n];
|
|
69
|
+
}
|
|
70
|
+
// MAX_HOOK_FEE = 1e6
|
|
71
|
+
const MAX_HOOK_FEE = 1_000_000;
|
|
72
|
+
const feeAmount = (output * BigInt(totalFeePpm)) / BigInt(MAX_HOOK_FEE);
|
|
73
|
+
// Split fee exactly like `_takeFees()` in Solidity
|
|
74
|
+
const feeParts = await this.arenaFeeHelper.getFeesForPool((0, utils_1.toId)(key));
|
|
75
|
+
let consumed = 0n;
|
|
76
|
+
const payouts = [];
|
|
77
|
+
for (let i = 0; i < feeParts.length; i++) {
|
|
78
|
+
const partPpm = BigInt(feeParts[i].feePpm);
|
|
79
|
+
let partAmount = (output * partPpm) / BigInt(MAX_HOOK_FEE);
|
|
80
|
+
// Apply remainder adjustment for the last recipient
|
|
81
|
+
consumed += partAmount;
|
|
82
|
+
if (i === feeParts.length - 1 && consumed < feeAmount) {
|
|
83
|
+
partAmount += feeAmount - consumed;
|
|
84
|
+
}
|
|
85
|
+
payouts.push({
|
|
86
|
+
recipient: feeParts[i].recipient,
|
|
87
|
+
fee: partAmount,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return [
|
|
91
|
+
'0xb47b2fb1', // selector for `super(BaseFeeHook).afterSwap`
|
|
92
|
+
feeAmount, // returned as int128 in Solidity
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.ArenaHook = ArenaHook;
|
|
97
|
+
//# sourceMappingURL=arena-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arena-hook.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/arena/arena-hook.ts"],"names":[],"mappings":";;;;;;AAAA,0BAA8B;AAI9B,mCAAkC;AAElC,iIAAiG;AACjG,uCAAmC;AAEnC,MAAM,wBAAwB,GAAG,4CAA4C,CAAC;AAE9E,MAAa,SAAU,SAAQ,YAAQ;IAI1B;IACQ;IAJF,SAAS,GAAG,IAAI,GA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AO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,UAAU,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;YAE3D,oDAAoD;YACpD,QAAQ,IAAI,UAAU,CAAC;YACvB,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,GAAG,SAAS,EAAE,CAAC;gBACtD,UAAU,IAAI,SAAS,GAAG,QAAQ,CAAC;YACrC,CAAC;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;gBAChC,GAAG,EAAE,UAAU;aAChB,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,YAAY,EAAE,8CAA8C;YAC5D,SAAS,EAAE,iCAAiC;SAC7C,CAAC;IACJ,CAAC;CACF;AA/GD,8BA+GC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ARENA_HOOK = void 0;
|
|
4
|
+
const constants_1 = require("../../../constants");
|
|
5
|
+
exports.ARENA_HOOK = {
|
|
6
|
+
name: 'ArenaHook',
|
|
7
|
+
address: '0xe32a5d788c568fc5a671255d17b618e70552e044',
|
|
8
|
+
networks: [constants_1.Network.AVALANCHE],
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=arena.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arena.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/arena.ts"],"names":[],"mappings":";;;AAAA,kDAA6C;AAEhC,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,4CAA4C;IACrD,QAAQ,EAAE,CAAC,mBAAO,CAAC,SAAS,CAAC;CAC9B,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-fee-hook.js","sourceRoot":"","sources":["../../../../../src/dex/uniswap-v4/hooks/base-fee/base-fee-hook.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { PoolKey } from '../types';
|
|
2
|
+
import { ModifyLiquidityParams, BalanceDelta, IBaseHook, HooksPermissions, SwapParams, BeforeSwapDelta } from './types';
|
|
3
|
+
export declare abstract class BaseHook implements IBaseHook {
|
|
4
|
+
abstract name(): string;
|
|
5
|
+
abstract getHookPermissions(): Promise<HooksPermissions>;
|
|
6
|
+
beforeInitialize(sender: string, key: PoolKey, sqrtPriceX96: string): Promise<string>;
|
|
7
|
+
afterInitialize(sender: string, key: PoolKey, sqrtPriceX96: string, tick: number): Promise<string>;
|
|
8
|
+
beforeAddLiquidity(sender: string, key: PoolKey, params: ModifyLiquidityParams, hookData: string): Promise<string>;
|
|
9
|
+
afterAddLiquidity(sender: string, key: PoolKey, params: ModifyLiquidityParams, delta0: BalanceDelta, delta1: BalanceDelta, hookData: string): Promise<[string, BalanceDelta]>;
|
|
10
|
+
beforeRemoveLiquidity(sender: string, key: PoolKey, params: ModifyLiquidityParams, hookData: string): Promise<string>;
|
|
11
|
+
afterRemoveLiquidity(sender: string, key: PoolKey, params: ModifyLiquidityParams, delta0: BalanceDelta, delta1: BalanceDelta, hookData: string): Promise<[string, BalanceDelta]>;
|
|
12
|
+
beforeSwap(sender: string, key: PoolKey, params: SwapParams, hookData: string): Promise<[string, BeforeSwapDelta, number]>;
|
|
13
|
+
afterSwap(sender: string, key: PoolKey, params: SwapParams, delta: BalanceDelta, hookData: string): Promise<[string, bigint]>;
|
|
14
|
+
beforeDonate(sender: string, key: PoolKey, amount0: string, amount1: string, hookData: string): Promise<string>;
|
|
15
|
+
afterDonate(sender: string, key: PoolKey, amount0: string, amount1: string, hookData: string): Promise<string>;
|
|
16
|
+
}
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
exports.BaseHook = void 0;
|
|
4
|
+
class BaseHook {
|
|
5
|
+
async beforeInitialize(sender, key, sqrtPriceX96) {
|
|
6
|
+
return '0x00000000';
|
|
7
|
+
}
|
|
8
|
+
async afterInitialize(sender, key, sqrtPriceX96, tick) {
|
|
9
|
+
return '0x00000000';
|
|
10
|
+
}
|
|
11
|
+
async beforeAddLiquidity(sender, key, params, hookData) {
|
|
12
|
+
return '0x00000000';
|
|
13
|
+
}
|
|
14
|
+
async afterAddLiquidity(sender, key, params, delta0, delta1, hookData) {
|
|
15
|
+
return ['0x00000000', { amount0: 0n, amount1: 0n }];
|
|
16
|
+
}
|
|
17
|
+
async beforeRemoveLiquidity(sender, key, params, hookData) {
|
|
18
|
+
return '0x00000000';
|
|
19
|
+
}
|
|
20
|
+
async afterRemoveLiquidity(sender, key, params, delta0, delta1, hookData) {
|
|
21
|
+
return ['0x00000000', { amount0: 0n, amount1: 0n }];
|
|
22
|
+
}
|
|
23
|
+
async beforeSwap(sender, key, params, hookData) {
|
|
24
|
+
return ['0x00000000', { amount0: 0n, amount1: 0n }, 0];
|
|
25
|
+
}
|
|
26
|
+
async afterSwap(sender, key, params, delta, hookData) {
|
|
27
|
+
return ['0x00000000', 0n];
|
|
28
|
+
}
|
|
29
|
+
async beforeDonate(sender, key, amount0, amount1, hookData) {
|
|
30
|
+
return '0x00000000';
|
|
31
|
+
}
|
|
32
|
+
async afterDonate(sender, key, amount0, amount1, hookData) {
|
|
33
|
+
return '0x00000000';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.BaseHook = BaseHook;
|
|
9
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/index.ts"],"names":[],"mappings":";;;AAUA,MAAsB,QAAQ;IAI5B,KAAK,CAAC,gBAAgB,CACpB,MAAc,EACd,GAAY,EACZ,YAAoB;QAEpB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,MAAc,EACd,GAAY,EACZ,YAAoB,EACpB,IAAY;QAEZ,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,MAAc,EACd,GAAY,EACZ,MAA6B,EAC7B,QAAgB;QAEhB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,MAAc,EACd,GAAY,EACZ,MAA6B,EAC7B,MAAoB,EACpB,MAAoB,EACpB,QAAgB;QAEhB,OAAO,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,qBAAqB,CACzB,MAAc,EACd,GAAY,EACZ,MAA6B,EAC7B,QAAgB;QAEhB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,MAAc,EACd,GAAY,EACZ,MAA6B,EAC7B,MAAoB,EACpB,MAAoB,EACpB,QAAgB;QAEhB,OAAO,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,UAAU,CACd,MAAc,EACd,GAAY,EACZ,MAAkB,EAClB,QAAgB;QAEhB,OAAO,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,SAAS,CACb,MAAc,EACd,GAAY,EACZ,MAAkB,EAClB,KAAmB,EACnB,QAAgB;QAEhB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,MAAc,EACd,GAAY,EACZ,OAAe,EACf,OAAe,EACf,QAAgB;QAEhB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,WAAW,CACf,MAAc,EACd,GAAY,EACZ,OAAe,EACf,OAAe,EACf,QAAgB;QAEhB,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AAnGD,4BAmGC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PoolKey } from '../types';
|
|
2
|
+
export interface BalanceDelta {
|
|
3
|
+
amount0: bigint;
|
|
4
|
+
amount1: bigint;
|
|
5
|
+
}
|
|
6
|
+
export interface BeforeSwapDelta {
|
|
7
|
+
amount0: bigint;
|
|
8
|
+
amount1: bigint;
|
|
9
|
+
}
|
|
10
|
+
export interface SwapParams {
|
|
11
|
+
zeroForOne: boolean;
|
|
12
|
+
amountSpecified: string;
|
|
13
|
+
sqrtPriceLimitX96: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ModifyLiquidityParams {
|
|
16
|
+
tickLower: number;
|
|
17
|
+
tickUpper: number;
|
|
18
|
+
liquidityDelta: string;
|
|
19
|
+
salt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface HooksPermissions {
|
|
22
|
+
beforeInitialize: boolean;
|
|
23
|
+
afterInitialize: boolean;
|
|
24
|
+
beforeAddLiquidity: boolean;
|
|
25
|
+
afterAddLiquidity: boolean;
|
|
26
|
+
beforeRemoveLiquidity: boolean;
|
|
27
|
+
afterRemoveLiquidity: boolean;
|
|
28
|
+
beforeSwap: boolean;
|
|
29
|
+
afterSwap: boolean;
|
|
30
|
+
beforeDonate: boolean;
|
|
31
|
+
afterDonate: boolean;
|
|
32
|
+
beforeSwapReturnDelta: boolean;
|
|
33
|
+
afterSwapReturnDelta: boolean;
|
|
34
|
+
afterAddLiquidityReturnDelta: boolean;
|
|
35
|
+
afterRemoveLiquidityReturnDelta: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface IBaseHook {
|
|
38
|
+
name(): string;
|
|
39
|
+
beforeInitialize?(sender: string, key: PoolKey, sqrtPriceX96: string): Promise<string>;
|
|
40
|
+
afterInitialize?(sender: string, key: PoolKey, sqrtPriceX96: string, tick: number): Promise<string>;
|
|
41
|
+
beforeAddLiquidity?(sender: string, key: PoolKey, params: ModifyLiquidityParams, hookData: string): Promise<string>;
|
|
42
|
+
beforeRemoveLiquidity?(sender: string, key: PoolKey, params: ModifyLiquidityParams, hookData: string): Promise<string>;
|
|
43
|
+
afterAddLiquidity?(sender: string, key: PoolKey, params: ModifyLiquidityParams, delta0: BalanceDelta, delta1: BalanceDelta, hookData: string): Promise<[string, BalanceDelta]>;
|
|
44
|
+
afterRemoveLiquidity?(sender: string, key: PoolKey, params: ModifyLiquidityParams, delta0: BalanceDelta, delta1: BalanceDelta, hookData: string): Promise<[string, BalanceDelta]>;
|
|
45
|
+
beforeSwap?(sender: string, key: PoolKey, params: SwapParams, hookData: string): Promise<[string, BeforeSwapDelta, number]>;
|
|
46
|
+
afterSwap?(sender: string, key: PoolKey, params: SwapParams, delta: BalanceDelta, hookData: string): Promise<[string, bigint]>;
|
|
47
|
+
beforeDonate?(sender: string, key: PoolKey, amount0: string, amount1: string, hookData: string): Promise<string>;
|
|
48
|
+
afterDonate?(sender: string, key: PoolKey, amount0: string, amount1: string, hookData: string): Promise<string>;
|
|
49
|
+
getHookPermissions(): Promise<HooksPermissions>;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/dex/uniswap-v4/hooks/types.ts"],"names":[],"mappings":""}
|