The Transfer module in Neutron is an enhanced wrapper around the standard IBC Transfer module that facilitates token transfers between IBC-connected blockchains. It extends the core functionality with contract detection and callback features to improve interchain token transfer reliability for smart contracts.

Key Features

Contract Detection

Automatically detects if the sender is a smart contract using HasContractInfo() to apply contract-specific handling.

Enhanced Responses

Provides tracking information with sequence IDs and channel information to help correlate transfers with their results.

Sudo Callbacks

Calls back to sending contracts via Sudo mechanism when acknowledgements or timeouts are received.

IBC Compatibility

Maintains full compatibility with standard IBC Transfer functionality while adding smart contract enhancements.

Packet Forwarding

Supports relaying transfer packets through Neutron using memo-based packet forwarding middleware for multi-hop transfers.

IBC Hooks

Enables calling smart contracts on Neutron via IBC transfers by supplying memo in the correct format for contract execution.

Module Interactions

The Transfer module integrates with other Neutron modules:
  • IBC Core: Routes packets between chains using the IBC protocol
  • Contract Manager: Uses PrepareSudoCallbackMessage() for callback message preparation
  • Fee Refunder: Uses fee locking (LockFees()) and distribution functions for packet processing

Architecture

The Transfer module wraps the standard IBC transfer functionality, adding contract detection and callback mechanisms for smart contract integration.

Advanced Transfer Features

Packet Forwarding Middleware

Neutron supports relaying transfer packets through itself using memo-based packet forwarding middleware. This enables multi-hop transfers where Neutron acts as an intermediary chain. Example memo format for packet forwarding:
{
  "forward": {
    "receiver": "${receiver_address}",
    "port": "transfer", 
    "channel": "channel-0"
  }
}
Packet forwarding is implemented as middleware in the IBC stack. The exact implementation details may be provided by external packet forwarding middleware integrated with Neutron’s IBC setup.

IBC Hooks Integration

IBC Hooks allow you to call smart contracts on Neutron by sending IBC transfers to the chain with properly formatted memo fields. This enables cross-chain contract execution triggered by token transfers. Example memo format for contract calls:
{
  "wasm": {
    "contract": "${contract_address}",
    "msg": {
      "test_msg": {
        "return_err": false,
        "arg": "test"
      }
    }
  }
}
When using IBC Hooks, the transferred tokens are sent to the specified contract address, and the contract’s entry point is called with the provided message.

Standard IBC Transfer Features

The module maintains all capabilities of the standard IBC Transfer module:
  • Transfer of tokens between IBC-connected chains
  • Denomination trace for cross-chain tokens
  • Automatic escrowing and releasing of tokens
  • Support for transfer timeout and recovery
  • Standard queries delegated to underlying IBC transfer implementation
For core IBC Transfer functionality, see the IBC Transfer documentation.

Learn More