Documentation ¶
Index ¶
- Constants
- Variables
- func AddressInDecisions(addr sdk.AccAddress, decisions []types.PurchaseOrderDecision) bool
- func AllInvariants(keeper Keeper) sdk.Invariant
- func GenerateRandomAddresses(num int) []sdk.AccAddress
- func LockedUndEqual(lA, lB types.LockedUnd) bool
- func ModuleAccountInvariant(keeper Keeper) sdk.Invariant
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamsEqual(paramsA, paramsB types.Params) bool
- func PurchaseOrderEqual(poA types.EnterpriseUndPurchaseOrder, poB types.EnterpriseUndPurchaseOrder) bool
- func RandInBetween(min, max int) int
- func RandomDecision() types.PurchaseOrderStatus
- func RandomStatus() types.PurchaseOrderStatus
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
- type Keeper
- func (k Keeper) AccountHasLockedUnd(ctx sdk.Context, address sdk.AccAddress) bool
- func (k Keeper) AddAddressToWhitelist(ctx sdk.Context, address sdk.AccAddress) error
- func (k Keeper) AddressIsWhitelisted(ctx sdk.Context, address sdk.AccAddress) bool
- func (k Keeper) Cdc() *codec.Codec
- func (k Keeper) DecrementLockedUnd(ctx sdk.Context, address sdk.AccAddress, amount sdk.Coin) error
- func (k Keeper) DeleteLockedUndForAccount(ctx sdk.Context, address sdk.AccAddress)
- func (k Keeper) GetAllLockedUndAccountsIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetAllLockedUnds(ctx sdk.Context) types.LockedUnds
- func (k Keeper) GetAllPurchaseOrders(ctx sdk.Context) (purchaseOrders types.PurchaseOrders)
- func (k Keeper) GetAllWhitelistedAddresses(ctx sdk.Context) (addresses types.WhitelistAddresses)
- func (k Keeper) GetEnterpriseAccount(ctx sdk.Context) exported.ModuleAccountI
- func (k Keeper) GetHighestPurchaseOrderID(ctx sdk.Context) (purchaseOrderID uint64, err error)
- func (k Keeper) GetLockedUndAmountForAccount(ctx sdk.Context, address sdk.AccAddress) sdk.Coin
- func (k Keeper) GetLockedUndForAccount(ctx sdk.Context, address sdk.AccAddress) types.LockedUnd
- func (k Keeper) GetParamDecisionLimit(ctx sdk.Context) uint64
- func (k Keeper) GetParamDenom(ctx sdk.Context) string
- func (k Keeper) GetParamEntSigners(ctx sdk.Context) string
- func (k Keeper) GetParamEntSignersAsAddressArray(ctx sdk.Context) []sdk.AccAddress
- func (k Keeper) GetParamMinAccepts(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPurchaseOrder(ctx sdk.Context, purchaseOrderID uint64) types.EnterpriseUndPurchaseOrder
- func (k Keeper) GetPurchaseOrderAmount(ctx sdk.Context, purchaseOrderID uint64) sdk.Coin
- func (k Keeper) GetPurchaseOrderPurchaser(ctx sdk.Context, purchaseOrderID uint64) sdk.AccAddress
- func (k Keeper) GetPurchaseOrderStatus(ctx sdk.Context, purchaseOrderID uint64) types.PurchaseOrderStatus
- func (k Keeper) GetPurchaseOrdersFiltered(ctx sdk.Context, params types.QueryPurchaseOrdersParams) []types.EnterpriseUndPurchaseOrder
- func (k Keeper) GetTotalLockedUnd(ctx sdk.Context) sdk.Coin
- func (k Keeper) GetTotalSupplyIncludingLockedUnd(ctx sdk.Context) types.UndSupply
- func (k Keeper) GetTotalUnLockedUnd(ctx sdk.Context) sdk.Coin
- func (k Keeper) GetTotalUndSupply(ctx sdk.Context) sdk.Coin
- func (k Keeper) IsAuthorisedToDecide(ctx sdk.Context, signer sdk.AccAddress) bool
- func (k Keeper) IsLocked(ctx sdk.Context, address sdk.AccAddress) bool
- func (k Keeper) IteratePurchaseOrders(ctx sdk.Context, ...)
- func (k Keeper) IterateWhitelist(ctx sdk.Context, cb func(addr sdk.AccAddress) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintCoinsAndLock(ctx sdk.Context, recipient sdk.AccAddress, amount sdk.Coin) error
- func (k Keeper) ProcessAcceptedPurchaseOrders(ctx sdk.Context)
- func (k Keeper) ProcessPurchaseOrderDecision(ctx sdk.Context, purchaseOrderID uint64, decision types.PurchaseOrderStatus, ...) error
- func (k Keeper) ProcessWhitelistAction(ctx sdk.Context, address sdk.AccAddress, action types.WhitelistAction, ...) error
- func (k Keeper) PurchaseOrderExists(ctx sdk.Context, purchaseOrderID uint64) bool
- func (k Keeper) RaiseNewPurchaseOrder(ctx sdk.Context, purchaser sdk.AccAddress, amount sdk.Coin) (uint64, error)
- func (k Keeper) RemoveAddressFromWhitelist(ctx sdk.Context, address sdk.AccAddress) error
- func (k Keeper) SetHighestPurchaseOrderID(ctx sdk.Context, purchaseOrderID uint64)
- func (k Keeper) SetLockedUndForAccount(ctx sdk.Context, lockedUnd types.LockedUnd) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPurchaseOrder(ctx sdk.Context, purchaseOrder types.EnterpriseUndPurchaseOrder) error
- func (k Keeper) SetTotalLockedUnd(ctx sdk.Context, totalLocked sdk.Coin) error
- func (k Keeper) TallyPurchaseOrderDecisions(ctx sdk.Context)
- func (k Keeper) UnlockCoinsForFees(ctx sdk.Context, feePayer sdk.AccAddress, feesToPay sdk.Coins) error
- type LockedUndRetriever
- type NodeQuerier
- type ParamsRetriever
- type TotalSupplyRetriever
Constants ¶
const ( QueryParameters = "params" QueryPurchaseOrders = "orders" QueryGetPurchaseOrder = "order" QueryGetLocked = "locked" QueryTotalLocked = "total-locked" QueryTotalUnlocked = "total-unlocked" QueryTotalSupply = "total-supply" QueryWhitelist = "whitelist" QueryWhitelisted = "whitelisted" )
const TestDenomination = "testc"
Variables ¶
var ( EntSignerAddr = sdk.AccAddress(entSignerPk.Address()) TestAddrs = []sdk.AccAddress{ entAddr1, entAddr2, entAddr3, entAddr4, entAddr5, } )
dummy addresses used for testing
Functions ¶
func AddressInDecisions ¶
func AddressInDecisions(addr sdk.AccAddress, decisions []types.PurchaseOrderDecision) bool
func AllInvariants ¶
AllInvariants runs all invariants of the enterprise module
func GenerateRandomAddresses ¶
func GenerateRandomAddresses(num int) []sdk.AccAddress
func LockedUndEqual ¶
func ModuleAccountInvariant ¶
ModuleAccountInvariant checks that the module account coins reflects the sum of locked FUND held on store
func NewQuerier ¶
NewQuerier is the module level router for state queries
func ParamsEqual ¶
func PurchaseOrderEqual ¶
func PurchaseOrderEqual(poA types.EnterpriseUndPurchaseOrder, poB types.EnterpriseUndPurchaseOrder) bool
PurchaseOrderEqual checks if two purchase orders are equal
func RandInBetween ¶
func RandomDecision ¶
func RandomDecision() types.PurchaseOrderStatus
func RandomStatus ¶
func RandomStatus() types.PurchaseOrderStatus
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
RegisterInvariants registers all enterprise invariants
Types ¶
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(storeKey sdk.StoreKey, supplyKeeper types.SupplyKeeper, accKeeper auth.AccountKeeper, paramSpace params.Subspace, cdc *codec.Codec) Keeper
NewKeeper creates new instances of the enterprise Keeper
func (Keeper) AccountHasLockedUnd ¶
Check if a record exists for locked FUND given an account address
func (Keeper) AddAddressToWhitelist ¶ added in v1.4.7
AddAddressToWhitelist adds an address to the whitelist
func (Keeper) AddressIsWhitelisted ¶ added in v1.4.7
Check if a record exists for locked FUND given an account address
func (Keeper) DecrementLockedUnd ¶
DecrementLockedUnd decrements the amount of locked FUND - used when purchase order is accepted
func (Keeper) DeleteLockedUndForAccount ¶
func (k Keeper) DeleteLockedUndForAccount(ctx sdk.Context, address sdk.AccAddress)
Deletes the accepted purchase order once processed
func (Keeper) GetAllLockedUndAccountsIterator ¶
Get an iterator over all accounts with Locked FUND
func (Keeper) GetAllLockedUnds ¶
func (k Keeper) GetAllLockedUnds(ctx sdk.Context) types.LockedUnds
func (Keeper) GetAllPurchaseOrders ¶
func (k Keeper) GetAllPurchaseOrders(ctx sdk.Context) (purchaseOrders types.PurchaseOrders)
GetAllPurchaseOrders returns all the purchase orders from store
func (Keeper) GetAllWhitelistedAddresses ¶ added in v1.4.7
func (k Keeper) GetAllWhitelistedAddresses(ctx sdk.Context) (addresses types.WhitelistAddresses)
GetAllWhitelistedAddresses returns an array of all currently whitelisted addresses
func (Keeper) GetEnterpriseAccount ¶
func (k Keeper) GetEnterpriseAccount(ctx sdk.Context) exported.ModuleAccountI
GetEnterpriseAccount returns the enterprise ModuleAccount
func (Keeper) GetHighestPurchaseOrderID ¶
GetHighestPurchaseOrderID gets the highest purchase order ID
func (Keeper) GetLockedUndAmountForAccount ¶
func (Keeper) GetLockedUndForAccount ¶
Gets a record for Locked FUND for a given address
func (Keeper) GetParamDecisionLimit ¶ added in v1.2.0
func (Keeper) GetParamEntSigners ¶ added in v1.2.0
func (Keeper) GetParamEntSignersAsAddressArray ¶ added in v1.2.0
func (k Keeper) GetParamEntSignersAsAddressArray(ctx sdk.Context) []sdk.AccAddress
func (Keeper) GetParamMinAccepts ¶ added in v1.2.0
func (Keeper) GetPurchaseOrder ¶
func (k Keeper) GetPurchaseOrder(ctx sdk.Context, purchaseOrderID uint64) types.EnterpriseUndPurchaseOrder
Gets a purchase order for a given purchaseOrderID
func (Keeper) GetPurchaseOrderAmount ¶
GetPurchaseOrderAmount - get the Amount of a raised purchase order for a given purchaseOrderID
func (Keeper) GetPurchaseOrderPurchaser ¶
GetPurchaseOrderPurchaser - get the Purchaser address of a purchase order should be the same as the search term!
func (Keeper) GetPurchaseOrderStatus ¶
func (k Keeper) GetPurchaseOrderStatus(ctx sdk.Context, purchaseOrderID uint64) types.PurchaseOrderStatus
GetPurchaseOrderStatus - get the Decision of a purchase order for a given purchaseOrderID
func (Keeper) GetPurchaseOrdersFiltered ¶
func (k Keeper) GetPurchaseOrdersFiltered(ctx sdk.Context, params types.QueryPurchaseOrdersParams) []types.EnterpriseUndPurchaseOrder
GetPurchaseOrdersFiltered retrieves purchase orders filtered by a given set of params which include pagination parameters along a purchase order status.
NOTE: If no filters are provided, all proposals will be returned in paginated form.
func (Keeper) GetTotalLockedUnd ¶
GetTotalLockedUnd returns the total locked FUND
func (Keeper) GetTotalSupplyIncludingLockedUnd ¶
GetTotalSupplyIncludingLockedUnd returns information including total FUND supply, total locked and unlocked
func (Keeper) GetTotalUnLockedUnd ¶
GetTotalUnLockedUnd returns the amount of unlocked FUND - i.e. in active circulation (totalSupply - locked)
func (Keeper) GetTotalUndSupply ¶
GetTotalUndSupply returns the total FUND in supply, obtained from the supply module's keeper
func (Keeper) IsAuthorisedToDecide ¶
func (Keeper) IteratePurchaseOrders ¶
func (k Keeper) IteratePurchaseOrders(ctx sdk.Context, cb func(purchaseOrder types.EnterpriseUndPurchaseOrder) (stop bool))
IteratePurchaseOrders iterates over the all the purchase orders and performs a callback function
func (Keeper) IterateWhitelist ¶ added in v1.4.7
IterateWhitelist iterates over the all the whitelisted addresses and performs a callback function
func (Keeper) MintCoinsAndLock ¶
MintCoinsAndLock implements an alias call to the underlying supply keeper's MintCoinsAndLock to be used in BeginBlocker.
func (Keeper) ProcessAcceptedPurchaseOrders ¶ added in v1.2.0
func (Keeper) ProcessPurchaseOrderDecision ¶
func (k Keeper) ProcessPurchaseOrderDecision(ctx sdk.Context, purchaseOrderID uint64, decision types.PurchaseOrderStatus, signer sdk.AccAddress) error
func (Keeper) ProcessWhitelistAction ¶ added in v1.4.7
func (k Keeper) ProcessWhitelistAction(ctx sdk.Context, address sdk.AccAddress, action types.WhitelistAction, signer sdk.AccAddress) error
ProcessWhitelistAction processes the add/remove whitelist messages
func (Keeper) PurchaseOrderExists ¶
Check if a raised purchase order for a given purchaseOrderID is in the store or not
func (Keeper) RaiseNewPurchaseOrder ¶
func (Keeper) RemoveAddressFromWhitelist ¶ added in v1.4.7
RemoveAddressFromWhitelist removes an address from the whitelist
func (Keeper) SetHighestPurchaseOrderID ¶
SetHighestPurchaseOrderID sets the new proposal ID to the store
func (Keeper) SetLockedUndForAccount ¶
Sets the Locked FUND data
func (Keeper) SetPurchaseOrder ¶
func (k Keeper) SetPurchaseOrder(ctx sdk.Context, purchaseOrder types.EnterpriseUndPurchaseOrder) error
Sets the Purchase Order data
func (Keeper) SetTotalLockedUnd ¶
SetTotalLockedUnd sets the total locked FUND
func (Keeper) TallyPurchaseOrderDecisions ¶ added in v1.2.0
func (Keeper) UnlockCoinsForFees ¶
type LockedUndRetriever ¶
type LockedUndRetriever struct {
// contains filtered or unexported fields
}
LockedUndRetriever defines the properties of a type that can be used to retrieve locked FUND.
func NewLockedUndRetriever ¶
func NewLockedUndRetriever(querier NodeQuerier) LockedUndRetriever
NewLockedUndRetriever initialises a new LockedUndRetriever instance.
func (LockedUndRetriever) GetLockedUnd ¶
func (ar LockedUndRetriever) GetLockedUnd(addr sdk.AccAddress) (types.LockedUnd, error)
GetLockedUndForAccount queries for locked FUND given an address. An error is returned if the query or decoding fails.
func (LockedUndRetriever) GetLockedUndHeight ¶
func (ar LockedUndRetriever) GetLockedUndHeight(addr sdk.AccAddress) (types.LockedUnd, int64, error)
GetLockedUndHeight queries for locked FUND given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.
type NodeQuerier ¶
type NodeQuerier interface { // QueryWithData performs a query to a Tendermint node with the provided path // and a data payload. It returns the result and height of the query upon success // or an error if the query fails. QueryWithData(path string, data []byte) ([]byte, int64, error) }
NodeQuerier is an interface that is satisfied by types that provide the QueryWithData method
type ParamsRetriever ¶
type ParamsRetriever struct {
// contains filtered or unexported fields
}
ParamsRetriever defines the properties of a type that can be used to retrieve enterprise params.
func NewParamsRetriever ¶
func NewParamsRetriever(querier NodeQuerier) ParamsRetriever
NewParamsRetriever initialises a new ParamsRetriever instance.
func (ParamsRetriever) GetParams ¶
func (ar ParamsRetriever) GetParams() (types.Params, error)
GetParams queries for parameters. An error is returned if the query or decoding fails.
func (ParamsRetriever) GetParamsHeight ¶
func (ar ParamsRetriever) GetParamsHeight() (types.Params, int64, error)
GetParamsHeight queries for parameters. Returns the height of the query with the params. An error is returned if the query or decoding fails.
type TotalSupplyRetriever ¶
type TotalSupplyRetriever struct {
// contains filtered or unexported fields
}
TotalSupplyRetriever defines the properties of a type that can be used to retrieve total FUND supply.
func NewTotalSupplyRetriever ¶
func NewTotalSupplyRetriever(querier NodeQuerier) TotalSupplyRetriever
NewTotalSupplyRetriever initialises a new TotalSupplyRetriever instance.
func (TotalSupplyRetriever) GetTotalSupply ¶
func (ar TotalSupplyRetriever) GetTotalSupply() (types.UndSupply, error)
GetLockedUndForAccount queries for locked FUND given an address. An error is returned if the query or decoding fails.
func (TotalSupplyRetriever) GetTotalSupplyHeight ¶
func (ar TotalSupplyRetriever) GetTotalSupplyHeight() (types.UndSupply, int64, error)
GetLockedUndHeight queries for locked FUND given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.