MockWormhole
Inherits: IWormhole
Title: MockWormhole
Mock implementation of IWormhole for testing Mayan contracts
Always returns valid=true for parseAndVerifyVM to pass Wormhole validation
State Variables
_chainId
uint16 public _chainId
_messageFee
uint256 public _messageFee
encodedVMToVM
mapping(bytes => VM) public encodedVMToVM
vmValidity
mapping(bytes => bool) public vmValidity
vmReason
mapping(bytes => string) public vmReason
Functions
constructor
constructor(uint16 chainId_, uint256 messageFee_) ;
parseAndVerifyVM
Parse and verify a Wormhole VM - always returns valid for testing
function parseAndVerifyVM(bytes calldata encodedVM)
external
view
returns (VM memory vm, bool valid, string memory reason);
Parameters
| Name | Type | Description |
|---|---|---|
encodedVM | bytes | The encoded VM bytes |
Returns
| Name | Type | Description |
|---|---|---|
vm | VM | The parsed VM struct |
valid | bool | Always returns true for testing |
reason | string | Empty string when valid |
publishMessage
Publish a message (stub implementation)
function publishMessage(uint32 nonce, bytes memory payload, uint8 consistencyLevel)
external
payable
returns (uint64 sequence);
chainId
Get the chain ID
function chainId() external view returns (uint16);
messageFee
Get the message fee
function messageFee() external view returns (uint256);
setChainId
Set the chain ID (for testing)
function setChainId(uint16 newChainId) external;
setMessageFee
Set the message fee (for testing)
function setMessageFee(uint256 newMessageFee) external;
setVMForEncoded
Configure a specific VM result for encoded bytes
function setVMForEncoded(bytes calldata encodedVM, VM calldata vmData, bool valid, string calldata reason)
external;
decodeVM
Decode a VM from encoded bytes
Simple decoding - assumes abi.encoded VM structure
function decodeVM(bytes calldata encodedVM) internal view returns (VM memory);