@paraswap/dex-lib 2.42.17 → 2.42.19
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/.vscode/launch.json +39 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +15 -0
- package/build/abi/algebra/SwapRouter.json +281 -0
- package/build/config.js +1 -1
- package/build/dex/algebra/algebra-pool-v1_1.js +7 -4
- package/build/dex/algebra/algebra-pool-v1_1.js.map +1 -1
- package/build/dex/algebra/algebra-pool-v1_9.js +7 -4
- package/build/dex/algebra/algebra-pool-v1_9.js.map +1 -1
- package/build/dex/algebra/algebra.d.ts +6 -5
- package/build/dex/algebra/algebra.js +90 -37
- package/build/dex/algebra/algebra.js.map +1 -1
- package/build/dex/algebra/config.js +1 -1
- package/build/dex/algebra/constants.d.ts +2 -0
- package/build/dex/algebra/constants.js +9 -2
- package/build/dex/algebra/constants.js.map +1 -1
- package/build/dex/algebra/lib/AlgebraMath.d.ts +3 -3
- package/build/dex/algebra/lib/AlgebraMath.js +9 -9
- package/build/dex/algebra/lib/AlgebraMath.js.map +1 -1
- package/build/dex/algebra/lib/TickTable.d.ts +2 -2
- package/build/dex/algebra/lib/TickTable.js +12 -10
- package/build/dex/algebra/lib/TickTable.js.map +1 -1
- package/build/dex/algebra/types.d.ts +10 -0
- package/build/dex/algebra/types.js +7 -0
- package/build/dex/algebra/types.js.map +1 -1
- package/find-diff-tests.sh +75 -0
- package/package.json +1 -1
- package/src/abi/algebra/SwapRouter.json +281 -0
- package/src/config.ts +1 -1
- package/src/dex/algebra/algebra-e2e.test.ts +84 -13
- package/src/dex/algebra/algebra-pool-v1_1.ts +17 -2
- package/src/dex/algebra/algebra-pool-v1_9.ts +17 -2
- package/src/dex/algebra/algebra.ts +151 -49
- package/src/dex/algebra/config.ts +1 -1
- package/src/dex/algebra/constants.ts +10 -0
- package/src/dex/algebra/lib/AlgebraMath.ts +9 -0
- package/src/dex/algebra/lib/TickTable.ts +21 -8
- package/src/dex/algebra/types.ts +12 -0
- package/tests/constants-e2e.ts +6 -1
- package/build/abi/algebra/AlgebraPool.abi.json +0 -727
- package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +0 -193
- package/build/dex/algebra/algebra-pool.d.ts +0 -46
- package/build/dex/algebra/algebra-pool.js +0 -336
- package/build/dex/algebra/algebra-pool.js.map +0 -1
- package/build/dex/quickswap/camelot-v3.d.ts +0 -6
- package/build/dex/quickswap/camelot-v3.js +0 -19
- package/build/dex/quickswap/camelot-v3.js.map +0 -1
- package/build/dex/quickswap/zyberswap-v3.d.ts +0 -6
- package/build/dex/quickswap/zyberswap-v3.js +0 -19
- package/build/dex/quickswap/zyberswap-v3.js.map +0 -1
- package/build/dex/uniswap-v2/rebase-tokens.json +0 -7
|
@@ -6,21 +6,23 @@ const constants_1 = require("../../uniswap-v3/constants");
|
|
|
6
6
|
const TickMath_1 = require("../../uniswap-v3/contract-math/TickMath");
|
|
7
7
|
const yul_helper_1 = require("./yul-helper");
|
|
8
8
|
const constants_2 = require("../constants");
|
|
9
|
-
function isWordPosOut(wordPos, startTickBitmap,
|
|
9
|
+
function isWordPosOut(networkId, wordPos, startTickBitmap,
|
|
10
10
|
// For pricing we use wider range to check price impact. If function called from event
|
|
11
11
|
// it must always be within buffer
|
|
12
12
|
isPriceQuery) {
|
|
13
13
|
let lowerTickBitmapLimit;
|
|
14
14
|
let upperTickBitmapLimit;
|
|
15
|
+
const tickBitmapToUse = constants_2.TICK_BITMAP_TO_USE_BY_CHAIN[networkId] ?? constants_2.TICK_BITMAP_TO_USE;
|
|
16
|
+
const tickBitmapBuffer = constants_2.TICK_BITMAP_BUFFER_BY_CHAIN[networkId] ?? constants_2.TICK_BITMAP_BUFFER;
|
|
15
17
|
if (isPriceQuery) {
|
|
16
18
|
lowerTickBitmapLimit =
|
|
17
|
-
startTickBitmap - (
|
|
19
|
+
startTickBitmap - (tickBitmapBuffer + tickBitmapToUse);
|
|
18
20
|
upperTickBitmapLimit =
|
|
19
|
-
startTickBitmap + (
|
|
21
|
+
startTickBitmap + (tickBitmapBuffer + tickBitmapToUse);
|
|
20
22
|
}
|
|
21
23
|
else {
|
|
22
|
-
lowerTickBitmapLimit = startTickBitmap -
|
|
23
|
-
upperTickBitmapLimit = startTickBitmap +
|
|
24
|
+
lowerTickBitmapLimit = startTickBitmap - tickBitmapBuffer;
|
|
25
|
+
upperTickBitmapLimit = startTickBitmap + tickBitmapBuffer;
|
|
24
26
|
}
|
|
25
27
|
(0, utils_1._require)(wordPos >= lowerTickBitmapLimit && wordPos <= upperTickBitmapLimit, `wordPos is out of safe state tickBitmap request range: ${constants_1.OUT_OF_RANGE_ERROR_POSTFIX}`, { wordPos }, `wordPos >= LOWER_TICK_REQUEST_LIMIT && wordPos <= UPPER_TICK_REQUEST_LIMIT`);
|
|
26
28
|
}
|
|
@@ -33,7 +35,7 @@ class TickTable {
|
|
|
33
35
|
BigInt.asUintN(8, tick & 0xffn),
|
|
34
36
|
];
|
|
35
37
|
}
|
|
36
|
-
static toggleTick(state, tick, tickSpacing) {
|
|
38
|
+
static toggleTick(networkId, state, tick, tickSpacing) {
|
|
37
39
|
if (tickSpacing !== undefined) {
|
|
38
40
|
tick /= tickSpacing;
|
|
39
41
|
}
|
|
@@ -41,7 +43,7 @@ class TickTable {
|
|
|
41
43
|
const mask = BigInt.asUintN(256, 1n << bitNumber);
|
|
42
44
|
// toggleTick is used only in _updatePosition which is always state changing event
|
|
43
45
|
// Therefore it is never used in price query
|
|
44
|
-
isWordPosOut(rowNumber, state.startTickBitmap, false);
|
|
46
|
+
isWordPosOut(networkId, rowNumber, state.startTickBitmap, false);
|
|
45
47
|
const stringWordPos = rowNumber.toString();
|
|
46
48
|
if (state.tickBitmap[stringWordPos] === undefined) {
|
|
47
49
|
state.tickBitmap[stringWordPos] = 0n;
|
|
@@ -51,13 +53,13 @@ class TickTable {
|
|
|
51
53
|
delete state.tickBitmap[stringWordPos];
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
|
-
static nextInitializedTickWithinOneWord(state, tick, lte, isPriceQuery, tickSpacing) {
|
|
56
|
+
static nextInitializedTickWithinOneWord(networkId, state, tick, lte, isPriceQuery, tickSpacing) {
|
|
55
57
|
if (tickSpacing !== undefined) {
|
|
56
58
|
tick = BigInt.asIntN(24, yul_helper_1.Yul.sub(yul_helper_1.Yul.sdiv(tick, tickSpacing), yul_helper_1.Yul.and(yul_helper_1.Yul.slt(tick, 0n), yul_helper_1.Yul.not(yul_helper_1.Yul.iszero(yul_helper_1.Yul.smod(tick, tickSpacing))))));
|
|
57
59
|
}
|
|
58
60
|
if (lte) {
|
|
59
61
|
const [rowNumber, bitNumber] = TickTable.position(tick);
|
|
60
|
-
isWordPosOut(rowNumber, state.startTickBitmap, isPriceQuery);
|
|
62
|
+
isWordPosOut(networkId, rowNumber, state.startTickBitmap, isPriceQuery);
|
|
61
63
|
let tickBitmapValue = state.tickBitmap[rowNumber.toString()];
|
|
62
64
|
tickBitmapValue = tickBitmapValue === undefined ? 0n : tickBitmapValue;
|
|
63
65
|
const _row = BigInt.asUintN(256, tickBitmapValue << (255n - bitNumber));
|
|
@@ -73,7 +75,7 @@ class TickTable {
|
|
|
73
75
|
else {
|
|
74
76
|
tick += 1n;
|
|
75
77
|
const [rowNumber, bitNumber] = TickTable.position(tick);
|
|
76
|
-
isWordPosOut(rowNumber, state.startTickBitmap, isPriceQuery);
|
|
78
|
+
isWordPosOut(networkId, rowNumber, state.startTickBitmap, isPriceQuery);
|
|
77
79
|
let tickBitmapValue = state.tickBitmap[rowNumber.toString()];
|
|
78
80
|
tickBitmapValue = tickBitmapValue === undefined ? 0n : tickBitmapValue;
|
|
79
81
|
const _row = BigInt.asUintN(256, tickBitmapValue >> bitNumber);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TickTable.js","sourceRoot":"","sources":["../../../../src/dex/algebra/lib/TickTable.ts"],"names":[],"mappings":";;;AACA,0CAA0C;AAE1C,0DAAwE;AACxE,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ACjD,IAAI,WAAW,KAAK,SAAS,EAAE;YAC7B,IAAI,IAAI,WAAW,CAAC;SACrB;QACD,IAAI,WAAW,GAAG,IAAI,CAAC;QACvB,IAAI,WAAW,GAAG,mBAAQ,CAAC,QAAQ,EAAE;YACnC,WAAW,GAAG,mBAAQ,CAAC,QAAQ,CAAC;SACjC;aAAM,IAAI,WAAW,GAAG,mBAAQ,CAAC,QAAQ,EAAE;YAC1C,WAAW,GAAG,mBAAQ,CAAC,QAAQ,CAAC;SACjC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAnLD,8BAmLC"}
|
|
@@ -52,8 +52,18 @@ export declare type AlgebraData = {
|
|
|
52
52
|
tokenIn: Address;
|
|
53
53
|
tokenOut: Address;
|
|
54
54
|
}[];
|
|
55
|
+
feeOnTransfer: boolean;
|
|
55
56
|
isApproved?: boolean;
|
|
56
57
|
};
|
|
58
|
+
export declare type AlgebraDataWithFee = {
|
|
59
|
+
tokenIn: Address;
|
|
60
|
+
tokenOut: Address;
|
|
61
|
+
};
|
|
62
|
+
export declare enum AlgebraFunctions {
|
|
63
|
+
exactInput = "exactInput",
|
|
64
|
+
exactOutput = "exactOutput",
|
|
65
|
+
exactInputWithFeeToken = "exactInputSingleSupportingFeeOnTransferTokens"
|
|
66
|
+
}
|
|
57
67
|
export declare type DexParams = {
|
|
58
68
|
router: Address;
|
|
59
69
|
quoter: Address;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlgebraFunctions = void 0;
|
|
4
|
+
var AlgebraFunctions;
|
|
5
|
+
(function (AlgebraFunctions) {
|
|
6
|
+
AlgebraFunctions["exactInput"] = "exactInput";
|
|
7
|
+
AlgebraFunctions["exactOutput"] = "exactOutput";
|
|
8
|
+
AlgebraFunctions["exactInputWithFeeToken"] = "exactInputSingleSupportingFeeOnTransferTokens";
|
|
9
|
+
})(AlgebraFunctions = exports.AlgebraFunctions || (exports.AlgebraFunctions = {}));
|
|
3
10
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/algebra/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/algebra/types.ts"],"names":[],"mappings":";;;AAqEA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,+CAA2B,CAAA;IAC3B,4FAAwE,CAAA;AAC1E,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# # Fetch the list of changed files in the specific 'src/dex/*' directories, excluding '*.test.ts' files
|
|
2
|
+
# CHANGED_FILES=$(git diff --name-only origin/feat/BACK-1392 origin/master | grep 'src/dex/.*' | grep -v '\.test\.ts$' || true)
|
|
3
|
+
|
|
4
|
+
# echo "Changed files:"
|
|
5
|
+
# # echo "$CHANGED_FILES"
|
|
6
|
+
|
|
7
|
+
# # Initialize an empty string for storing tests to run
|
|
8
|
+
# CHANGED_TESTS=""
|
|
9
|
+
|
|
10
|
+
# for FILE in $CHANGED_FILES; do
|
|
11
|
+
# # Extract the directory of the changed file
|
|
12
|
+
# DIRECTORY=$(dirname "$FILE")
|
|
13
|
+
# echo $DIRECTORY
|
|
14
|
+
|
|
15
|
+
# # Find all test files in the directory
|
|
16
|
+
# for TEST_FILE in $(find "$DIRECTORY" -type f -name '*.test.ts'); do
|
|
17
|
+
# # echo $TEST_FILE
|
|
18
|
+
# # Check if the test file is already in the list
|
|
19
|
+
# if [[ $CHANGED_TESTS != *"$TEST_FILE"* ]]; then
|
|
20
|
+
# # Append the test file to the list of tests to run
|
|
21
|
+
# CHANGED_TESTS+="$TEST_FILE "
|
|
22
|
+
# fi
|
|
23
|
+
# done
|
|
24
|
+
# done
|
|
25
|
+
|
|
26
|
+
# # Remove trailing whitespace
|
|
27
|
+
# CHANGED_TESTS=$(echo "$CHANGED_TESTS" | xargs)
|
|
28
|
+
|
|
29
|
+
# # Print the list of tests to be run
|
|
30
|
+
# # echo "$CHANGED_TESTS"
|
|
31
|
+
|
|
32
|
+
# # Check if there are tests to run
|
|
33
|
+
# if [ -n "$CHANGED_TESTS" ]; then
|
|
34
|
+
# echo "Running the following changed specs"
|
|
35
|
+
# echo $CHANGED_TESTS
|
|
36
|
+
# else
|
|
37
|
+
# echo "There are no changed tests...skipping"
|
|
38
|
+
# fi
|
|
39
|
+
# Fetch the list of changed files in the specific 'src/dex/*' directories, excluding '*.test.ts' files
|
|
40
|
+
# CHANGED_FILES=$(git diff --name-only origin/aburkut/back-1309-smardex origin/master | grep 'src/dex/.*' | grep -v '\.test\.ts$' || true)
|
|
41
|
+
CHANGED_TESTS=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} | grep test.ts || true)
|
|
42
|
+
# CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} | grep 'src/dex/.*' | grep -v '\.test\.ts$' || true)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
echo $CHANGED_FILES
|
|
46
|
+
# Initialize an empty string for storing tests to run
|
|
47
|
+
CHANGED_TESTS=""
|
|
48
|
+
|
|
49
|
+
# Loop through each changed file and determine the corresponding test files
|
|
50
|
+
for FILE in $CHANGED_FILES; do
|
|
51
|
+
# Extract the directory of the changed file
|
|
52
|
+
DIRECTORY=$(dirname "$FILE")
|
|
53
|
+
|
|
54
|
+
# Find all test files in the directory
|
|
55
|
+
for TEST_FILE in $(find "$DIRECTORY" -type f -name '*.test.ts'); do
|
|
56
|
+
# Check if the test file is already in the list
|
|
57
|
+
if [[ $CHANGED_TESTS != *"$TEST_FILE"* ]]; then
|
|
58
|
+
# Append the test file to the list of tests to run
|
|
59
|
+
CHANGED_TESTS+="$TEST_FILE "
|
|
60
|
+
fi
|
|
61
|
+
done
|
|
62
|
+
done
|
|
63
|
+
|
|
64
|
+
# Remove trailing whitespace
|
|
65
|
+
CHANGED_TESTS=$(echo "$CHANGED_TESTS" | xargs)
|
|
66
|
+
|
|
67
|
+
# Check if there are tests to run
|
|
68
|
+
if [ -n "$CHANGED_TESTS" ]; then
|
|
69
|
+
echo "Running the following changed specs"
|
|
70
|
+
# echo $CHANGED_TESTS
|
|
71
|
+
# npx jest --ci --forceExit --verbose $CHANGED_TESTS
|
|
72
|
+
else
|
|
73
|
+
echo "There are no changed tests...skipping"
|
|
74
|
+
fi
|
|
75
|
+
|
package/package.json
CHANGED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{ "internalType": "address", "name": "_factory", "type": "address" },
|
|
5
|
+
{ "internalType": "address", "name": "_WNativeToken", "type": "address" },
|
|
6
|
+
{ "internalType": "address", "name": "_poolDeployer", "type": "address" }
|
|
7
|
+
],
|
|
8
|
+
"stateMutability": "nonpayable",
|
|
9
|
+
"type": "constructor"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"inputs": [],
|
|
13
|
+
"name": "WNativeToken",
|
|
14
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
15
|
+
"stateMutability": "view",
|
|
16
|
+
"type": "function"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"inputs": [
|
|
20
|
+
{ "internalType": "int256", "name": "amount0Delta", "type": "int256" },
|
|
21
|
+
{ "internalType": "int256", "name": "amount1Delta", "type": "int256" },
|
|
22
|
+
{ "internalType": "bytes", "name": "_data", "type": "bytes" }
|
|
23
|
+
],
|
|
24
|
+
"name": "algebraSwapCallback",
|
|
25
|
+
"outputs": [],
|
|
26
|
+
"stateMutability": "nonpayable",
|
|
27
|
+
"type": "function"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"inputs": [
|
|
31
|
+
{
|
|
32
|
+
"components": [
|
|
33
|
+
{ "internalType": "bytes", "name": "path", "type": "bytes" },
|
|
34
|
+
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
35
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
|
36
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
|
|
37
|
+
{
|
|
38
|
+
"internalType": "uint256",
|
|
39
|
+
"name": "amountOutMinimum",
|
|
40
|
+
"type": "uint256"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"internalType": "struct ISwapRouter.ExactInputParams",
|
|
44
|
+
"name": "params",
|
|
45
|
+
"type": "tuple"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"name": "exactInput",
|
|
49
|
+
"outputs": [
|
|
50
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }
|
|
51
|
+
],
|
|
52
|
+
"stateMutability": "payable",
|
|
53
|
+
"type": "function"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"inputs": [
|
|
57
|
+
{
|
|
58
|
+
"components": [
|
|
59
|
+
{ "internalType": "address", "name": "tokenIn", "type": "address" },
|
|
60
|
+
{ "internalType": "address", "name": "tokenOut", "type": "address" },
|
|
61
|
+
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
62
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
|
63
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" },
|
|
64
|
+
{
|
|
65
|
+
"internalType": "uint256",
|
|
66
|
+
"name": "amountOutMinimum",
|
|
67
|
+
"type": "uint256"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"internalType": "uint160",
|
|
71
|
+
"name": "limitSqrtPrice",
|
|
72
|
+
"type": "uint160"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"internalType": "struct ISwapRouter.ExactInputSingleParams",
|
|
76
|
+
"name": "params",
|
|
77
|
+
"type": "tuple"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"name": "exactInputSingleSupportingFeeOnTransferTokens",
|
|
81
|
+
"outputs": [
|
|
82
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }
|
|
83
|
+
],
|
|
84
|
+
"stateMutability": "nonpayable",
|
|
85
|
+
"type": "function"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"inputs": [
|
|
89
|
+
{
|
|
90
|
+
"components": [
|
|
91
|
+
{ "internalType": "bytes", "name": "path", "type": "bytes" },
|
|
92
|
+
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
93
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
|
94
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
|
95
|
+
{
|
|
96
|
+
"internalType": "uint256",
|
|
97
|
+
"name": "amountInMaximum",
|
|
98
|
+
"type": "uint256"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"internalType": "struct ISwapRouter.ExactOutputParams",
|
|
102
|
+
"name": "params",
|
|
103
|
+
"type": "tuple"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"name": "exactOutput",
|
|
107
|
+
"outputs": [
|
|
108
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }
|
|
109
|
+
],
|
|
110
|
+
"stateMutability": "payable",
|
|
111
|
+
"type": "function"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"inputs": [
|
|
115
|
+
{
|
|
116
|
+
"components": [
|
|
117
|
+
{ "internalType": "address", "name": "tokenIn", "type": "address" },
|
|
118
|
+
{ "internalType": "address", "name": "tokenOut", "type": "address" },
|
|
119
|
+
{ "internalType": "uint24", "name": "fee", "type": "uint24" },
|
|
120
|
+
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
121
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
|
122
|
+
{ "internalType": "uint256", "name": "amountOut", "type": "uint256" },
|
|
123
|
+
{
|
|
124
|
+
"internalType": "uint256",
|
|
125
|
+
"name": "amountInMaximum",
|
|
126
|
+
"type": "uint256"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"internalType": "uint160",
|
|
130
|
+
"name": "limitSqrtPrice",
|
|
131
|
+
"type": "uint160"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"internalType": "struct ISwapRouter.ExactOutputSingleParams",
|
|
135
|
+
"name": "params",
|
|
136
|
+
"type": "tuple"
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"name": "exactOutputSingle",
|
|
140
|
+
"outputs": [
|
|
141
|
+
{ "internalType": "uint256", "name": "amountIn", "type": "uint256" }
|
|
142
|
+
],
|
|
143
|
+
"stateMutability": "payable",
|
|
144
|
+
"type": "function"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"inputs": [],
|
|
148
|
+
"name": "factory",
|
|
149
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
150
|
+
"stateMutability": "view",
|
|
151
|
+
"type": "function"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"inputs": [
|
|
155
|
+
{ "internalType": "bytes[]", "name": "data", "type": "bytes[]" }
|
|
156
|
+
],
|
|
157
|
+
"name": "multicall",
|
|
158
|
+
"outputs": [
|
|
159
|
+
{ "internalType": "bytes[]", "name": "results", "type": "bytes[]" }
|
|
160
|
+
],
|
|
161
|
+
"stateMutability": "payable",
|
|
162
|
+
"type": "function"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"inputs": [],
|
|
166
|
+
"name": "poolDeployer",
|
|
167
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
168
|
+
"stateMutability": "view",
|
|
169
|
+
"type": "function"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"inputs": [],
|
|
173
|
+
"name": "refundNativeToken",
|
|
174
|
+
"outputs": [],
|
|
175
|
+
"stateMutability": "payable",
|
|
176
|
+
"type": "function"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"inputs": [
|
|
180
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
181
|
+
{ "internalType": "uint256", "name": "value", "type": "uint256" },
|
|
182
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
|
183
|
+
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
|
184
|
+
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
|
185
|
+
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
|
186
|
+
],
|
|
187
|
+
"name": "selfPermit",
|
|
188
|
+
"outputs": [],
|
|
189
|
+
"stateMutability": "payable",
|
|
190
|
+
"type": "function"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"inputs": [
|
|
194
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
195
|
+
{ "internalType": "uint256", "name": "nonce", "type": "uint256" },
|
|
196
|
+
{ "internalType": "uint256", "name": "expiry", "type": "uint256" },
|
|
197
|
+
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
|
198
|
+
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
|
199
|
+
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
|
200
|
+
],
|
|
201
|
+
"name": "selfPermitAllowed",
|
|
202
|
+
"outputs": [],
|
|
203
|
+
"stateMutability": "payable",
|
|
204
|
+
"type": "function"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"inputs": [
|
|
208
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
209
|
+
{ "internalType": "uint256", "name": "nonce", "type": "uint256" },
|
|
210
|
+
{ "internalType": "uint256", "name": "expiry", "type": "uint256" },
|
|
211
|
+
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
|
212
|
+
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
|
213
|
+
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
|
214
|
+
],
|
|
215
|
+
"name": "selfPermitAllowedIfNecessary",
|
|
216
|
+
"outputs": [],
|
|
217
|
+
"stateMutability": "payable",
|
|
218
|
+
"type": "function"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"inputs": [
|
|
222
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
223
|
+
{ "internalType": "uint256", "name": "value", "type": "uint256" },
|
|
224
|
+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
|
|
225
|
+
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
|
226
|
+
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
|
227
|
+
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
|
228
|
+
],
|
|
229
|
+
"name": "selfPermitIfNecessary",
|
|
230
|
+
"outputs": [],
|
|
231
|
+
"stateMutability": "payable",
|
|
232
|
+
"type": "function"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"inputs": [
|
|
236
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
237
|
+
{ "internalType": "uint256", "name": "amountMinimum", "type": "uint256" },
|
|
238
|
+
{ "internalType": "address", "name": "recipient", "type": "address" }
|
|
239
|
+
],
|
|
240
|
+
"name": "sweepToken",
|
|
241
|
+
"outputs": [],
|
|
242
|
+
"stateMutability": "payable",
|
|
243
|
+
"type": "function"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"inputs": [
|
|
247
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
248
|
+
{ "internalType": "uint256", "name": "amountMinimum", "type": "uint256" },
|
|
249
|
+
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
250
|
+
{ "internalType": "uint256", "name": "feeBips", "type": "uint256" },
|
|
251
|
+
{ "internalType": "address", "name": "feeRecipient", "type": "address" }
|
|
252
|
+
],
|
|
253
|
+
"name": "sweepTokenWithFee",
|
|
254
|
+
"outputs": [],
|
|
255
|
+
"stateMutability": "payable",
|
|
256
|
+
"type": "function"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"inputs": [
|
|
260
|
+
{ "internalType": "uint256", "name": "amountMinimum", "type": "uint256" },
|
|
261
|
+
{ "internalType": "address", "name": "recipient", "type": "address" }
|
|
262
|
+
],
|
|
263
|
+
"name": "unwrapWNativeToken",
|
|
264
|
+
"outputs": [],
|
|
265
|
+
"stateMutability": "payable",
|
|
266
|
+
"type": "function"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"inputs": [
|
|
270
|
+
{ "internalType": "uint256", "name": "amountMinimum", "type": "uint256" },
|
|
271
|
+
{ "internalType": "address", "name": "recipient", "type": "address" },
|
|
272
|
+
{ "internalType": "uint256", "name": "feeBips", "type": "uint256" },
|
|
273
|
+
{ "internalType": "address", "name": "feeRecipient", "type": "address" }
|
|
274
|
+
],
|
|
275
|
+
"name": "unwrapWNativeTokenWithFee",
|
|
276
|
+
"outputs": [],
|
|
277
|
+
"stateMutability": "payable",
|
|
278
|
+
"type": "function"
|
|
279
|
+
},
|
|
280
|
+
{ "stateMutability": "payable", "type": "receive" }
|
|
281
|
+
]
|
package/src/config.ts
CHANGED
|
@@ -281,7 +281,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
281
281
|
process.env[`HASHFLOW_DISABLED_MMS_42161`]?.split(',') || [],
|
|
282
282
|
adapterAddresses: {
|
|
283
283
|
ArbitrumAdapter01: '0xD8134ACfc9c71Ab51452b5bA23A31354F4739032',
|
|
284
|
-
ArbitrumAdapter02: '
|
|
284
|
+
ArbitrumAdapter02: '0x7b0c7f946c845bb0d43ad41ece7027e1fc11bea7',
|
|
285
285
|
ArbitrumBuyAdapter: '0xEECA9223063bD13e8ca77ed9e39a07f2BD1923E6',
|
|
286
286
|
},
|
|
287
287
|
uniswapV2ExchangeRouterAddress:
|