thorchain

package
v0.0.0-...-8acb6f8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName       = types.ModuleName
	RouterKey        = types.RouterKey
	StoreKey         = types.StoreKey
	DefaultCodespace = types.DefaultCodespace
	PoolEnabled      = types.Enabled
	PoolBootstrap    = types.Bootstrap
	PoolSuspended    = types.Suspended
	EventSuccess     = types.Success
	EventRefund      = types.Refund

	// Admin config keys
	GSLKey                 = types.GSLKey
	StakerAmtIntervalKey   = types.StakerAmtIntervalKey
	MaxWithdrawBasisPoints = types.MaxWithdrawBasisPoints
	MinValidatorBondKey    = types.MinValidatorBondKey
	WhiteListGasAssetKey   = types.WhiteListGasAssetKey
	PoolRefundGasKey       = types.PoolRefundGasKey
	DefaultPoolStatus      = types.DefaultPoolStatus

	NodeActive      = types.Active
	NodeWhiteListed = types.WhiteListed
	NodeDisabled    = types.Disabled
	NodeReady       = types.Ready
	NodeStandby     = types.Standby
	NodeUnknown     = types.Unknown
)
View Source
const (
	EventTypeNewPoolAddress    = `NewPoolAddress`
	EventTypeAbortPoolRotation = "AbortPoolRotation"
)

const values used to emit events

View Source
const (
	EventTypeNodeReady               = `node_ready`
	EventTypeNextPoolPubKeyObserved  = `next_pool_pubkey_observed`
	EventTypeNexePoolPubKeyConfirmed = `next_pool_pubkey_confirmed`
	EventTypeSignerAct               = `signer_acked`
)
View Source
const (
	EventTypeValidatorManager   = `validator_manager`
	EventTypeNominatedValidator = `validator_nominated`
	EventTypeQueuedValidator    = `validator_queued`
	EventTypeValidatorActive    = `validator_active`
	EventTypeValidatorStandby   = `validator_standby`
)

Variables

View Source
var (
	NewPool                        = types.NewPool
	NewVaultData                   = types.NewVaultData
	NewAdminConfig                 = types.NewAdminConfig
	NewMsgNoOp                     = types.NewMsgNoOp
	NewMsgAdd                      = types.NewMsgAdd
	NewMsgSetPoolData              = types.NewMsgSetPoolData
	NewMsgSetStakeData             = types.NewMsgSetStakeData
	NewMsgSetUnStake               = types.NewMsgSetUnStake
	NewMsgSwap                     = types.NewMsgSwap
	NewMsgSetAdminConfig           = types.NewMsgSetAdminConfig
	NewTxInVoter                   = types.NewTxInVoter
	NewTxOut                       = types.NewTxOut
	NewEvent                       = types.NewEvent
	NewEventPool                   = types.NewEventPool
	NewEventAdd                    = types.NewEventAdd
	NewEventAdminConfig            = types.NewEventAdminConfig
	NewEventSwap                   = types.NewEventSwap
	NewEventStake                  = types.NewEventStake
	NewEmptyRefundEvent            = types.NewEmptyRefundEvent
	NewEventUnstake                = types.NewEventUnstake
	NewMsgOutboundTx               = types.NewMsgOutboundTx
	NewPoolStaker                  = types.NewPoolStaker
	NewStakerPool                  = types.NewStakerPool
	NewMsgEndPool                  = types.NewMsgEndPool
	NewMsgAck                      = types.NewMsgAck
	HasMajority                    = types.HasMajority
	GetAdminConfigKey              = types.GetAdminConfigKey
	ModuleCdc                      = types.ModuleCdc
	RegisterCodec                  = types.RegisterCodec
	NewTrustAccount                = types.NewTrustAccount
	NewNodeAccount                 = types.NewNodeAccount
	NewYggdrasil                   = types.NewYggdrasil
	NewReserveContributor          = types.NewReserveContributor
	NewMsgYggdrasil                = types.NewMsgYggdrasil
	NewMsgReserveContributor       = types.NewMsgReserveContributor
	NewMsgBond                     = types.NewMsgBond
	NewPoolAddresses               = types.NewPoolAddresses
	NewMsgNextPoolAddress          = types.NewMsgNextPoolAddress
	NewMsgLeave                    = types.NewMsgLeave
	GetPoolStatus                  = types.GetPoolStatus
	GetRandomTx                    = types.GetRandomTx
	GetRandomNodeAccount           = types.GetRandomNodeAccount
	GetRandomBNBAddress            = types.GetRandomBNBAddress
	GetRandomTxHash                = types.GetRandomTxHash
	GetRandomBech32Addr            = types.GetRandomBech32Addr
	GetRandomBech32ConsensusPubKey = types.GetRandomBech32ConsensusPubKey
	GetRandomPubKey                = types.GetRandomPubKey
	GetRandomPubkeys               = types.GetRandomPubKeys
	SetupConfigForTest             = types.SetupConfigForTest
	EmptyPoolAddresses             = types.EmptyPoolAddresses
)
View Source
var EmptyAccAddress = sdk.AccAddress{}

EmptyAccAddress empty address

