/cross-solidity

Cross Framework in solidity

Primary LanguageGoOtherNOASSERTION

cross-solidity

Test GoDoc

This is a solidity implementation of Cross Framework.

Currently, it provides the following features:

  • the registry feature that allows developers to register their contracts
  • the participant feature of the simple commit protocol
  • it's implemented on top of yui-ibc-solidity

A coordinator feature of the simple commit and two-phase commit will be provided in the future.

Contract module development

A developer who develops contract using Cross Framework need to implement IContractModule, which is defined in IContractModule.sol.

// IContractModule defines the expected interface of a contract module on Cross Framework
interface IContractModule {
    // onContractCall is a callback function that is called at the commit(simple-commit) phase
    function onContractCall(CrossContext calldata context, bytes calldata callInfo) external returns (bytes memory);
}
  • Currently, only one function onContractCall is defined, which implements the process of a transaction called via the cross-chain transaction.

  • The return value of onContractCall is emitted as an Event OnContractCall with the transaction info.

  • If it gets an unexpected call, the developer need to perform revert in the contract. This will request the coordinator to abort the transaction.

How to deploy a contract module

Here is an example of deploying with the module CrossSimpleModule that implements the simple commit.

For Developers

To develop this project, you need the code generator solidity-protobuf to generate encoders and decoders in solidity from proto files.

Currently, you need to use this version.