keeper

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryResourceNodeByNetworkAddr = "resource_node_by_network"
	QueryIndexingNodeByNetworkAddr = "indexing_nodes"
	QueryNodesTotalStakes          = "nodes_total_stakes"
	QueryNodeStakeByNodeAddr       = "node_stakes"
	QueryNodeStakeByOwner          = "node_stakes_by_owner"
	QueryRegisterParams            = "register_params"
	QueryDefaultLimit              = 100
)

Variables

This section is empty.

Functions

func CheckAccAddr added in v0.4.0

func CheckAccAddr(w http.ResponseWriter, r *http.Request, data string) (sdk.AccAddress, bool)

func CheckSdsAddr added in v0.7.0

func CheckSdsAddr(w http.ResponseWriter, r *http.Request, data string) (stratos.SdsAddress, bool)

func MakeTestCodec

func MakeTestCodec() *codec.Codec

create a codec used only for testing

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier creates a new querier for register clients.

func TestMain added in v0.7.0

func TestMain(m *testing.M)

Types

type Keeper

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

Keeper of the register store

func CreateTestInput

func CreateTestInput(t *testing.T, isCheckTx bool) (sdk.Context, auth.AccountKeeper, bank.Keeper, Keeper, params.Keeper)

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace,
	accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper) Keeper

NewKeeper creates a register keeper

func (Keeper) AddIndexingNodeStake

func (k Keeper) AddIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToAdd sdk.Coin,
) (ozoneLimitChange sdk.Int, err error)

AddIndexingNodeStake Update the tokens of an existing indexing node

func (Keeper) AddResourceNodeStake

func (k Keeper) AddResourceNodeStake(ctx sdk.Context, resourceNode types.ResourceNode, tokenToAdd sdk.Coin,
) (ozoneLimitChange sdk.Int, err error)

AddResourceNodeStake Update the tokens of an existing resource node

func (Keeper) AfterNodeBeginUnbonding added in v0.4.0

func (k Keeper) AfterNodeBeginUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool)

AfterNodeBeginUnbonding - call hook if registered

func (Keeper) AfterNodeBonded added in v0.4.0

func (k Keeper) AfterNodeBonded(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool)

AfterNodeBonded - call hook if registered

func (Keeper) AfterNodeCreated added in v0.4.0

func (k Keeper) AfterNodeCreated(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool)

AfterNodeCreated - call hook if registered

func (Keeper) AfterNodeRemoved added in v0.4.0

func (k Keeper) AfterNodeRemoved(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool)

AfterNodeRemoved - call hook if registered

func (Keeper) BeforeNodeModified added in v0.4.0

func (k Keeper) BeforeNodeModified(ctx sdk.Context, network stratos.SdsAddress, isIndexingNode bool)

BeforeNodeModified - call hook if registered

func (Keeper) BlockRegisteredNodesUpdates added in v0.4.0

func (k Keeper) BlockRegisteredNodesUpdates(ctx sdk.Context) []abci.ValidatorUpdate

Called in each EndBlock

func (Keeper) BondDenom

func (k Keeper) BondDenom(ctx sdk.Context) (res string)

BondDenom - Bondable coin denomination

func (Keeper) CompleteUnbonding added in v0.4.0

func (k Keeper) CompleteUnbonding(ctx sdk.Context, networkAddr stratos.SdsAddress) error

CompleteUnbonding performs the same logic as CompleteUnbondingWithAmount except it does not return the total unbonding amount.

func (Keeper) CompleteUnbondingWithAmount added in v0.4.0

func (k Keeper) CompleteUnbondingWithAmount(ctx sdk.Context, networkAddr stratos.SdsAddress) (sdk.Coins, bool, error)

CompleteUnbondingWithAmount completes the unbonding of all mature entries in the retrieved unbonding delegation object and returns the total unbonding balance or an error upon failure.

func (Keeper) CurrUozPrice added in v0.6.2

func (k Keeper) CurrUozPrice(ctx sdk.Context) sdk.Dec

calc current uoz price