Functions

func Fund

func Fund(ctx sdk.Context, keeper Keeper, txOutStore *TxOutStore) error

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) []abci.ValidatorUpdate

InitGenesis read the data in GenesisState and apply it to data store

func NewHandler

func NewHandler(keeper Keeper, poolAddressMgr *PoolAddressManager, txOutStore *TxOutStore, validatorManager *ValidatorManager) sdk.Handler

NewHandler returns a handler for "thorchain" type messages.

func NewQuerier

func NewQuerier(keeper Keeper, poolAddressMgr *PoolAddressManager, validatorMgr *ValidatorManager) sdk.Querier

NewQuerier is the module level router for state queries

func RefundBond

func RefundBond(ctx sdk.Context, txID common.TxID, nodeAcc NodeAccount, keeper Keeper, txOut *TxOutStore)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validate genesis is valid or not

Types

type AckMemo

type AckMemo struct {
	MemoBase
}

type AddMemo

type AddMemo struct {
	MemoBase
}

type AdminConfig

type AdminConfig = types.AdminConfig

type AdminConfigKey

type AdminConfigKey = types.AdminConfigKey

type AdminMemo

type AdminMemo struct {
	MemoBase
	Key   string
	Value string
	Type  adminType
}

func (AdminMemo) GetKey

func (m AdminMemo) GetKey() string

func (AdminMemo) GetValue

func (m AdminMemo) GetValue() string

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

func NewAppModule

func NewAppModule(k Keeper, bankKeeper bank.Keeper, supplyKeeper supply.Keeper) AppModule

NewAppModule creates a new AppModule Object

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)

func (AppModule) EndBlock

func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

func (AppModule) Name

func (AppModule) Name() string

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

func (AppModule) QuerierRoute

func (am AppModule) QuerierRoute() string

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

func (AppModule) Route

func (am AppModule) Route() string

type AppModuleBasic

type AppModuleBasic struct{}

app module Basics object

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

Get the root query command of this module

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

Get the root tx command of this module

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

Register rest routes

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

Validation check of the Genesis

type BondMemo

type BondMemo struct {
	MemoBase
	NodeAddress sdk.AccAddress
}

func (BondMemo) GetNodeAddress

func (m BondMemo) GetNodeAddress() sdk.AccAddress

type CreateMemo

type CreateMemo struct {
	MemoBase
}

type Event

type Event = types.Event

type EventStake

type EventStake = types.EventStake

type EventStatus

type EventStatus = types.EventStatus

type EventSwap

type EventSwap = types.EventSwap

type Events

type Events = types.Events

type GasMemo

type GasMemo struct {
	MemoBase
}

type GenesisState

type GenesisState struct {
	Pools            []Pool        `json:"pools"`
	PoolIndex        PoolIndex     `json:"pool_index"`
	PoolStakers      []PoolStaker  `json:"pool_stakers"`
	StakerPools      []StakerPool  `json:"staker_pools"`
	TxInVoters       []TxInVoter   `json:"txin_voters"`
	TxInIndexes      []txIndex     `json:"txin_indexes"`
	TxOuts           []TxOut       `json:"txouts"`
	CompleteEvents   Events        `json:"complete_events"`
	IncompleteEvents Events        `json:"incomplete_events"`
	NodeAccounts     NodeAccounts  `json:"node_accounts"`
	AdminConfigs     []AdminConfig `json:"admin_configs"`
	LastEventID      int64         `json:"last_event_id"`
	PoolAddresses    PoolAddresses `json:"pool_addresses"`
}

GenesisState strcture that used to store the data we put in genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState the default values we put in the Genesis

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState

ExportGenesis export the data in Genesis

func NewGenesisState

func NewGenesisState(pools []Pool, nodeAccounts NodeAccounts, configs []AdminConfig) GenesisState

NewGenesisState create a new instance of GenesisState

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(coinKeeper bank.Keeper, supplyKeeper supply.Keeper, storeKey sdk.StoreKey, cdc *codec.Codec) Keeper

NewKeeper creates new instances of the thorchain Keeper

func (Keeper) AddChain

func (k Keeper) AddChain(ctx sdk.Context, chain common.Chain)

func (Keeper) AddIncompleteEvents

func (k Keeper) AddIncompleteEvents(ctx sdk.Context, event Event)

AddIncompleteEvents append to incomplete events

func (Keeper) AddObservingAddresses

func (k Keeper) AddObservingAddresses(ctx sdk.Context, inAddresses []sdk.AccAddress)

AddObservingAddresses - add a list of addresses that have been helpful in getting enough observations to process an inbound tx.

func (Keeper) AddToPoolIndex

func (k Keeper) AddToPoolIndex(ctx sdk.Context, asset common.Asset) error

AddToPoolIndex will add the given asset into the poolindex

func (Keeper) AddToTxInIndex

func (k Keeper) AddToTxInIndex(ctx sdk.Context, height uint64, id common.TxID) error

AddToTxInIndex will add the given txIn into the index

func (Keeper) CheckTxHash

func (k Keeper) CheckTxHash(ctx sdk.Context, hash common.TxID) bool

