Documentation ¶
Index ¶
- func ErrAccountBankNotFound() sdk.Error
- func ErrAccountInfoNotFound() sdk.Error
- func ErrAccountMetaNotFound() sdk.Error
- func ErrFailedToMarshalAccountBank(err error) sdk.Error
- func ErrFailedToMarshalAccountInfo(err error) sdk.Error
- func ErrFailedToMarshalAccountMeta(err error) sdk.Error
- func ErrFailedToMarshalGrantPubKey(err error) sdk.Error
- func ErrFailedToMarshalPendingCoinDayQueue(err error) sdk.Error
- func ErrFailedToMarshalReward(err error) sdk.Error
- func ErrFailedToUnmarshalAccountBank(err error) sdk.Error
- func ErrFailedToUnmarshalAccountInfo(err error) sdk.Error
- func ErrFailedToUnmarshalAccountMeta(err error) sdk.Error
- func ErrFailedToUnmarshalGrantPubKey(err error) sdk.Error
- func ErrFailedToUnmarshalPendingCoinDayQueue(err error) sdk.Error
- func ErrFailedToUnmarshalReward(err error) sdk.Error
- func ErrGrantPubKeyNotFound() sdk.Error
- func ErrPendingCoinDayQueueNotFound() sdk.Error
- func ErrRewardNotFound() sdk.Error
- func GetAccountBankKey(accKey types.AccountKey) []byte
- func GetAccountInfoKey(accKey types.AccountKey) []byte
- func GetAccountInfoPrefix() []byte
- func GetAccountMetaKey(accKey types.AccountKey) []byte
- type AccountBank
- type AccountInfo
- type AccountMeta
- type AccountRow
- type AccountRowIR
- type AccountStorage
- func (as AccountStorage) DeleteAllGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey)
- func (as AccountStorage) DoesAccountExist(ctx sdk.Context, accKey types.AccountKey) bool
- func (as AccountStorage) Export(ctx sdk.Context) *AccountTables
- func (as AccountStorage) GetAllGrantPermissions(ctx sdk.Context, me types.AccountKey) ([]*GrantPermission, sdk.Error)
- func (as AccountStorage) GetBankFromAccountKey(ctx sdk.Context, me types.AccountKey) (*AccountBank, sdk.Error)
- func (as AccountStorage) GetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey) ([]*GrantPermission, sdk.Error)
- func (as AccountStorage) GetInfo(ctx sdk.Context, accKey types.AccountKey) (*AccountInfo, sdk.Error)
- func (as AccountStorage) GetMeta(ctx sdk.Context, accKey types.AccountKey) (*AccountMeta, sdk.Error)
- func (as AccountStorage) GetPendingCoinDayQueue(ctx sdk.Context, me types.AccountKey) (*PendingCoinDayQueue, sdk.Error)
- func (as AccountStorage) GetReward(ctx sdk.Context, accKey types.AccountKey) (*Reward, sdk.Error)
- func (as AccountStorage) Import(ctx sdk.Context, tb *AccountTablesIR)
- func (as AccountStorage) IterateAccounts(ctx sdk.Context, process func(AccountInfo, AccountBank) (stop bool))
- func (as AccountStorage) SetBankFromAccountKey(ctx sdk.Context, username types.AccountKey, accBank *AccountBank) sdk.Error
- func (as AccountStorage) SetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey, ...) sdk.Error
- func (as AccountStorage) SetInfo(ctx sdk.Context, accKey types.AccountKey, accInfo *AccountInfo) sdk.Error
- func (as AccountStorage) SetMeta(ctx sdk.Context, accKey types.AccountKey, accMeta *AccountMeta) sdk.Error
- func (as AccountStorage) SetPendingCoinDayQueue(ctx sdk.Context, me types.AccountKey, pendingCoinDayQueue *PendingCoinDayQueue) sdk.Error
- func (as AccountStorage) SetReward(ctx sdk.Context, accKey types.AccountKey, reward *Reward) sdk.Error
- type AccountTables
- type AccountTablesIR
- type FrozenMoney
- type GrantPermission
- type GrantPermissionIR
- type GrantPubKeyRow
- type GrantPubKeyRowIR
- type PendingCoinDay
- type PendingCoinDayQueue
- type PendingCoinDayQueueIR
- type Reward
- type Transaction
- type TxAndSequenceNumber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrAccountBankNotFound ¶
ErrAccountBankNotFound - error if account bank is not found
func ErrAccountInfoNotFound ¶
ErrAccountInfoNotFound - error if account info is not found
func ErrAccountMetaNotFound ¶
ErrAccountMetaNotFound - error if account meta is not found
func ErrFailedToMarshalAccountBank ¶
ErrFailedToMarshalAccountBank - error if marshal account bank failed
func ErrFailedToMarshalAccountInfo ¶
ErrFailedToMarshalAccountInfo - error if marshal account info failed
func ErrFailedToMarshalAccountMeta ¶
ErrFailedToMarshalAccountMeta - error if marshal account meta failed
func ErrFailedToMarshalGrantPubKey ¶
ErrFailedToMarshalGrantPubKey - error if marshal grant public key failed
func ErrFailedToMarshalPendingCoinDayQueue ¶ added in v0.1.1
ErrFailedToMarshalPendingCoinDayQueue - error if marshal pending coin day queue failed
func ErrFailedToMarshalReward ¶
ErrFailedToMarshalReward - error if marshal reward failed
func ErrFailedToUnmarshalAccountBank ¶
ErrFailedToUnmarshalAccountBank - error if unmarshal account bank failed
func ErrFailedToUnmarshalAccountInfo ¶
ErrFailedToUnmarshalAccountInfo - error if unmarshal account info failed
func ErrFailedToUnmarshalAccountMeta ¶
ErrFailedToUnmarshalAccountMeta - error if unmarshal account meta failed
func ErrFailedToUnmarshalGrantPubKey ¶
ErrFailedToUnmarshalGrantPubKey - error if unmarshal grant public key failed
func ErrFailedToUnmarshalPendingCoinDayQueue ¶ added in v0.1.1
ErrFailedToUnmarshalPendingCoinDayQueue - error if unmarshal pending coin day queue failed
func ErrFailedToUnmarshalReward ¶
ErrFailedToUnmarshalReward - error if unmarshal account reward failed
func ErrGrantPubKeyNotFound ¶
ErrGrantPubKeyNotFound - error if grant public key is not found
func ErrPendingCoinDayQueueNotFound ¶ added in v0.1.1
ErrPendingCoinDayQueueNotFound - error if pending coin day queue is not found
func ErrRewardNotFound ¶
ErrRewardNotFound - error if reward is not found
func GetAccountBankKey ¶
func GetAccountBankKey(accKey types.AccountKey) []byte
GetAccountBankKey - "account bank substore" + "username"
func GetAccountInfoKey ¶
func GetAccountInfoKey(accKey types.AccountKey) []byte
GetAccountInfoKey - "account info substore" + "username"
func GetAccountInfoPrefix ¶ added in v0.1.1
func GetAccountInfoPrefix() []byte
GetAccountInfoPrefix - "account info substore"
func GetAccountMetaKey ¶
func GetAccountMetaKey(accKey types.AccountKey) []byte
GetAccountMetaKey - "account meta substore" + "username"
Types ¶
type AccountBank ¶
type AccountBank struct { Saving types.Coin `json:"saving"` CoinDay types.Coin `json:"coin_day"` FrozenMoneyList []FrozenMoney `json:"frozen_money_list"` }
AccountBank - user balance
type AccountInfo ¶
type AccountInfo struct { Username types.AccountKey `json:"username"` CreatedAt int64 `json:"created_at"` ResetKey crypto.PubKey `json:"reset_key"` TransactionKey crypto.PubKey `json:"transaction_key"` AppKey crypto.PubKey `json:"app_key"` }
AccountInfo - user information
type AccountMeta ¶
type AccountMeta struct { Sequence uint64 `json:"sequence"` LastActivityAt int64 `json:"last_activity_at"` TransactionCapacity types.Coin `json:"transaction_capacity"` JSONMeta string `json:"json_meta"` LastReportOrUpvoteAt int64 `json:"last_report_or_upvote_at"` LastPostAt int64 `json:"last_post_at"` }
AccountMeta - stores tiny and frequently updated fields.
type AccountRow ¶ added in v0.2.0
type AccountRow struct { Username types.AccountKey `json:"username"` Info AccountInfo `json:"info"` Bank AccountBank `json:"bank"` Meta AccountMeta `json:"meta"` Reward Reward `json:"reward"` PendingCoinDayQueue PendingCoinDayQueue `json:"pending_coin_day_queue"` }
AccountRow account related information when migrate, pk: Username
type AccountRowIR ¶ added in v0.2.0
type AccountRowIR struct { Username types.AccountKey `json:"username"` Info AccountInfo `json:"info"` Bank AccountBank `json:"bank"` Meta AccountMeta `json:"meta"` Reward Reward `json:"reward"` PendingCoinDayQueue PendingCoinDayQueueIR `json:"pending_coin_day_queue"` }
AccountRowIR account related information when migrate, pk: Username
type AccountStorage ¶
type AccountStorage struct {
// contains filtered or unexported fields
}
AccountStorage - account storage
func NewAccountStorage ¶
func NewAccountStorage(key sdk.StoreKey) AccountStorage
NewLinoAccountStorage - creates and returns a account manager
func (AccountStorage) DeleteAllGrantPermissions ¶ added in v0.2.0
func (as AccountStorage) DeleteAllGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey)
DeleteAllGrantPermissions - deletes all grant pubkeys from a granted user in KV.
func (AccountStorage) DoesAccountExist ¶
func (as AccountStorage) DoesAccountExist(ctx sdk.Context, accKey types.AccountKey) bool
DoesAccountExist - returns true when a specific account exist in the KVStore.
func (AccountStorage) Export ¶ added in v0.2.0
func (as AccountStorage) Export(ctx sdk.Context) *AccountTables
Export to table representation.
func (AccountStorage) GetAllGrantPermissions ¶ added in v0.2.0
func (as AccountStorage) GetAllGrantPermissions(ctx sdk.Context, me types.AccountKey) ([]*GrantPermission, sdk.Error)
GetAllGrantPermissions - returns grant user info keyed with pubkey.
func (AccountStorage) GetBankFromAccountKey ¶
func (as AccountStorage) GetBankFromAccountKey( ctx sdk.Context, me types.AccountKey) (*AccountBank, sdk.Error)
GetBankFromAccountKey - returns bank info of a specific account, returns error if any.
func (AccountStorage) GetGrantPermissions ¶ added in v0.2.0
func (as AccountStorage) GetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey) ([]*GrantPermission, sdk.Error)
GetGrantPermissions - returns grant user info keyed with pubkey.
func (AccountStorage) GetInfo ¶
func (as AccountStorage) GetInfo(ctx sdk.Context, accKey types.AccountKey) (*AccountInfo, sdk.Error)
GetInfo - returns general account info of a specific account, returns error otherwise.
func (AccountStorage) GetMeta ¶
func (as AccountStorage) GetMeta(ctx sdk.Context, accKey types.AccountKey) (*AccountMeta, sdk.Error)
GetMeta - returns meta of a given account that are tiny and frequently updated fields.
func (AccountStorage) GetPendingCoinDayQueue ¶ added in v0.1.1
func (as AccountStorage) GetPendingCoinDayQueue( ctx sdk.Context, me types.AccountKey) (*PendingCoinDayQueue, sdk.Error)
GetPendingCoinDayQueue - returns a pending coin day queue for a given address.
func (AccountStorage) GetReward ¶
func (as AccountStorage) GetReward(ctx sdk.Context, accKey types.AccountKey) (*Reward, sdk.Error)
GetReward - returns reward info of a given account, returns error if any.
func (AccountStorage) Import ¶ added in v0.2.0
func (as AccountStorage) Import(ctx sdk.Context, tb *AccountTablesIR)
Import from tablesIR.
func (AccountStorage) IterateAccounts ¶
func (as AccountStorage) IterateAccounts(ctx sdk.Context, process func(AccountInfo, AccountBank) (stop bool))
IterateAccounts - iterate accounts in KVStore
func (AccountStorage) SetBankFromAccountKey ¶
func (as AccountStorage) SetBankFromAccountKey(ctx sdk.Context, username types.AccountKey, accBank *AccountBank) sdk.Error
SetBankFromAddress - sets bank info for a given address, returns error if any.
func (AccountStorage) SetGrantPermissions ¶ added in v0.2.0
func (as AccountStorage) SetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey, grantPubKeys []*GrantPermission) sdk.Error
SetGrantPermissions - sets a grant user to KV. Key is pubkey and value is grant user info
func (AccountStorage) SetInfo ¶
func (as AccountStorage) SetInfo(ctx sdk.Context, accKey types.AccountKey, accInfo *AccountInfo) sdk.Error
SetInfo - sets general account info to a specific account, returns error if any.
func (AccountStorage) SetMeta ¶
func (as AccountStorage) SetMeta(ctx sdk.Context, accKey types.AccountKey, accMeta *AccountMeta) sdk.Error
SetMeta - sets meta for a given account, returns error if any.
func (AccountStorage) SetPendingCoinDayQueue ¶ added in v0.1.1
func (as AccountStorage) SetPendingCoinDayQueue(ctx sdk.Context, me types.AccountKey, pendingCoinDayQueue *PendingCoinDayQueue) sdk.Error
SetPendingCoinDayQueue - sets a pending coin day queue for a given username.
func (AccountStorage) SetReward ¶
func (as AccountStorage) SetReward(ctx sdk.Context, accKey types.AccountKey, reward *Reward) sdk.Error
SetReward - sets the rewards info of a given account, returns error if any.
type AccountTables ¶ added in v0.2.0
type AccountTables struct { Accounts []AccountRow `json:"accounts"` AccountGrantPubKeys []GrantPubKeyRow `json:"account_grant_pub_keys"` }
AccountTables is the state of account storage, organized as a table.
type AccountTablesIR ¶ added in v0.2.0
type AccountTablesIR struct { Accounts []AccountRowIR `json:"accounts"` AccountGrantPubKeys []GrantPubKeyRowIR `json:"account_grant_pub_keys"` }
AccountTablesIR -
type FrozenMoney ¶
type FrozenMoney struct { Amount types.Coin `json:"amount"` StartAt int64 `json:"start_at"` Times int64 `json:"times"` Interval int64 `json:"interval"` }
FrozenMoney - frozen money
type GrantPermission ¶ added in v0.2.0
type GrantPermission struct { GrantTo types.AccountKey `json:"grant_to"` Permission types.Permission `json:"permission"` CreatedAt int64 `json:"created_at"` ExpiresAt int64 `json:"expires_at"` Amount types.Coin `json:"amount"` }
GrantPermission - user grant permission to a user with a certain permission
func (GrantPermission) ToIR ¶ added in v0.2.1
func (g GrantPermission) ToIR() GrantPermissionIR
ToIR - name change, username -> GrantTo
type GrantPermissionIR ¶ added in v0.2.1
type GrantPermissionIR struct { Username types.AccountKey `json:"username"` Permission types.Permission `json:"permission"` CreatedAt int64 `json:"created_at"` ExpiresAt int64 `json:"expires_at"` Amount types.Coin `json:"amount"` }
GrantPermissionIR - user grant permission to a user with a certain permission XXX(yumin): note that there is a field name change during upgrade-1.
func (GrantPermissionIR) ToState ¶ added in v0.2.1
func (g GrantPermissionIR) ToState() *GrantPermission
ToState - convert IR back to state.
type GrantPubKeyRow ¶ added in v0.2.0
type GrantPubKeyRow struct { Username types.AccountKey `json:"username"` PubKey crypto.PubKey `json:"pub_key"` GrantPubKey GrantPermission `json:"grant_pub_key"` }
GrantPubKeyRow also in account, pk: (Username, pubKey)
type GrantPubKeyRowIR ¶ added in v0.2.1
type GrantPubKeyRowIR struct { Username types.AccountKey `json:"username"` PubKey crypto.PubKey `json:"pub_key"` GrantPubKey GrantPermissionIR `json:"grant_pub_key"` }
GrantPubKeyRowIR also in account, pk: (Username, pubKey)
type PendingCoinDay ¶ added in v0.1.1
type PendingCoinDay struct { StartTime int64 `json:"start_time"` EndTime int64 `json:"end_time"` Coin types.Coin `json:"coin"` }
PendingCoinDay - pending coin day in the list
type PendingCoinDayQueue ¶ added in v0.1.1
type PendingCoinDayQueue struct { LastUpdatedAt int64 `json:"last_updated_at"` TotalCoinDay sdk.Dec `json:"total_coin_day"` TotalCoin types.Coin `json:"total_coin"` PendingCoinDays []PendingCoinDay `json:"pending_coin_days"` }
PendingCoinDayQueue - stores a list of pending coin day and total number of coin waiting in list
func (PendingCoinDayQueue) ToIR ¶ added in v0.2.0
func (p PendingCoinDayQueue) ToIR() PendingCoinDayQueueIR
ToIR coin.
type PendingCoinDayQueueIR ¶ added in v0.2.0
type PendingCoinDayQueueIR struct { LastUpdatedAt int64 `json:"last_updated_at"` TotalCoinDay string `json:"total_coin_day"` TotalCoin types.Coin `json:"total_coin"` PendingCoinDays []PendingCoinDay `json:"pending_coin_days"` }
PendingCoinDayQueueIR - TotalCoinDay: rat -> string
type Reward ¶
type Reward struct { TotalIncome types.Coin `json:"total_income"` OriginalIncome types.Coin `json:"original_income"` FrictionIncome types.Coin `json:"friction_income"` InflationIncome types.Coin `json:"inflation_income"` UnclaimReward types.Coin `json:"unclaim_reward"` }
Reward - get from the inflation pool
type Transaction ¶ added in v0.2.8
type TxAndSequenceNumber ¶ added in v0.2.8
type TxAndSequenceNumber struct { Username string `json:"username"` Sequence uint64 `json:"sequence"` Tx *Transaction `json:"tx"` }