MoroRouterV1
The Moromoro Router is the main smart contract for executing swaps on supported networks.
Contract Addresses
HyperEVM
MoroRouter V1
Address: 0x3e1c48732b2dff04e83bd7fc1cf618584693d23f
Contract Interface
The router contract provides the following main functions:
swap()
Executes a token swap based on the quote provided by the SDK.
Function Signature:
function swap(
address swapAddress,
bytes calldata data,
address depositAddress,
address srcToken,
uint256 amountIn,
address destToken,
uint256 minAmountOut,
address receiver,
uint256 partnerId,
uint256 metadata
) external payable returns (uint256 amountOut)Parameters:
swapAddress: The DEX wrapper contract address to execute the swapdata: Encoded swap data from the quotedepositAddress: The deposit address for the specific DEXsrcToken: Source token address (0x5555...5555for native HYPE)amountIn: Amount of source tokens to swapdestToken: Destination token addressminAmountOut: Minimum acceptable output amount (for slippage protection)receiver: Address to receive the output tokenspartnerId: Partner ID for profit sharing (use0if not applicable)metadata: Reserved for future use (use0)
Returns:
amountOut: Actual amount of destination tokens received
Usage Example
JavaScript/TypeScript
Using SDK Helper Methods
Slippage Protection
Always set an appropriate minAmountOut to protect against slippage:
Gas Considerations
HyperEVM
Default gas price on HyperEVM is typically 5 gwei:
Token Addresses
Native Token
On HyperEVM, the native token (HYPE) uses a special address:
When swapping FROM native token, send the value with the transaction:
Events
The router contract emits events for tracking swaps. Check the contract ABI for specific event signatures.
Security
Always verify the router contract address before interacting
Use appropriate slippage protection
Test with small amounts first
Ensure you understand the gas costs involved
Getting the ABI
See Also
HyperEVM Contracts
Last updated