CheckTxHash - check to see if we have already processed a specific tx

func (Keeper) ClearObservingAddresses

func (k Keeper) ClearObservingAddresses(ctx sdk.Context)

ClearObservingAddresses - clear all observing addresses

func (Keeper) CompleteEvents

func (k Keeper) CompleteEvents(ctx sdk.Context, in []common.TxID, out common.Tx)

CompleteEvent

func (Keeper) EnableAPool

func (k Keeper) EnableAPool(ctx sdk.Context)

Picks the most "deserving" pool (by most staked rune) to be enabled and enables it

func (Keeper) EnsureTrustAccountUnique

func (k Keeper) EnsureTrustAccountUnique(ctx sdk.Context, consensusPubKey string, pubKeys common.PubKeys) error

func (Keeper) FindPubKeyOfAddress

func (k Keeper) FindPubKeyOfAddress(ctx sdk.Context, addr common.Address, chain common.Chain) (common.PubKey, error)

func (Keeper) GetAdminConfigAmountType

func (k Keeper) GetAdminConfigAmountType(ctx sdk.Context, key AdminConfigKey, dValue string, addr sdk.AccAddress) common.Amount

GetAdminConfigAmountType - get the config for TSL

func (Keeper) GetAdminConfigBnbAddressType

func (k Keeper) GetAdminConfigBnbAddressType(ctx sdk.Context, key AdminConfigKey, dValue string, addr sdk.AccAddress) common.Address

GetAdminConfigBnbAddressType - get the config with return type is BNBAddress

func (Keeper) GetAdminConfigCoinsType

func (k Keeper) GetAdminConfigCoinsType(ctx sdk.Context, key AdminConfigKey, dValue string, addr sdk.AccAddress) sdk.Coins

GetAdminConfigCoinsType - get the config for TSL

func (Keeper) GetAdminConfigDefaultPoolStatus

func (k Keeper) GetAdminConfigDefaultPoolStatus(ctx sdk.Context, addr sdk.AccAddress) PoolStatus

GetAdminConfigDefaultPoolStatus - get the config for Default Pool Status

func (Keeper) GetAdminConfigGSL

func (k Keeper) GetAdminConfigGSL(ctx sdk.Context, addr sdk.AccAddress) common.Amount

GetAdminConfigGSL - get the config for GSL

func (Keeper) GetAdminConfigInt64

func (k Keeper) GetAdminConfigInt64(ctx sdk.Context, key AdminConfigKey, dValue string, addr sdk.AccAddress) int64

GetAdminConfigInt64 - get the int64 config

func (Keeper) GetAdminConfigIterator

func (k Keeper) GetAdminConfigIterator(ctx sdk.Context) sdk.Iterator

GetAdminConfigIterator iterate admin configs

func (Keeper) GetAdminConfigMinValidatorBond

func (k Keeper) GetAdminConfigMinValidatorBond(ctx sdk.Context, addr sdk.AccAddress) sdk.Uint

GetAdminConfigMinValidatorBond get the minimum bond to become a validator

func (Keeper) GetAdminConfigStakerAmtInterval

func (k Keeper) GetAdminConfigStakerAmtInterval(ctx sdk.Context, addr sdk.AccAddress) common.Amount

GetAdminConfigStakerAmtInterval - get the config for StakerAmtInterval

func (Keeper) GetAdminConfigUintType

func (k Keeper) GetAdminConfigUintType(ctx sdk.Context, key AdminConfigKey, dValue string, addr sdk.AccAddress) sdk.Uint

func (Keeper) GetAdminConfigValue

func (k Keeper) GetAdminConfigValue(ctx sdk.Context, kkey AdminConfigKey, addr sdk.AccAddress) (val string, err error)

GetAdminConfigValue - gets the value of a given admin key

func (Keeper) GetAdminConfigWhiteListGasAsset

