cosmwasm

package
v0.0.0-...-d3b4d27 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveBtcDelegation

type ActiveBtcDelegation struct {
	StakerAddr           string                      `json:"staker_addr"`
	BTCPkHex             string                      `json:"btc_pk_hex"`
	FpBtcPkList          []string                    `json:"fp_btc_pk_list"`
	StartHeight          uint32                      `json:"start_height"`
	EndHeight            uint32                      `json:"end_height"`
	TotalSat             uint64                      `json:"total_sat"`
	StakingTx            []byte                      `json:"staking_tx"`
	SlashingTx           []byte                      `json:"slashing_tx"`
	DelegatorSlashingSig []byte                      `json:"delegator_slashing_sig"`
	CovenantSigs         []CovenantAdaptorSignatures `json:"covenant_sigs"`
	StakingOutputIdx     uint32                      `json:"staking_output_idx"`
	UnbondingTime        uint32                      `json:"unbonding_time"`
	UndelegationInfo     BtcUndelegationInfo         `json:"undelegation_info"`
	ParamsVersion        uint32                      `json:"params_version"`
}

type BlockQuery

type BlockQuery struct {
	Height uint64 `json:"height"`
}

type BlocksQuery

type BlocksQuery struct {
	StartAfter *uint64 `json:"start_after,omitempty"`
	Limit      *uint64 `json:"limit,omitempty"`
	Finalized  *bool   `json:"finalised,omitempty"` //TODO: finalised or finalized, typo in smart contract
	Reverse    *bool   `json:"reverse,omitempty"`
}

type BlocksResponse

type BlocksResponse struct {
	Blocks []IndexedBlock `json:"blocks"`
}

type BtcStaking

type BtcStaking struct {
	NewFP       []NewFinalityProvider   `json:"new_fp"`
	ActiveDel   []ActiveBtcDelegation   `json:"active_del"`
	SlashedDel  []SlashedBtcDelegation  `json:"slashed_del"`
	UnbondedDel []UnbondedBtcDelegation `json:"unbonded_del"`
}

type BtcUndelegationInfo

type BtcUndelegationInfo struct {
	UnbondingTx              []byte                       `json:"unbonding_tx"`
	SlashingTx               []byte                       `json:"slashing_tx"`
	DelegatorSlashingSig     []byte                       `json:"delegator_slashing_sig"`
	CovenantSlashingSigs     []*CovenantAdaptorSignatures `json:"covenant_slashing_sigs"`
	CovenantUnbondingSigList []*SignatureInfo             `json:"covenant_unbonding_sig_list"`
	DelegatorUnbondingInfo   *DelegatorUnbondingInfo      `json:"delegator_unbonding_info"`
}

type CommitPublicRandomness

type CommitPublicRandomness struct {
	FPPubKeyHex string `json:"fp_pubkey_hex"`
	StartHeight uint64 `json:"start_height"`
	NumPubRand  uint64 `json:"num_pub_rand"`
	Commitment  []byte `json:"commitment"`
	Signature   []byte `json:"signature"`
}

type ConsumerDelegationsResponse

type ConsumerDelegationsResponse struct {
	Delegations []SingleConsumerDelegationResponse `json:"delegations"`
}

type ConsumerFpInfoResponse

type ConsumerFpInfoResponse struct {
	BtcPkHex string `json:"btc_pk_hex"`
	Power    uint64 `json:"power"`
}

type ConsumerFpsByPowerResponse

type ConsumerFpsByPowerResponse struct {
	Fps []ConsumerFpInfoResponse `json:"fps"`
}

type ConsumerFpsResponse

type ConsumerFpsResponse struct {
	Fps []SingleConsumerFpResponse `json:"fps"`
}

type CosmwasmConsumerController

type CosmwasmConsumerController struct {
	// contains filtered or unexported fields
}

func NewCosmwasmConsumerController

func NewCosmwasmConsumerController(
	cfg *cwconfig.CosmwasmConfig,
	encodingCfg wasmdparams.EncodingConfig,
	logger *zap.Logger,
) (*CosmwasmConsumerController, error)

func (*CosmwasmConsumerController) Close

func (cc *CosmwasmConsumerController) Close() error

func (*CosmwasmConsumerController) CommitPubRandList

func (cc *CosmwasmConsumerController) CommitPubRandList(
	fpPk *btcec.PublicKey,
	startHeight uint64,
	numPubRand uint64,
	commitment []byte,
	sig *schnorr.Signature,
) (*types.TxResponse, error)

CommitPubRandList commits a list of Schnorr public randomness to contract deployed on Consumer Chain it returns tx hash and error

func (*CosmwasmConsumerController) ExecuteFinalityContract

func (cc *CosmwasmConsumerController) ExecuteFinalityContract(msgBytes []byte) (*provider.RelayerTxResponse, error)

func (*CosmwasmConsumerController) ExecuteStakingContract

func (cc *CosmwasmConsumerController) ExecuteStakingContract(msgBytes []byte) (*provider.RelayerTxResponse, error)

func (*CosmwasmConsumerController) GetCometBlock

func (cc *CosmwasmConsumerController) GetCometBlock(height int64) (*coretypes.ResultBlock, error)

GetCometBlock gets the tendermint block at a given height NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) GetCometNodeStatus

func (cc *CosmwasmConsumerController) GetCometNodeStatus() (*coretypes.ResultStatus, error)

GetCometNodeStatus gets the tendermint node status of the consumer chain NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) GetLatestCodeId

func (cc *CosmwasmConsumerController) GetLatestCodeId() (uint64, error)

GetLatestCodeId returns the latest wasm code id. NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) IBCChannels

IBCChannels queries the IBC channels

func (*CosmwasmConsumerController) InstantiateContract

func (cc *CosmwasmConsumerController) InstantiateContract(codeID uint64, initMsg []byte) error

InstantiateContract instantiates a contract with the given code id and init msg NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) ListContractsByCode

ListContractsByCode lists all contracts by wasm code id NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) MustGetValidatorAddress

func (cc *CosmwasmConsumerController) MustGetValidatorAddress() string

MustGetValidatorAddress gets the validator address of the consumer chain NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) QueryActivatedHeight

func (cc *CosmwasmConsumerController) QueryActivatedHeight() (uint64, error)

func (*CosmwasmConsumerController) QueryBabylonContractBalances

func (cc *CosmwasmConsumerController) QueryBabylonContractBalances() (sdk.Coins, error)

func (*CosmwasmConsumerController) QueryBalance

func (cc *CosmwasmConsumerController) QueryBalance(address string, denom string) (*sdk.Coin, error)

func (*CosmwasmConsumerController) QueryBalances

func (cc *CosmwasmConsumerController) QueryBalances(address string) (sdk.Coins, error)

QueryBalances returns balances at the address

func (*CosmwasmConsumerController) QueryBlock

func (cc *CosmwasmConsumerController) QueryBlock(height uint64) (*types.BlockInfo, error)

func (*CosmwasmConsumerController) QueryBlocks

func (cc *CosmwasmConsumerController) QueryBlocks(startHeight, endHeight, limit uint64) ([]*types.BlockInfo, error)

func (*CosmwasmConsumerController) QueryChannelClientState

func (cc *CosmwasmConsumerController) QueryChannelClientState(channelID, portID string) (*channeltypes.QueryChannelClientStateResponse, error)

func (*CosmwasmConsumerController) QueryDelegations

func (*CosmwasmConsumerController) QueryFinalityContractBalances

func (cc *CosmwasmConsumerController) QueryFinalityContractBalances() (sdk.Coins, error)

func (*CosmwasmConsumerController) QueryFinalityProvider

func (cc *CosmwasmConsumerController) QueryFinalityProvider(btcPkHex string) (*SingleConsumerFpResponse, error)

func (*CosmwasmConsumerController) QueryFinalityProviderHasPower

