This repo is the interface repo of the zkBridge Messaging component and mainly contains three files: IMessaging.sol, Receiver.sol and ReceiverUpgradeable.sol. Developers can easily implement cross-chain communication by introducing interface files.
More detailed information about Tusima zkBridge please refer to here.
More detailed information about Tusima zkBridge Messaging component please refer to here.
IMessaging.sol
is an Solidity interface file, you can find it here.
This file includes two interfaces, ISender
and IReceiver
, corresponding to Sending and Receiving functionalities, respectively.
You can implement the message receiving function yourself using the IReceiver
interface. However, you must ensure the following:
- Verify that
msg.sender
originates from Tusima'sMessaging
contract. - Return the function selector at the end of the function, i.e.,
return IReceiver.handleMsg.selector
.
We also provide a simpler usage method, that is Receiver.sol
, an abstract contract. By implementing the interfaces defined in this abstract contract, you won't need to verify the source of msg.sender
or return the function selector. You can solely concentrate on the message processing logic. You can find its code here.
If you wish to make your contract upgradeable, we also offer ReceiverUpgradeable.sol
, and its code is here.