func (k Keeper) GetAdminConfigWhiteListGasAsset(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

GetAdminConfigWhiteListGasAsset

func (Keeper) GetChains

func (k Keeper) GetChains(ctx sdk.Context) common.Chains

func (Keeper) GetCompleteEventIterator

func (k Keeper) GetCompleteEventIterator(ctx sdk.Context) sdk.Iterator

GetCompleteEventIterator iterate complete events

func (Keeper) GetCompletedEvent

func (k Keeper) GetCompletedEvent(ctx sdk.Context, id int64) (Event, error)

GetCompletedEvent retrieve completed event

func (Keeper) GetIncompleteEvents

func (k Keeper) GetIncompleteEvents(ctx sdk.Context) (Events, error)

GetIncompleteEvents retrieve incomplete events

func (Keeper) GetLastChainHeight

func (k Keeper) GetLastChainHeight(ctx sdk.Context, chain common.Chain) (height sdk.Uint)

func (Keeper) GetLastEventID

func (k Keeper) GetLastEventID(ctx sdk.Context) int64

GetLastEventID get last event id

func (Keeper) GetLastSignedHeight

func (k Keeper) GetLastSignedHeight(ctx sdk.Context) (height sdk.Uint)

func (Keeper) GetLowestActiveVersion

func (k Keeper) GetLowestActiveVersion(ctx sdk.Context) int64

GetLowestActiveVersion - get version number of lowest active node

func (Keeper) GetNodeAccount

func (k Keeper) GetNodeAccount(ctx sdk.Context, addr sdk.AccAddress) (NodeAccount, error)

GetNodeAccount try to get node account with the given address from db

func (Keeper) GetNodeAccountByBondAddress

func (k Keeper) GetNodeAccountByBondAddress(ctx sdk.Context, addr common.Address) (NodeAccount, error)

GetNodeAccountByBondAddress go through data store to get node account by it's signer bnb address

func (Keeper) GetNodeAccountByPubKey

func (k Keeper) GetNodeAccountByPubKey(ctx sdk.Context, pk common.PubKey) (NodeAccount, error)

GetNodeAccountByPubKey try to get node account with the given pubkey from db

func (Keeper) GetNodeAccountIterator

func (k Keeper) GetNodeAccountIterator(ctx sdk.Context) sdk.Iterator

GetTrustAccountIterator iterate trust accounts

func (Keeper) GetObservingAddresses

func (k Keeper) GetObservingAddresses(ctx sdk.Context) []sdk.AccAddress

GetObservingAddresses - get list of observed addresses. This is a list of addresses that have recently contributed via observing a tx that got 2/3rds majority

func (Keeper) GetPool

func (k Keeper) GetPool(ctx sdk.Context, asset common.Asset) Pool

GetPool get the entire Pool metadata struct for a pool ID

func (Keeper) GetPoolAddresses

func (k Keeper) GetPoolAddresses(ctx sdk.Context) PoolAddresses

GetPoolAddresses get current pool addresses

func (Keeper) GetPoolBalances

func (k Keeper) GetPoolBalances(ctx sdk.Context, asset, asset2 common.Asset) (sdk.Uint, sdk.Uint)

func (Keeper) GetPoolDataIterator

func (k Keeper) GetPoolDataIterator(ctx sdk.Context) sdk.Iterator

GetPoolDataIterator only iterate pool data

func (Keeper) GetPoolIndex

func (k Keeper) GetPoolIndex(ctx sdk.Context) (PoolIndex, error)

GetPoolIndex retrieve pool index from the data store

func (Keeper) GetPoolStaker

func (k Keeper) GetPoolStaker(ctx sdk.Context, asset common.Asset) (PoolStaker, error)

GetPoolStaker retrieve poolStaker from the data store

func (Keeper) GetPoolStakerIterator

func (k Keeper) GetPoolStakerIterator(ctx sdk.Context) sdk.Iterator

GetPoolStakerIterator iterate pool stakers

func (Keeper) GetReservesContributors

func (k Keeper) GetReservesContributors(ctx sdk.Context) ReserveContributors

func (Keeper) GetStakerPool

func (k Keeper) GetStakerPool(ctx sdk.Context, stakerID common.Address) (StakerPool, error)

GetStakerPool get the stakerpool from key value store

func (Keeper) GetStakerPoolIterator

func (k Keeper) GetStakerPoolIterator(ctx sdk.Context) sdk.Iterator

GetStakerPoolIterator iterate stakers pools

func (Keeper) GetTxInIndex

func (k Keeper) GetTxInIndex(ctx sdk.Context, height uint64) (TxInIndex, error)

GetTxInIndex retrieve txIn by height

func (Keeper) GetTxInIndexIterator

func (k Keeper) GetTxInIndexIterator(ctx sdk.Context) sdk.Iterator

GetTxInIndexIterator iterate tx in indexes

func (Keeper) GetTxInVoter

func (k Keeper) GetTxInVoter(ctx sdk.Context, hash common.TxID) TxInVoter

GetTxIn - gets information of a tx hash

func (Keeper) GetTxInVoterIterator

func (k Keeper) GetTxInVoterIterator(ctx sdk.Context) sdk.Iterator

GetTxInVoterIterator iterate tx in voters

func (Keeper) GetTxOut

func (k Keeper) GetTxOut(ctx sdk.Context, height uint64) (*TxOut, error)

GetTxOut - write the given txout information to key values tore

func (Keeper) GetTxOutIterator

func (k Keeper) GetTxOutIterator(ctx sdk.Context) sdk.Iterator

GetTxOutIterator iterate tx out

func (Keeper) GetValidatorMeta

func (k Keeper) GetValidatorMeta(ctx sdk.Context) ValidatorMeta

func (Keeper) GetVaultData

func (k Keeper) GetVaultData(ctx sdk.Context) VaultData

////////////////////// Vault Data //////////////////////////

func (Keeper) GetYggdrasil

func (k Keeper) GetYggdrasil(ctx sdk.Context, pk common.PubKey) Yggdrasil

func (Keeper) GetYggdrasilIterator

func (k Keeper) GetYggdrasilIterator(ctx sdk.Context) sdk.Iterator

GetYggdrasilIterator only iterate yggdrasil pools

func (Keeper) HasValidYggdrasilPools

func (k Keeper) HasValidYggdrasilPools(ctx sdk.Context) (bool, error)

func (Keeper) IsActiveObserver

func (k Keeper) IsActiveObserver(ctx sdk.Context, addr sdk.AccAddress) bool

IsActiveObserver check the given account address, whether they are active

func (Keeper) IsWhitelistedNode

func (k Keeper) IsWhitelistedNode(ctx sdk.Context, addr sdk.AccAddress) bool

IsWhitelistedAccount check whether the given account is white listed

func (Keeper) ListActiveNodeAccounts

func (k Keeper) ListActiveNodeAccounts(ctx sdk.Context) (NodeAccounts, error)

ListActiveNodeAccounts - get a list of active trust accounts

func (Keeper) ListNodeAccounts

func (k Keeper) ListNodeAccounts(ctx sdk.Context) (NodeAccounts, error)

ListNodeAccounts - gets a list of all trust accounts

func (Keeper) ListNodeAccountsByStatus

func (k Keeper) ListNodeAccountsByStatus(ctx sdk.Context, status NodeStatus) (NodeAccounts, error)

ListNodeAccountsByStatus - get a list of node accounts with the given status if status = NodeUnknown, then it return everything

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) PoolExist

