Helper contracts to interact with some KyberSwap's protocols
InputScalingHelper
: Main contract to scale the swap data of Kyber's router (MetaAggregationRouterV2),
from oldAmount to newAmount of swap amount
ScalingDataLib
: Library to scale swap amount of each dex in the route
InputScalingHelperL2
: (For Arbitrum, Optimism) Main contract to scale the swap data of Kyber's router (MetaAggregationRouterV2),
from oldAmount to newAmount of swap amount
ScalingDataL2Lib
: (For Arbitrum, Optimism) Library to scale swap amount of each dex in the route
Function getScaledInputData
in the InputScalingHelper
contract
- Input:
- The encoded data (including the selector) of
swap
andswapSimpleMode
from the contractMetaAggregationRouterV2
- The new input amount
- The encoded data (including the selector) of
- Output: New encoded data
- Flows:
- Decode data of router’s description and executor’s description and scale the input amount. There are 2 cases here of swap and swapSimpleMode.
- Decode the
Swap[]
data from executor’s data and use the scaling lib to scale amount of eachSwap
- Encode the new executor’s data and router’s data
- Requirements: There isn’t any RFQ swap in input data, else it will be reverted with the message “InputScalingHelper: Can not scale RFQ swap”
Remember to check script before run script at script/YOUR_SCRIPT_FILE
forge script DeployScaleL1V2 --rpc-url mainnet --chain-id 1 --with-gas-price 10000000000 --broadcast