GluexRouter smart contract (version 1.1) represents an optimized iteration of our routing infrastructure. It provides enhanced functionality for highly efficient token routing, dynamic fee collection and the precise execution of onchain interactions through a refined, structured interface. This version introduces advanced mechanisms for surplus and slippage sharing
Deployment
TheGluexRouter-v1.1 contract is deployed at the following address on the supported chains by GlueX:
Contract Address: 0xe95F6EAeaE1E4d650576Af600b33D9F7e5f9f7fd
Functions
Swap
Executes a token routing operation through an externalIExecutor contract using a predefined set of interactions
Function Signature
executor(IExecutor): The executor contract responsible for processing interactionsdesc(RouteDescription calldata): A structured object containing input/output token information, fees, limits and recipient addressesinteractions(Interaction[] calldata): An array of interaction steps to be executed by the executor
finalOutputAmount(uint256): The final amount of output token received by theoutputReceiverafter fees and surplus/slippage sharing
InvalidNativeTokenInputAmount: If the ETH value sent does not match the expected input amountRoutingFeeTooHigh: Ifdesc.routingFeeexceeds the maximum allowed fee (_MAX_FEE)RoutingFeeTooLow: Ifdesc.routingFeeis below the minimum required fee (_MIN_FEE)PartnerSurplusShareTooHigh: Ifdesc.partnerSurplusShareexceeds_MAX_PARTNER_SURPLUS_SHARE_LIMITProtocolSurplusShareTooLow: Ifdesc.protocolSurplusShareis below_MIN_PROTOCOL_SURPLUS_SHARE_LIMITPartnerSlippageShareTooHigh: Ifdesc.partnerSlippageShareexceeds_MAX_PARTNER_SLIPPAGE_SHARE_LIMITProtocolSlippageShareTooLow: Ifdesc.protocolSlippageShareis below_MIN_PROTOCOL_SLIPPAGE_SHARE_LIMITZeroAddress: If any required address (eg:inputReceiver,outputReceiver) is a zero addressInvalidSlippage: Ifdesc.minOutputAmountis zeroSlippageLimitTooLarge: Ifdesc.minOutputAmountexceedsdesc.outputAmountInsufficientBalance: If the router does not hold sufficient balance for the intended transferNativeTransferFailed: If the native token transfer fails
Events
Routed
Emitted upon successful completion of a routing operation Event SignatureuniquePID(bytes): The unique identifier for the partneruserAddress(address): The address of the user who initiated the routeoutputReceiver(address): The address of the receiver of the output tokeninputToken(IERC20): The ERC20 token used as inputinputAmount(uint256): The amount of input token used for routingoutputToken(IERC20): The ERC20 token received as outputfinalOutputAmount(uint256): The actual output amount received after routingpartnerFee(uint256): The fee charged for the partnerroutingFee(uint256): The fee charged for the routing operationpartnerShare(uint256): The share of surplus/slippage allocated to the partnerprotocolShare(uint256): The share of surplus/slippage allocated to the protocol