func (k Keeper) PoolExist(ctx sdk.Context, asset common.Asset) bool

PoolExist check whether the given pool exist in the datastore

func (Keeper) RemoveActiveObserver

func (k Keeper) RemoveActiveObserver(ctx sdk.Context, addr sdk.AccAddress)

RemoveActiveObserver remove the given address from active observer

func (Keeper) RemoveFromPoolIndex

func (k Keeper) RemoveFromPoolIndex(ctx sdk.Context, asset common.Asset) error

RemoveFromPoolIndex remove the given asset from the poolIndex

func (Keeper) SetActiveObserver

func (k Keeper) SetActiveObserver(ctx sdk.Context, addr sdk.AccAddress)

SetActiveObserver set the given addr as an active observer address

func (Keeper) SetAdminConfig

func (k Keeper) SetAdminConfig(ctx sdk.Context, config AdminConfig)

SetAdminConfig - saving a given admin config to the KVStore

func (Keeper) SetCompletedEvent

func (k Keeper) SetCompletedEvent(ctx sdk.Context, event Event)

SetCompletedEvent write a completed event

func (Keeper) SetIncompleteEvents

func (k Keeper) SetIncompleteEvents(ctx sdk.Context, events Events)

SetIncompleteEvents write incomplete events

func (Keeper) SetLastChainHeight

func (k Keeper) SetLastChainHeight(ctx sdk.Context, chain common.Chain, height sdk.Uint) error

func (Keeper) SetLastEventID

func (k Keeper) SetLastEventID(ctx sdk.Context, id int64)

SetLastEventID write a last event id

func (Keeper) SetLastSignedHeight

func (k Keeper) SetLastSignedHeight(ctx sdk.Context, height sdk.Uint)

func (Keeper) SetNodeAccount

func (k Keeper) SetNodeAccount(ctx sdk.Context, na NodeAccount)

SetNodeAccount save the given node account into datastore

func (Keeper) SetPool

func (k Keeper) SetPool(ctx sdk.Context, pool Pool)

Sets the entire Pool metadata struct for a pool ID

func (Keeper) SetPoolAddresses

func (k Keeper) SetPoolAddresses(ctx sdk.Context, addresses *PoolAddresses)

SetPoolAddresses save the pool address to key value store

func (Keeper) SetPoolData

func (k Keeper) SetPoolData(ctx sdk.Context, asset common.Asset, ps PoolStatus)

SetPoolData - sets the value string that a pool ID resolves to

func (Keeper) SetPoolIndex

func (k Keeper) SetPoolIndex(ctx sdk.Context, pi PoolIndex)

SetPoolIndex write a pool index into datastore

func (Keeper) SetPoolStaker

func (k Keeper) SetPoolStaker(ctx sdk.Context, asset common.Asset, ps PoolStaker)

SetPoolStaker store the poolstaker to datastore

func (Keeper) SetReserveContributors

func (k Keeper) SetReserveContributors(ctx sdk.Context, contribs ReserveContributors)

func (Keeper) SetStakerPool

func (k Keeper) SetStakerPool(ctx sdk.Context, stakerID common.Address, sp StakerPool)

SetStakerPool save the given stakerpool object to key value store

func (Keeper) SetTxInIndex

func (k Keeper) SetTxInIndex(ctx sdk.Context, height uint64, index TxInIndex)

SetTxInIndex write a TxIn index into datastore

func (Keeper) SetTxInVoter

func (k Keeper) SetTxInVoter(ctx sdk.Context, tx TxInVoter)

SetTxInVoter - save a txin voter object

func (Keeper) SetTxOut

func (k Keeper) SetTxOut(ctx sdk.Context, blockOut *TxOut)

SetTxOut - write the given txout information to key values tore

func (Keeper) SetValidatorMeta

func (k Keeper) SetValidatorMeta(ctx sdk.Context, meta ValidatorMeta)

func (Keeper) SetVaultData

func (k Keeper) SetVaultData(ctx sdk.Context, data VaultData)

func (Keeper) SetYggdrasil

