Documentation ¶
Index ¶
- Variables
- func IsTransfer(payload []byte) bool
- func MustWrite(w io.Writer, order binary.ByteOrder, data interface{})
- type Action
- type Address
- type BodyContractUpgrade
- type BodyGuardianSetUpgrade
- type BodyTokenBridgeDestroyContracts
- type BodyTokenBridgeRegisterChain
- type BodyTokenBridgeUpdateMinimalConsistencyLevel
- type BodyTokenBridgeUpdateRefundAddress
- type BodyTokenBridgeUpgradeContract
- type BodyTransferFee
- type BodyUpdateMessageFee
- type ChainID
- type Signature
- type SignatureData
- type TransferPayloadHdr
- type VAA
- func (v *VAA) AddSignature(key *ecdsa.PrivateKey, index uint8)
- func (v *VAA) HexDigest() string
- func (v *VAA) Marshal() ([]byte, error)
- func (v *VAA) MessageID() string
- func (v *VAA) SerializeBody() []byte
- func (v *VAA) SigningMsg() common.Hash
- func (v *VAA) VerifySignatures(addresses []common.Address) bool
- type VAAID
Constants ¶
This section is empty.
Variables ¶
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 TokenBridgeModule = []byte{00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65}
000000000000000000000000000000000000000000546f6b656e427269646765
Functions ¶
func IsTransfer ¶
NOTE: This function assumes that the caller has verified that the VAA is from the token bridge.
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 StringToAddress ¶
StringToAddress converts a hex-encoded address into a vaa.Address
func (Address) MarshalJSON ¶
type BodyContractUpgrade ¶
type BodyContractUpgrade struct {
Payload []byte
}
BodyContractUpgrade is a governance message to perform a contract upgrade of the core module
func (BodyContractUpgrade) Serialize ¶
func (b BodyContractUpgrade) Serialize() []byte
type BodyGuardianSetUpgrade ¶
BodyGuardianSetUpgrade is a governance message to set a new guardian set
func (BodyGuardianSetUpgrade) Serialize ¶
func (b BodyGuardianSetUpgrade) Serialize() []byte
type BodyTokenBridgeDestroyContracts ¶
func (BodyTokenBridgeDestroyContracts) Serialize ¶
func (b BodyTokenBridgeDestroyContracts) Serialize() []byte
type BodyTokenBridgeRegisterChain ¶
BodyTokenBridgeRegisterChain is a governance message to register a chain on the token bridge
func (BodyTokenBridgeRegisterChain) Serialize ¶
func (r BodyTokenBridgeRegisterChain) Serialize() []byte
type BodyTokenBridgeUpdateMinimalConsistencyLevel ¶
type BodyTokenBridgeUpdateMinimalConsistencyLevel struct {
NewConsistencyLevel uint8
}
func (BodyTokenBridgeUpdateMinimalConsistencyLevel) Serialize ¶
func (b BodyTokenBridgeUpdateMinimalConsistencyLevel) Serialize() []byte
type BodyTokenBridgeUpdateRefundAddress ¶
type BodyTokenBridgeUpdateRefundAddress struct {
NewRefundAddress []byte
}
func (BodyTokenBridgeUpdateRefundAddress) Serialize ¶
func (b BodyTokenBridgeUpdateRefundAddress) Serialize() []byte
type BodyTokenBridgeUpgradeContract ¶
BodyTokenBridgeUpgradeContract is a governance message to upgrade the token bridge.
func (BodyTokenBridgeUpgradeContract) Serialize ¶
func (r BodyTokenBridgeUpgradeContract) Serialize() []byte
type BodyTransferFee ¶
func (BodyTransferFee) Serialize ¶
func (b BodyTransferFee) Serialize() []byte
type BodyUpdateMessageFee ¶
type BodyUpdateMessageFee struct {
NewMessageFee []byte
}
BodyUpdateMessageFee is a governance message to perform update message fee of the core module
func (BodyUpdateMessageFee) Serialize ¶
func (b BodyUpdateMessageFee) Serialize() []byte
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 // ChainIDMoonbeam is the ChainID of Moonbeam ChainIDMoonbeam ChainID = 16 // ChainIDNeon is the ChainID of Neon ChainIDNeon ChainID = 17 // ChainIDAlephium is the ChainID of Alephium ChainIDAlephium ChainID = 255 // ChainIDEthereumRopsten is the ChainID of Ethereum Ropsten ChainIDEthereumRopsten ChainID = 10001 SupportedVAAVersion = 0x01 )
func ChainIDFromString ¶
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 }
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 // The target chain of the VAA TargetChain 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 (*VAA) AddSignature ¶
func (v *VAA) AddSignature(key *ecdsa.PrivateKey, index uint8)
func (*VAA) MessageID ¶
MessageID returns a human-readable emitter_chain/emitter_address/target_chain/sequence tuple.
func (*VAA) SerializeBody ¶
func (*VAA) SigningMsg ¶
SigningMsg returns the hash of the signing body. This is used for signature generation and verification
type VAAID ¶
type VAAID struct { EmitterChain ChainID EmitterAddress Address TargetChain ChainID Sequence uint64 }
func VaaIDFromString ¶
VaaIDFromString parses a <emitter_chain>/<address>/<target_chain>/<sequence> string into a VAAID.