You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Charges the MEV taxes in ETH and transfer to the MevTaxCollector.
It supports only single-hop swap (exact in and exact out).
Variables
mevTaxCollector : address.
mevTaxMultiplier: uint256 18 decimals. Multiplier of priority gas price.
priorityGasThreshold : uint256 18 decimals. Above this value, the transaction pays the mev tax to the router.
mevTaxEnabled : boolean. If true, charge MEV taxes.
Functions
All variables described above needs to have getters and setters, and all setters must be permissioned. (Only the priority fee admin is able to change it). Besides, the following functions must be implemented:
enableMevTax and disableMevTax: authenticated functions to enable/disable MEV charges.
swapSingleTokenExactIn : same signature as the single-hop Router.sol , and has most of the code in common. It should charge MEV taxes before calculating the swap logic.
swapSingleTokenExactOut : same signature as the single-hop Router.sol, and has most of the code in common. It should charge MEV taxes before calculating the swap logic.
Description
Charges the MEV taxes in ETH and transfer to the MevTaxCollector.
It supports only single-hop swap (exact in and exact out).
Variables
mevTaxCollector
: address.mevTaxMultiplier
: uint256 18 decimals. Multiplier of priority gas price.priorityGasThreshold
: uint256 18 decimals. Above this value, the transaction pays the mev tax to the router.mevTaxEnabled
: boolean. If true, charge MEV taxes.Functions
All variables described above needs to have getters and setters, and all setters must be permissioned. (Only the priority fee admin is able to change it). Besides, the following functions must be implemented:
enableMevTax
anddisableMevTax
: authenticated functions to enable/disable MEV charges.swapSingleTokenExactIn
: same signature as the single-hopRouter.sol
, and has most of the code in common. It should charge MEV taxes before calculating the swap logic.swapSingleTokenExactOut
: same signature as the single-hopRouter.sol
, and has most of the code in common. It should charge MEV taxes before calculating the swap logic.Logic to charge priority fees
mevTaxEnabled == true
priorityGasPrice
:tx.gasprice - block.basefee
priorityGasPrice > priorityGasThreshold
mevTax
:priorityGasPrice * mevTaxMultiplier
mevTaxCollector.chargeMevTax{value: mevTax}(address pool)
, which will collect and register the MEV tax (LPs + Protocol).MevTaxCharged(address pool, uint256 mevTax)
Tests
Swap ExactIn and ExactOut
Getters and Setters
The text was updated successfully, but these errors were encountered: