2022-10-17 11:28:17 -07:00
|
|
|
// This is a simple contract to generate Wormhole messages.
|
|
|
|
// It allows you to populate the consistency level in the message.
|
|
|
|
// It can be used to test the guardian watcher.
|
|
|
|
|
2022-09-30 09:03:01 -07:00
|
|
|
pragma solidity >=0.8.0 <0.9.0;
|
|
|
|
|
|
|
|
import "./libraries/external/BytesLib.sol";
|
|
|
|
|
|
|
|
interface IWormhole {
|
|
|
|
function publishMessage(
|
|
|
|
uint32 nonce,
|
|
|
|
bytes memory payload,
|
|
|
|
uint8 consistencyLevel
|
|
|
|
) external payable returns (uint64 sequence);
|
|
|
|
}
|
|
|
|
|
2022-10-17 11:28:17 -07:00
|
|
|
contract PublishMsg {
|
2022-09-30 09:03:01 -07:00
|
|
|
|
|
|
|
IWormhole wormhole;
|
|
|
|
|
|
|
|
constructor(address wormholeAddress) {
|
|
|
|
wormhole = IWormhole(wormholeAddress);
|
|
|
|
}
|
|
|
|
|
2022-10-17 11:28:17 -07:00
|
|
|
function publishMsg(uint8 consistencyLevel) public payable returns (uint64 sequence) {
|
2022-09-30 09:03:01 -07:00
|
|
|
return wormhole.publishMessage{
|
|
|
|
value : msg.value
|
2022-10-17 11:28:17 -07:00
|
|
|
}(0, bytes("hello"), consistencyLevel);
|
2022-09-30 09:03:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|