@paraswap/dex-lib 3.5.6-maverick-v2-7 → 3.6.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/.vscode/launch.json +53 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +15 -0
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
- package/build/abi/wombat/pool.json +1289 -0
- package/build/constants.d.ts +2 -0
- package/build/constants.js +3 -1
- package/build/constants.js.map +1 -1
- package/build/dex/aave-v1/aave-v1.d.ts +2 -1
- package/build/dex/aave-v1/aave-v1.js +23 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/aave-v2/tokens-avalanche.json +44 -0
- package/build/dex/aave-v2/tokens-mainnet.json +188 -0
- package/build/dex/aave-v2/tokens-polygon.json +44 -0
- package/build/dex/compound.js +1 -1
- package/build/dex/compound.js.map +1 -1
- package/build/dex/index.js +0 -2
- package/build/dex/index.js.map +1 -1
- package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +185 -0
- package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
- package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/build/dex/maverick-v2/config.d.ts +2 -1
- package/build/dex/maverick-v2/config.js +6 -2
- package/build/dex/maverick-v2/config.js.map +1 -1
- package/build/dex/maverick-v2/maverick-v2.d.ts +3 -2
- package/build/dex/maverick-v2/maverick-v2.js +17 -6
- package/build/dex/maverick-v2/maverick-v2.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +2 -1
- package/build/dex/platypus/platypus.js +45 -0
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
- package/build/dex/stable-pool.js +1 -8
- package/build/dex/stable-pool.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
- package/build/dex/swaap-v1/swaap-v1.js +14 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/uniswap-v2/uniswap-v2.d.ts +2 -2
- package/build/dex/uniswap-v2/uniswap-v2.js.map +1 -1
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
- package/build/dex/uniswap-v3/uniswap-v3.d.ts +2 -2
- package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
- package/build/dex/zerox/index.d.ts +1 -1
- package/build/dex/zerox/index.js.map +1 -1
- package/build/executor/Executor03BytecodeBuilder.js +1 -12
- package/build/executor/Executor03BytecodeBuilder.js.map +1 -1
- package/build/generic-swap-transaction-builder.d.ts +5 -3
- package/build/generic-swap-transaction-builder.js +22 -7
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/package.json +2 -2
- package/src/constants.ts +2 -0
- package/src/dex/index.ts +0 -2
- package/src/dex/maker-psm/scripts/gem.abi.json +136 -0
- package/src/dex/maker-psm/scripts/validate-state.ts +221 -0
- package/src/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/src/dex/uniswap-v2/uniswap-v2.ts +2 -2
- package/src/dex/uniswap-v3/uniswap-v3.ts +2 -2
- package/src/dex/zerox/index.ts +1 -1
- package/src/executor/Executor03BytecodeBuilder.ts +1 -15
- package/src/generic-swap-transaction-builder.ts +40 -0
- package/tests/constants-e2e.ts +2 -2
- package/build/dex/etherfi/etherfi.d.ts +0 -26
- package/build/dex/etherfi/etherfi.js +0 -96
- package/build/dex/etherfi/etherfi.js.map +0 -1
- package/build/dex/sdai/config.d.ts +0 -11
- package/build/dex/sdai/config.js +0 -21
- package/build/dex/sdai/config.js.map +0 -1
- package/build/dex/sdai/constants.d.ts +0 -2
- package/build/dex/sdai/constants.js +0 -6
- package/build/dex/sdai/constants.js.map +0 -1
- package/build/dex/sdai/scripts/validate-state.js +0 -102
- package/build/dex/sdai/scripts/validate-state.js.map +0 -1
- package/build/dex/sdai/sdai-pool.d.ts +0 -16
- package/build/dex/sdai/sdai-pool.js +0 -85
- package/build/dex/sdai/sdai-pool.js.map +0 -1
- package/build/dex/sdai/sdai.d.ts +0 -51
- package/build/dex/sdai/sdai.js +0 -172
- package/build/dex/sdai/sdai.js.map +0 -1
- package/build/dex/sdai/types.d.ts +0 -21
- package/build/dex/sdai/types.js +0 -11
- package/build/dex/sdai/types.js.map +0 -1
- package/build/dex/sdai/utils.d.ts +0 -4
- package/build/dex/sdai/utils.js +0 -39
- package/build/dex/sdai/utils.js.map +0 -1
- package/src/abi/maverick-v2/MaverickV2Pool.json +0 -1234
- package/src/abi/maverick-v2/MaverickV2PoolLens.json +0 -1232
- package/src/abi/maverick-v2/MaverickV2Quoter.json +0 -278
- package/src/dex/maverick-v2/config.ts +0 -17
- package/src/dex/maverick-v2/maverick-math/maverick-basic-math.ts +0 -152
- package/src/dex/maverick-v2/maverick-math/maverick-bin-math.ts +0 -288
- package/src/dex/maverick-v2/maverick-math/maverick-delta-math.ts +0 -32
- package/src/dex/maverick-v2/maverick-math/maverick-math.ts +0 -30
- package/src/dex/maverick-v2/maverick-math/maverick-pool-lib.ts +0 -42
- package/src/dex/maverick-v2/maverick-math/maverick-pool-math.ts +0 -709
- package/src/dex/maverick-v2/maverick-math/maverick-swap-math.ts +0 -199
- package/src/dex/maverick-v2/maverick-math/maverick-tick-math.ts +0 -171
- package/src/dex/maverick-v2/maverick-math/maverick-twa-math.ts +0 -54
- package/src/dex/maverick-v2/maverick-v2-e2e.test.ts +0 -176
- package/src/dex/maverick-v2/maverick-v2-events.test.ts +0 -112
- package/src/dex/maverick-v2/maverick-v2-integration.test.ts +0 -269
- package/src/dex/maverick-v2/maverick-v2-pool.ts +0 -276
- package/src/dex/maverick-v2/maverick-v2.ts +0 -424
- package/src/dex/maverick-v2/types.ts +0 -152
- /package/build/dex/{sdai/scripts/validate-state.d.ts → solidly-v3/scripts/check-event-pool-event.d.ts} +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{ "internalType": "address", "name": "vat_", "type": "address" },
|
|
5
|
+
{ "internalType": "bytes32", "name": "ilk_", "type": "bytes32" },
|
|
6
|
+
{ "internalType": "address", "name": "gem_", "type": "address" }
|
|
7
|
+
],
|
|
8
|
+
"stateMutability": "nonpayable",
|
|
9
|
+
"type": "constructor"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"anonymous": true,
|
|
13
|
+
"inputs": [
|
|
14
|
+
{
|
|
15
|
+
"indexed": true,
|
|
16
|
+
"internalType": "bytes4",
|
|
17
|
+
"name": "sig",
|
|
18
|
+
"type": "bytes4"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"indexed": true,
|
|
22
|
+
"internalType": "address",
|
|
23
|
+
"name": "usr",
|
|
24
|
+
"type": "address"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"indexed": true,
|
|
28
|
+
"internalType": "bytes32",
|
|
29
|
+
"name": "arg1",
|
|
30
|
+
"type": "bytes32"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"indexed": true,
|
|
34
|
+
"internalType": "bytes32",
|
|
35
|
+
"name": "arg2",
|
|
36
|
+
"type": "bytes32"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"indexed": false,
|
|
40
|
+
"internalType": "bytes",
|
|
41
|
+
"name": "data",
|
|
42
|
+
"type": "bytes"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "LogNote",
|
|
46
|
+
"type": "event"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"inputs": [],
|
|
50
|
+
"name": "cage",
|
|
51
|
+
"outputs": [],
|
|
52
|
+
"stateMutability": "nonpayable",
|
|
53
|
+
"type": "function"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"inputs": [],
|
|
57
|
+
"name": "dec",
|
|
58
|
+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
59
|
+
"stateMutability": "view",
|
|
60
|
+
"type": "function"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"inputs": [{ "internalType": "address", "name": "usr", "type": "address" }],
|
|
64
|
+
"name": "deny",
|
|
65
|
+
"outputs": [],
|
|
66
|
+
"stateMutability": "nonpayable",
|
|
67
|
+
"type": "function"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"inputs": [
|
|
71
|
+
{ "internalType": "address", "name": "guy", "type": "address" },
|
|
72
|
+
{ "internalType": "uint256", "name": "wad", "type": "uint256" }
|
|
73
|
+
],
|
|
74
|
+
"name": "exit",
|
|
75
|
+
"outputs": [],
|
|
76
|
+
"stateMutability": "nonpayable",
|
|
77
|
+
"type": "function"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"inputs": [],
|
|
81
|
+
"name": "gem",
|
|
82
|
+
"outputs": [
|
|
83
|
+
{ "internalType": "contract GemLike_2", "name": "", "type": "address" }
|
|
84
|
+
],
|
|
85
|
+
"stateMutability": "view",
|
|
86
|
+
"type": "function"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"inputs": [],
|
|
90
|
+
"name": "ilk",
|
|
91
|
+
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
|
|
92
|
+
"stateMutability": "view",
|
|
93
|
+
"type": "function"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"inputs": [
|
|
97
|
+
{ "internalType": "address", "name": "urn", "type": "address" },
|
|
98
|
+
{ "internalType": "uint256", "name": "wad", "type": "uint256" },
|
|
99
|
+
{ "internalType": "address", "name": "_msgSender", "type": "address" }
|
|
100
|
+
],
|
|
101
|
+
"name": "join",
|
|
102
|
+
"outputs": [],
|
|
103
|
+
"stateMutability": "nonpayable",
|
|
104
|
+
"type": "function"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"inputs": [],
|
|
108
|
+
"name": "live",
|
|
109
|
+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
110
|
+
"stateMutability": "view",
|
|
111
|
+
"type": "function"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"inputs": [{ "internalType": "address", "name": "usr", "type": "address" }],
|
|
115
|
+
"name": "rely",
|
|
116
|
+
"outputs": [],
|
|
117
|
+
"stateMutability": "nonpayable",
|
|
118
|
+
"type": "function"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"inputs": [],
|
|
122
|
+
"name": "vat",
|
|
123
|
+
"outputs": [
|
|
124
|
+
{ "internalType": "contract VatLike_4", "name": "", "type": "address" }
|
|
125
|
+
],
|
|
126
|
+
"stateMutability": "view",
|
|
127
|
+
"type": "function"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
131
|
+
"name": "wards",
|
|
132
|
+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
133
|
+
"stateMutability": "view",
|
|
134
|
+
"type": "function"
|
|
135
|
+
}
|
|
136
|
+
]
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// /* eslint-disable no-console */
|
|
2
|
+
// import dotenv from 'dotenv';
|
|
3
|
+
// dotenv.config();
|
|
4
|
+
|
|
5
|
+
// import { Network } from '../../../constants';
|
|
6
|
+
// import { DummyDexHelper } from '../../../dex-helper';
|
|
7
|
+
// import { BlockHeader } from 'web3-eth';
|
|
8
|
+
// import { MakerPsmConfig } from '../config';
|
|
9
|
+
// import { BigNumber, ethers } from 'ethers';
|
|
10
|
+
// import { Interface } from '@ethersproject/abi';
|
|
11
|
+
// import _ from 'lodash';
|
|
12
|
+
// import vatABI from './vat.abi.json';
|
|
13
|
+
// import gemABI from './gem.abi.json';
|
|
14
|
+
// // @ts-ignore
|
|
15
|
+
// import { Tokens } from '../../../../tests/constants-e2e';
|
|
16
|
+
|
|
17
|
+
// const tokens = Tokens[Network.MAINNET];
|
|
18
|
+
|
|
19
|
+
// const vatInterface = new Interface(vatABI);
|
|
20
|
+
// const gemInterface = new Interface(gemABI);
|
|
21
|
+
// const erc20Interface = new Interface([
|
|
22
|
+
// {
|
|
23
|
+
// constant: true,
|
|
24
|
+
// inputs: [{ internalType: 'address', name: '', type: 'address' }],
|
|
25
|
+
// name: 'balanceOf',
|
|
26
|
+
// outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
27
|
+
// payable: false,
|
|
28
|
+
// stateMutability: 'view',
|
|
29
|
+
// type: 'function',
|
|
30
|
+
// },
|
|
31
|
+
// ]);
|
|
32
|
+
|
|
33
|
+
// const network = Network.MAINNET;
|
|
34
|
+
// const vat = MakerPsmConfig.MakerPsm[Network.MAINNET].vatAddress;
|
|
35
|
+
// const MOVE_TOPIC =
|
|
36
|
+
// '0xbb35783b00000000000000000000000000000000000000000000000000000000';
|
|
37
|
+
|
|
38
|
+
// const dexHelper = new DummyDexHelper(network);
|
|
39
|
+
|
|
40
|
+
// async function findNewGems(): Promise<boolean> {
|
|
41
|
+
// const network = Network.MAINNET;
|
|
42
|
+
// const dexHelper = new DummyDexHelper(network);
|
|
43
|
+
|
|
44
|
+
// const lastBlockNumber = await dexHelper.provider.getBlockNumber();
|
|
45
|
+
|
|
46
|
+
// const startBlockNumber = lastBlockNumber - 1_000_000;
|
|
47
|
+
// const endBlockNumber = lastBlockNumber;
|
|
48
|
+
// // const startBlockNumber = endBlockNumber - 700_000;
|
|
49
|
+
|
|
50
|
+
// const totalRange = endBlockNumber - startBlockNumber;
|
|
51
|
+
|
|
52
|
+
// const smallChunkSize = 10_000;
|
|
53
|
+
// const bigChunkSize = 100_000;
|
|
54
|
+
|
|
55
|
+
// const bigChunks = Math.ceil(totalRange / bigChunkSize);
|
|
56
|
+
|
|
57
|
+
// const smallChunks = Math.ceil(bigChunkSize / smallChunkSize);
|
|
58
|
+
|
|
59
|
+
// const uniquePotentialGemJoinsSet = new Set();
|
|
60
|
+
|
|
61
|
+
// for (let i = 0; i < bigChunks; i++) {
|
|
62
|
+
// console.log('Processing chunk', i + 1, 'of', bigChunks);
|
|
63
|
+
// const from = startBlockNumber + i * bigChunkSize;
|
|
64
|
+
// console.log(
|
|
65
|
+
// new Array(smallChunks).fill(0).map((_, smallChunkNumber) => ({
|
|
66
|
+
// fromBlock: from + smallChunkNumber * smallChunkSize,
|
|
67
|
+
// toBlock: from + smallChunkNumber * smallChunkSize + smallChunkSize,
|
|
68
|
+
// })),
|
|
69
|
+
// );
|
|
70
|
+
|
|
71
|
+
// const logsToDispatch = (
|
|
72
|
+
// await Promise.all(
|
|
73
|
+
// new Array(smallChunks).fill(0).map((_, smallChunkNumber) =>
|
|
74
|
+
// dexHelper.provider.getLogs({
|
|
75
|
+
// fromBlock: from + smallChunkNumber * smallChunkSize,
|
|
76
|
+
// toBlock: from + smallChunkNumber * smallChunkSize + smallChunkSize,
|
|
77
|
+
// address: vat,
|
|
78
|
+
// }),
|
|
79
|
+
// ),
|
|
80
|
+
// )
|
|
81
|
+
// ).flat();
|
|
82
|
+
|
|
83
|
+
// const moveLogs = logsToDispatch.filter(l => l.topics[0] === MOVE_TOPIC);
|
|
84
|
+
|
|
85
|
+
// const potentialGemJoins = moveLogs.map(
|
|
86
|
+
// l => ethers.utils.defaultAbiCoder.decode(['address'], l.topics[1])[0],
|
|
87
|
+
// );
|
|
88
|
+
|
|
89
|
+
// potentialGemJoins.forEach(gemJoin =>
|
|
90
|
+
// uniquePotentialGemJoinsSet.add(gemJoin),
|
|
91
|
+
// );
|
|
92
|
+
// }
|
|
93
|
+
|
|
94
|
+
// const uniquePotentialGemJoins = Array.from(uniquePotentialGemJoinsSet);
|
|
95
|
+
// console.log('unique potential gem joins', uniquePotentialGemJoins.length);
|
|
96
|
+
|
|
97
|
+
// const gemJoinCalldata = uniquePotentialGemJoins
|
|
98
|
+
// .map(gemJoin => {
|
|
99
|
+
// return [
|
|
100
|
+
// {
|
|
101
|
+
// target: gemJoin,
|
|
102
|
+
// callData: vatInterface.encodeFunctionData('gemJoin'),
|
|
103
|
+
// },
|
|
104
|
+
// ];
|
|
105
|
+
// })
|
|
106
|
+
// .flat();
|
|
107
|
+
|
|
108
|
+
// const slicedGemJoinCallData = _.chunk(gemJoinCalldata, 500);
|
|
109
|
+
|
|
110
|
+
// const gemJoinData = (
|
|
111
|
+
// await Promise.all(
|
|
112
|
+
// slicedGemJoinCallData.map(async _multiCallData =>
|
|
113
|
+
// dexHelper.multiContract.methods
|
|
114
|
+
// .tryAggregate(false, _multiCallData)
|
|
115
|
+
// .call({}),
|
|
116
|
+
// ),
|
|
117
|
+
// )
|
|
118
|
+
// ).flat();
|
|
119
|
+
|
|
120
|
+
// // console.log(
|
|
121
|
+
// // gemJoinData
|
|
122
|
+
// // .map((data, i) => ({ ...data, index: i }))
|
|
123
|
+
// // .filter(d => d.returnData !== '0x' && d.returnData.length === 66)
|
|
124
|
+
// // .map(d => [d.returnData, gemJoinCalldata[d.index]]),
|
|
125
|
+
// // );
|
|
126
|
+
|
|
127
|
+
// const gemJoins = gemJoinData
|
|
128
|
+
// .filter(d => d.returnData !== '0x' && d.returnData.length === 66)
|
|
129
|
+
// .map(
|
|
130
|
+
// d => ethers.utils.defaultAbiCoder.decode(['address'], d.returnData)[0],
|
|
131
|
+
// );
|
|
132
|
+
|
|
133
|
+
// const uniqueGemJoins = [...new Set(gemJoins)];
|
|
134
|
+
// console.log('unique gem joins', uniqueGemJoins.length);
|
|
135
|
+
|
|
136
|
+
// const gemCalldata = uniqueGemJoins
|
|
137
|
+
// .map(gemJoin => {
|
|
138
|
+
// return [
|
|
139
|
+
// {
|
|
140
|
+
// target: gemJoin,
|
|
141
|
+
// callData: gemInterface.encodeFunctionData('gem'),
|
|
142
|
+
// },
|
|
143
|
+
// ];
|
|
144
|
+
// })
|
|
145
|
+
// .flat();
|
|
146
|
+
|
|
147
|
+
// const returnGemData = await dexHelper.multiContract.methods
|
|
148
|
+
// .tryAggregate(false, gemCalldata)
|
|
149
|
+
// .call({});
|
|
150
|
+
|
|
151
|
+
// const gems = returnGemData
|
|
152
|
+
// .filter((d: any) => d.returnData !== '0x')
|
|
153
|
+
// .map(
|
|
154
|
+
// (d: any) =>
|
|
155
|
+
// ethers.utils.defaultAbiCoder.decode(['address'], d.returnData)[0],
|
|
156
|
+
// );
|
|
157
|
+
|
|
158
|
+
// const balanceCalldata = gems
|
|
159
|
+
// .map((gem: any, i: number) => {
|
|
160
|
+
// return [
|
|
161
|
+
// {
|
|
162
|
+
// target: gem,
|
|
163
|
+
// callData: erc20Interface.encodeFunctionData('balanceOf', [
|
|
164
|
+
// uniqueGemJoins[i],
|
|
165
|
+
// ]),
|
|
166
|
+
// },
|
|
167
|
+
// ];
|
|
168
|
+
// })
|
|
169
|
+
// .flat();
|
|
170
|
+
|
|
171
|
+
// const returnBalanceData = await dexHelper.multiContract.methods
|
|
172
|
+
// .tryAggregate(false, balanceCalldata)
|
|
173
|
+
// .call({});
|
|
174
|
+
|
|
175
|
+
// console.log(returnBalanceData);
|
|
176
|
+
|
|
177
|
+
// const balances: BigNumber[] = returnBalanceData
|
|
178
|
+
// .filter((d: any) => d.returnData !== '0x')
|
|
179
|
+
// .map(
|
|
180
|
+
// (d: any) =>
|
|
181
|
+
// ethers.utils.defaultAbiCoder.decode(['uint256'], d.returnData)[0],
|
|
182
|
+
// );
|
|
183
|
+
|
|
184
|
+
// console.log(balances.map(b => b.toString()));
|
|
185
|
+
|
|
186
|
+
// const data = uniqueGemJoins.map((gemJoin, i) => {
|
|
187
|
+
// const token = Object.values(tokens).find(
|
|
188
|
+
// t => t.address.toLowerCase() === gems[i].toLowerCase(),
|
|
189
|
+
// );
|
|
190
|
+
// const symbol = token
|
|
191
|
+
// ? Object.entries(tokens).find(
|
|
192
|
+
// ([symbol, t]) => t.address.toLowerCase() === gems[i].toLowerCase(),
|
|
193
|
+
// )?.[0]
|
|
194
|
+
// : 'Not found';
|
|
195
|
+
// const balance = token
|
|
196
|
+
// ? Number(ethers.utils.formatUnits(balances[i], token.decimals))
|
|
197
|
+
// : balances[i].toString();
|
|
198
|
+
|
|
199
|
+
// return {
|
|
200
|
+
// gemJoin,
|
|
201
|
+
// gem: gems[i],
|
|
202
|
+
// balance,
|
|
203
|
+
// ...(token
|
|
204
|
+
// ? {
|
|
205
|
+
// address: gems[i],
|
|
206
|
+
// decimals: token.decimals,
|
|
207
|
+
// symbol,
|
|
208
|
+
// }
|
|
209
|
+
// : { address: gems[i] }),
|
|
210
|
+
// };
|
|
211
|
+
// });
|
|
212
|
+
|
|
213
|
+
// console.log(data);
|
|
214
|
+
|
|
215
|
+
// // const address = logsToDispatch[0].address;
|
|
216
|
+
// return true;
|
|
217
|
+
// }
|
|
218
|
+
|
|
219
|
+
// findNewGems()
|
|
220
|
+
// .then(() => console.log('Done'))
|
|
221
|
+
// .catch(e => console.error(e));
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{ "internalType": "address", "name": "gemJoin_", "type": "address" },
|
|
5
|
+
{ "internalType": "address", "name": "daiJoin_", "type": "address" },
|
|
6
|
+
{ "internalType": "address", "name": "vow_", "type": "address" }
|
|
7
|
+
],
|
|
8
|
+
"stateMutability": "nonpayable",
|
|
9
|
+
"type": "constructor"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"anonymous": false,
|
|
13
|
+
"inputs": [
|
|
14
|
+
{
|
|
15
|
+
"indexed": true,
|
|
16
|
+
"internalType": "address",
|
|
17
|
+
"name": "owner",
|
|
18
|
+
"type": "address"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"indexed": false,
|
|
22
|
+
"internalType": "uint256",
|
|
23
|
+
"name": "value",
|
|
24
|
+
"type": "uint256"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"indexed": false,
|
|
28
|
+
"internalType": "uint256",
|
|
29
|
+
"name": "fee",
|
|
30
|
+
"type": "uint256"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"name": "BuyGem",
|
|
34
|
+
"type": "event"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"anonymous": false,
|
|
38
|
+
"inputs": [
|
|
39
|
+
{
|
|
40
|
+
"indexed": false,
|
|
41
|
+
"internalType": "address",
|
|
42
|
+
"name": "user",
|
|
43
|
+
"type": "address"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"name": "Deny",
|
|
47
|
+
"type": "event"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"anonymous": false,
|
|
51
|
+
"inputs": [
|
|
52
|
+
{
|
|
53
|
+
"indexed": true,
|
|
54
|
+
"internalType": "bytes32",
|
|
55
|
+
"name": "what",
|
|
56
|
+
"type": "bytes32"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"indexed": false,
|
|
60
|
+
"internalType": "uint256",
|
|
61
|
+
"name": "data",
|
|
62
|
+
"type": "uint256"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"name": "File",
|
|
66
|
+
"type": "event"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"anonymous": false,
|
|
70
|
+
"inputs": [
|
|
71
|
+
{
|
|
72
|
+
"indexed": false,
|
|
73
|
+
"internalType": "address",
|
|
74
|
+
"name": "user",
|
|
75
|
+
"type": "address"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"name": "Rely",
|
|
79
|
+
"type": "event"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"anonymous": false,
|
|
83
|
+
"inputs": [
|
|
84
|
+
{
|
|
85
|
+
"indexed": true,
|
|
86
|
+
"internalType": "address",
|
|
87
|
+
"name": "owner",
|
|
88
|
+
"type": "address"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"indexed": false,
|
|
92
|
+
"internalType": "uint256",
|
|
93
|
+
"name": "value",
|
|
94
|
+
"type": "uint256"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"indexed": false,
|
|
98
|
+
"internalType": "uint256",
|
|
99
|
+
"name": "fee",
|
|
100
|
+
"type": "uint256"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"name": "SellGem",
|
|
104
|
+
"type": "event"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"inputs": [
|
|
108
|
+
{ "internalType": "address", "name": "usr", "type": "address" },
|
|
109
|
+
{ "internalType": "uint256", "name": "gemAmt", "type": "uint256" }
|
|
110
|
+
],
|
|
111
|
+
"name": "buyGem",
|
|
112
|
+
"outputs": [],
|
|
113
|
+
"stateMutability": "nonpayable",
|
|
114
|
+
"type": "function"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"inputs": [],
|
|
118
|
+
"name": "dai",
|
|
119
|
+
"outputs": [
|
|
120
|
+
{ "internalType": "contract DaiAbstract", "name": "", "type": "address" }
|
|
121
|
+
],
|
|
122
|
+
"stateMutability": "view",
|
|
123
|
+
"type": "function"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"inputs": [],
|
|
127
|
+
"name": "daiJoin",
|
|
128
|
+
"outputs": [
|
|
129
|
+
{
|
|
130
|
+
"internalType": "contract DaiJoinAbstract",
|
|
131
|
+
"name": "",
|
|
132
|
+
"type": "address"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"stateMutability": "view",
|
|
136
|
+
"type": "function"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"inputs": [{ "internalType": "address", "name": "usr", "type": "address" }],
|
|
140
|
+
"name": "deny",
|
|
141
|
+
"outputs": [],
|
|
142
|
+
"stateMutability": "nonpayable",
|
|
143
|
+
"type": "function"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"inputs": [
|
|
147
|
+
{ "internalType": "bytes32", "name": "what", "type": "bytes32" },
|
|
148
|
+
{ "internalType": "uint256", "name": "data", "type": "uint256" }
|
|
149
|
+
],
|
|
150
|
+
"name": "file",
|
|
151
|
+
"outputs": [],
|
|
152
|
+
"stateMutability": "nonpayable",
|
|
153
|
+
"type": "function"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"inputs": [],
|
|
157
|
+
"name": "gemJoin",
|
|
158
|
+
"outputs": [
|
|
159
|
+
{
|
|
160
|
+
"internalType": "contract AuthGemJoinAbstract",
|
|
161
|
+
"name": "",
|
|
162
|
+
"type": "address"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"stateMutability": "view",
|
|
166
|
+
"type": "function"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"inputs": [{ "internalType": "address", "name": "usr", "type": "address" }],
|
|
170
|
+
"name": "hope",
|
|
171
|
+
"outputs": [],
|
|
172
|
+
"stateMutability": "nonpayable",
|
|
173
|
+
"type": "function"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"inputs": [],
|
|
177
|
+
"name": "ilk",
|
|
178
|
+
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
|
|
179
|
+
"stateMutability": "view",
|
|
180
|
+
"type": "function"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"inputs": [{ "internalType": "address", "name": "usr", "type": "address" }],
|
|
184
|
+
"name": "nope",
|
|
185
|
+
"outputs": [],
|
|
186
|
+
"stateMutability": "nonpayable",
|
|
187
|
+
"type": "function"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"inputs": [{ "internalType": "address", "name": "usr", "type": "address" }],
|
|
191
|
+
"name": "rely",
|
|
192
|
+
"outputs": [],
|
|
193
|
+
"stateMutability": "nonpayable",
|
|
194
|
+
"type": "function"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"inputs": [
|
|
198
|
+
{ "internalType": "address", "name": "usr", "type": "address" },
|
|
199
|
+
{ "internalType": "uint256", "name": "gemAmt", "type": "uint256" }
|
|
200
|
+
],
|
|
201
|
+
"name": "sellGem",
|
|
202
|
+
"outputs": [],
|
|
203
|
+
"stateMutability": "nonpayable",
|
|
204
|
+
"type": "function"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"inputs": [],
|
|
208
|
+
"name": "tin",
|
|
209
|
+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
210
|
+
"stateMutability": "view",
|
|
211
|
+
"type": "function"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"inputs": [],
|
|
215
|
+
"name": "tout",
|
|
216
|
+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
217
|
+
"stateMutability": "view",
|
|
218
|
+
"type": "function"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"inputs": [],
|
|
222
|
+
"name": "vat",
|
|
223
|
+
"outputs": [
|
|
224
|
+
{ "internalType": "contract VatAbstract", "name": "", "type": "address" }
|
|
225
|
+
],
|
|
226
|
+
"stateMutability": "view",
|
|
227
|
+
"type": "function"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"inputs": [],
|
|
231
|
+
"name": "vow",
|
|
232
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
233
|
+
"stateMutability": "view",
|
|
234
|
+
"type": "function"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
238
|
+
"name": "wards",
|
|
239
|
+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
240
|
+
"stateMutability": "view",
|
|
241
|
+
"type": "function"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
@@ -938,7 +938,7 @@ export class UniswapV2
|
|
|
938
938
|
deadline: NumberAsString,
|
|
939
939
|
partner: string,
|
|
940
940
|
beneficiary: string,
|
|
941
|
-
contractMethod
|
|
941
|
+
contractMethod: string,
|
|
942
942
|
): TxInfo<UniswapParam> {
|
|
943
943
|
if (!contractMethod) throw new Error(`contractMethod need to be passed`);
|
|
944
944
|
if (permit !== '0x') contractMethod += 'WithPermit';
|
|
@@ -1014,7 +1014,7 @@ export class UniswapV2
|
|
|
1014
1014
|
partnerAndFee: string,
|
|
1015
1015
|
beneficiary: string,
|
|
1016
1016
|
blockNumber: number,
|
|
1017
|
-
contractMethod
|
|
1017
|
+
contractMethod: string,
|
|
1018
1018
|
) {
|
|
1019
1019
|
if (!contractMethod) throw new Error(`contractMethod need to be passed`);
|
|
1020
1020
|
if (!UniswapV2.getDirectFunctionNameV6().includes(contractMethod!)) {
|
|
@@ -960,7 +960,7 @@ export class UniswapV3
|
|
|
960
960
|
deadline: NumberAsString,
|
|
961
961
|
partner: string,
|
|
962
962
|
beneficiary: string,
|
|
963
|
-
contractMethod
|
|
963
|
+
contractMethod: string,
|
|
964
964
|
): TxInfo<UniswapV3Param> {
|
|
965
965
|
if (!UniswapV3.getDirectFunctionName().includes(contractMethod!)) {
|
|
966
966
|
throw new Error(`Invalid contract method ${contractMethod}`);
|
|
@@ -1023,7 +1023,7 @@ export class UniswapV3
|
|
|
1023
1023
|
partnerAndFee: string,
|
|
1024
1024
|
beneficiary: string,
|
|
1025
1025
|
blockNumber: number,
|
|
1026
|
-
contractMethod
|
|
1026
|
+
contractMethod: string,
|
|
1027
1027
|
) {
|
|
1028
1028
|
if (!UniswapV3.getDirectFunctionNameV6().includes(contractMethod!)) {
|
|
1029
1029
|
throw new Error(`Invalid contract method ${contractMethod}`);
|
package/src/dex/zerox/index.ts
CHANGED
|
@@ -275,7 +275,7 @@ export class ZeroX
|
|
|
275
275
|
deadline: NumberAsString,
|
|
276
276
|
partner: string,
|
|
277
277
|
beneficiary: string,
|
|
278
|
-
contractMethod
|
|
278
|
+
contractMethod: string,
|
|
279
279
|
): TxInfo<ZeroXParam> {
|
|
280
280
|
const usePermit = permit !== '0x';
|
|
281
281
|
const encoder = (...params: ZeroXParam) => {
|
|
@@ -142,21 +142,7 @@ export class Executor03BytecodeBuilder extends ExecutorBytecodeBuilder<
|
|
|
142
142
|
maybeWethCallData,
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
const transferCallData = this.buildTransferCallData(
|
|
147
|
-
this.erc20Interface.encodeFunctionData('transfer', [
|
|
148
|
-
curExchangeParam.transferSrcTokenBeforeSwap,
|
|
149
|
-
swap.swapExchanges[0].srcAmount,
|
|
150
|
-
]),
|
|
151
|
-
isETHAddress(swap.srcToken)
|
|
152
|
-
? this.getWETHAddress(curExchangeParam)
|
|
153
|
-
: swap.srcToken.toLowerCase(),
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
swapCallData = hexConcat([transferCallData, dexCallData]);
|
|
157
|
-
} else {
|
|
158
|
-
swapCallData = hexConcat([dexCallData]);
|
|
159
|
-
}
|
|
145
|
+
swapCallData = hexConcat([dexCallData]);
|
|
160
146
|
|
|
161
147
|
if (
|
|
162
148
|
flags.dexes[index] % 4 !== 1 && // not sendEth
|