Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToHash(b []byte) (common.Hash, error)
- func CalculateQuorum(numGuardians int) int
- func CreateInstatiateCosmwasmContractHash(codeId uint64, label string, msg []byte) [32]byte
- func CreateMigrateCosmwasmContractHash(codeId uint64, contract string, msg []byte) [32]byte
- func DeprecatedSigningDigest(bz []byte) common.Hash
- func DeprecatedVerifySignatures(vaaBody []byte, signatures []*Signature, addresses []common.Address) bool
- func EmptyPayloadVaa(module string, actionId GovernanceAction, chainId ChainID) ([]byte, error)
- func IsTransfer(payload []byte) bool
- func LeftPadBytes(payload string, length int) (*bytes.Buffer, error)
- func LeftPadIbcChannelId(channelId string) ([64]byte, error)
- func MessageSigningDigest(prefix []byte, data []byte) (common.Hash, error)
- func MustWrite(w io.Writer, order binary.ByteOrder, data interface{})
- func StringToHash(value string) (common.Hash, error)
- func VerifyMessageSignature(prefix []byte, messageBody []byte, signatures *Signature, ...) bool
- type Action
- type Address
- type Attestation
- type BodyAccountantModifyBalance
- type BodyCircleIntegrationRegisterEmitterAndDomain
- type BodyCircleIntegrationUpdateWormholeFinality
- type BodyCircleIntegrationUpgradeContractImplementation
- type BodyContractUpgrade
- type BodyGatewayIbcComposabilityMwContract
- type BodyGatewayScheduleUpgrade
- type BodyGeneralPurposeGovernanceEvm
- type BodyGeneralPurposeGovernanceSolana
- type BodyGuardianSetUpdate
- type BodyIbcUpdateChannelChain
- type BodyRecoverChainId
- type BodyTokenBridgeRegisterChain
- type BodyTokenBridgeUpgradeContract
- type BodyWormchainInstantiateContract
- type BodyWormchainMigrateContract
- type BodyWormchainStoreCode
- type BodyWormchainWasmAllowlistInstantiate
- type BodyWormholeRelayerSetDefaultDeliveryProvider
- type ChainID
- type GovernanceAction
- type Observation
- type Signature
- type SignatureData
- type TransferPayloadHdr
- type VAA
- func (v *VAA) AddSignature(key *ecdsa.PrivateKey, index uint8)
- func (v *VAA) GetEmitterChain() ChainID
- func (v *VAA) HexDigest() string
- func (v *VAA) Marshal() ([]byte, error)
- func (v VAA) MarshalBinary() ([]byte, error)
- func (v *VAA) MessageID() string
- func (v *VAA) SigningDigest() common.Hash
- func (v *VAA) UniqueID() string
- func (v *VAA) UnmarshalBinary(data []byte) error
- func (v *VAA) Verify(addresses []common.Address) error
- func (v *VAA) VerifySignatures(addresses []common.Address) bool
Constants ¶
const ( ConsistencyLevelPublishImmediately = uint8(200) ConsistencyLevelSafe = uint8(201) )
const AccountantModifyBalanceReasonLength = 32
Variables ¶
var CircleIntegrationModule = [32]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43,
0x69, 0x72, 0x63, 0x6c, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
}
CircleIntegrationModule is the identifier of the Circle Integration module (which is used for governance messages). It is the hex representation of "CircleIntegration" left padded with zeroes.
var CircleIntegrationModuleStr = string(CircleIntegrationModule[:])
var CoreModule = []byte{00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0x43, 0x6f, 0x72, 0x65}
CoreModule is the identifier of the Core module (which is used for governance messages)
var GatewayModule = [32]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
}
GatewayModule is the identifier of the Gateway module (which is used for general Gateway-related governance messages)
var GatewayModuleStr = string(GatewayModule[:])
var GeneralPurposeGovernanceModule = [32]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
0x50, 0x75, 0x72, 0x70, 0x6F, 0x73, 0x65, 0x47, 0x6F, 0x76, 0x65, 0x72, 0x6E, 0x61, 0x6E,
0x63, 0x65,
}
var GeneralPurposeGovernanceModuleStr = string(GeneralPurposeGovernanceModule[:])
var GovernanceChain = ChainIDSolana
var GovernanceEmitter = Address{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}
var IbcReceiverModule = [32]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x62, 0x63, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72,
}
IbcReceiverModule is the identifier of the Wormchain ibc_receiver contract module (which is used for governance messages) It is the hex representation of "IbcReceiver" left padded with zeroes.
var IbcReceiverModuleStr = string(IbcReceiverModule[:])
var IbcTranslatorModule = [32]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x49, 0x62, 0x63, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x6f, 0x72,
}
IbcTranslatorModule is the identifier of the Wormchain ibc_receiver contract module (which is used for governance messages) It is the hex representation of "IbcTranslator" left padded with zeroes.
var IbcTranslatorModuleStr = string(IbcTranslatorModule[:])
var WasmdModule = [32]byte{00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0x57, 0x61, 0x73, 0x6D, 0x64, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65}
WasmdModule is the identifier of the Wormchain Wasmd module (which is used for governance messages)
var WasmdModuleStr = string(WasmdModule[:])
var WormholeRelayerModule = [32]byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x57, 0x6f, 0x72, 0x6d, 0x68, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72,
}
WormholeRelayerModule is the identifier of the Wormhole Relayer module (which is used for governance messages). It is the hex representation of "WormholeRelayer" left padded with zeroes.
var WormholeRelayerModuleStr = string(WormholeRelayerModule[:])
Functions ¶
func CalculateQuorum ¶
CalculateQuorum returns the minimum number of guardians that need to sign a VAA for a given guardian set.
The canonical source is the calculation in the contracts (solana/bridge/src/processor.rs and ethereum/contracts/Wormhole.sol), and this needs to match the implementation in the contracts.
func CreateInstatiateCosmwasmContractHash ¶
Compute the hash for cosmwasm contract instatiation params. The hash is keccak256 hash(hash(hash(BigEndian(CodeID)), Label), Msg). We compute the nested hash so there is no chance of bytes leaking between CodeID, Label, and Msg.
func CreateMigrateCosmwasmContractHash ¶
Compute the hash for cosmwasm contract migration params. The hash is keccak256 hash(hash(hash(BigEndian(CodeID)), Contract), Msg). We compute the nested hash so there is no chance of bytes leaking between CodeID, Contract, and Msg.
func DeprecatedSigningDigest ¶
This is a temporary method to produce a vaa signing digest on raw bytes. It is error prone and we should use `v.SigningDigest()` instead. whenever possible. This will be removed in a subsequent release.
func DeprecatedVerifySignatures ¶
func DeprecatedVerifySignatures(vaaBody []byte, signatures []*Signature, addresses []common.Address) bool
Operating on bytes directly is error prone. We should use `vaa.VerifyingSignatures()` whenever possible. This function will be removed in a subsequent release.
func EmptyPayloadVaa ¶
func EmptyPayloadVaa(module string, actionId GovernanceAction, chainId ChainID) ([]byte, error)
func IsTransfer ¶
NOTE: This function assumes that the caller has verified that the VAA is from the token bridge.
func LeftPadBytes ¶
Prepends 0x00 bytes to the payload buffer, up to a size of `length`
func LeftPadIbcChannelId ¶
func MessageSigningDigest ¶
MessageSigningDigest returns the hash of the data prepended with it's signing prefix. This is intending to be used for signing messages of different types from VAA's. The message prefix helps protect from message collisions.
func StringToHash ¶
StringToHash converts a hex-encoded string into a common.Hash
Types ¶
type Address ¶
type Address [32]byte
Address is a Wormhole protocol address, it contains the native chain's address. If the address data type of a chain is < 32bytes the value is zero-padded on the left.
func BytesToAddress ¶
func StringToAddress ¶
StringToAddress converts a hex-encoded address into a vaa.Address
func (Address) MarshalJSON ¶
func (*Address) UnmarshalJSON ¶
Standard marshal stores the Address like this: "[0,0,0,0,0,0,0,0,0,0,0,0,2,144,251,22,114,8,175,69,91,177,55,120,1,99,183,183,169,161,12,22]" The above MarshalJSON stores it like this (66 bytes): ""0000000000000000000000000290fb167208af455bb137780163b7b7a9a10c16""
type Attestation ¶
type Attestation interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler SigningMsg() common.Hash VerifySignatures(addrs []common.Address) bool UniqueID() string HexDigest() string AddSignature(key *ecdsa.PrivateKey, index uint8) GetEmitterChain() ChainID // contains filtered or unexported methods }
Attestation interface contains the methods common to all VAA types
type BodyAccountantModifyBalance ¶
type BodyAccountantModifyBalance struct { Module string TargetChainID ChainID Sequence uint64 ChainId ChainID TokenChain ChainID TokenAddress Address Kind uint8 Amount *uint256.Int Reason string }
BodyTokenBridgeModifyBalance is a governance message to modify accountant balances for the tokenbridge.
func (BodyAccountantModifyBalance) Serialize ¶
func (r BodyAccountantModifyBalance) Serialize() ([]byte, error)
type BodyCircleIntegrationRegisterEmitterAndDomain ¶
type BodyCircleIntegrationRegisterEmitterAndDomain struct { TargetChainID ChainID ForeignEmitterChainId ChainID ForeignEmitterAddress [32]byte CircleDomain uint32 }
BodyCircleIntegrationRegisterEmitterAndDomain is a governance message to register an emitter and domain for Circle Integration.
func (BodyCircleIntegrationRegisterEmitterAndDomain) Serialize ¶
func (r BodyCircleIntegrationRegisterEmitterAndDomain) Serialize() ([]byte, error)
type BodyCircleIntegrationUpdateWormholeFinality ¶
BodyCircleIntegrationUpdateWormholeFinality is a governance message to update the wormhole finality for Circle Integration.
func (BodyCircleIntegrationUpdateWormholeFinality) Serialize ¶
func (r BodyCircleIntegrationUpdateWormholeFinality) Serialize() ([]byte, error)
type BodyCircleIntegrationUpgradeContractImplementation ¶
type BodyCircleIntegrationUpgradeContractImplementation struct { TargetChainID ChainID NewImplementationAddress [32]byte }
BodyCircleIntegrationUpgradeContractImplementation is a governance message to upgrade the contract implementation for Circle Integration.
func (BodyCircleIntegrationUpgradeContractImplementation) Serialize ¶
func (r BodyCircleIntegrationUpgradeContractImplementation) Serialize() ([]byte, error)
type BodyContractUpgrade ¶
BodyContractUpgrade is a governance message to perform a contract upgrade of the core module
func (BodyContractUpgrade) Serialize ¶
func (b BodyContractUpgrade) Serialize() ([]byte, error)
type BodyGatewayIbcComposabilityMwContract ¶
type BodyGatewayIbcComposabilityMwContract struct {
ContractAddr [32]byte
}
BodyGatewayIbcComposabilityMwContract is a governance message to set a specific contract (i.e. IBC Translator) for the ibc composability middleware to use
func (*BodyGatewayIbcComposabilityMwContract) Deserialize ¶
func (r *BodyGatewayIbcComposabilityMwContract) Deserialize(bz []byte) error
func (BodyGatewayIbcComposabilityMwContract) Serialize ¶
func (r BodyGatewayIbcComposabilityMwContract) Serialize() ([]byte, error)
type BodyGatewayScheduleUpgrade ¶
BodyGatewayScheduleUpgrade is a governance message to schedule an upgrade on Gateway
func (*BodyGatewayScheduleUpgrade) Deserialize ¶
func (r *BodyGatewayScheduleUpgrade) Deserialize(bz []byte) error
func (BodyGatewayScheduleUpgrade) Serialize ¶
func (r BodyGatewayScheduleUpgrade) Serialize() ([]byte, error)
type BodyGeneralPurposeGovernanceEvm ¶
type BodyGeneralPurposeGovernanceEvm struct { ChainID ChainID GovernanceContract ethcommon.Address TargetContract ethcommon.Address Payload []byte }
BodyGeneralPurposeGovernanceEvm is a general purpose governance message for EVM chains
func (BodyGeneralPurposeGovernanceEvm) Serialize ¶
func (r BodyGeneralPurposeGovernanceEvm) Serialize() ([]byte, error)
type BodyGeneralPurposeGovernanceSolana ¶
type BodyGeneralPurposeGovernanceSolana struct { ChainID ChainID GovernanceContract Address // NOTE: unlike in EVM, no target contract in the schema here, the // instruction encodes the target contract address (unlike in EVM, where // an abi encoded calldata doesn't include the target contract address) Instruction []byte }
BodyGeneralPurposeGovernanceSolana is a general purpose governance message for Solana chains
func (BodyGeneralPurposeGovernanceSolana) Serialize ¶
func (r BodyGeneralPurposeGovernanceSolana) Serialize() ([]byte, error)
type BodyGuardianSetUpdate ¶
BodyGuardianSetUpdate is a governance message to set a new guardian set
func (BodyGuardianSetUpdate) Serialize ¶
func (b BodyGuardianSetUpdate) Serialize() ([]byte, error)
type BodyIbcUpdateChannelChain ¶
type BodyIbcUpdateChannelChain struct { // The chain that this governance VAA should be redeemed on TargetChainId ChainID // This should follow the IBC channel identifier standard: https://github.com/cosmos/ibc/tree/main/spec/core/ics-024-host-requirements#paths-identifiers-separators // If the identifier string is shorter than 64 bytes, the correct number of 0x00 bytes should be prepended. ChannelId [64]byte ChainId ChainID }
BodyIbcUpdateChannelChain is a governance message to update the ibc channel_id -> chain_id mapping in either of the ibc_receiver or ibc_translator contracts
type BodyRecoverChainId ¶
BodyRecoverChainId is a governance message to recover a chain id.
func (BodyRecoverChainId) Serialize ¶
func (r BodyRecoverChainId) Serialize() ([]byte, error)
type BodyTokenBridgeRegisterChain ¶
BodyTokenBridgeRegisterChain is a governance message to register a chain on the token bridge
func (BodyTokenBridgeRegisterChain) Serialize ¶
func (r BodyTokenBridgeRegisterChain) Serialize() ([]byte, error)
type BodyTokenBridgeUpgradeContract ¶
type BodyTokenBridgeUpgradeContract struct { Module string TargetChainID ChainID NewContract Address }
BodyTokenBridgeUpgradeContract is a governance message to upgrade the token bridge.
func (BodyTokenBridgeUpgradeContract) Serialize ¶
func (r BodyTokenBridgeUpgradeContract) Serialize() ([]byte, error)
type BodyWormchainInstantiateContract ¶
type BodyWormchainInstantiateContract struct {
InstantiationParamsHash [32]byte
}
BodyWormchainInstantiateContract is a governance message to instantiate a cosmwasm contract on wormchain
func (BodyWormchainInstantiateContract) Serialize ¶
func (r BodyWormchainInstantiateContract) Serialize() ([]byte, error)
type BodyWormchainMigrateContract ¶
type BodyWormchainMigrateContract struct {
MigrationParamsHash [32]byte
}
BodyWormchainInstantiateContract is a governance message to migrate a cosmwasm contract on wormchain
func (BodyWormchainMigrateContract) Serialize ¶
func (r BodyWormchainMigrateContract) Serialize() ([]byte, error)
type BodyWormchainStoreCode ¶
type BodyWormchainStoreCode struct {
WasmHash [32]byte
}
BodyWormchainStoreCode is a governance message to upload a new cosmwasm contract to wormchain
func (BodyWormchainStoreCode) Serialize ¶
func (r BodyWormchainStoreCode) Serialize() ([]byte, error)
type BodyWormchainWasmAllowlistInstantiate ¶
BodyWormchainAllowlistInstantiateContract is a governance message to allowlist a specific contract address to instantiate a specific wasm code id.
func (*BodyWormchainWasmAllowlistInstantiate) Deserialize ¶
func (r *BodyWormchainWasmAllowlistInstantiate) Deserialize(bz []byte) error
func (BodyWormchainWasmAllowlistInstantiate) Serialize ¶
func (r BodyWormchainWasmAllowlistInstantiate) Serialize(action GovernanceAction) ([]byte, error)
type BodyWormholeRelayerSetDefaultDeliveryProvider ¶
type BodyWormholeRelayerSetDefaultDeliveryProvider struct { ChainID ChainID NewDefaultDeliveryProviderAddress Address }
BodyWormholeRelayerSetDefaultDeliveryProvider is a governance message to set the default relay provider for the Wormhole Relayer.
func (BodyWormholeRelayerSetDefaultDeliveryProvider) Serialize ¶
func (r BodyWormholeRelayerSetDefaultDeliveryProvider) Serialize() ([]byte, error)
type ChainID ¶
type ChainID uint16
ChainID of a Wormhole chain
const ( ChainIDUnset ChainID = 0 // ChainIDSolana is the ChainID of Solana ChainIDSolana ChainID = 1 // ChainIDEthereum is the ChainID of Ethereum ChainIDEthereum ChainID = 2 // ChainIDTerra is the ChainID of Terra ChainIDTerra ChainID = 3 // ChainIDBSC is the ChainID of Binance Smart Chain ChainIDBSC ChainID = 4 // ChainIDPolygon is the ChainID of Polygon ChainIDPolygon ChainID = 5 // ChainIDAvalanche is the ChainID of Avalanche ChainIDAvalanche ChainID = 6 // ChainIDOasis is the ChainID of Oasis ChainIDOasis ChainID = 7 // ChainIDAlgorand is the ChainID of Algorand ChainIDAlgorand ChainID = 8 // ChainIDAurora is the ChainID of Aurora ChainIDAurora ChainID = 9 // ChainIDFantom is the ChainID of Fantom ChainIDFantom ChainID = 10 // ChainIDKarura is the ChainID of Karura ChainIDKarura ChainID = 11 // ChainIDAcala is the ChainID of Acala ChainIDAcala ChainID = 12 // ChainIDKlaytn is the ChainID of Klaytn ChainIDKlaytn ChainID = 13 // ChainIDCelo is the ChainID of Celo ChainIDCelo ChainID = 14 // ChainIDNear is the ChainID of Near ChainIDNear ChainID = 15 // ChainIDMoonbeam is the ChainID of Moonbeam ChainIDMoonbeam ChainID = 16 // OBSOLETE: ChainIDNeon ChainID = 17 // ChainIDTerra2 is the ChainID of Terra 2 ChainIDTerra2 ChainID = 18 // ChainIDInjective is the ChainID of Injective ChainIDInjective ChainID = 19 // ChainIDOsmosis is the ChainID of Osmosis ChainIDOsmosis ChainID = 20 // ChainIDSui is the ChainID of Sui ChainIDSui ChainID = 21 // ChainIDAptos is the ChainID of Aptos ChainIDAptos ChainID = 22 // ChainIDArbitrum is the ChainID of Arbitrum ChainIDArbitrum ChainID = 23 // ChainIDOptimism is the ChainID of Optimism ChainIDOptimism ChainID = 24 // ChainIDGnosis is the ChainID of Gnosis ChainIDGnosis ChainID = 25 // ChainIDPythNet is the ChainID of PythNet ChainIDPythNet ChainID = 26 // ChainIDXpla is the ChainID of Xpla ChainIDXpla ChainID = 28 //ChainIDBtc is the ChainID of Bitcoin ChainIDBtc ChainID = 29 // ChainIDBase is the ChainID of Base ChainIDBase ChainID = 30 // ChainIDSei is the ChainID of Sei ChainIDSei ChainID = 32 // ChainIDRootstock is the ChainID of Rootstock ChainIDRootstock ChainID = 33 // ChainIDScroll is the ChainID of Scroll ChainIDScroll ChainID = 34 // ChainIDMantle is the ChainID of Mantle ChainIDMantle ChainID = 35 // ChainIDBlast is the ChainID of Blast ChainIDBlast ChainID = 36 // ChainIDXLayer is the ChainID of XLayer ChainIDXLayer ChainID = 37 // ChainIDLinea is the ChainID of Linea ChainIDLinea ChainID = 38 // ChainIDBerachain is the ChainID of Berachain ChainIDBerachain ChainID = 39 // ChainIDSeiEVM is the ChainID of SeiEVM ChainIDSeiEVM ChainID = 40 //ChainIDWormchain is the ChainID of Wormchain ChainIDWormchain ChainID = 3104 // ChainIDCosmoshub is the ChainID of Cosmoshub ChainIDCosmoshub ChainID = 4000 // ChainIDEvmos is the ChainID of Evmos ChainIDEvmos ChainID = 4001 // ChainIDKujira is the ChainID of Kujira ChainIDKujira ChainID = 4002 // ChainIDNeutron is the ChainID of Neutron ChainIDNeutron ChainID = 4003 // ChainIDCelestia is the ChainID of Celestia ChainIDCelestia ChainID = 4004 // ChainIDStargaze is the ChainID of Stargaze ChainIDStargaze ChainID = 4005 // ChainIDSeda is the ChainID of Seda ChainIDSeda ChainID = 4006 // ChainIDDymension is the ChainID of Dymension ChainIDDymension ChainID = 4007 // ChainIDProvenance is the ChainID of Provenance ChainIDProvenance ChainID = 4008 // ChainIDSepolia is the ChainID of Sepolia ChainIDSepolia ChainID = 10002 // ChainIDArbitrumSepolia is the ChainID of Arbitrum on Sepolia ChainIDArbitrumSepolia ChainID = 10003 // ChainIDBaseSepolia is the ChainID of Base on Sepolia ChainIDBaseSepolia ChainID = 10004 // ChainIDOptimismSepolia is the ChainID of Optimism on Sepolia ChainIDOptimismSepolia ChainID = 10005 // ChainIDHolesky is the ChainID of Holesky ChainIDHolesky ChainID = 10006 // ChainIDPolygonSepolia is the ChainID of Polygon on Sepolia ChainIDPolygonSepolia ChainID = 10007 SupportedVAAVersion = 0x01 )
func ChainIDFromString ¶
func GetAllNetworkIDs ¶
func GetAllNetworkIDs() []ChainID
type GovernanceAction ¶
type GovernanceAction uint8
var ( // Wormhole core governance actions // See e.g. GovernanceStructs.sol for semantic meaning of these ActionContractUpgrade GovernanceAction = 1 ActionGuardianSetUpdate GovernanceAction = 2 ActionCoreSetMessageFee GovernanceAction = 3 ActionCoreTransferFees GovernanceAction = 4 ActionCoreRecoverChainId GovernanceAction = 5 // Wormchain cosmwasm/middleware governance actions ActionStoreCode GovernanceAction = 1 ActionInstantiateContract GovernanceAction = 2 ActionMigrateContract GovernanceAction = 3 ActionAddWasmInstantiateAllowlist GovernanceAction = 4 ActionDeleteWasmInstantiateAllowlist GovernanceAction = 5 // Gateway governance actions ActionScheduleUpgrade GovernanceAction = 1 ActionCancelUpgrade GovernanceAction = 2 ActionSetIbcComposabilityMwContract GovernanceAction = 3 // Accountant governance actions ActionModifyBalance GovernanceAction = 1 // Wormhole tokenbridge governance actions ActionRegisterChain GovernanceAction = 1 ActionUpgradeTokenBridge GovernanceAction = 2 ActionTokenBridgeRecoverChainId GovernanceAction = 3 // Circle Integration governance actions CircleIntegrationActionUpdateWormholeFinality GovernanceAction = 1 CircleIntegrationActionRegisterEmitterAndDomain GovernanceAction = 2 CircleIntegrationActionUpgradeContractImplementation GovernanceAction = 3 // Ibc Receiver governance actions IbcReceiverActionUpdateChannelChain GovernanceAction = 1 // Ibc Translator governance actions IbcTranslatorActionUpdateChannelChain GovernanceAction = 1 // Wormhole relayer governance actions WormholeRelayerSetDefaultDeliveryProvider GovernanceAction = 3 // General purpose governance GeneralPurposeGovernanceEvmAction GovernanceAction = 1 GeneralPurposeGovernanceSolanaAction GovernanceAction = 2 )
type Observation ¶
type Signature ¶
type Signature struct { // Index of the validator Index uint8 // Signature data Signature SignatureData }
Signature of a single guardian
type SignatureData ¶
type SignatureData [65]byte
func (SignatureData) MarshalJSON ¶
func (a SignatureData) MarshalJSON() ([]byte, error)
func (SignatureData) String ¶
func (a SignatureData) String() string
type TransferPayloadHdr ¶
type TransferPayloadHdr struct { Type uint8 Amount *big.Int OriginAddress Address OriginChain ChainID TargetAddress Address TargetChain ChainID }
func DecodeTransferPayloadHdr ¶
func DecodeTransferPayloadHdr(payload []byte) (*TransferPayloadHdr, error)
type VAA ¶
type VAA struct { // Version of the VAA schema Version uint8 // GuardianSetIndex is the index of the guardian set that signed this VAA GuardianSetIndex uint32 // SignatureData is the signature of the guardian set Signatures []*Signature // Timestamp when the VAA was created Timestamp time.Time // Nonce of the VAA Nonce uint32 // Sequence of the VAA Sequence uint64 /// ConsistencyLevel of the VAA ConsistencyLevel uint8 // EmitterChain the VAA was emitted on EmitterChain ChainID // EmitterAddress of the contract that emitted the Message EmitterAddress Address // Payload of the message Payload []byte }
VAA is a verifiable action approval of the Wormhole protocol
func CreateGovernanceVAA ¶
func UnmarshalBody ¶
UnmarshalBody deserializes the binary representation of a VAA's "BODY" properties The BODY fields are common among multiple types of VAA - v1, v2, etc
func (*VAA) AddSignature ¶
func (v *VAA) AddSignature(key *ecdsa.PrivateKey, index uint8)
func (*VAA) GetEmitterChain ¶
GetEmitterChain implements the processor.Observation interface for *VAA.
func (VAA) MarshalBinary ¶
implement encoding.BinaryMarshaler interface for the VAA struct
func (*VAA) MessageID ¶
MessageID returns a human-readable emitter_chain/emitter_address/sequence tuple.
func (*VAA) SigningDigest ¶
SigningDigest returns the hash of the vaa hash to be signed directly. This is used for signature generation and verification
func (*VAA) UniqueID ¶
UniqueID normalizes the ID of the VAA (any type) for the Attestation interface UniqueID returns the MessageID that uniquely identifies the Attestation
func (*VAA) UnmarshalBinary ¶
implement encoding.BinaryUnmarshaler interface for the VAA struct
func (*VAA) Verify ¶
Verify is a function on the VAA that takes a complete set of guardian keys as input and attempts certain checks with respect to this guardian. Verify will return nil if the VAA passes checks. Otherwise, Verify will return an error containing the text of the first check to fail. NOTE: Verify will not work correctly if a subset of the guardian set keys is passed in. The complete guardian set must be passed in. Verify does the following checks: - If the guardian does not have or know its own guardian set keys, then the VAA cannot be verified. - Quorum is calculated on the guardian set passed in and checks if the VAA has enough signatures. - The signatures in the VAA is verified against the guardian set keys.