|
|
@@ -3,10 +3,80 @@
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
-import "../Structs.sol";
|
|
|
+interface IWormhole {
|
|
|
+ struct GuardianSet {
|
|
|
+ address[] keys;
|
|
|
+ uint32 expirationTime;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct Signature {
|
|
|
+ bytes32 r;
|
|
|
+ bytes32 s;
|
|
|
+ uint8 v;
|
|
|
+ uint8 guardianIndex;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct VM {
|
|
|
+ uint8 version;
|
|
|
+ uint32 timestamp;
|
|
|
+ uint32 nonce;
|
|
|
+ uint16 emitterChainId;
|
|
|
+ bytes32 emitterAddress;
|
|
|
+ uint64 sequence;
|
|
|
+ uint8 consistencyLevel;
|
|
|
+ bytes payload;
|
|
|
+
|
|
|
+ uint32 guardianSetIndex;
|
|
|
+ Signature[] signatures;
|
|
|
+
|
|
|
+ bytes32 hash;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct ContractUpgrade {
|
|
|
+ bytes32 module;
|
|
|
+ uint8 action;
|
|
|
+ uint16 chain;
|
|
|
+
|
|
|
+ address newContract;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct GuardianSetUpgrade {
|
|
|
+ bytes32 module;
|
|
|
+ uint8 action;
|
|
|
+ uint16 chain;
|
|
|
+
|
|
|
+ GuardianSet newGuardianSet;
|
|
|
+ uint32 newGuardianSetIndex;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct SetMessageFee {
|
|
|
+ bytes32 module;
|
|
|
+ uint8 action;
|
|
|
+ uint16 chain;
|
|
|
+
|
|
|
+ uint256 messageFee;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct TransferFees {
|
|
|
+ bytes32 module;
|
|
|
+ uint8 action;
|
|
|
+ uint16 chain;
|
|
|
+
|
|
|
+ uint256 amount;
|
|
|
+ bytes32 recipient;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct RecoverChainId {
|
|
|
+ bytes32 module;
|
|
|
+ uint8 action;
|
|
|
+
|
|
|
+ uint256 evmChainId;
|
|
|
+ uint16 newChainId;
|
|
|
+ }
|
|
|
|
|
|
-interface IWormhole is Structs {
|
|
|
event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel);
|
|
|
+ event ContractUpgraded(address indexed oldContract, address indexed newContract);
|
|
|
+ event GuardianSetAdded(uint32 indexed index);
|
|
|
|
|
|
function publishMessage(
|
|
|
uint32 nonce,
|
|
|
@@ -14,29 +84,59 @@ interface IWormhole is Structs {
|
|
|
uint8 consistencyLevel
|
|
|
) external payable returns (uint64 sequence);
|
|
|
|
|
|
- function parseAndVerifyVM(bytes calldata encodedVM) external view returns (Structs.VM memory vm, bool valid, string memory reason);
|
|
|
+ function initialize() external;
|
|
|
|
|
|
- function verifyVM(Structs.VM memory vm) external view returns (bool valid, string memory reason);
|
|
|
+ function parseAndVerifyVM(bytes calldata encodedVM) external view returns (VM memory vm, bool valid, string memory reason);
|
|
|
|
|
|
- function verifySignatures(bytes32 hash, Structs.Signature[] memory signatures, Structs.GuardianSet memory guardianSet) external pure returns (bool valid, string memory reason) ;
|
|
|
+ function verifyVM(VM memory vm) external view returns (bool valid, string memory reason);
|
|
|
|
|
|
- function parseVM(bytes memory encodedVM) external pure returns (Structs.VM memory vm);
|
|
|
+ function verifySignatures(bytes32 hash, Signature[] memory signatures, GuardianSet memory guardianSet) external pure returns (bool valid, string memory reason);
|
|
|
|
|
|
- function getGuardianSet(uint32 index) external view returns (Structs.GuardianSet memory) ;
|
|
|
+ function parseVM(bytes memory encodedVM) external pure returns (VM memory vm);
|
|
|
|
|
|
- function getCurrentGuardianSetIndex() external view returns (uint32) ;
|
|
|
+ function quorum(uint numGuardians) external pure returns (uint numSignaturesRequiredForQuorum);
|
|
|
|
|
|
- function getGuardianSetExpiry() external view returns (uint32) ;
|
|
|
+ function getGuardianSet(uint32 index) external view returns (GuardianSet memory);
|
|
|
|
|
|
- function governanceActionIsConsumed(bytes32 hash) external view returns (bool) ;
|
|
|
+ function getCurrentGuardianSetIndex() external view returns (uint32);
|
|
|
|
|
|
- function isInitialized(address impl) external view returns (bool) ;
|
|
|
+ function getGuardianSetExpiry() external view returns (uint32);
|
|
|
|
|
|
- function chainId() external view returns (uint16) ;
|
|
|
+ function governanceActionIsConsumed(bytes32 hash) external view returns (bool);
|
|
|
+
|
|
|
+ function isInitialized(address impl) external view returns (bool);
|
|
|
+
|
|
|
+ function chainId() external view returns (uint16);
|
|
|
+
|
|
|
+ function isFork() external view returns (bool);
|
|
|
|
|
|
function governanceChainId() external view returns (uint16);
|
|
|
|
|
|
function governanceContract() external view returns (bytes32);
|
|
|
|
|
|
- function messageFee() external view returns (uint256) ;
|
|
|
+ function messageFee() external view returns (uint256);
|
|
|
+
|
|
|
+ function evmChainId() external view returns (uint256);
|
|
|
+
|
|
|
+ function nextSequence(address emitter) external view returns (uint64);
|
|
|
+
|
|
|
+ function parseContractUpgrade(bytes memory encodedUpgrade) external pure returns (ContractUpgrade memory cu);
|
|
|
+
|
|
|
+ function parseGuardianSetUpgrade(bytes memory encodedUpgrade) external pure returns (GuardianSetUpgrade memory gsu);
|
|
|
+
|
|
|
+ function parseSetMessageFee(bytes memory encodedSetMessageFee) external pure returns (SetMessageFee memory smf);
|
|
|
+
|
|
|
+ function parseTransferFees(bytes memory encodedTransferFees) external pure returns (TransferFees memory tf);
|
|
|
+
|
|
|
+ function parseRecoverChainId(bytes memory encodedRecoverChainId) external pure returns (RecoverChainId memory rci);
|
|
|
+
|
|
|
+ function submitContractUpgrade(bytes memory _vm) external;
|
|
|
+
|
|
|
+ function submitSetMessageFee(bytes memory _vm) external;
|
|
|
+
|
|
|
+ function submitNewGuardianSet(bytes memory _vm) external;
|
|
|
+
|
|
|
+ function submitTransferFees(bytes memory _vm) external;
|
|
|
+
|
|
|
+ function submitRecoverChainId(bytes memory _vm) external;
|
|
|
}
|