MoroRouterV1

The Moromoro Router is the main smart contract for executing swaps on supported networks.

Contract Addresses

HyperEVM

MoroRouter V1

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 swap

  • data: Encoded swap data from the quote

  • depositAddress: The deposit address for the specific DEX

  • srcToken: Source token address (0x5555...5555 for native HYPE)

  • amountIn: Amount of source tokens to swap

  • destToken: Destination token address

  • minAmountOut: Minimum acceptable output amount (for slippage protection)

  • receiver: Address to receive the output tokens

  • partnerId: Partner ID for profit sharing (use 0 if not applicable)

  • metadata: Reserved for future use (use 0)

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

1

From HyperEVM Scan

Find the ABI on the contract page on HyperEVM Scan: https://hyperevmscan.io/address/0x3e1c48732b2dff04e83bd7fc1cf618584693d23f#code

2

From the contract repository

Look for the ABI in the contract repository (if available).

3

Download from the block explorer

Download the ABI directly from the block explorer.

See Also

Last updated