vaa

package
v0.0.0-...-a8a8cbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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)

Functions

func MustWrite

func MustWrite(w io.Writer, order binary.ByteOrder, data interface{})

MustWrite calls binary.Write and panics on errors

Types

type Action

type Action uint8

Action of a VAA

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 (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

func (Address) String

func (a Address) String() string

type BodyContractUpgrade

type BodyContractUpgrade struct {
	ChainID     ChainID
	NewContract Address
}

BodyContractUpgrade is a governance message to perform a contract upgrade of the core module

func (BodyContractUpgrade) Serialize

func (b BodyContractUpgrade) Serialize() []byte

type BodyGuardianSetUpdate

type BodyGuardianSetUpdate struct {
	Keys     []common.Address
	NewIndex uint32
}

BodyGuardianSetUpdate is a governance message to set a new guardian set

func (BodyGuardianSetUpdate) Serialize

func (b BodyGuardianSetUpdate) Serialize() []byte

type ChainID

type ChainID uint16

ChainID of a Wormhole chain

const (
	// 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

	SupportedVAAVersion = 0x01
)

func (ChainID) String

func (c ChainID) String() string

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 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 Unmarshal

func Unmarshal(data []byte) (*VAA, error)

Unmarshal deserializes the binary representation of a VAA

func (*VAA) AddSignature

func (v *VAA) AddSignature(key *ecdsa.PrivateKey, index uint8)

func (*VAA) Marshal

func (v *VAA) Marshal() ([]byte, error)

Marshal returns the binary representation of the VAA

func (*VAA) MessageID

func (v *VAA) MessageID() string

MessageID returns a human-readable emitter_chain/emitter_address/sequence tuple.

func (*VAA) SigningMsg

func (v *VAA) SigningMsg() (common.Hash, error)

SigningMsg returns the hash of the signing body. This is used for signature generation and verification

func (*VAA) VerifySignatures

func (v *VAA) VerifySignatures(addresses []common.Address) bool

VerifySignature verifies the signature of the VAA given the signer addresses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL