V2

GitHub Zellic Audit

Overview

The Odos Router is designed as a safety wrapper around contract operations, which helps facilitate effective token swaps in the world of decentralized finance (DeFi). The Router safeguards user approvals, making sure tokens are only moved from the user in the right amount when the user is performing a swap. The goal is that the user receives at least the minimum amount they were expecting. The router can handle different kinds of swaps, as well as various approval mechanisms. Also, the router is responsible for collecting and holding revenue, which comes from positive slippage and/or fees, from the swap activities.

Key Features

Single and Multi-input/output Swapping

The main operations of the router are swap functions that aid users in exchanging tokens. The router can handle multi-input and multi-output swaps efficiently through its _swapMulti function, and single to single swaps via the _swap function. These two functions also have different methods for collecting revenue. The _swap function collects any positive slippage, which is the surplus between the quoted and actual output when the actual output is higher. Meanwhile, the _swapMulti function charges a flat fee on all swaps, but doesn’t collect any positive slippage.

Both _swap and _swapMulti have various externally callable functions. For accessing the user’s ERC20 tokens, both methods allow for standard approvals made directly to the router, as well as the use of Uniswap’s Permit2 contract. Both methods also have a compact version that reduces the amount of calldata needed to describe the swap.

Compact Swaps

The compact swap function variants aim to use as little calldata as possible, removing padding and compressing the data needed to define a swap path without compromising on complexity and accessible liquidity. This leads to gas savings across the board on all chains, but the savings are particularly large for optimistic rollups that post their calldata to Mainnet Ethereum like Arbitrum, Optimism, and Base. On these rollups, gas costs for swapping will be well over 50% cheaper than V1 in many cases, depending on network conditions and details of the swap. Compact swaps are enabled by default, but swaps encoded via the native solidity ABI are still available as well by setting the “compact” flag to false in the API.

Max Balance Swapping

Router V2 also allows the user to specify that their entire balance at the time of the swap to be used by passing in a 0 as the input amount. This is particularly useful for rebasing tokens whose balance can change slightly between the time of the path computation and the time of transaction execution. Typically these will be tokens that accumulate yield via rebasing, like Aave wrapped tokens and Overnight Finance wrapped stablecoins.

Referrals

The router has a feature for referral codes to keep track of usage. Optionally, an extra fee can be charged in conjunction with this referral code. New referral codes can be registered freely with the registerReferralCode function. Once registered, the referral code information cannot be changed - if a change is needed, a new referral code will need to be registered.

When executing a swap, a referral code can be used by passing it into the swap function. The swap will then charge the referral fee (if applicable) on the output(s) of the swap and send 80% of the fee to the specified beneficiary instantly, holding back the other 20% of the additional fee as router revenue.

For more information on how to use referral codes, check out our referral code documentation.

Owner Controls

The router collects and holds revenue generated from swap fees through positive slippage and swap fees. These funds are held in the router to avoid extra gas fees during the user’s swap for additional transfers. The router provides several owner protected functions to manage this revenue. The owner can also use certain functions to access the collected revenue, for instance, to transfer out revenue in a single denomination (like USDC) despite it originally being collected in many denominations.

Revenue Streams

The router generates income through three methods:

  1. Normal Swaps: Revenue is generated from positive slippage, which is the difference between the quoted amount and the actual amount received when the latter is higher. Negative slippage is not revenue for the router.

  2. SwapMulti: Instead of positive slippage, a fixed fee is deducted from the output tokens for transactions using the SwapMulti function. (Refer to the specific section for fee details.)

  3. Referral Fees: When swaps include a partner’s referral code, an added fee is charged. Of this fee, 20% is kept by the router as its earnings, while the remaining 80% is paid to the referring partner.

Positive Slippage

In single token swaps, the router collects revenue through a process called positive slippage. Positive slippage occurs when the router executes a swap that is better than initially predicted. This can happen due to fluctuations in the market between the time an order is placed and when it’s fulfilled.

The router ensures the returned token amount falls within a range between the minimum amount outputMin to a projected amount outputQuote. If the final trade is more favorable than initially anticipated, demonstrating positive slippage, the router retains the additional amount as its revenue.

$$\max( output_{actual} -output_{quote} , 0)$$

No / Non-fee Referral

When using the router without a referral code or with a referral code that does not charge an extra fee.

FunctionOwner Take
SwapPositive Slippage
SwapMulti0.01% of Output

Referral Fee

When using the router with a referral code that charges an extra fee.

FunctionOwner TakeReferrer Take
SwapPositive Slippage + 20% of fee80% of fee
SwapMulti0.01% of Output + 20% of fee80% of fee

Audit

Router V2 was audited by Zellic in June 2023. A link to the report can be found in the Zellic Publications GitHub Repository.

Deployments

Each of these addresses can be retrieved from the Odos API using the /info/router/v2/{chain_id} endpoint. More information about our API can be found here.

Mainnets

ChainRouter Address
Ethereum LogoEthereum0xCf5540fFFCdC3d510B18bFcA6d2b9987b0772559
Arbitrum LogoArbitrum0xa669e7A0d4b3e4Fa48af2dE86BD4CD7126Be4e13
Base LogoBase0x19cEeAd7105607Cd444F5ad10dd51356436095a1
Optimism LogoOptimism0xCa423977156BB05b13A2BA3b76Bc5419E2fE9680
Linea LogoLinea0x2d8879046f1559E53eb052E949e9544bCB72f414
Scroll LogoScroll0xbFe03C9E20a9Fc0b37de01A172F207004935E0b1
Mantle LogoMantle0xD9F4e85489aDCD0bAF0Cd63b4231c6af58c26745
zkSync LogozkSync Era0x4bBa932E9792A2b917D47830C93a9BC79320E4f7
Mode LogoMode0x7E15EB462cdc67Cf92Af1f7102465a8F8c784874
Polygon PoS LogoPolygon PoS0x4E3288c9ca110bCC82bf38F09A7b425c095d92Bf
Avalanche LogoAvalanche0x88de50B233052e4Fb783d4F6db78Cc34fEa3e9FC
BNB LogoBNB0x89b8AA89FDd0507a99d334CBe3C808fAFC7d850E
Fantom LogoFantom0xD0c22A5435F4E8E5770C1fAFb5374015FC12F7cD

ABI