func (k Keeper) SetYggdrasil(ctx sdk.Context, ygg Yggdrasil)

func (Keeper) SlashNodeAccountBond

func (k Keeper) SlashNodeAccountBond(ctx sdk.Context, na *NodeAccount, slash sdk.Uint)

Slash the bond of a node account NOTE: Should be careful not to slash too much, and have their Yggdrasil vault have more in funds than their bond. This could trigger them to have a untimely exit, stealing an amount of funds from stakers.

func (Keeper) SlashNodeAccountRewards

func (k Keeper) SlashNodeAccountRewards(ctx sdk.Context, na *NodeAccount, pts int64)

Slash the rewards of a node account NOTE: if we slash their rewards so much, they may do an orderly exit and rotate out of the active vault, wait in line to rejoin later.

func (Keeper) SupportedChain

func (k Keeper) SupportedChain(ctx sdk.Context, chain common.Chain) bool

func (Keeper) TotalActiveNodeAccount

func (k Keeper) TotalActiveNodeAccount(ctx sdk.Context) (int, error)

TotalActiveNodeAccount count the number of active node account

func (Keeper) TotalNodeAccounts

func (k Keeper) TotalNodeAccounts(ctx sdk.Context) (count int)

TotalNodeAccounts counts the number of trust accounts

func (Keeper) UpdateVaultData

func (k Keeper) UpdateVaultData(ctx sdk.Context)

Update the vault data to reflect changing in this block

type LeaveMemo

type LeaveMemo struct {
	MemoBase
}

type Memo

type Memo interface {
	IsType(tx TxType) bool

	String() string
	GetAsset() common.Asset
	GetAmount() string
	GetDestination() common.Address
	GetSlipLimit() sdk.Uint
	GetKey() string
	GetValue() string
	GetTxID() common.TxID
	GetNodeAddress() sdk.AccAddress
	GetNextPoolAddress() common.PubKey
}

func ParseMemo

func ParseMemo(memo string) (Memo, error)

type MemoBase

type MemoBase struct {
	TxType TxType
	Asset  common.Asset
}

func (MemoBase) GetAmount

func (m MemoBase) GetAmount() string

func (MemoBase) GetAsset

func (m MemoBase) GetAsset() common.Asset

func (MemoBase) GetDestination

func (m MemoBase) GetDestination() common.Address

func (MemoBase) GetKey

func (m MemoBase) GetKey() string

func (MemoBase) GetNextPoolAddress

func (m MemoBase) GetNextPoolAddress() common.PubKey

func (MemoBase) GetNodeAddress

func (m MemoBase) GetNodeAddress() sdk.AccAddress

func (MemoBase) GetSlipLimit

func (m MemoBase) GetSlipLimit() sdk.Uint

func (MemoBase) GetTxID

func (m MemoBase) GetTxID() common.TxID

func (MemoBase) GetType

func (m MemoBase) GetType() TxType

func (MemoBase) GetValue

func (m MemoBase) GetValue() string

func (MemoBase) IsType

func (m MemoBase) IsType(tx TxType) bool

func (MemoBase) String

func (m MemoBase) String() string

Base Functions

type MockInMemoryPoolStorage

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

func NewMockInMemoryPoolStorage

func NewMockInMemoryPoolStorage() *MockInMemoryPoolStorage

NewMockInMemoryPoolStorage

func (*MockInMemoryPoolStorage) AddIncompleteEvents

func (p *MockInMemoryPoolStorage) AddIncompleteEvents(ctx sdk.Context, event Event)

func (*MockInMemoryPoolStorage) GetAdminConfigDefaultPoolStatus

func (p *MockInMemoryPoolStorage) GetAdminConfigDefaultPoolStatus(ctx sdk.Context, addr sdk.AccAddress) PoolStatus

func (*MockInMemoryPoolStorage) GetAdminConfigStakerAmtInterval

func (p *MockInMemoryPoolStorage) GetAdminConfigStakerAmtInterval(ctx sdk.Context, addr sdk.AccAddress) common.Amount

func (*MockInMemoryPoolStorage) GetAdminConfigValue

func (p *MockInMemoryPoolStorage) GetAdminConfigValue(ctx sdk.Context, key AdminConfigKey, addr sdk.AccAddress) (string, error)

func (*MockInMemoryPoolStorage) GetLowestActiveVersion

func (p *MockInMemoryPoolStorage) GetLowestActiveVersion(ctx sdk.Context) int64

func (*MockInMemoryPoolStorage) GetPool

func (p *MockInMemoryPoolStorage) GetPool(ctx sdk.Context, asset common.Asset) Pool

func (*MockInMemoryPoolStorage) GetPoolStaker

func (p *MockInMemoryPoolStorage) GetPoolStaker(ctx sdk.Context, asset common.Asset) (PoolStaker, error)

func (*MockInMemoryPoolStorage) GetStakerPool

func (p *MockInMemoryPoolStorage) GetStakerPool(ctx sdk.Context, stakerID common.Address) (StakerPool, error)

func (*MockInMemoryPoolStorage) PoolExist

func (p *MockInMemoryPoolStorage) PoolExist(ctx sdk.Context, asset common.Asset) bool