func (Keeper) DeductSlashing added in v0.7.0

func (k Keeper) DeductSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, coins sdk.Coins) sdk.Coins

deduct slashing amount from coins, return the coins that after deduction

func (Keeper) DequeueAllMatureUBDQueue added in v0.4.0

func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context,
	currTime time.Time) (matureUnbonds []stratos.SdsAddress)

Returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue

func (Keeper) GetAllIndexingNodes

func (k Keeper) GetAllIndexingNodes(ctx sdk.Context) (indexingNodes []types.IndexingNode)

GetAllIndexingNodes get the set of all indexing nodes with no limits, used during genesis dump

func (Keeper) GetAllMatureUBDNodeQueue added in v0.4.0

func (k Keeper) GetAllMatureUBDNodeQueue(ctx sdk.Context, currTime time.Time) (matureNetworkAddrs []sdk.AccAddress)

Returns a concatenated list of all the timeslices before currTime, and deletes the timeslices from the queue

func (Keeper) GetAllResourceNodes

func (k Keeper) GetAllResourceNodes(ctx sdk.Context) (resourceNodes []types.ResourceNode)

GetAllResourceNodes get the set of all resource nodes with no limits, used during genesis dump

func (Keeper) GetAllUnbondingNodes added in v0.4.0

func (k Keeper) GetAllUnbondingNodes(ctx sdk.Context) (unbondingNodes []types.UnbondingNode)

GetAllUnbondingNodes get the set of all ubd nodes with no limits, used during genesis dump

func (Keeper) GetAllUnbondingNodesTotalBalance added in v0.4.0

func (k Keeper) GetAllUnbondingNodesTotalBalance(ctx sdk.Context) sdk.Int

func (Keeper) GetAllValidIndexingNodes

func (k Keeper) GetAllValidIndexingNodes(ctx sdk.Context) (indexingNodes []types.IndexingNode)

GetAllValidIndexingNodes get the set of all bonded & not suspended indexing nodes

func (Keeper) GetIndexingNetworksIterator

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

GetIndexingNetworksIterator gets an iterator over all network addresses

func (Keeper) GetIndexingNode

func (k Keeper) GetIndexingNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (indexingNode types.IndexingNode, found bool)

getIndexingNode get a single indexing node

func (Keeper) GetIndexingNodeBondedToken added in v0.4.0

func (k Keeper) GetIndexingNodeBondedToken(ctx sdk.Context) (token sdk.Coin)

func (Keeper) GetIndexingNodeList

func (k Keeper) GetIndexingNodeList(ctx sdk.Context, networkAddr stratos.SdsAddress) (indexingNodes []types.IndexingNode, err error)

getIndexingNodeList get all indexing nodes by networkAddr

func (Keeper) GetIndexingNodeListByMoniker

func (k Keeper) GetIndexingNodeListByMoniker(ctx sdk.Context, moniker string) (resourceNodes []types.IndexingNode, err error)

func (Keeper) GetIndexingNodeNotBondedToken added in v0.4.0

func (k Keeper) GetIndexingNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin)

func (Keeper) GetIndexingNodeRegistrationVotePool

func (k Keeper) GetIndexingNodeRegistrationVotePool(ctx sdk.Context, nodeAddr stratos.SdsAddress) (votePool types.IndexingNodeRegistrationVotePool, found bool)

func (Keeper) GetIndexingNodesFiltered added in v0.4.0

func (k Keeper) GetIndexingNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.IndexingNode

func (Keeper) GetInitialGenesisStakeTotal

func (k Keeper) GetInitialGenesisStakeTotal(ctx sdk.Context) (stake sdk.Int)

func (Keeper) GetInitialUOzonePrice added in v0.6.0

func (k Keeper) GetInitialUOzonePrice(ctx sdk.Context) (price sdk.Dec)

func (Keeper) GetNetworks

func (k Keeper) GetNetworks(ctx sdk.Context, keeper Keeper) (res []byte)

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of register parameters.

func (Keeper) GetRemainingOzoneLimit

func (k Keeper) GetRemainingOzoneLimit(ctx sdk.Context) (value sdk.Int)

func (Keeper) GetResourceNetworksIterator

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

GetResourceNetworksIterator gets an iterator over all network addresses

func (Keeper) GetResourceNode

func (k Keeper) GetResourceNode(ctx sdk.Context, p2pAddress stratos.SdsAddress) (resourceNode types.ResourceNode, found bool)

GetResourceNode get a single resource node

func (Keeper) GetResourceNodeBondedToken added in v0.4.0

func (k Keeper) GetResourceNodeBondedToken(ctx sdk.Context) (token sdk.Coin)

func (Keeper) GetResourceNodeNotBondedToken added in v0.4.0

func (k Keeper) GetResourceNodeNotBondedToken(ctx sdk.Context) (token sdk.Coin)

func (Keeper) GetResourceNodesFiltered added in v0.4.0

func (k Keeper) GetResourceNodesFiltered(ctx sdk.Context, params types.QueryNodesParams) []types.ResourceNode

func (Keeper) GetSlashing added in v0.7.0

func (k Keeper) GetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress) (res sdk.Int)

func (Keeper) GetTotalUnissuedPrepay added in v0.6.2

func (k Keeper) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk.Coin)

func (Keeper) GetUnbondingNode added in v0.4.0

func (k Keeper) GetUnbondingNode(ctx sdk.Context,
	networkAddr stratos.SdsAddress) (ubd types.UnbondingNode, found bool)

return a unbonding UnbondingIndexingNode

func (Keeper) GetUnbondingNodeBalance added in v0.4.0

func (k Keeper) GetUnbondingNodeBalance(ctx sdk.Context,
	networkAddr stratos.SdsAddress) sdk.Int

GetUnbondingNodeBalance returns an unbonding balance and an UnbondingNode

func (Keeper) GetUnbondingNodeQueueTimeSlice added in v0.4.0

func (k Keeper) GetUnbondingNodeQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (networkAddrs []stratos.SdsAddress)

gets a specific unbonding queue timeslice. A timeslice is a slice of DVPairs corresponding to unbonding delegations that expire at a certain time.

func (Keeper) GetUnbondingNodes added in v0.4.0

func (k Keeper) GetUnbondingNodes(ctx sdk.Context, networkAddr stratos.SdsAddress,
	maxRetrieve uint16) (unbondingIndexingNodes []types.UnbondingNode)

return a given amount of all the UnbondingIndexingNodes

func (Keeper) HandleVoteForIndexingNodeRegistration

func (k Keeper) HandleVoteForIndexingNodeRegistration(ctx sdk.Context, nodeAddr stratos.SdsAddress, ownerAddr sdk.AccAddress,
	opinion types.VoteOpinion, voterAddr stratos.SdsAddress) (nodeStatus sdk.BondStatus, err error)

func (Keeper) HasMaxUnbondingNodeEntries added in v0.4.0

func (k Keeper) HasMaxUnbondingNodeEntries(ctx sdk.Context, networkAddr stratos.SdsAddress) bool

HasMaxUnbondingIndexingNodeEntries - check if unbonding IndexingNode has maximum number of entries

func (Keeper) InsertUnbondingNodeQueue added in v0.4.0

func (k Keeper) InsertUnbondingNodeQueue(ctx sdk.Context, ubd types.UnbondingNode,
	completionTime time.Time)

Insert an unbonding delegation to the appropriate timeslice in the unbonding queue

func (Keeper) IterateUnbondingNodes added in v0.4.0

func (k Keeper) IterateUnbondingNodes(ctx sdk.Context, fn func(index int64, ubd types.UnbondingNode) (stop bool))

iterate through all of the unbonding indexingNodes

func (Keeper) IteratorSlashingInfo added in v0.7.0

func (k Keeper) IteratorSlashingInfo(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, slashing sdk.Int) (stop bool))

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MaxEntries added in v0.4.0

func (k Keeper) MaxEntries(ctx sdk.Context) (res uint16)

MaxEntries - Maximum number of simultaneous unbonding delegations or redelegations (per pair/trio)

func (Keeper) RegisterIndexingNode

func (k Keeper) RegisterIndexingNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey crypto.PubKey, ownerAddr sdk.AccAddress,
	description types.Description, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error)

func (Keeper) RegisterResourceNode

func (k Keeper) RegisterResourceNode(ctx sdk.Context, networkAddr stratos.SdsAddress, pubKey crypto.PubKey, ownerAddr sdk.AccAddress,
	description types.Description, nodeType types.NodeType, stake sdk.Coin) (ozoneLimitChange sdk.Int, err error)

func (Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode added in v0.4.0

func (k Keeper) RemoveTokenFromPoolWhileUnbondingIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error

func (Keeper) RemoveTokenFromPoolWhileUnbondingResourceNode added in v0.4.0

func (k Keeper) RemoveTokenFromPoolWhileUnbondingResourceNode(ctx sdk.Context, resourceNode types.ResourceNode, tokenToSub sdk.Coin) error

func (Keeper) RemoveUnbondingNode added in v0.4.0

func (k Keeper) RemoveUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode)

remove the unbonding IndexingNode object

func (*Keeper) SetHooks added in v0.4.0

func (k *Keeper) SetHooks(sh types.RegisterHooks) *Keeper

Set the register hooks

func (Keeper) SetIndexingNode

func (k Keeper) SetIndexingNode(ctx sdk.Context, indexingNode types.IndexingNode)

set the main record holding indexing node details

func (Keeper) SetIndexingNodeBondedToken added in v0.4.0

func (k Keeper) SetIndexingNodeBondedToken(ctx sdk.Context, token sdk.Coin)

func (Keeper) SetIndexingNodeNotBondedToken added in v0.4.0

func (k Keeper) SetIndexingNodeNotBondedToken(ctx sdk.Context, token sdk.Coin)

func (Keeper) SetIndexingNodeRegistrationVotePool

func (k Keeper) SetIndexingNodeRegistrationVotePool(ctx sdk.Context, votePool types.IndexingNodeRegistrationVotePool)

func (Keeper) SetInitialGenesisStakeTotal

func (k Keeper) SetInitialGenesisStakeTotal(ctx sdk.Context, stake sdk.Int)

func (Keeper) SetInitialUOzonePrice added in v0.6.0

func (k Keeper) SetInitialUOzonePrice(ctx sdk.Context, price sdk.Dec)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the register parameters to the param space.

func (Keeper) SetRemainingOzoneLimit

func (k Keeper) SetRemainingOzoneLimit(ctx sdk.Context, value sdk.Int)

func (Keeper) SetResourceNode

func (k Keeper) SetResourceNode(ctx sdk.Context, resourceNode types.ResourceNode)

SetResourceNode sets the main record holding resource node details

func (Keeper) SetResourceNodeBondedToken added in v0.4.0

func (k Keeper) SetResourceNodeBondedToken(ctx sdk.Context, token sdk.Coin)

func (Keeper) SetResourceNodeNotBondedToken added in v0.4.0

func (k Keeper) SetResourceNodeNotBondedToken(ctx sdk.Context, token sdk.Coin)

func (Keeper) SetSlashing added in v0.7.0

func (k Keeper) SetSlashing(ctx sdk.Context, walletAddress sdk.AccAddress, slashing sdk.Int)

func (Keeper) SetTotalUnissuedPrepay added in v0.6.2

func (k Keeper) SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Coin)

func (Keeper) SetUnbondingNode added in v0.4.0

func (k Keeper) SetUnbondingNode(ctx sdk.Context, ubd types.UnbondingNode)

set the unbonding IndexingNode

func (Keeper) SetUnbondingNodeEntry added in v0.4.0

func (k Keeper) SetUnbondingNodeEntry(ctx sdk.Context, networkAddr stratos.SdsAddress, isIndexingNode bool,
	creationHeight int64, minTime time.Time, balance sdk.Int) types.UnbondingNode

