Documentation ¶
Overview ¶
Please put all the test related function to here
Index ¶
- Constants
- Variables
- func GetCurrentVersion() semver.Version
- func GetLiquidityPools(version semver.Version) common.Assets
- func GetRandomAZTECAddress() common.Address
- func GetRandomBCHAddress() common.Address
- func GetRandomBNBAddress() common.Address
- func GetRandomBTCAddress() common.Address
- func GetRandomBaseAddress() common.Address
- func GetRandomBech32Addr() cosmos.AccAddress
- func GetRandomBech32ConsensusPubKey() string
- func GetRandomDASHAddress() common.Address
- func GetRandomDOGEAddress() common.Address
- func GetRandomETHAddress() common.Address
- func GetRandomGAIAAddress() common.Address
- func GetRandomLTCAddress() common.Address
- func GetRandomPubKey() common.PubKey
- func GetRandomPubKeySet() common.PubKeySet
- func GetRandomTx() common.Tx
- func GetRandomTxHash() common.TxID
- func GetThreshold(value int) (int, error)
- func HasMinority(signers, total int) bool
- func HasSimpleMajority(signers, total int) bool
- func HasSuperMajority(signers, total int) bool
- func MakeTestCodec() *codec.LegacyAmino
- func RegisterCodec(cdc *codec.LegacyAmino)
- func RegisterInterfaces(registry cdctypes.InterfaceRegistry)
- func SetupConfigForTest()
- type LiquidityAuctionTiers
- type LiquidityProviders
- type NodeAccounts
- func (nas NodeAccounts) Contains(na NodeAccount) bool
- func (nas NodeAccounts) GetNodeAddresses() []cosmos.AccAddress
- func (nas NodeAccounts) IsEmpty() bool
- func (nas NodeAccounts) IsNodeKeys(addr cosmos.AccAddress) bool
- func (nas NodeAccounts) Len() int
- func (nas NodeAccounts) Less(i, j int) bool
- func (nas NodeAccounts) Swap(i, j int)
- type ObservedTxVoters
- type ObservedTxs
- type PoolMods
- type Pools
- type QueryChainAddress
- type QueryChainHeight
- type QueryKeygenBlock
- type QueryKeysign
- type QueryNodeAccount
- type QueryNodeAccountPreflightCheck
- type QueryQueue
- type QueryResLastBlockHeights
- type QueryTxOutItem
- type QueryVaultPubKeyContract
- type QueryVaultResp
- type QueryVaultsPubKeys
- type QueryVersion
- type QueryYggdrasilVaults
- type ReserveContributors
- type Vaults
- func (vs Vaults) Has(target common.Coin) Vaults
- func (vs Vaults) HasAddress(chain common.Chain, address common.Address) (bool, error)
- func (vs Vaults) SelectByMaxCoin(asset common.Asset) (vault Vault)
- func (vs Vaults) SelectByMinCoin(asset common.Asset) (vault Vault)
- func (vs Vaults) SortBy(sortBy common.Asset) Vaults
Constants ¶
const ( // ModuleName name of BASEChain module ModuleName = "mayachain" // DefaultCodespace is the same as ModuleName DefaultCodespace = ModuleName // ReserveName the module account name to keep reserve ReserveName = "reserve" // AsgardName the module account name to keep asgard fund AsgardName = "asgard" // BondName the name of account used to store bond BondName = "bond" // MayaFund the module account name to keep the maya fund MayaFund = "maya_fund" // StoreKey to be used when creating the KVStore StoreKey = ModuleName // RouterKey used in the RPC query RouterKey = ModuleName // this was defined in your key.go file )
const ( AddLiquidityEventType = "add_liquidity" BondEventType = "bond" DonateEventType = "donate" ErrataEventType = "errata" FeeEventType = "fee" GasEventType = "gas" OutboundEventType = "outbound" PendingLiquidity = "pending_liquidity" PoolBalanceChangeEventType = "pool_balance_change" PoolEventType = "pool" RefundEventType = "refund" ReserveEventType = "reserve" RewardEventType = "rewards" ScheduledOutboundEventType = "scheduled_outbound" SecurityEventType = "security" SetMimirEventType = "set_mimir" SetNodeMimirEventType = "set_node_mimir" SlashEventType = "slash" SlashLiquidityEventType = "slash_liquidity" SlashPointEventType = "slash_points" SwapEventType = "swap" SwitchEventType = "switch" MAYANameEventType = "mayaname" TSSKeygenMetricEventType = "tss_keygen" TSSKeysignMetricEventType = "tss_keysign" WithdrawEventType = "withdraw" )
all event types support by BASEChain
const ( // SuperMajorityFactor - super majority 2/3 SuperMajorityFactor = 3 // SimpleMajorityFactor - simple majority 1/2 SimpleMajorityFactor = 2 )
const DefaultIndex uint64 = 1
DefaultIndex is the default capability global index
const MaxAffiliateFeeBasisPoints = 1_000
MaxAffiliateFeeBasisPoints basis points for withdrawals
const MaxWithdrawBasisPoints = 10_000
MaxWithdrawBasisPoints basis points for withdrawals
Variables ¶
var (
ModuleCdc = codec.NewAminoCodec(amino)
)
Functions ¶
func GetCurrentVersion ¶
GetCurrentVersion - intended for unit tests, fetches the current version of THORNode via `version` file #nosec G304 this is a method only used for test purpose
func GetRandomAZTECAddress ¶
GetRandomAZTECAddress will just create a random aztec address used for test purpose
func GetRandomBCHAddress ¶
func GetRandomBNBAddress ¶
GetRandomBNBAddress will just create a random bnb address used for test purpose
func GetRandomBTCAddress ¶
func GetRandomBaseAddress ¶
GetRandomBaseAddress will just create a random base address used for test purpose
func GetRandomBech32Addr ¶
func GetRandomBech32Addr() cosmos.AccAddress
GetRandomBech32Addr is an account address used for test
func GetRandomBech32ConsensusPubKey ¶
func GetRandomBech32ConsensusPubKey() string
func GetRandomDASHAddress ¶
func GetRandomDOGEAddress ¶
func GetRandomETHAddress ¶
GetRandomETHAddress get a random ETH address for test purpose
func GetRandomGAIAAddress ¶
GetRandomGAIAAddress will just create a random terra address used for test purpose
func GetRandomLTCAddress ¶
func GetRandomPubKey ¶
func GetRandomPubKeySet ¶
GetRandomPubKeySet return a random common.PubKeySet for test purpose
func GetRandomTxHash ¶
GetRandomTxHash create a random txHash used for test purpose
func HasMinority ¶
HasMinority return true when it has more than 1/3
func HasSimpleMajority ¶
HasSimpleMajority return true when it has more than 1/2 this method replace HasSimpleMajority, which is not correct
func HasSuperMajority ¶
HasSuperMajority return true when it has 2/3 majority
func MakeTestCodec ¶
func MakeTestCodec() *codec.LegacyAmino
nolint: deadcode unused create a codec used only for testing
func RegisterCodec ¶
func RegisterCodec(cdc *codec.LegacyAmino)
RegisterCodec register the msg types for amino
func RegisterInterfaces ¶
func RegisterInterfaces(registry cdctypes.InterfaceRegistry)
RegisterInterfaces register the types
Types ¶
type LiquidityAuctionTiers ¶
type LiquidityAuctionTiers []LiquidityAuctionTier
LiquidityAuctionTiers a list of liquidity providers
type LiquidityProviders ¶
type LiquidityProviders []LiquidityProvider
LiquidityProviders a list of liquidity providers
func (LiquidityProviders) SetNodeAccount
deprecated
func (lps LiquidityProviders) SetNodeAccount(na cosmos.AccAddress)
Deprecated: do not use
type NodeAccounts ¶
type NodeAccounts []NodeAccount
NodeAccounts just a list of NodeAccount
func (NodeAccounts) Contains ¶
func (nas NodeAccounts) Contains(na NodeAccount) bool
Contains will check whether the given node account is in the list
func (NodeAccounts) GetNodeAddresses ¶
func (nas NodeAccounts) GetNodeAddresses() []cosmos.AccAddress
func (NodeAccounts) IsEmpty ¶
func (nas NodeAccounts) IsEmpty() bool
IsEmpty to check whether the NodeAccounts is empty
func (NodeAccounts) IsNodeKeys ¶
func (nas NodeAccounts) IsNodeKeys(addr cosmos.AccAddress) bool
IsNodeKeys validate whether the given account address belongs to an currently active validator
func (NodeAccounts) Less ¶
func (nas NodeAccounts) Less(i, j int) bool
Less sort interface , it will sort by StatusSince field, and then by SignerBNBAddress
type ObservedTxVoters ¶
type ObservedTxVoters []ObservedTxVoter
ObservedTxVoters a list of observed tx voter
type ObservedTxs ¶
type ObservedTxs []ObservedTx
ObservedTxs a list of ObservedTx
func (ObservedTxs) Contains ¶
func (txs ObservedTxs) Contains(tx ObservedTx) bool
type QueryChainAddress ¶
type QueryChainHeight ¶
QueryChainHeight chain height
type QueryKeygenBlock ¶
type QueryKeygenBlock struct { KeygenBlock KeygenBlock `json:"keygen_block"` Signature string `json:"signature"` }
QueryKeygenBlock query keygen, displays signed keygen requests
func (QueryKeygenBlock) String ¶
func (n QueryKeygenBlock) String() string
String implement fmt.Stringer
type QueryKeysign ¶
type QueryKeysign struct { Keysign TxOut `json:"keysign"` Signature string `json:"signature"` }
QueryKeysign query keysign result
type QueryNodeAccount ¶
type QueryNodeAccount struct { NodeAddress cosmos.AccAddress `json:"node_address"` Status NodeStatus `json:"status"` PubKeySet common.PubKeySet `json:"pub_key_set"` AztecAddress common.Address `json:"aztec_address"` ValidatorConsPubKey string `json:"validator_cons_pub_key"` Bond cosmos.Uint `json:"bond"` Reward cosmos.Uint `json:"reward"` ActiveBlockHeight int64 `json:"active_block_height"` BondAddress common.Address `json:"bond_address"` StatusSince int64 `json:"status_since"` SignerMembership common.PubKeys `json:"signer_membership"` RequestedToLeave bool `json:"requested_to_leave"` ForcedToLeave bool `json:"forced_to_leave"` LeaveScore uint64 `json:"leave_height"` IPAddress string `json:"ip_address"` Version semver.Version `json:"version"` SlashPoints int64 `json:"slash_points"` Jail Jail `json:"jail"` ObserveChains []QueryChainHeight `json:"observe_chains"` PreflightStatus QueryNodeAccountPreflightCheck `json:"preflight_status"` BondProviders BondProviders `json:"bond_providers"` }
QueryNodeAccount hold all the information related to node account
func NewQueryNodeAccount ¶
func NewQueryNodeAccount(na NodeAccount, naBond cosmos.Uint) QueryNodeAccount
NewQueryNodeAccount create a new QueryNodeAccount based on the given node account parameter
type QueryNodeAccountPreflightCheck ¶
type QueryNodeAccountPreflightCheck struct { Status NodeStatus `json:"status"` Description string `json:"reason"` Code int `json:"code"` }
QueryNodeAccountPreflightCheck is structure to hold all the information need to return to client include current node status , and whether it might get churned in next
func (QueryNodeAccountPreflightCheck) String ¶
func (n QueryNodeAccountPreflightCheck) String() string
String implement fmt.Stringer
type QueryQueue ¶
type QueryQueue struct { Swap int64 `json:"swap"` Outbound int64 `json:"outbound"` Internal int64 `json:"internal"` ScheduledOutboundValue cosmos.Uint `json:"scheduled_outbound_value"` }
QueryQueue a struct store the total outstanding out items
type QueryResLastBlockHeights ¶
type QueryResLastBlockHeights struct { Chain common.Chain `json:"chain"` LastChainHeight int64 `json:"last_observed_in"` LastSignedHeight int64 `json:"last_signed_out"` Mayachain int64 `json:"mayachain"` }
QueryResLastBlockHeights used to return the block height query
func (QueryResLastBlockHeights) String ¶
func (h QueryResLastBlockHeights) String() string
String implement fmt.Stringer return a string representation of QueryResLastBlockHeights
type QueryTxOutItem ¶
type QueryTxOutItem struct { Chain common.Chain `json:"chain"` ToAddress common.Address `json:"to_address"` VaultPubKey common.PubKey `json:"vault_pub_key,omitempty"` Coin common.Coin `json:"coin"` Memo string `json:"memo,omitempty"` MaxGas common.Gas `json:"max_gas"` GasRate int64 `json:"gas_rate,omitempty"` InHash common.TxID `json:"in_hash,omitempty"` OutHash common.TxID `json:"out_hash,omitempty"` Height int64 `json:"height"` }
func NewQueryTxOutItem ¶
func NewQueryTxOutItem(toi TxOutItem, height int64) QueryTxOutItem
NewQueryTxOutItem create a new QueryTxOutItem based on the given txout item parameter
type QueryVaultPubKeyContract ¶
type QueryVaultPubKeyContract struct { PubKey common.PubKey `json:"pub_key"` Routers []ChainContract `json:"routers"` }
QueryVaultPubKeyContract is a type to combine PubKey and it's related contract
type QueryVaultResp ¶
type QueryVaultResp struct { BlockHeight int64 `json:"block_height,omitempty"` PubKey gitlab_com_thorchain_thornode_common.PubKey `json:"pub_key,omitempty"` Coins gitlab_com_thorchain_thornode_common.Coins `json:"coins"` Type VaultType `json:"type,omitempty"` Status VaultStatus `json:"status,omitempty"` StatusSince int64 `json:"status_since,omitempty"` Membership []string `json:"membership,omitempty"` Chains []string `json:"chains,omitempty"` InboundTxCount int64 `json:"inbound_tx_count,omitempty"` OutboundTxCount int64 `json:"outbound_tx_count,omitempty"` PendingTxBlockHeights []int64 `json:"pending_tx_block_heights,omitempty"` Routers []ChainContract `json:"routers"` Addresses []QueryChainAddress `json:"addresses"` Frozen []string `json:"frozen,omitempty"` }
QueryVaultResp used represent the informat return to client for query asgard
type QueryVaultsPubKeys ¶
type QueryVaultsPubKeys struct { Asgard []QueryVaultPubKeyContract `json:"asgard"` Yggdrasil []QueryVaultPubKeyContract `json:"yggdrasil"` }
QueryVaultsPubKeys represent the result for query vaults pubkeys
type QueryVersion ¶
type QueryYggdrasilVaults ¶
type QueryYggdrasilVaults struct { BlockHeight int64 `json:"block_height,omitempty"` PubKey gitlab_com_thorchain_thornode_common.PubKey `json:"pub_key,omitempty"` Coins gitlab_com_thorchain_thornode_common.Coins `json:"coins"` Type VaultType `json:"type,omitempty"` StatusSince int64 `json:"status_since,omitempty"` Membership []string `json:"membership,omitempty"` Chains []string `json:"chains,omitempty"` InboundTxCount int64 `json:"inbound_tx_count,omitempty"` OutboundTxCount int64 `json:"outbound_tx_count,omitempty"` PendingTxBlockHeights []int64 `json:"pending_tx_block_heights,omitempty"` Routers []ChainContract `json:"routers"` Status NodeStatus `json:"status"` Bond cosmos.Uint `json:"bond"` TotalValue cosmos.Uint `json:"total_value"` Addresses []QueryChainAddress `json:"addresses"` }
QueryYggdrasilVaults query yggdrasil vault result
type ReserveContributors ¶
type ReserveContributors []ReserveContributor
ReserveContributors a list of reserve contributors
func (ReserveContributors) Add ¶
func (reses ReserveContributors) Add(res ReserveContributor) ReserveContributors
Add the given reserve contributor to list
type Vaults ¶
type Vaults []Vault
Vaults a list of vault
func (Vaults) HasAddress ¶
HasAddress will go through the vaults to determinate whether any of the vault match the given address on the given chain
func (Vaults) SelectByMaxCoin ¶
SelectByMaxCoin return the vault that has most of given asset
func (Vaults) SelectByMinCoin ¶
SelectByMinCoin return the vault that has least of given asset
Source Files ¶
- blame.go
- codec.go
- genesis.go
- key.go
- liquidity_pools.go
- msg_add_liquidity.go
- msg_add_liquidity_archive.go
- msg_ban.go
- msg_bond.go
- msg_consolidate.go
- msg_deposit.go
- msg_donate.go
- msg_errata.go
- msg_forgive_slash.go
- msg_ip_address.go
- msg_leave.go
- msg_manage_mayaname.go
- msg_migrate.go
- msg_mimir.go
- msg_network_fee.go
- msg_node_pause_chain.go
- msg_noop.go
- msg_observed_txin.go
- msg_observed_txout.go
- msg_ragnarok.go
- msg_refund.go
- msg_reserve_contribibutor.go
- msg_send.go
- msg_set_aztec_address.go
- msg_set_node_keys.go
- msg_solvency.go
- msg_swap.go
- msg_tss_pool.go
- msg_tss_sign_fail.go
- msg_tx_outbound.go
- msg_unbond.go
- msg_version.go
- msg_withdraw_liquidity.go
- msg_yggdrasil.go
- querier.go
- test_common.go
- type_ban.go
- type_chain_contract.go
- type_errata.go
- type_event.go
- type_forgive_slash.go
- type_jail.go
- type_keygen.go
- type_liquidity_auction_tier.go
- type_liquidity_provider.go
- type_mayaname.go
- type_mimir.go
- type_network.go
- type_network_fee.go
- type_node_account.go
- type_observed_network_fee_voter.go
- type_observed_tx.go
- type_pol.go
- type_pool.go
- type_ragnarok.go
- type_reserve_contributor.go
- type_solvency_voter.go
- type_tss.go
- type_tss_keysign_fail.go
- type_tss_metric.go
- type_tx_out.go
- type_vault.go
- types.go