func (*MockInMemoryPoolStorage) SetCompletedEvent

func (p *MockInMemoryPoolStorage) SetCompletedEvent(ctx sdk.Context, event Event)

func (*MockInMemoryPoolStorage) SetPool

func (p *MockInMemoryPoolStorage) SetPool(ctx sdk.Context, ps Pool)

func (*MockInMemoryPoolStorage) SetPoolStaker

func (p *MockInMemoryPoolStorage) SetPoolStaker(ctx sdk.Context, asset common.Asset, ps PoolStaker)

func (*MockInMemoryPoolStorage) SetStakerPool

func (p *MockInMemoryPoolStorage) SetStakerPool(ctx sdk.Context, stakerID common.Address, sp StakerPool)

type MockTxOutSetter

type MockTxOutSetter struct {
}

MockTxOutSetter

func (MockTxOutSetter) SetTxOut

func (mts MockTxOutSetter) SetTxOut(ctx sdk.Context, out *TxOut)

type MsgAck

type MsgAck = types.MsgAck

type MsgAdd

type MsgAdd = types.MsgAdd

type MsgBond

type MsgBond = types.MsgBond

type MsgEndPool

type MsgEndPool = types.MsgEndPool

type MsgLeave

type MsgLeave = types.MsgLeave

type MsgNextPoolAddress

type MsgNextPoolAddress = types.MsgNextPoolAddress

type MsgNoOp

type MsgNoOp = types.MsgNoOp

type MsgOutboundTx

type MsgOutboundTx = types.MsgOutboundTx

type MsgReserveContributor

type MsgReserveContributor = types.MsgReserveContributor

type MsgSetAdminConfig

type MsgSetAdminConfig = types.MsgSetAdminConfig

type MsgSetPoolData

type MsgSetPoolData = types.MsgSetPoolData

type MsgSetStakeData

type MsgSetStakeData = types.MsgSetStakeData

type MsgSetTrustAccount

type MsgSetTrustAccount = types.MsgSetTrustAccount

type MsgSetTxIn

type MsgSetTxIn = types.MsgSetTxIn

type MsgSetUnStake

type MsgSetUnStake = types.MsgSetUnStake

type MsgSetVersion

type MsgSetVersion = types.MsgSetVersion

type MsgSwap

type MsgSwap = types.MsgSwap

type MsgYggdrasil

type MsgYggdrasil = types.MsgYggdrasil

type NextPoolMemo

type NextPoolMemo struct {
	MemoBase
	NextPoolAddr common.PubKey
}

func (NextPoolMemo) GetNextPoolAddress

func (m NextPoolMemo) GetNextPoolAddress() common.PubKey

type NodeAccount

type NodeAccount = types.NodeAccount

type NodeAccounts

type NodeAccounts = types.NodeAccounts

type NodeAccountsBySlashingPoint

type NodeAccountsBySlashingPoint = types.NodeAccountsBySlashingPoint

type NodeStatus

type NodeStatus = types.NodeStatus

type OutboundMemo

type OutboundMemo struct {
	MemoBase
	TxID common.TxID
}

func NewOutboundMemo

func NewOutboundMemo(txID common.TxID) OutboundMemo

func (OutboundMemo) GetTxID

func (m OutboundMemo) GetTxID() common.TxID

func (OutboundMemo) String

func (m OutboundMemo) String() string

type Pool

type Pool = types.Pool

type PoolAddressManager

type PoolAddressManager struct {
	ObservedNextPoolAddrPubKey common.PoolPubKeys
	IsRotateWindowOpen         bool
	// contains filtered or unexported fields
}

PoolAddressManager is going to manage the pool addresses , rotate etc

func NewPoolAddressManager

func NewPoolAddressManager(k Keeper) *PoolAddressManager

NewPoolAddressManager create a new PoolAddressManager

func (*PoolAddressManager) BeginBlock

func (pm *PoolAddressManager) BeginBlock(ctx sdk.Context)

BeginBlock should be called when BeginBlock

func (*PoolAddressManager) EndBlock

func (pm *PoolAddressManager) EndBlock(ctx sdk.Context, store *TxOutStore)

EndBlock contains some actions we need to take when block commit

func (*PoolAddressManager) GetCurrentPoolAddresses

func (pm *PoolAddressManager) GetCurrentPoolAddresses() *PoolAddresses

GetCurrentPoolAddresses return current pool addresses

type PoolAddresses

type PoolAddresses = types.PoolAddresses

type PoolIndex

type PoolIndex = types.PoolIndex

type PoolStaker

type PoolStaker = types.PoolStaker

type PoolStatus

type PoolStatus = types.PoolStatus

type QueryResHeights

type QueryResHeights = types.QueryResHeights

type QueryResPools

type QueryResPools = types.QueryResPools

type QueryResTxOut

type QueryResTxOut = types.QueryResTxOut

type ResTxOut

type ResTxOut = types.ResTxOut

type ReserveContributor

type ReserveContributor = types.ReserveContributor

type ReserveContributors

type ReserveContributors = types.ReserveContributors

type ReservesMemo

type ReservesMemo struct {
	MemoBase
}

