swapservice

package
v0.0.0-...-20852dc Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

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

	// Admin config keys
	GSLKey                    = types.GSLKey
	StakerAmtIntervalKey      = types.StakerAmtIntervalKey
	MaxWithdrawBasisPoints    = types.MaxWithdrawBasisPoints
	MinValidatorBondKey       = types.MinValidatorBondKey
	WhiteListGasTokenKey      = types.WhiteListGasTokenKey
	DesireValidatorSetKey     = types.DesireValidatorSetKey
	RotatePerBlockHeightKey   = types.RotatePerBlockHeightKey
	ValidatorsChangeWindowKey = types.ValidatorsChangeWindowKey

	NodeActive      = types.Active
	NodeWhiteListed = types.WhiteListed
	NodeDisabled    = types.Disabled
	NodeReady       = types.Ready
	NodeStandby     = types.Standby
	NodeUnknown     = types.Unknown
)
View Source
const (
	EventTypeNewPoolAddress = `pooladdress_new`
	EventTypePoolAddress    = `pooladdress`
	PoolAddressAction       = `action`
)

const values used to emit events

View Source
const (
	EventTypeNodeReady       = `node_ready`
	EventTypeNextPoolAddress = `next_pool_address`
	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
	NewAdminConfig                 = types.NewAdminConfig
	NewMsgNoOp                     = types.NewMsgNoOp
	NewMsgAdd                      = types.NewMsgAdd
	NewMsgSetPoolData              = types.NewMsgSetPoolData
	NewMsgSetStakeData             = types.NewMsgSetStakeData
	NewMsgSetUnStake               = types.NewMsgSetUnStake
	NewMsgSwap                     = types.NewMsgSwap
	NewMsgSetAdminConfig           = types.NewMsgSetAdminConfig
	NewTxOut                       = types.NewTxOut
	NewEvent                       = types.NewEvent
	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
	NewMsgBond                     = types.NewMsgBond
	NewPoolAddresses               = types.NewPoolAddresses
	NewMsgNextPoolAddress          = types.NewMsgNextPoolAddress
	NewMsgLeave                    = types.NewMsgLeave
	GetRandomNodeAccount           = types.GetRandomNodeAccount
	GetRandomBNBAddress            = types.GetRandomBNBAddress
	GetRandomTxHash                = types.GetRandomTxHash
	GetRandomBech32Addr            = types.GetRandomBech32Addr
	GetRandomBech32ConsensusPubKey = types.GetRandomBech32ConsensusPubKey
	SetupConfigForTest             = types.SetupConfigForTest
)
View Source
var EmptyAccAddress = sdk.AccAddress{}

EmptyAccAddress empty address

Functions

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 "swapservice" type messages.

func NewQuerier

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

NewQuerier is the module level router for state queries

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      common.Amount `json:"last_event_id"`
}

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 swapservice Keeper

func (Keeper) AddIncompleteEvents

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

AddIncompleteEvents append to incomplete events

func (Keeper) AddToPoolIndex

func (k Keeper) AddToPoolIndex(ctx sdk.Context, ticker common.Ticker) error

AddToPoolIndex will add the given ticker 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) CompleteEvents

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

CompleteEvent

func (Keeper) EnsureTrustAccountUnique

func (k Keeper) EnsureTrustAccountUnique(ctx sdk.Context, account TrustAccount) 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) GetAdminConfigDesireValidatorSet

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

GetAdminConfigDesireValidatorSet

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) GetAdminConfigRotatePerBlockHeight

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

GetAdminConfigRotatePerBlockHeight get rotate per block height

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) GetAdminConfigValidatorsChangeWindow

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

GetAdminConfigValidatorsChangeWindow get validator change window

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) GetAdminConfigWhiteListGasToken

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

GetAdminConfigWhiteListGasToken

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) GetLastBinanceHeight

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

func (Keeper) GetLastEventID

func (k Keeper) GetLastEventID(ctx sdk.Context) common.Amount

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) int

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) GetNodeAccountByObserver

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

GetNodeAccountByObserver

func (Keeper) GetNodeAccountIterator

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

GetTrustAccountIterator iterate trust accounts

func (Keeper) GetPool

func (k Keeper) GetPool(ctx sdk.Context, ticker common.Ticker) 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, ticker, ticker2 common.Ticker) (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, ticker common.Ticker) (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) 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) 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, ticker common.Ticker) 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, ticker common.Ticker) error