func (cc *CosmwasmConsumerController) QueryFinalityProviderHasPower(
	fpPk *btcec.PublicKey,
	blockHeight uint64,
) (bool, error)

QueryFinalityProviderHasPower queries whether the finality provider has voting power at a given height

func (*CosmwasmConsumerController) QueryFinalityProviderInfo

func (cc *CosmwasmConsumerController) QueryFinalityProviderInfo(
	fpPk *btcec.PublicKey,
	opts ...uint64,
) (*ConsumerFpInfoResponse, error)

func (*CosmwasmConsumerController) QueryFinalityProviders

func (cc *CosmwasmConsumerController) QueryFinalityProviders() (*ConsumerFpsResponse, error)

func (*CosmwasmConsumerController) QueryFinalityProvidersByPower

func (cc *CosmwasmConsumerController) QueryFinalityProvidersByPower() (*ConsumerFpsByPowerResponse, error)

func (*CosmwasmConsumerController) QueryFinalitySignature

func (cc *CosmwasmConsumerController) QueryFinalitySignature(fpBtcPkHex string, height uint64) (*FinalitySignatureResponse, error)

func (*CosmwasmConsumerController) QueryIndexedBlock

func (cc *CosmwasmConsumerController) QueryIndexedBlock(height uint64) (*IndexedBlock, error)

QueryIndexedBlock queries the indexed block at a given height NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) QueryIsBlockFinalized

func (cc *CosmwasmConsumerController) QueryIsBlockFinalized(height uint64) (bool, error)

func (*CosmwasmConsumerController) QueryLastPublicRandCommit

func (cc *CosmwasmConsumerController) QueryLastPublicRandCommit(fpPk *btcec.PublicKey) (*types.PubRandCommit, error)

QueryLastPublicRandCommit returns the last public randomness commitments

func (*CosmwasmConsumerController) QueryLatestBlockHeight

func (cc *CosmwasmConsumerController) QueryLatestBlockHeight() (uint64, error)

func (*CosmwasmConsumerController) QueryLatestFinalizedBlock

func (cc *CosmwasmConsumerController) QueryLatestFinalizedBlock() (*types.BlockInfo, error)

func (*CosmwasmConsumerController) QueryNextSequenceReceive

func (cc *CosmwasmConsumerController) QueryNextSequenceReceive(channelID, portID string) (*channeltypes.QueryNextSequenceReceiveResponse, error)

func (*CosmwasmConsumerController) QueryNodeStatus

func (cc *CosmwasmConsumerController) QueryNodeStatus() (*coretypes.ResultStatus, error)

func (*CosmwasmConsumerController) QuerySmartContractState

func (cc *CosmwasmConsumerController) QuerySmartContractState(contractAddress string, queryData string) (*wasmdtypes.QuerySmartContractStateResponse, error)

QuerySmartContractState queries the smart contract state NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) QueryStakingContractBalances

func (cc *CosmwasmConsumerController) QueryStakingContractBalances() (sdk.Coins, error)

func (*CosmwasmConsumerController) SetBtcFinalityContractAddress

func (cc *CosmwasmConsumerController) SetBtcFinalityContractAddress(newAddress string)

SetBtcFinalityContractAddress updates the BtcFinalityContractAddress in the configuration NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) SetBtcStakingContractAddress

func (cc *CosmwasmConsumerController) SetBtcStakingContractAddress(newAddress string)

SetBtcStakingContractAddress updates the BtcStakingContractAddress in the configuration NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) StoreWasmCode

func (cc *CosmwasmConsumerController) StoreWasmCode(wasmFile string) error

StoreWasmCode stores the wasm code on the consumer chain NOTE: this function is only meant to be used in tests.

func (*CosmwasmConsumerController) SubmitBatchFinalitySigs

func (cc *CosmwasmConsumerController) SubmitBatchFinalitySigs(
	fpPk *btcec.PublicKey,
	blocks []*types.BlockInfo,
	pubRandList []*btcec.FieldVal,
	proofList [][]byte,
	sigs []*btcec.ModNScalar,
) (*types.TxResponse, error)

