HelloWorld

The skeleton of an Hyperlane-connected contract and app

****HelloWorld **** app **** is the skeleton of an Hyperlane-connected contract and app using the App framework.

The hyperlane-app-template repo shows the basic skeleton of an Hyperlane app.

Contract

Its contract sends a user-specified string to another chain which handles the message by increasing counters and emitting events.

To conveniently implement the router pattern, the contract extends @hyperlane-xyz/core/contracts/Router.sol

To send the message, it calls the _dispatchWithGas method.

Deployer

The deployer is configured to deploy to local hardhat-based test networks.

The main purpose of defining a deployer is to provide the custom types and implementation of the deployContracts method. See Deploying contracts for more details.

export class HelloWorldDeployer<
  Chain extends ChainName,
> extends HyperlaneRouterDeployer<
  Chain,
  HelloWorldConfig,
  HelloWorldContracts,
  HelloWorldFactories,
> 

Application

The application fetches some basic statistics and returns them.

The sendHelloWorld method shows an example of triggering the remote message dispatch:

    const tx = await sender.sendHelloWorld(toDomain, message, {
      ...chainConnection.overrides,
      gasLimit,
      value,
    });

Last updated