RemoveFromPoolIndex remove the given ticker 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) SetLastBinanceHeight

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

func (Keeper) SetLastEventID

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

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, ticker common.Ticker, 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, ticker common.Ticker, ps PoolStaker)

SetPoolStaker store the poolstaker to datastore

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)

SetTxHas - saving a given txhash to the KVStore

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

type LeaveMemo

type LeaveMemo struct {
	MemoBase
}

type Memo

type Memo interface {
	IsType(tx TxType) bool

	GetTicker() common.Ticker
	GetAmount() string
	GetDestination() common.Address
	GetSlipLimit() sdk.Uint
	GetKey() string
	GetValue() string
	GetBlockHeight() uint64
	GetNodeAddress() sdk.AccAddress
	GetNextPoolAddress() common.Address
}

func ParseMemo

func ParseMemo(memo string) (Memo, error)

type MemoBase

type MemoBase struct {
	TxType TxType
	Ticker common.Ticker
}

func (MemoBase) GetAmount

func (m MemoBase) GetAmount() string

func (MemoBase) GetBlockHeight

func (m MemoBase) GetBlockHeight() uint64

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.Address

func (MemoBase) GetNodeAddress

func (m MemoBase) GetNodeAddress() sdk.AccAddress

func (MemoBase) GetSlipLimit

func (m MemoBase) GetSlipLimit() sdk.Uint

func (MemoBase) GetTicker

func (m MemoBase) GetTicker() common.Ticker

func (MemoBase) GetType

func (m MemoBase) GetType() TxType

Base Functions

func (MemoBase) GetValue

func (m MemoBase) GetValue() string

func (MemoBase) IsType

func (m MemoBase) IsType(tx TxType) bool

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) 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) int

func (*MockInMemoryPoolStorage) GetPool

func (p *MockInMemoryPoolStorage) GetPool(ctx sdk.Context, ticker common.Ticker) Pool

func (*MockInMemoryPoolStorage) GetPoolStaker

func (p *MockInMemoryPoolStorage) GetPoolStaker(ctx sdk.Context, ticker common.Ticker) (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, ticker common.Ticker) bool

func (*MockInMemoryPoolStorage) SetPool

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

func (*MockInMemoryPoolStorage) SetPoolStaker

func (p *MockInMemoryPoolStorage) SetPoolStaker(ctx sdk.Context, ticker common.Ticker, 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 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 NextPoolMemo

type NextPoolMemo struct {
	MemoBase
	NextPoolAddr common.Address
}

func (NextPoolMemo) GetNextPoolAddress

func (m NextPoolMemo) GetNextPoolAddress() common.Address

type NodeAccount

type NodeAccount = types.NodeAccount

type NodeAccounts

type NodeAccounts = types.NodeAccounts

type NodeStatus

type NodeStatus = types.NodeStatus

type OutboundMemo

type OutboundMemo struct {
	MemoBase
	BlockHeight uint64
}

func (OutboundMemo) GetBlockHeight

func (m OutboundMemo) GetBlockHeight() uint64

type Pool

type Pool = types.Pool

type PoolAddressManager

type PoolAddressManager struct {
	// 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, height int64)

BeginBlock

func (*PoolAddressManager) EndBlock

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

func (*PoolAddressManager) GetCurrentPoolAddresses

func (pm *PoolAddressManager) GetCurrentPoolAddresses() PoolAddresses

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 StakeMemo

type StakeMemo struct {
	MemoBase
	RuneAmount  string
	TokenAmount string
}

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) *TxOutStore

NewTxOutStore will create a new instance of TxOutStore.

func (*TxOutStore) AddTxOutItem

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

AddTxOutItem add an item to internal structure

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) 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) *ValidatorManager

NewValidatorManager create a new instance of ValidatorManager

func (*ValidatorManager) BeginBlock

func (vm *ValidatorManager) BeginBlock(ctx sdk.Context, height int64)

BeginBlock when block begin

func (*ValidatorManager) EndBlock

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

EndBlock when block end

type ValidatorMeta

type ValidatorMeta = types.ValidatorMeta

type WithdrawMemo

type WithdrawMemo struct {
	MemoBase
	Amount string
}

func (WithdrawMemo) GetAmount

func (m WithdrawMemo) GetAmount() string

Transaction Specific Functions

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