Skip to content

XLabs/wormhole-solidity-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wormhole Solidity SDK

The purpose of this SDK is to make integrations with Wormhole on EVM compatible chains as smooth as possible by providing all necessary Solidity interfaces along with useful libraries and tools for testing.

This SDK was originally created for integrations with the WormholeRelayer and then expanded to cover all integrations.

Installation

Foundry and Forge

forge install wormhole-foundation/wormhole-solidity-sdk

Solc Version

Be careful when building for cross-chain and set your evm version to paris in foundry.toml via:

evm_version = "paris"

This avoids issues with OPCODE0, which was introduced in 0.8.20 which bumped the default evm version to shanghai, which is not supported on many EVM chains.

WormholeRelayer

Introduction

The WormholeRelayer (also sometimes referred to as the automatic or generic relayer) allows integrators to leverage external parties known as delivery providers, to relay messages emitted on a given source chain to the intended target chain.

This frees integrators, who are building a cross-chain app, from the cumbersome and painful task of having to run relaying infrastructure themselves, without off-loading the burden of having to submit any transactions on the target chain themselves (and thus e.g. dealing with the headache of having to acquire gas tokens for the target chain).

Messages include, but aren't limited to: Wormhole attestations (VAAs), Circle attestations (CCTP)

Delivery providers provide a quote for the cost of a delivery on the source chain and also take payment there. This means the process is not fully trustless (delivery providers can take payment and then fail to perform the delivery), however the state of the respective chains always makes it clear whether a delivery provider has done their duty for a given delivery and delivery providers can't maliciously manipulate the content of a delivery.

Example Usage

HelloWormhole - Simple cross-chain message sending application

HelloToken - Simple cross-chain token sending application

HelloUSDC - Simple cross-chain USDC sending application using CCTP

SDK Summary

  • Includes interfaces to interact with contracts in the Wormhole ecosystem (src/interfaces)

  • Includes the base class ‘Base’ with helpers for common actions that will typically need to be done within ‘receiveWormholeMessages’:

  • Included are also the ‘TokenSender’ and ‘TokenReceiver’ base classes with helpers for smart contracts that wish to send and receive tokens using Wormhole’s TokenBridge. See ‘HelloToken’ for example usage.

  • Included are also the ‘CCTPSender’ and ‘CCTPReceiver’ base classes with helpers for smart contracts that wish to send and receive both tokens using Wormhole’s TokenBridge as well as USDC using CCTP. See ‘HelloUSDC’ for example usage.

  • Included are helpers that help set up a local forge testing environment. See ‘HelloWormhole’ for example usage.

Note: This code is meant to be used as starter / reference code. Feel free to modify for use in your contracts, and also make sure to audit any code used from here as part of your contracts before deploying to mainnet.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 100.0%