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
onContractCallis defined, which implements the process of a transaction called via the cross-chain transaction. -
The return value of
onContractCallis emitted as an EventOnContractCallwith the transaction info. -
If it gets an unexpected call, the developer need to perform
revertin 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 generate encoders and decoders in solidity from proto files, you need to use the code generator solidity-protobuf.
Currently, this version is required.
Install Slither and use it for static analysis.
pip3 install slither-analyzer
make slither
Lint the source code using solhint
npm ci
npm run lint:sol