SubmitBatchFinalitySigs submits a batch of finality signatures to Babylon

func (*CosmwasmConsumerController) SubmitFinalitySig

func (cc *CosmwasmConsumerController) SubmitFinalitySig(
	fpSK *btcec.PrivateKey,
	fpBtcPk *btcec.PublicKey,
	privateRand *eots.PrivateRand,
	pubRand *bbntypes.SchnorrPubRand,
	proof *cmtcrypto.Proof,
	heightToVote uint64,
) (*types.TxResponse, error)

func (*CosmwasmConsumerController) SubmitInvalidFinalitySig

func (cc *CosmwasmConsumerController) SubmitInvalidFinalitySig(
	r *rand.Rand,
	fpSK *btcec.PrivateKey,
	fpBtcPk *btcec.PublicKey,
	privateRand *eots.PrivateRand,
	pubRand *bbntypes.SchnorrPubRand,
	proof *cmtcrypto.Proof,
	heightToVote int64,
) (*types.TxResponse, error)

type CovenantAdaptorSignatures

type CovenantAdaptorSignatures struct {
	CovPK       []byte   `json:"cov_pk"`
	AdaptorSigs [][]byte `json:"adaptor_sigs"`
}

type DelegatorUnbondingInfo

type DelegatorUnbondingInfo struct {
	SpendStakeTx []byte `json:"spend_stake_tx"`
}

type ExecMsg

type ExecMsg struct {
	SubmitFinalitySignature *SubmitFinalitySignature `json:"submit_finality_signature,omitempty"`
	BtcStaking              *BtcStaking              `json:"btc_staking,omitempty"`
	CommitPublicRandomness  *CommitPublicRandomness  `json:"commit_public_randomness,omitempty"`
}

type FinalityProviderDescription

type FinalityProviderDescription struct {
	Moniker         string `json:"moniker"`
	Identity        string `json:"identity"`
	Website         string `json:"website"`
	SecurityContact string `json:"security_contact"`
	Details         string `json:"details"`
}

type FinalityProviderInfo

type FinalityProviderInfo struct {
	BtcPkHex string `json:"btc_pk_hex"`
	Height   uint64 `json:"height,omitempty"`
}

type FinalityProviderQuery

type FinalityProviderQuery struct {
	BtcPkHex string `json:"btc_pk_hex"`
}

type FinalitySignatureQuery

type FinalitySignatureQuery struct {
	BtcPkHex string `json:"btc_pk_hex"`
	Height   uint64 `json:"height"`
}

type FinalitySignatureResponse

type FinalitySignatureResponse struct {
	Signature []byte `json:"signature"`
}

type IndexedBlock

type IndexedBlock struct {
	Height    uint64 `json:"height"`
	AppHash   []byte `json:"app_hash"`
	Finalized bool   `json:"finalized"`
}

type LastPubRandCommitQuery

type LastPubRandCommitQuery struct {
	BtcPkHex string `json:"btc_pk_hex"`
}

type NewFinalityProvider

type NewFinalityProvider struct {
	Description *FinalityProviderDescription `json:"description,omitempty"`
	Commission  string                       `json:"commission"`
	Addr        string                       `json:"addr"`
	BTCPKHex    string                       `json:"btc_pk_hex"`
	Pop         *ProofOfPossessionBtc        `json:"pop,omitempty"`
	ConsumerID  string                       `json:"consumer_id"`
}

type Proof

type Proof struct {
	Total    int64    `json:"total"`
	Index    int64    `json:"index"`
	LeafHash []byte   `json:"leaf_hash"`
	Aunts    [][]byte `json:"aunts"`
}

type ProofOfPossessionBtc

type ProofOfPossessionBtc struct {
	BTCSigType int32  `json:"btc_sig_type"`
	BTCSig     []byte `json:"btc_sig"`
}

type QueryMsgActivatedHeight

type QueryMsgActivatedHeight struct {
	ActivatedHeight struct{} `json:"activated_height"`
}