SetUnbondingIndexingNodeEntry adds an entry to the unbonding IndexingNode at the given addresses. It creates the unbonding IndexingNode if it does not exist

func (Keeper) SetUnbondingNodeQueueTimeSlice added in v0.4.0

func (k Keeper) SetUnbondingNodeQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []stratos.SdsAddress)

Sets a specific unbonding queue timeslice.

func (Keeper) SubtractIndexingNodeStake

func (k Keeper) SubtractIndexingNodeStake(ctx sdk.Context, indexingNode types.IndexingNode, tokenToSub sdk.Coin) error

SubtractIndexingNodeStake Update the tokens of an existing indexing node

func (Keeper) SubtractResourceNodeStake

func (k Keeper) SubtractResourceNodeStake(ctx sdk.Context, resourceNode types.ResourceNode, tokenToSub sdk.Coin) error

SubtractResourceNodeStake Update the tokens of an existing resource node

func (Keeper) SubtractUBDNodeStake added in v0.4.0

func (k Keeper) SubtractUBDNodeStake(ctx sdk.Context, ubd types.UnbondingNode, tokenToSub sdk.Coin) error

func (Keeper) UBDNodeQueueIterator added in v0.4.0

func (k Keeper) UBDNodeQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns all the validator queue timeslices from time 0 until endTime

func (Keeper) UnbondAllMatureUBDNodeQueue added in v0.4.0

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

Unbonds all the unbonding validators that have finished their unbonding period

func (Keeper) UnbondIndexingNode added in v0.4.0

func (k Keeper) UnbondIndexingNode(
	ctx sdk.Context, indexingNode types.IndexingNode, amt sdk.Int,
) (ozoneLimitChange sdk.Int, unbondingMatureTime time.Time, err error)

func (Keeper) UnbondResourceNode added in v0.4.0

func (k Keeper) UnbondResourceNode(
	ctx sdk.Context, resourceNode types.ResourceNode, amt sdk.Int,
) (ozoneLimitChange sdk.Int, unbondingMatureTime time.Time, err error)

func (Keeper) UnbondingCompletionTime added in v0.4.0

func (k Keeper) UnbondingCompletionTime(ctx sdk.Context) (res time.Duration)

UnbondingCompletionTime

func (Keeper) UnbondingNodeQueueIterator added in v0.4.0

func (k Keeper) UnbondingNodeQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

Returns all the unbonding queue timeslices from time 0 until endTime

func (Keeper) UnbondingThreasholdTime added in v0.4.0

func (k Keeper) UnbondingThreasholdTime(ctx sdk.Context) (res time.Duration)

UnbondingThreasholdTime

func (Keeper) UozSupply added in v0.6.2

func (k Keeper) UozSupply(ctx sdk.Context) (remaining, total sdk.Int)

calc remaining/total supply for uoz

func (Keeper) UpdateIndexingNode added in v0.4.0

func (k Keeper) UpdateIndexingNode(ctx sdk.Context, description types.Description,
	networkAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) error

func (Keeper) UpdateIndexingNodeStake added in v0.6.0

func (k Keeper) UpdateIndexingNodeStake(ctx sdk.Context, networkAddr stratos.SdsAddress, ownerAddr sdk.AccAddress,
	stakeDelta sdk.Coin, incrStake bool) (ozoneLimitChange sdk.Int, unbondingMatureTime time.Time, err error)

func (Keeper) UpdateResourceNode added in v0.4.0

func (k Keeper) UpdateResourceNode(ctx sdk.Context, description types.Description, nodeType types.NodeType,
	networkAddr stratos.SdsAddress, ownerAddr sdk.AccAddress) error

func (Keeper) UpdateResourceNodeStake added in v0.6.0

func (k Keeper) UpdateResourceNodeStake(ctx sdk.Context, networkAddr stratos.SdsAddress, ownerAddr sdk.AccAddress,
	stakeDelta sdk.Coin, incrStake bool) (ozoneLimitChange sdk.Int, unbondingMatureTime time.Time, err error)

Jump to

Keyboard shortcuts

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