This is retrievable from our API using the /info/contract-info/v2 endpoint. More information about our API can be found here.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
{
  "abi": [
    {
      "inputs": [],
      "stateMutability": "nonpayable",
      "type": "constructor"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "previousOwner",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "newOwner",
          "type": "address"
        }
      ],
      "name": "OwnershipTransferred",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "inputAmount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "inputToken",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amountOut",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "outputToken",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "int256",
          "name": "slippage",
          "type": "int256"
        },
        {
          "indexed": false,
          "internalType": "uint32",
          "name": "referralCode",
          "type": "uint32"
        }
      ],
      "name": "Swap",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "address",
          "name": "sender",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256[]",
          "name": "amountsIn",
          "type": "uint256[]"
        },
        {
          "indexed": false,
          "internalType": "address[]",
          "name": "tokensIn",
          "type": "address[]"
        },
        {
          "indexed": false,
          "internalType": "uint256[]",
          "name": "amountsOut",
          "type": "uint256[]"
        },
        {
          "indexed": false,
          "internalType": "address[]",
          "name": "tokensOut",
          "type": "address[]"
        },
        {
          "indexed": false,
          "internalType": "uint32",
          "name": "referralCode",
          "type": "uint32"
        }
      ],
      "name": "SwapMulti",
      "type": "event"
    },
    {
      "inputs": [],
      "name": "FEE_DENOM",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "REFERRAL_WITH_FEE_THRESHOLD",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "name": "addressList",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "owner",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint32",
          "name": "",
          "type": "uint32"
        }
      ],
      "name": "referralLookup",
      "outputs": [
        {
          "internalType": "uint64",
          "name": "referralFee",
          "type": "uint64"
        },
        {
          "internalType": "address",
          "name": "beneficiary",
          "type": "address"
        },
        {
          "internalType": "bool",
          "name": "registered",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint32",
          "name": "_referralCode",
          "type": "uint32"
        },
        {
          "internalType": "uint64",
          "name": "_referralFee",
          "type": "uint64"
        },
        {
          "internalType": "address",
          "name": "_beneficiary",
          "type": "address"
        }
      ],
      "name": "registerReferralCode",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "renounceOwnership",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_swapMultiFee",
          "type": "uint256"
        }
      ],
      "name": "setSwapMultiFee",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "address",
              "name": "inputToken",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "inputAmount",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "inputReceiver",
              "type": "address"
            },
            {
              "internalType": "address",
              "name": "outputToken",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "outputQuote",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "outputMin",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "outputReceiver",
              "type": "address"
            }
          ],
          "internalType": "struct OdosRouterV2.swapTokenInfo",
          "name": "tokenInfo",
          "type": "tuple"
        },
        {
          "internalType": "bytes",
          "name": "pathDefinition",
          "type": "bytes"
        },
        {
          "internalType": "address",
          "name": "executor",
          "type": "address"
        },
        {
          "internalType": "uint32",
          "name": "referralCode",
          "type": "uint32"
        }
      ],
      "name": "swap",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "amountOut",
          "type": "uint256"
        }
      ],
      "stateMutability": "payable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "swapCompact",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "payable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "address",
              "name": "tokenAddress",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "amountIn",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "receiver",
              "type": "address"
            }
          ],
          "internalType": "struct OdosRouterV2.inputTokenInfo[]",
          "name": "inputs",
          "type": "tuple[]"
        },
        {
          "components": [
            {
              "internalType": "address",
              "name": "tokenAddress",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "relativeValue",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "receiver",
              "type": "address"
            }
          ],
          "internalType": "struct OdosRouterV2.outputTokenInfo[]",
          "name": "outputs",
          "type": "tuple[]"
        },
        {
          "internalType": "uint256",
          "name": "valueOutMin",
          "type": "uint256"
        },
        {
          "internalType": "bytes",
          "name": "pathDefinition",
          "type": "bytes"
        },
        {
          "internalType": "address",
          "name": "executor",
          "type": "address"
        },
        {
          "internalType": "uint32",
          "name": "referralCode",
          "type": "uint32"
        }
      ],
      "name": "swapMulti",
      "outputs": [
        {
          "internalType": "uint256[]",
          "name": "amountsOut",
          "type": "uint256[]"
        }
      ],
      "stateMutability": "payable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "swapMultiCompact",
      "outputs": [
        {
          "internalType": "uint256[]",
          "name": "amountsOut",
          "type": "uint256[]"
        }
      ],
      "stateMutability": "payable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "swapMultiFee",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "address",
              "name": "contractAddress",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "nonce",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "deadline",
              "type": "uint256"
            },
            {
              "internalType": "bytes",
              "name": "signature",
              "type": "bytes"
            }
          ],
          "internalType": "struct OdosRouterV2.permit2Info",
          "name": "permit2",
          "type": "tuple"
        },
        {
          "components": [
            {
              "internalType": "address",
              "name": "tokenAddress",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "amountIn",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "receiver",
              "type": "address"
            }
          ],
          "internalType": "struct OdosRouterV2.inputTokenInfo[]",
          "name": "inputs",
          "type": "tuple[]"
        },
        {
          "components": [
            {
              "internalType": "address",
              "name": "tokenAddress",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "relativeValue",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "receiver",
              "type": "address"
            }
          ],
          "internalType": "struct OdosRouterV2.outputTokenInfo[]",
          "name": "outputs",
          "type": "tuple[]"
        },
        {
          "internalType": "uint256",
          "name": "valueOutMin",
          "type": "uint256"
        },
        {
          "internalType": "bytes",
          "name": "pathDefinition",
          "type": "bytes"
        },
        {
          "internalType": "address",
          "name": "executor",
          "type": "address"
        },
        {
          "internalType": "uint32",
          "name": "referralCode",
          "type": "uint32"
        }
      ],
      "name": "swapMultiPermit2",
      "outputs": [
        {
          "internalType": "uint256[]",
          "name": "amountsOut",
          "type": "uint256[]"
        }
      ],
      "stateMutability": "payable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "address",
              "name": "contractAddress",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "nonce",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "deadline",
              "type": "uint256"
            },
            {
              "internalType": "bytes",
              "name": "signature",
              "type": "bytes"
            }
          ],
          "internalType": "struct OdosRouterV2.permit2Info",
          "name": "permit2",
          "type": "tuple"
        },
        {
          "components": [
            {
              "internalType": "address",
              "name": "inputToken",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "inputAmount",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "inputReceiver",
              "type": "address"
            },
            {
              "internalType": "address",
              "name": "outputToken",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "outputQuote",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "outputMin",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "outputReceiver",
              "type": "address"
            }
          ],
          "internalType": "struct OdosRouterV2.swapTokenInfo",
          "name": "tokenInfo",
          "type": "tuple"
        },
        {
          "internalType": "bytes",
          "name": "pathDefinition",
          "type": "bytes"
        },
        {
          "internalType": "address",
          "name": "executor",
          "type": "address"
        },
        {
          "internalType": "uint32",
          "name": "referralCode",
          "type": "uint32"
        }
      ],
      "name": "swapPermit2",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "amountOut",
          "type": "uint256"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "address",
              "name": "tokenAddress",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "amountIn",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "receiver",
              "type": "address"
            }
          ],
          "internalType": "struct OdosRouterV2.inputTokenInfo[]",
          "name": "inputs",
          "type": "tuple[]"
        },
        {
          "components": [
            {
              "internalType": "address",
              "name": "tokenAddress",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "relativeValue",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "receiver",
              "type": "address"
            }
          ],
          "internalType": "struct OdosRouterV2.outputTokenInfo[]",
          "name": "outputs",
          "type": "tuple[]"
        },
        {
          "internalType": "uint256",
          "name": "valueOutMin",
          "type": "uint256"
        },
        {
          "internalType": "bytes",
          "name": "pathDefinition",
          "type": "bytes"
        },
        {
          "internalType": "address",
          "name": "executor",
          "type": "address"
        }
      ],
      "name": "swapRouterFunds",
      "outputs": [
        {
          "internalType": "uint256[]",
          "name": "amountsOut",
          "type": "uint256[]"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "newOwner",
          "type": "address"
        }
      ],
      "name": "transferOwnership",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address[]",
          "name": "tokens",
          "type": "address[]"
        },
        {
          "internalType": "uint256[]",
          "name": "amounts",
          "type": "uint256[]"
        },
        {
          "internalType": "address",
          "name": "dest",
          "type": "address"
        }
      ],
      "name": "transferRouterFunds",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address[]",
          "name": "addresses",
          "type": "address[]"
        }
      ],
      "name": "writeAddressList",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "stateMutability": "payable",
      "type": "receive"
    }
  ]
}

