npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@biconomy/ccmp-contracts

v0.0.6

Published

Biconomy's Cross Chain Messaging Protocol Aggregrator Contracts

Downloads

10

Readme

Biconomy Cross Chain Messaging Protocol (CCMP)

This repository contains the smart contracts for Biconomy's CCM Protocol.

Introduction

CCMP faciliates cross-chain transfer of messages via Biconomy's network of decentralized relayers.

With CCMP, smart contracts deployed on one chain are able to execute arbitrary logic on another chain.

Usage

Sending Messages

To send a "message" to another chain, smart contracts will interact with the CCMPGateway contract, specifically call the sendMessage function as follows:

/// @param _destinationChainId The chain id of the destination chain.
/// @param _adaptorName The name of the router adaptor to use. Currently "axelar", "wormhole" and "abacus" are supported.
/// @param _gasFeePaymentArgs Contains details for the fee quoted by the relayer
/// @param _routerArgs Contains abi encoded router specific arguments. For ex, CONSISTENCY_LEVEL when sending message via wormhole.
/// @return sent The hash of the message sent.
function sendMessage(
    uint256 _destinationChainId,
    string calldata _adaptorName,
    CCMPMessagePayload[] calldata _payloads,
    GasFeePaymentArgs calldata _gasFeePaymentArgs,
    bytes calldata _routerArgs
) external payable;

The _payloads argument is an array of the following form:

[
    {
        // Address of contract on the destination chain
        address to;

        // Calldata to execute on 'to'
        bytes _calldata; 
    },
    {
        address to;
        bytes _calldata;
    },
    {
        address to;
        bytes _calldata;
    }...
]

The _gasFeePaymentArgs argument specified the exected gas fee to be paid to confirm the transaction on the destination chain. This can be fetched by calling and API Exposed by the Biconomy SDK.

Receiving Messages

Inherit contracts/receiver/CCMPReceiver.sol in the contract receiving the messages (to from the payload array). The function _ccmpMessageOrigin() will return the chainId of the source chain and the address of the sender contract.

Overview

Scenario: A smart contract 0xCONTRACT on ethereum wants to send a cross-chain message to 0xCONTRACT on Polygon.

Source Chain

  1. 0xCONTRACT on ethereum prepares the required payload to be executed om polygon (calldata), selects an underlying protcol supported by CCMP and calls 0xCCMPGateway.sendMessage. The fee required to execute the message on the exit chain is assumed to be negotiated previously b/w the sender and relayer and the required payment mode is sent as gasFeePaymentArgs along with the actual tokens are sent with the same call.
  2. 0xCCMPGateway will do some validations and pass on the message to 0xCCMPExecutor.
  3. 0xCCMPExecutor verifies the fee payment and does some accounting so that fee can be claimed later by the executor. In case there are any token transfer via Hyphen involved,0xExecutor will perform the token deposits into existing Hyphen Liquidity Pools as well.
  4. 0xCCMPGatway calls the underlying protocol's adapter which sends the message to the exit chain.

Intermediate Off-Chain Steps

  1. In case the underlying protocol requires a fee payment for the message to be sent to the destination chain, the relayer will pay the fee to the underlying protocol on the user's behalf. This fee is assumed to be accounted for in the original fee negotiation b/w the user and the relayer.
  2. The relayer the waits for the message to be confirmed on the destination chain by the underlying protocol.
  3. Once the message is confirmed, the relayer calls 0xCCMPGateway on the destination chain.

Destination Chain

  1. 0xCCMPGateway calls the underlying adapter to verify the message with the underlying protocol.
  2. The message is passed on 0xCCMPExecutor, which executes the contract calls and Hyphen Token Transfers included in the original payload.