type StakeMemo

type StakeMemo struct {
	MemoBase
	RuneAmount  string
	AssetAmount string
	Address     common.Address
}

func (StakeMemo) GetDestination

func (m StakeMemo) GetDestination() common.Address

type StakeTxDetail

type StakeTxDetail = types.StakeTxDetail

type StakerPool

type StakerPool = types.StakerPool

type StakerPoolItem

type StakerPoolItem = types.StakerPoolItem

type StakerUnit

type StakerUnit = types.StakerUnit

type SwapMemo

type SwapMemo struct {
	MemoBase
	Destination common.Address
	SlipLimit   sdk.Uint
}

func (SwapMemo) GetDestination

func (m SwapMemo) GetDestination() common.Address

func (SwapMemo) GetSlipLimit

func (m SwapMemo) GetSlipLimit() sdk.Uint

type TrustAccount

type TrustAccount = types.TrustAccount

type TrustAccounts

type TrustAccounts = types.TrustAccounts

type TxIn

type TxIn = types.TxIn

type TxInIndex

type TxInIndex = types.TxInIndex

type TxInVoter

type TxInVoter = types.TxInVoter

type TxOut

type TxOut = types.TxOut

type TxOutItem

type TxOutItem = types.TxOutItem

type TxOutSetter

type TxOutSetter interface {
	SetTxOut(sdk.Context, *TxOut)
}

TxOutSetter define a method that is required to be used in TxOutStore We need this interface thus we could test the refund logic accordingly

type TxOutStore

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

TxOutStore is going to manage all the outgoing tx

func NewTxOutStore

func NewTxOutStore(txOutSetter TxOutSetter, poolAddrMgr *PoolAddressManager) *TxOutStore

NewTxOutStore will create a new instance of TxOutStore.

func (*TxOutStore) AddTxOutItem

func (tos *TxOutStore) AddTxOutItem(ctx sdk.Context, keeper Keeper, toi *TxOutItem, deductFee, asgard bool)

AddTxOutItem add an item to internal structure

func (*TxOutStore) ApplyBNBFees

func (tos *TxOutStore) ApplyBNBFees(ctx sdk.Context, keeper Keeper, toi *TxOutItem)

func (*TxOutStore) CommitBlock

func (tos *TxOutStore) CommitBlock(ctx sdk.Context)

CommitBlock we write the block into key value store , thus we could send to signer later.

func (*TxOutStore) GetOutboundItems

func (tos *TxOutStore) GetOutboundItems() []*TxOutItem

func (*TxOutStore) NewBlock

func (tos *TxOutStore) NewBlock(height uint64)

NewBlock create a new block

type TxType

type TxType uint8

func (TxType) Equals

func (tx TxType) Equals(tx2 TxType) bool

Check if two txTypes are the same

func (TxType) String

func (tx TxType) String() string

Converts a txType into a string

type ValidatorManager

type ValidatorManager struct {
	Meta *ValidatorMeta
	// contains filtered or unexported fields
}

ValidatorManager is to manage a list of validators , and rotate them

func NewValidatorManager

func NewValidatorManager(k Keeper, poolAddrMgr *PoolAddressManager) *ValidatorManager

NewValidatorManager create a new instance of ValidatorManager

func (*ValidatorManager) BeginBlock

func (vm *ValidatorManager) BeginBlock(ctx sdk.Context)

BeginBlock when block begin

func (*ValidatorManager) EndBlock

func (vm *ValidatorManager) EndBlock(ctx sdk.Context, store *TxOutStore) []abci.ValidatorUpdate

EndBlock when block end

type ValidatorMeta

type ValidatorMeta = types.ValidatorMeta

type ValidatorRotationPolicy

type ValidatorRotationPolicy struct {
	RotateInNumBeforeFull      int64
	RotateOutNumBeforeFull     int64
	RotateNumAfterFull         int64
	RotatePerBlockHeight       int64
	ValidatorChangeWindow      int64
	DesireValidatorSet         int64
	LeaveProcessPerBlockHeight int64
}

ValidatorRotationPolicy store all the relevant parameters we need to perform validator rotation

func GetValidatorRotationPolicy

func GetValidatorRotationPolicy(ctx sdk.Context, k Keeper) ValidatorRotationPolicy

GetValidatorRotationPolicy from data store

func (ValidatorRotationPolicy) IsValid

func (vp ValidatorRotationPolicy) IsValid() error

type VaultData

type VaultData = types.VaultData

type WithdrawMemo

type WithdrawMemo struct {
	MemoBase
	Amount string
}

func (WithdrawMemo) GetAmount

func (m WithdrawMemo) GetAmount() string

Transaction Specific Functions

type Yggdrasil

type Yggdrasil = types.Yggdrasil

type YggdrasilFundMemo

type YggdrasilFundMemo struct {
	MemoBase
}

type YggdrasilReturnMemo

type YggdrasilReturnMemo struct {
	MemoBase
}

type Yggdrasils

type Yggdrasils = types.Yggdrasils

Directories

Path Synopsis
client
cli
Please put all the test related function to here
Please put all the test related function to here

Jump to

Keyboard shortcuts

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