Events

Swap

Emitted when a swap between two tokens has been performed successfully using the swap or swapCompact functions.

Parameters:

  • sender: Address of swap user
  • inputAmount: Amount of input token
  • inputToken: Address of input token
  • amountOut: Amount of output token
  • outputToken: Address of output token
  • slippage: A signed int256 indicating the slippage for the swap
  • referralCode: Referral code if one is passed in

SwapMulti

Emitted when a multi-token swap has been performed successfully using the swapMulti, swapMultiCompact, or swapRouterFunds functions.

Parameters:

  • sender: The address of the user who initiated the swap operation. This could be an individual user or a contract.
  • amountsIn: An array containing the amounts of the input tokens that were used in the swap. The order of amounts corresponds to the order of the tokens in the tokensIn parameter.
  • tokensIn: An array containing the addresses of the input tokens that were used in the swap.
  • amountsOut: An array containing the amounts of the output tokens that were received from the swap. The order of amounts corresponds to the order of the tokens in the tokensOut parameter.
  • tokensOut: An array containing the addresses of the output tokens that were received from the swap.
  • referralCode: The referral code that was used for the swap operation. This might affect the fee structure or benefit a particular referrer. If no referral code was used, this parameter could be 0 or an empty string.

OwnershipTransferred

Emitted when the owner of the router is transferred from one address to another.

Parameters:

  • previousOwner: Address of the previous owner
  • newOwner: Address of the new owner