@kumbaya_xyz/smart-order-router 4.22.38 → 4.22.39
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/README.md +76 -263
- package/package.json +17 -16
package/README.md
CHANGED
|
@@ -2,314 +2,127 @@
|
|
|
2
2
|
|
|
3
3
|
# Kumbaya Smart Order Router
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The Smart Order Router for [Kumbaya DEX](https://kumbaya.xyz) on MegaETH - the first real-time blockchain with 10ms block times.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This package finds the most efficient way to swap tokens by searching across multiple routes and considering gas costs.
|
|
8
8
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
### Unit Tests
|
|
12
|
-
|
|
13
|
-
First make sure you have run `npm install` and `npm run build`.
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
npm run test
|
|
17
|
-
```
|
|
9
|
+
## Supported Networks
|
|
18
10
|
|
|
19
|
-
|
|
11
|
+
| Network | Chain ID | Status |
|
|
12
|
+
|---------|----------|--------|
|
|
13
|
+
| MegaETH Testnet | 6343 | ✅ Live |
|
|
14
|
+
| MegaETH Mainnet | 4326 | 🔜 Coming Soon |
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
## Installation
|
|
22
17
|
|
|
23
|
-
```
|
|
24
|
-
npm
|
|
18
|
+
```bash
|
|
19
|
+
npm install @kumbaya_xyz/smart-order-router
|
|
25
20
|
```
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
## Quick Start
|
|
28
23
|
|
|
29
|
-
|
|
24
|
+
```typescript
|
|
25
|
+
import { AlphaRouter, ChainId } from '@kumbaya_xyz/smart-order-router';
|
|
26
|
+
import { ethers } from 'ethers';
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
process.env.TENDERLY_PROJECT!,
|
|
37
|
-
process.env.TENDERLY_ACCESS_KEY!,
|
|
28
|
+
const provider = new ethers.providers.JsonRpcProvider('https://carrot.megaeth.com');
|
|
29
|
+
const router = new AlphaRouter({
|
|
30
|
+
chainId: ChainId.MEGAETH_TESTNET,
|
|
31
|
+
provider,
|
|
32
|
+
});
|
|
38
33
|
```
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
The package can be run as a CLI for testing purposes.
|
|
43
|
-
|
|
44
|
-
First create a `.env` file in the root of the project and configure:
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
JSON_RPC_PROVIDER = '<JSON_RPC_PROVIDER>'
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
To run on chains other than mainnet set up a connection by specifying the environment variable
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
JSON_RPC_PROVIDER_GORLI = '<JSON_RPC_PROVIDER>'
|
|
54
|
-
JSON_RPC_PROVIDER_OPTIMISM = '<JSON_RPC_PROVIDER>'
|
|
55
|
-
JSON_RPC_PROVIDER_OPTIMISM_GOERLI = '<JSON_RPC_PROVIDER>'
|
|
56
|
-
JSON_RPC_PROVIDER_ARBITRUM_ONE = '<JSON_RPC_PROVIDER>'
|
|
57
|
-
JSON_RPC_PROVIDER_ARBITRUM_GOERLI = '<JSON_RPC_PROVIDER>'
|
|
58
|
-
JSON_RPC_PROVIDER_POLYGON = '<JSON_RPC_PROVIDER>'
|
|
59
|
-
JSON_RPC_PROVIDER_POLYGON_MUMBAI = '<JSON_RPC_PROVIDER>'
|
|
60
|
-
JSON_RPC_PROVIDER_CELO = '<JSON_RPC_PROVIDER>'
|
|
61
|
-
JSON_RPC_PROVIDER_CELO_ALFAJORES = '<JSON_RPC_PROVIDER>'
|
|
62
|
-
JSON_RPC_PROVIDER_BNB = '<JSON_RPC_PROVIDER>'
|
|
63
|
-
JSON_RPC_PROVIDER_AVALANCHE = '<JSON_RPC_PROVIDER>'
|
|
64
|
-
JSON_RPC_PROVIDER_BASE = '<JSON_RPC_PROVIDER>'
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Then from the root directory you can execute the CLI.
|
|
68
|
-
|
|
69
|
-
## Examples
|
|
70
|
-
|
|
71
|
-
Some examples to use for manual CLI testing.
|
|
72
|
-
|
|
73
|
-
### Mainnet
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
./bin/cli quote --tokenIn 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 --tokenOut 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984 --amount 1000 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --protocols v2,v3
|
|
77
|
-
|
|
78
|
-
Best Route:
|
|
79
|
-
100.00% = USDC -- 0.3% --> UNI
|
|
80
|
-
Raw Quote Out:
|
|
81
|
-
35.72
|
|
82
|
-
Gas Adjusted Quote Out:
|
|
83
|
-
34.03
|
|
84
|
-
|
|
85
|
-
Gas Used Quote Token: 1.691772
|
|
86
|
-
Gas Used USD: 47.592951
|
|
87
|
-
Calldata: 0x414bf389000000000000...
|
|
88
|
-
Value: 0x00
|
|
89
|
-
|
|
90
|
-
blockNumber: "13088815"
|
|
91
|
-
estimatedGasUsed: "113000"
|
|
92
|
-
gasPriceWei: "130000000000"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
./bin/cli quote-to-ratio --token0 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 --token1 0xdac17f958d2ee523a2206206994597c13d831ec7 --feeAmount 3000 --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --token0Balance 1000 --token1Balance 2000 --tickLower -120 --tickUpper 120
|
|
96
|
-
|
|
97
|
-
Best Route:
|
|
98
|
-
100.00% = USDT -- 0.05% --> USDC
|
|
99
|
-
Raw Quote Exact In:
|
|
100
|
-
392.68
|
|
101
|
-
Gas Adjusted Quote In}:
|
|
102
|
-
346.13
|
|
103
|
-
|
|
104
|
-
Gas Used Quote Token: 46.550010
|
|
105
|
-
Gas Used USD: 46.342899
|
|
106
|
-
Calldata: 0x414bf389000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000ab5801a7d398351b8be11c439e05c5b3259aec9b000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000176a736c000000000000000000000000000000000000000000000000000000001764f8650000000000000000000000000000000000000000000000000000000000000000
|
|
107
|
-
Value: 0x00
|
|
108
|
-
|
|
109
|
-
blockNumber: "13239188"
|
|
110
|
-
estimatedGasUsed: "113000"
|
|
111
|
-
gasPriceWei: "116690684398"
|
|
112
|
-
|
|
113
|
-
./bin/cli quote --tokenIn 0x0391D2021f89DC339F60Fff84546EA23E337750f --tokenOut 0x4d224452801ACEd8B2F0aebE155379bb5D594381 --amount 10000 --exactIn --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --protocols v2,v3,mixed
|
|
114
|
-
Best Route:
|
|
115
|
-
[V2 + V3] 100.00% = BOND -- [0x6591c4BcD6D7A1eb4E537DA8B78676C1576Ba244] --> USDC -- 0.3% [0xB07Fe2F407F971125D4EB1977f8aCEe8846C7324] --> APE
|
|
116
|
-
Raw Quote Exact In:
|
|
117
|
-
10437.85
|
|
118
|
-
Gas Adjusted Quote In:
|
|
119
|
-
10433.83
|
|
120
|
-
|
|
121
|
-
Gas Used Quote Token: 4.018625
|
|
122
|
-
Gas Used USD: 29.669402
|
|
123
|
-
Calldata: 0x5ae401dc0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000e4472b43f300000000000000000000000000000000000000000000021e19e0c9bab240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000391d2021f89dc339f60fff84546ea23e337750f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000104b858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000ab5801a7d398351b8be11c439e05c5b3259aec9b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002358df5b3b4459a3f5b000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000bb84d224452801aced8b2f0aebe155379bb5d59438100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
124
|
-
Value: 0x00
|
|
125
|
-
|
|
126
|
-
blockNumber: "15303839"
|
|
127
|
-
estimatedGasUsed: "434000"
|
|
128
|
-
gasPriceWei: "38218865879"
|
|
129
|
-
Total ticks crossed: 7
|
|
130
|
-
```
|
|
35
|
+
## Contract Addresses (MegaETH Testnet)
|
|
131
36
|
|
|
132
|
-
|
|
37
|
+
| Contract | Address |
|
|
38
|
+
|----------|---------|
|
|
39
|
+
| UniswapV3Factory | `0x53447989580f541bc138d29A0FcCf72AfbBE1355` |
|
|
40
|
+
| SwapRouter02 | `0x8268DC930BA98759E916DEd4c9F367A844814023` |
|
|
41
|
+
| UniversalRouter | `0x7E6c4Ada91e432efe5F01FbCb3492Bd3eb7ccD2E` |
|
|
42
|
+
| QuoterV2 | `0xfb230b93803F90238cB03f254452bA3a3b0Ec38d` |
|
|
43
|
+
| NonfungiblePositionManager | `0x367f9db1F974eA241ba046b77B87C58e2947d8dF` |
|
|
44
|
+
| Multicall2 | `0xc638099246A98B3A110429B47B3F42CA037BC0a3` |
|
|
45
|
+
| WETH | `0x4200000000000000000000000000000000000006` |
|
|
133
46
|
|
|
134
|
-
|
|
135
|
-
./bin/cli quote --tokenIn 0x5592ec0cfb4dbc12d3ab100b257153436a1f0fea --tokenOut 0x4DBCdF9B62e891a7cec5A2568C3F4FAF9E8Abe2b --amount 200000 --exactIn --minSplits 1 --router alpha --chainId 4
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Sepolia
|
|
139
|
-
|
|
140
|
-
```
|
|
141
|
-
./bin/cli quote --tokenIn 0x7AF17A48a6336F7dc1beF9D485139f7B6f4FB5C8 --tokenOut 0x6f14C02Fc1F78322cFd7d707aB90f18baD3B54f5 --amount 10 --exactIn --minSplits 1 --router alpha --chainId 11155111
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Kovan
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
./bin/cli quote --tokenIn 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa --tokenOut 0xd0a1e359811322d97991e03f863a0c30c2cf029c --amount 10 --exactIn --minSplits 1 --router alpha --chainId 42
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Ropsten
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
./bin/cli quote --tokenIn 0x07865c6e87b9f70255377e024ace6630c1eaa37f --tokenOut 0xc778417e063141139fce010982780140aa0cd5ab --amount 200000 --exactIn --minSplits 1 --router alpha --chainId 3
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Optimism
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
./bin/cli quote --tokenIn 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 --tokenOut 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 --amount 200000 --exactIn --minSplits 1 --router alpha --chainId 10
|
|
160
|
-
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
```
|
|
164
|
-
./bin/cli quote --tokenIn 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 --tokenOut 0x4200000000000000000000000000000000000042 --amount 1 --exactIn --minSplits 1 --protocols v2 --router alpha --chainId 10
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
## Optimism-Goerli
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
./bin/cli quote --tokenIn 0x7E07E15D2a87A24492740D16f5bdF58c16db0c4E --tokenOut 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 --amount 200000 --exactIn --minSplits 1 --router alpha --chainId 420
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## Optimistic-Kovan
|
|
175
|
-
|
|
176
|
-
```
|
|
177
|
-
./bin/cli quote --tokenIn 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 --tokenOut 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1 --amount 200 --exactIn --minSplits 1 --router alpha --chainId 69
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Arbitrum
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
./bin/cli quote --tokenIn 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9 --tokenOut 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 --amount 20000 --exactIn --minSplits 1 --router alpha --chainId 42161 --debug
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## Arbitrum-Rinkeby
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
./bin/cli quote --tokenIn 0x09b98f8b2395d076514037ff7d39a091a536206c --tokenOut 0xb47e6a5f8b33b3f17603c83a0535a9dcd7e32681 --amount 200 --exactIn --minSplits 1 --router alpha --chainId 421611
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
## Arbitrum-Goerli
|
|
193
|
-
|
|
194
|
-
```
|
|
195
|
-
./bin/cli quote --tokenIn 0xe39ab88f8a4777030a534146a9ca3b52bd5d43a3 --tokenOut 0x8FB1E3fC51F3b789dED7557E680551d93Ea9d892 --amount 200 --exactIn --minSplits 1 --router alpha --chainId 421613
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Polygon Mumbai
|
|
199
|
-
|
|
200
|
-
```
|
|
201
|
-
./bin/cli quote --tokenIn 0x001b3b4d0f3714ca98ba10f6042daebf0b1b7b6f --tokenOut 0x9c3c9283d3e44854697cd22d3faa240cfb032889 --amount 1 --exactIn --protocols v3 --recipient 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B --minSplits 1 --router alpha --chainId 80001
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Polygon Mainnet
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
./bin/cli quote --tokenIn 0x2791bca1f2de4661ed88a30c99a7a9449aa84174 --tokenOut 0x7ceb23fd6bc0add59e62ac25578270cff1b9f619 --amount 5 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 137
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Celo Mainnet
|
|
211
|
-
|
|
212
|
-
```
|
|
213
|
-
./bin/cli quote --tokenIn CELO --tokenOut 0x765DE816845861e75A25fCA122bb6898B8B1282a --amount 5 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 42220
|
|
214
|
-
```
|
|
47
|
+
## Testing
|
|
215
48
|
|
|
216
|
-
|
|
49
|
+
### Unit Tests
|
|
217
50
|
|
|
51
|
+
```bash
|
|
52
|
+
pnpm install
|
|
53
|
+
pnpm build
|
|
54
|
+
pnpm test
|
|
218
55
|
```
|
|
219
|
-
./bin/cli quote --tokenIn 0x55d398326f99059fF775485246999027B3197955 --tokenOut 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d --amount 1 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 56
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
## AVAX Mainnet
|
|
223
56
|
|
|
224
|
-
|
|
225
|
-
./bin/cli quote --tokenIn 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E --tokenOut 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7 --amount 1000 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 43114
|
|
226
|
-
```
|
|
57
|
+
### Integration Tests
|
|
227
58
|
|
|
228
|
-
|
|
59
|
+
Create a `.env` file with your RPC endpoint:
|
|
229
60
|
|
|
230
61
|
```
|
|
231
|
-
|
|
62
|
+
JSON_RPC_PROVIDER_MEGAETH_TESTNET = 'https://carrot.megaeth.com'
|
|
232
63
|
```
|
|
233
64
|
|
|
234
|
-
|
|
65
|
+
Then run:
|
|
235
66
|
|
|
236
|
-
```
|
|
237
|
-
|
|
67
|
+
```bash
|
|
68
|
+
pnpm integ-test
|
|
238
69
|
```
|
|
239
70
|
|
|
240
|
-
##
|
|
71
|
+
## CLI Examples
|
|
241
72
|
|
|
242
|
-
|
|
243
|
-
./bin/cli quote --tokenIn 0x4200000000000000000000000000000000000006 --tokenOut 0x79A02482A880bCE3F13e09Da970dC34db4CD24d1 --amount 0.1 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 480
|
|
244
|
-
```
|
|
73
|
+
### MegaETH Testnet
|
|
245
74
|
|
|
246
|
-
|
|
75
|
+
Swap WETH to USDC:
|
|
247
76
|
|
|
248
|
-
```
|
|
249
|
-
./bin/cli quote --tokenIn 0x4200000000000000000000000000000000000006 --tokenOut
|
|
77
|
+
```bash
|
|
78
|
+
./bin/cli quote --tokenIn 0x4200000000000000000000000000000000000006 --tokenOut 0x75139A9559c9CD1aD69B7E239C216151D2c81e6f --amount 0.1 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 6343
|
|
250
79
|
```
|
|
251
80
|
|
|
252
|
-
|
|
81
|
+
Swap USDC to USDT:
|
|
253
82
|
|
|
254
|
-
```
|
|
255
|
-
./bin/cli quote --tokenIn
|
|
83
|
+
```bash
|
|
84
|
+
./bin/cli quote --tokenIn 0x75139A9559c9CD1aD69B7E239C216151D2c81e6f --tokenOut 0x8E1eb0b74A0aC37abaa0f75C598A681975896900 --amount 100 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 6343
|
|
256
85
|
```
|
|
257
86
|
|
|
258
|
-
##
|
|
87
|
+
## Gas Configuration
|
|
259
88
|
|
|
260
|
-
|
|
261
|
-
./bin/cli quote --tokenIn 0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701 --tokenOut 0xfBC2D240A5eD44231AcA3A9e9066bc4b33f01149 --amount 0.1 --exactIn --minSplits 1 --protocols v2 --router alpha --chainId 10143
|
|
262
|
-
```
|
|
89
|
+
MegaETH has unique gas characteristics due to its 10ms block times:
|
|
263
90
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
91
|
+
- Base swap cost: 80,000 gas
|
|
92
|
+
- Cost per initialized tick: 350,000 gas
|
|
93
|
+
- Cost per hop: 100,000 gas
|
|
94
|
+
- Blocks to live (cache): 360,000 blocks (~1 hour)
|
|
268
95
|
|
|
269
|
-
|
|
96
|
+
### Measuring Gas Costs
|
|
270
97
|
|
|
271
|
-
|
|
272
|
-
./bin/cli quote --tokenIn 0x4200000000000000000000000000000000000006 --tokenOut 0x036CbD53842c5426634e7929541eC2318f3dCF7e --amount 0.1 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 84532
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Soneium
|
|
98
|
+
To measure actual gas costs on MegaETH Testnet, run the gas measurement script:
|
|
276
99
|
|
|
100
|
+
```bash
|
|
101
|
+
npx ts-node scripts/measure-megaeth-gas.ts
|
|
277
102
|
```
|
|
278
|
-
./bin/cli quote --tokenIn 0x4200000000000000000000000000000000000006 --tokenOut 0xbA9986D2381edf1DA03B0B9c1f8b00dc4AacC369 --amount 0.1 --exactIn --minSplits 1 --protocols v3 --router alpha --chainId 1868
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
## Adding a new Chain
|
|
282
|
-
|
|
283
|
-
The main components to complete are:
|
|
284
|
-
|
|
285
|
-
- Deploy contracts on chain, add the pools to subgraph
|
|
286
|
-
- Populate v3 providers in `src/providers/v3/subgraph-provider` and `src/providers/v3/static-subgraph-provider`
|
|
287
|
-
- Populate chainId and addresses in `src/util/chains.ts` and `src/util/addresses.ts`
|
|
288
|
-
- Populate token providers in `src/providers/caching-token-provider` and `src/providers/token-provider.ts`
|
|
289
|
-
- Populate gas constants in `src/routers/alpha-router/gas-models/*`
|
|
290
|
-
- Populate bases in `src/routers/legacy-router/bases.ts`
|
|
291
|
-
- Populate `test/integ/routers/alpha-router/alpha-router.integration.test.ts` and `src/providers/v2/static-subgraph-provider.ts`
|
|
292
|
-
- Populate `src/routers/alpha-router/*`
|
|
293
|
-
- Add a log to `/CHANGELOG.md`
|
|
294
|
-
- Run `npm run integ-test` successfully
|
|
295
103
|
|
|
296
|
-
|
|
104
|
+
This script:
|
|
105
|
+
- Connects to MegaETH Testnet RPC
|
|
106
|
+
- Scans for existing pools via PoolCreated events
|
|
107
|
+
- Measures gas for factory, pool, and quoter operations
|
|
108
|
+
- Reports gasEstimate values from QuoterV2 quotes
|
|
109
|
+
- Outputs recommended gas constants for the router
|
|
297
110
|
|
|
298
|
-
##
|
|
111
|
+
## Related Packages
|
|
299
112
|
|
|
300
|
-
|
|
113
|
+
- [@kumbaya_xyz/sdk-core](https://www.npmjs.com/package/@kumbaya_xyz/sdk-core) - Core SDK with chain definitions
|
|
114
|
+
- [@kumbaya_xyz/v3-sdk](https://www.npmjs.com/package/@kumbaya_xyz/v3-sdk) - V3 pool SDK with pool init code hash
|
|
115
|
+
- [@kumbaya_xyz/router-sdk](https://www.npmjs.com/package/@kumbaya_xyz/router-sdk) - Router SDK for swap encoding
|
|
116
|
+
- [@kumbaya_xyz/universal-router-sdk](https://www.npmjs.com/package/@kumbaya_xyz/universal-router-sdk) - Universal Router SDK
|
|
301
117
|
|
|
302
|
-
|
|
118
|
+
## Troubleshooting
|
|
303
119
|
|
|
304
|
-
|
|
305
|
-
- 120,000,000 gas on Arbitrum
|
|
306
|
-
- 50,000,000 gas on Celo
|
|
307
|
-
- 150,000,000 gas on every other network (Mainnet, Goerli, etc.)
|
|
120
|
+
### ProviderGasLimit Errors
|
|
308
121
|
|
|
309
|
-
|
|
122
|
+
If you encounter gas limit errors, ensure your RPC provider has a high enough `eth_call` gas limit. The default configuration uses up to 150,000,000 gas per call.
|
|
310
123
|
|
|
311
|
-
|
|
124
|
+
For custom node configurations, you can lower the `multicallChunk` and `gasLimitPerCall` parameters when initializing the router.
|
|
312
125
|
|
|
313
|
-
|
|
126
|
+
## License
|
|
314
127
|
|
|
315
|
-
|
|
128
|
+
GPL-2.0-or-later
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumbaya_xyz/smart-order-router",
|
|
3
|
-
"version": "4.22.
|
|
3
|
+
"version": "4.22.39",
|
|
4
4
|
"description": "Kumbaya DEX Smart Order Router",
|
|
5
5
|
"main": "build/main/index.js",
|
|
6
6
|
"typings": "build/main/index.d.ts",
|
|
@@ -15,6 +15,22 @@
|
|
|
15
15
|
"dex",
|
|
16
16
|
"ethereum"
|
|
17
17
|
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"compile-v3-types": "npx typechain --target ethers-v5 --out-dir src/types/v3 './node_modules/@uniswap/?(v3-core|v3-periphery)/artifacts/contracts/**/*.json'",
|
|
20
|
+
"compile-v2-types": "npx typechain --target ethers-v5 --out-dir src/types/v2 './node_modules/@uniswap/?(v2-core|v2-periphery)/build/*UniswapV2*.json'",
|
|
21
|
+
"compile-router": "npx typechain --target ethers-v5 --out-dir src/types/other './node_modules/@uniswap/swap-router-contracts/artifacts/contracts/**/*.json'",
|
|
22
|
+
"compile-external-types": "npx typechain --target ethers-v5 --out-dir src/types/other 'src/abis/**/*.json'",
|
|
23
|
+
"build": "run-p compile-v3-types compile-v2-types compile-router compile-external-types && run-p build:*",
|
|
24
|
+
"build:main": "tsc -p tsconfig.json",
|
|
25
|
+
"build:module": "tsc -p tsconfig.module.json",
|
|
26
|
+
"fix": "run-s fix:*",
|
|
27
|
+
"fix:prettier": "prettier \"src/**/*.ts\" --write",
|
|
28
|
+
"fix:lint": "eslint src --ext .ts --fix",
|
|
29
|
+
"prepare-release": "run-s cov:check doc:html version doc:publish",
|
|
30
|
+
"test": "jest test/unit",
|
|
31
|
+
"integ-test": "TS_NODE=true jest test/integ --testRunner='jest-circus/runner'",
|
|
32
|
+
"prepare": "husky"
|
|
33
|
+
},
|
|
18
34
|
"engines": {
|
|
19
35
|
"node": ">=10"
|
|
20
36
|
},
|
|
@@ -110,20 +126,5 @@
|
|
|
110
126
|
},
|
|
111
127
|
"oclif": {
|
|
112
128
|
"commands": "./cli/commands"
|
|
113
|
-
},
|
|
114
|
-
"scripts": {
|
|
115
|
-
"compile-v3-types": "npx typechain --target ethers-v5 --out-dir src/types/v3 './node_modules/@uniswap/?(v3-core|v3-periphery)/artifacts/contracts/**/*.json'",
|
|
116
|
-
"compile-v2-types": "npx typechain --target ethers-v5 --out-dir src/types/v2 './node_modules/@uniswap/?(v2-core|v2-periphery)/build/*UniswapV2*.json'",
|
|
117
|
-
"compile-router": "npx typechain --target ethers-v5 --out-dir src/types/other './node_modules/@uniswap/swap-router-contracts/artifacts/contracts/**/*.json'",
|
|
118
|
-
"compile-external-types": "npx typechain --target ethers-v5 --out-dir src/types/other 'src/abis/**/*.json'",
|
|
119
|
-
"build": "run-p compile-v3-types compile-v2-types compile-router compile-external-types && run-p build:*",
|
|
120
|
-
"build:main": "tsc -p tsconfig.json",
|
|
121
|
-
"build:module": "tsc -p tsconfig.module.json",
|
|
122
|
-
"fix": "run-s fix:*",
|
|
123
|
-
"fix:prettier": "prettier \"src/**/*.ts\" --write",
|
|
124
|
-
"fix:lint": "eslint src --ext .ts --fix",
|
|
125
|
-
"prepare-release": "run-s cov:check doc:html version doc:publish",
|
|
126
|
-
"test": "jest test/unit",
|
|
127
|
-
"integ-test": "TS_NODE=true jest test/integ --testRunner='jest-circus/runner'"
|
|
128
129
|
}
|
|
129
130
|
}
|