type QueryMsgBlock

type QueryMsgBlock struct {
	Block BlockQuery `json:"block"`
}

type QueryMsgBlocks

type QueryMsgBlocks struct {
	Blocks BlocksQuery `json:"blocks"`
}

type QueryMsgDelegations

type QueryMsgDelegations struct {
	Delegations struct{} `json:"delegations"`
}

type QueryMsgFinalityProvider

type QueryMsgFinalityProvider struct {
	FinalityProvider FinalityProviderQuery `json:"finality_provider"`
}

type QueryMsgFinalityProviderInfo

type QueryMsgFinalityProviderInfo struct {
	FinalityProviderInfo FinalityProviderInfo `json:"finality_provider_info"`
}

type QueryMsgFinalityProviders

type QueryMsgFinalityProviders struct {
	FinalityProviders struct{} `json:"finality_providers"`
}

type QueryMsgFinalityProvidersByPower

type QueryMsgFinalityProvidersByPower struct {
	FinalityProvidersByPower struct{} `json:"finality_providers_by_power"`
}

type QueryMsgFinalitySignature

type QueryMsgFinalitySignature struct {
	FinalitySignature FinalitySignatureQuery `json:"finality_signature"`
}

type QueryMsgLastPubRandCommit

type QueryMsgLastPubRandCommit struct {
	LastPubRandCommit LastPubRandCommitQuery `json:"last_pub_rand_commit"`
}

type SignatureInfo

type SignatureInfo struct {
	PK  []byte `json:"pk"`
	Sig []byte `json:"sig"`
}

type SingleConsumerDelegationResponse

type SingleConsumerDelegationResponse struct {
	BtcPkHex             string                      `json:"btc_pk_hex"`
	FpBtcPkList          []string                    `json:"fp_btc_pk_list"`
	StartHeight          uint32                      `json:"start_height"`
	EndHeight            uint32                      `json:"end_height"`
	TotalSat             uint64                      `json:"total_sat"`
	StakingTx            []byte                      `json:"staking_tx"`
	SlashingTx           []byte                      `json:"slashing_tx"`
	DelegatorSlashingSig []byte                      `json:"delegator_slashing_sig"`
	CovenantSigs         []CovenantAdaptorSignatures `json:"covenant_sigs"`
	StakingOutputIdx     uint32                      `json:"staking_output_idx"`
	UnbondingTime        uint32                      `json:"unbonding_time"`
	UndelegationInfo     *BtcUndelegationInfo        `json:"undelegation_info"`
	ParamsVersion        uint32                      `json:"params_version"`
}

type SingleConsumerFpResponse

type SingleConsumerFpResponse struct {
	BtcPkHex         string `json:"btc_pk_hex"`
	SlashedHeight    uint64 `json:"slashed_height"`
	SlashedBtcHeight uint32 `json:"slashed_btc_height"`
	ConsumerId       string `json:"consumer_id"`
}

SingleConsumerFpResponse represents the finality provider data returned by the contract query. For more details, refer to the following links: https://github.com/babylonchain/babylon-contract/blob/v0.5.3/packages/apis/src/btc_staking_api.rs https://github.com/babylonchain/babylon-contract/blob/v0.5.3/contracts/btc-staking/src/msg.rs https://github.com/babylonchain/babylon-contract/blob/v0.5.3/contracts/btc-staking/schema/btc-staking.json

type SlashedBtcDelegation

type SlashedBtcDelegation struct {
}

type SubmitFinalitySignature

type SubmitFinalitySignature struct {
	FpPubkeyHex string `json:"fp_pubkey_hex"`
	Height      uint64 `json:"height"`
	PubRand     []byte `json:"pub_rand"`
	Proof       Proof  `json:"proof"` // nested struct
	BlockHash   []byte `json:"block_hash"`
	Signature   []byte `json:"signature"`
}

type UnbondedBtcDelegation

type UnbondedBtcDelegation struct {
}

Jump to

Keyboard shortcuts

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