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.
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 EventOnContractCall
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.
Here is an example of deploying with the module CrossSimpleModule
that implements the simple commit.
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.