Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToHash(b []byte) (common.Hash, error)
- func CalculateQuorum(numPhylaxs 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
- func IsTransfer(payload []byte) bool
- func LeftPadBytes(payload string, length int) *bytes.Buffer
- func LeftPadIbcChannelId(channelId string) [64]byte
- 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 BatchVAA
- func (v *BatchVAA) AddSignature(key *ecdsa.PrivateKey, index uint8)
- func (v *BatchVAA) BatchID() string
- func (v *BatchVAA) GetEmitterChain() ChainID
- func (v *BatchVAA) GetTransactionID() common.Hash
- func (b *BatchVAA) HexDigest() string
- func (v *BatchVAA) Marshal() ([]byte, error)
- func (b BatchVAA) MarshalBinary() ([]byte, error)
- func (v *BatchVAA) ObsvHashArray() []common.Hash
- func (v *BatchVAA) SigningDigest() common.Hash
- func (b *BatchVAA) UniqueID() string
- func (b *BatchVAA) UnmarshalBinary(data []byte) error
- func (v *BatchVAA) VerifySignatures(addresses []common.Address) bool
- type BodyAccountantModifyBalance
- type BodyCircleIntegrationRegisterEmitterAndDomain
- type BodyCircleIntegrationUpdateDeltaswapFinality
- type BodyCircleIntegrationUpgradeContractImplementation
- type BodyContractUpgrade
- type BodyDeltachainInstantiateContract
- type BodyDeltachainMigrateContract
- type BodyDeltachainStoreCode
- type BodyDeltachainWasmAllowlistInstantiate
- type BodyDeltaswapRelayerSetDefaultDeliveryProvider
- type BodyGatewayIbcComposabilityMwContract
- type BodyGatewayScheduleUpgrade
- type BodyIbcUpdateChannelChain
- type BodyPhylaxSetUpdate
- type BodySetMessageFee
- type BodyTokenBridgeRegisterChain
- type BodyTokenBridgeUpgradeContract
- type BodyTransferFees
- 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) )
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 DeltaswapRelayerModule = [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,
}
DeltaswapRelayerModule is the identifier of the Deltaswap Relayer module (which is used for governance messages). It is the hex representation of "DeltaswapRelayer" left padded with zeroes.
var DeltaswapRelayerModuleStr = string(DeltaswapRelayerModule[:])
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 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 Deltachain 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 Deltachain 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 Deltachain Wasmd module (which is used for governance messages)
var WasmdModuleStr = string(WasmdModule[:])
Functions ¶
func CalculateQuorum ¶
CalculateQuorum returns the minimum number of phylaxs that need to sign a VAA for a given phylax set.
The canonical source is the calculation in the contracts (solana/bridge/src/processor.rs and ethereum/contracts/Deltaswap.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
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 Deltaswap 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 BatchVAA ¶
type BatchVAA struct { // Version of the VAA schema Version uint8 // PhylaxSetIndex is the index of the phylax set that signed this VAA PhylaxSetIndex uint32 // SignatureData is the signature of the phylax set Signatures []*Signature // EmitterChain the VAAs were emitted on EmitterChain ChainID // The chain-native identifier of the transaction that created the batch VAA. TransactionID common.Hash // array of Observation VAA hashes Hashes []common.Hash // Observations in the batch Observations []*Observation }
func UnmarshalBatch ¶
UnmarshalBatch deserializes the binary representation of a BatchVAA
func (*BatchVAA) AddSignature ¶
func (v *BatchVAA) AddSignature(key *ecdsa.PrivateKey, index uint8)
creates signature of BatchVAA.Hashes and adds it to BatchVAA.Signatures.
func (*BatchVAA) GetEmitterChain ¶
GetEmitterChain implements the processor.Batch interface for *BatchVAA.
func (*BatchVAA) GetTransactionID ¶
GetTransactionID implements the processor.Batch interface for *BatchVAA.
func (BatchVAA) MarshalBinary ¶
implement encoding.BinaryMarshaler interface for BatchVAA struct
func (*BatchVAA) ObsvHashArray ¶
ObsvHashArray creates an array of hashes of Observation. hashes in the array have the index position of their Observation.Index.
func (*BatchVAA) SigningDigest ¶
BatchSigningDigest returns the hash of the batch vaa hash to be signed directly. This is used for signature generation and verification
func (*BatchVAA) UnmarshalBinary ¶
implement encoding.BinaryUnmarshaler interface for BatchVAA struct
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
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
type BodyCircleIntegrationUpdateDeltaswapFinality ¶
BodyCircleIntegrationUpdateDeltaswapFinality is a governance message to update the deltaswap finality for Circle Integration.
func (BodyCircleIntegrationUpdateDeltaswapFinality) Serialize ¶
func (r BodyCircleIntegrationUpdateDeltaswapFinality) Serialize() []byte
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
type BodyContractUpgrade ¶
BodyContractUpgrade is a governance message to perform a contract upgrade of the core module
func (BodyContractUpgrade) Serialize ¶
func (b BodyContractUpgrade) Serialize() []byte
type BodyDeltachainInstantiateContract ¶
type BodyDeltachainInstantiateContract struct {
InstantiationParamsHash [32]byte
}
BodyDeltachainInstantiateContract is a governance message to instantiate a cosmwasm contract on deltachain
func (BodyDeltachainInstantiateContract) Serialize ¶
func (r BodyDeltachainInstantiateContract) Serialize() []byte
type BodyDeltachainMigrateContract ¶
type BodyDeltachainMigrateContract struct {
MigrationParamsHash [32]byte
}
BodyDeltachainInstantiateContract is a governance message to migrate a cosmwasm contract on deltachain
func (BodyDeltachainMigrateContract) Serialize ¶
func (r BodyDeltachainMigrateContract) Serialize() []byte
type BodyDeltachainStoreCode ¶
type BodyDeltachainStoreCode struct {
WasmHash [32]byte
}
BodyDeltachainStoreCode is a governance message to upload a new cosmwasm contract to deltachain
func (BodyDeltachainStoreCode) Serialize ¶
func (r BodyDeltachainStoreCode) Serialize() []byte
type BodyDeltachainWasmAllowlistInstantiate ¶
BodyDeltachainAllowlistInstantiateContract is a governance message to allowlist a specific contract address to instantiate a specific wasm code id.
func (*BodyDeltachainWasmAllowlistInstantiate) Deserialize ¶
func (r *BodyDeltachainWasmAllowlistInstantiate) Deserialize(bz []byte)
func (BodyDeltachainWasmAllowlistInstantiate) Serialize ¶
func (r BodyDeltachainWasmAllowlistInstantiate) Serialize(action GovernanceAction) []byte
type BodyDeltaswapRelayerSetDefaultDeliveryProvider ¶
type BodyDeltaswapRelayerSetDefaultDeliveryProvider struct { ChainID ChainID NewDefaultDeliveryProviderAddress Address }
BodyDeltaswapRelayerSetDefaultDeliveryProvider is a governance message to set the default relay provider for the Deltaswap Relayer.
func (BodyDeltaswapRelayerSetDefaultDeliveryProvider) Serialize ¶
func (r BodyDeltaswapRelayerSetDefaultDeliveryProvider) Serialize() []byte
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)
func (BodyGatewayIbcComposabilityMwContract) Serialize ¶
func (r BodyGatewayIbcComposabilityMwContract) Serialize() []byte
type BodyGatewayScheduleUpgrade ¶
BodyGatewayScheduleUpgrade is a governance message to schedule an upgrade on Gateway
func (*BodyGatewayScheduleUpgrade) Deserialize ¶
func (r *BodyGatewayScheduleUpgrade) Deserialize(bz []byte)
func (BodyGatewayScheduleUpgrade) Serialize ¶
func (r BodyGatewayScheduleUpgrade) Serialize() []byte
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
func (BodyIbcUpdateChannelChain) Serialize ¶
func (r BodyIbcUpdateChannelChain) Serialize(module string) []byte
type BodyPhylaxSetUpdate ¶
BodyPhylaxSetUpdate is a governance message to set a new phylax set
func (BodyPhylaxSetUpdate) Serialize ¶
func (b BodyPhylaxSetUpdate) Serialize() []byte
type BodySetMessageFee ¶
func (BodySetMessageFee) Serialize ¶
func (b BodySetMessageFee) 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 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
type BodyTransferFees ¶
func (BodyTransferFees) Serialize ¶
func (b BodyTransferFees) Serialize() []byte
type ChainID ¶
type ChainID uint16
ChainID of a Deltaswap 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 // ChainIDNeon is the ChainID of Neon ChainIDNeon ChainID = 17 // ChainIDTerra2 is the ChainID of Terra 2 ChainIDTerra2 ChainID = 18 // ChainIDInjective is the ChainID of Injective ChainIDInjective ChainID = 19 // 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 // 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 //ChainIDDeltachain is the ChainID of Deltachain ChainIDSei ChainID = 32 ChainIDScroll ChainID = 34 ChainIDTron ChainID = 100 ChainIDPlanq ChainID = 7070 ChainIDDeltachain ChainID = 7077 // ChainIDSepolia is the ChainID of Sepolia ChainIDSepolia ChainID = 10002 SupportedVAAVersion = 0x01 BatchVAAVersion = 0x02 )
func ChainIDFromString ¶
func GetAllNetworkIDs ¶
func GetAllNetworkIDs() []ChainID
type GovernanceAction ¶
type GovernanceAction uint8
var ( // Deltaswap core governance actions // See e.g. GovernanceStructs.sol for semantic meaning of these ActionContractUpgrade GovernanceAction = 1 ActionPhylaxSetUpdate GovernanceAction = 2 ActionCoreSetMessageFee GovernanceAction = 3 ActionCoreTransferFees GovernanceAction = 4 ActionCoreRecoverChainId GovernanceAction = 5 // Deltachain 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 goverance actions ActionModifyBalance GovernanceAction = 1 // Deltaswap tokenbridge governance actions ActionRegisterChain GovernanceAction = 1 ActionUpgradeTokenBridge GovernanceAction = 2 ActionTokenBridgeRecoverChainId GovernanceAction = 3 // Circle Integration governance actions CircleIntegrationActionUpdateDeltaswapFinality GovernanceAction = 1 CircleIntegrationActionRegisterEmitterAndDomain GovernanceAction = 2 CircleIntegrationActionUpgradeContractImplementation GovernanceAction = 3 // Ibc Receiver governance actions IbcReceiverActionUpdateChannelChain GovernanceAction = 1 // Ibc Translator governance actions IbcTranslatorActionUpdateChannelChain GovernanceAction = 1 // Deltaswap relayer governance actions DeltaswapRelayerSetDefaultDeliveryProvider GovernanceAction = 3 )
type Observation ¶
type Signature ¶
type Signature struct { // Index of the validator Index uint8 // Signature data Signature SignatureData }
Signature of a single phylax
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 // PhylaxSetIndex is the index of the phylax set that signed this VAA PhylaxSetIndex uint32 // SignatureData is the signature of the phylax 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 Deltaswap 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 (BatchVAA), 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 phylax keys as input and attempts certain checks with respect to this phylax. 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 phylax set keys is passed in. The complete phylax set must be passed in. Verify does the following checks: - If the phylax does not have or know its own phylax set keys, then the VAA cannot be verified. - Quorum is calculated on the phylax set passed in and checks if the VAA has enough signatures. - The signatures in the VAA is verified against the phylax set keys.