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 ErrFailedToMarshalBalanceHistory(err error) sdk.Error
- func ErrFailedToMarshalFollowerMeta(err error) sdk.Error
- func ErrFailedToMarshalFollowingMeta(err error) sdk.Error
- func ErrFailedToMarshalGrantPubKey(err error) sdk.Error
- func ErrFailedToMarshalPendingCoinDayQueue(err error) sdk.Error
- func ErrFailedToMarshalRelationship(err error) sdk.Error
- func ErrFailedToMarshalReward(err error) sdk.Error
- func ErrFailedToMarshalRewardHistory(err error) sdk.Error
- func ErrFailedToUnmarshalAccountBank(err error) sdk.Error
- func ErrFailedToUnmarshalAccountInfo(err error) sdk.Error
- func ErrFailedToUnmarshalAccountMeta(err error) sdk.Error
- func ErrFailedToUnmarshalBalanceHistory(err error) sdk.Error
- func ErrFailedToUnmarshalGrantPubKey(err error) sdk.Error
- func ErrFailedToUnmarshalPendingCoinDayQueue(err error) sdk.Error
- func ErrFailedToUnmarshalRelationship(err error) sdk.Error
- func ErrFailedToUnmarshalReward(err error) sdk.Error
- func ErrFailedToUnmarshalRewardHistory(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 AccountStorage
- func (as AccountStorage) DeleteGrantPubKey(ctx sdk.Context, me types.AccountKey, pubKey crypto.PubKey)
- func (as AccountStorage) DeleteRewardHistory(ctx sdk.Context, me types.AccountKey, bucketSlot int64)
- func (as AccountStorage) DoesAccountExist(ctx sdk.Context, accKey types.AccountKey) bool
- func (as AccountStorage) GetBalanceHistory(ctx sdk.Context, me types.AccountKey, bucketSlot int64) (*BalanceHistory, sdk.Error)
- func (as AccountStorage) GetBankFromAccountKey(ctx sdk.Context, me types.AccountKey) (*AccountBank, sdk.Error)
- func (as AccountStorage) GetGrantPubKey(ctx sdk.Context, me types.AccountKey, pubKey crypto.PubKey) (*GrantPubKey, 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) GetRelationship(ctx sdk.Context, me types.AccountKey, other types.AccountKey) (*Relationship, sdk.Error)
- func (as AccountStorage) GetReward(ctx sdk.Context, accKey types.AccountKey) (*Reward, sdk.Error)
- func (as AccountStorage) GetRewardHistory(ctx sdk.Context, me types.AccountKey, bucketSlot int64) (*RewardHistory, sdk.Error)
- func (as AccountStorage) IsMyFollower(ctx sdk.Context, me types.AccountKey, follower types.AccountKey) bool
- func (as AccountStorage) IsMyFollowing(ctx sdk.Context, me types.AccountKey, following types.AccountKey) bool
- func (as AccountStorage) IterateAccounts(ctx sdk.Context, process func(AccountInfo, AccountBank) (stop bool))
- func (as AccountStorage) RemoveFollowerMeta(ctx sdk.Context, me types.AccountKey, follower types.AccountKey)
- func (as AccountStorage) RemoveFollowingMeta(ctx sdk.Context, me types.AccountKey, following types.AccountKey)
- func (as AccountStorage) SetBalanceHistory(ctx sdk.Context, me types.AccountKey, bucketSlot int64, ...) sdk.Error
- func (as AccountStorage) SetBankFromAccountKey(ctx sdk.Context, username types.AccountKey, accBank *AccountBank) sdk.Error
- func (as AccountStorage) SetFollowerMeta(ctx sdk.Context, me types.AccountKey, meta FollowerMeta) sdk.Error
- func (as AccountStorage) SetFollowingMeta(ctx sdk.Context, me types.AccountKey, meta FollowingMeta) sdk.Error
- func (as AccountStorage) SetGrantPubKey(ctx sdk.Context, me types.AccountKey, pubKey crypto.PubKey, ...) 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) SetRelationship(ctx sdk.Context, me types.AccountKey, other types.AccountKey, ...) sdk.Error
- func (as AccountStorage) SetReward(ctx sdk.Context, accKey types.AccountKey, reward *Reward) sdk.Error
- func (as AccountStorage) SetRewardHistory(ctx sdk.Context, me types.AccountKey, bucketSlot int64, history *RewardHistory) sdk.Error
- type BalanceHistory
- type Detail
- type FollowerMeta
- type FollowingMeta
- type FrozenMoney
- type GrantPubKey
- type PendingCoinDay
- type PendingCoinDayQueue
- type Relationship
- type Reward
- type RewardDetail
- type RewardHistory
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 ErrFailedToMarshalBalanceHistory ¶
ErrFailedToMarshalBalanceHistory - error if marshal balance history failed
func ErrFailedToMarshalFollowerMeta ¶
ErrFailedToMarshalFollowerMeta - error if marshal follower meta failed
func ErrFailedToMarshalFollowingMeta ¶
ErrFailedToMarshalFollowingMeta - error if marshal following 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 ErrFailedToMarshalRelationship ¶
ErrFailedToMarshalRelationship - error if marshal relationship failed
func ErrFailedToMarshalReward ¶
ErrFailedToMarshalReward - error if marshal reward failed
func ErrFailedToMarshalRewardHistory ¶
ErrFailedToMarshalRewardHistory - error if marshal reward history 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 ErrFailedToUnmarshalBalanceHistory ¶
ErrFailedToUnmarshalBalanceHistory - error if unmarshal balance history 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 ErrFailedToUnmarshalRelationship ¶
ErrFailedToUnmarshalRelationship - error if unmarshal relationship failed
func ErrFailedToUnmarshalReward ¶
ErrFailedToUnmarshalReward - error if unmarshal account reward failed
func ErrFailedToUnmarshalRewardHistory ¶
ErrFailedToUnmarshalRewardHistory - error if unmarshal reward history 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"` NumOfTx int64 `json:"number_of_transaction"` NumOfReward int64 `json:"number_of_reward"` }
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 int64 `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 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) DeleteGrantPubKey ¶
func (as AccountStorage) DeleteGrantPubKey(ctx sdk.Context, me types.AccountKey, pubKey crypto.PubKey)
DeleteGrantPubKey - deletes given pubkey in KV.
func (AccountStorage) DeleteRewardHistory ¶
func (as AccountStorage) DeleteRewardHistory(ctx sdk.Context, me types.AccountKey, bucketSlot int64)
DeleteRewardHistory - delete reward history from KVStore
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) GetBalanceHistory ¶
func (as AccountStorage) GetBalanceHistory( ctx sdk.Context, me types.AccountKey, bucketSlot int64) (*BalanceHistory, sdk.Error)
GetRelationship - returns the relationship between two accounts
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) GetGrantPubKey ¶
func (as AccountStorage) GetGrantPubKey(ctx sdk.Context, me types.AccountKey, pubKey crypto.PubKey) (*GrantPubKey, sdk.Error)
GetGrantPubKey - 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) GetRelationship ¶
func (as AccountStorage) GetRelationship(ctx sdk.Context, me types.AccountKey, other types.AccountKey) (*Relationship, sdk.Error)
GetRelationship - returns the relationship between two accounts
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) GetRewardHistory ¶
func (as AccountStorage) GetRewardHistory( ctx sdk.Context, me types.AccountKey, bucketSlot int64) (*RewardHistory, sdk.Error)
GetRewardHistory - returns the history of rewards that a user received
func (AccountStorage) IsMyFollower ¶
func (as AccountStorage) IsMyFollower(ctx sdk.Context, me types.AccountKey, follower types.AccountKey) bool
IsMyfollower - returns true if `follower` follows `me`.
func (AccountStorage) IsMyFollowing ¶
func (as AccountStorage) IsMyFollowing(ctx sdk.Context, me types.AccountKey, following types.AccountKey) bool
IsMyFollowing - returns true if `me` follows `following`
func (AccountStorage) IterateAccounts ¶
func (as AccountStorage) IterateAccounts(ctx sdk.Context, process func(AccountInfo, AccountBank) (stop bool))
IterateAccounts - iterate accounts in KVStore
func (AccountStorage) RemoveFollowerMeta ¶
func (as AccountStorage) RemoveFollowerMeta(ctx sdk.Context, me types.AccountKey, follower types.AccountKey)
RemoveFollowerMeta removes follower meta info of a relationship.
func (AccountStorage) RemoveFollowingMeta ¶
func (as AccountStorage) RemoveFollowingMeta(ctx sdk.Context, me types.AccountKey, following types.AccountKey)
RemoveFollowingMeta - removes following meta info of a relationship.
func (AccountStorage) SetBalanceHistory ¶
func (as AccountStorage) SetBalanceHistory( ctx sdk.Context, me types.AccountKey, bucketSlot int64, history *BalanceHistory) sdk.Error
SetBalanceHistory - sets balance history
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) SetFollowerMeta ¶
func (as AccountStorage) SetFollowerMeta(ctx sdk.Context, me types.AccountKey, meta FollowerMeta) sdk.Error
SetFollowerMeta - sets follower meta info for a given account which includes time and follower name.
func (AccountStorage) SetFollowingMeta ¶
func (as AccountStorage) SetFollowingMeta(ctx sdk.Context, me types.AccountKey, meta FollowingMeta) sdk.Error
SetFollowerMeta - sets following meta info for a given account which includes time and following name.
func (AccountStorage) SetGrantPubKey ¶
func (as AccountStorage) SetGrantPubKey(ctx sdk.Context, me types.AccountKey, pubKey crypto.PubKey, grantPubKey *GrantPubKey) sdk.Error
SetGrantPubKey - 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) SetRelationship ¶
func (as AccountStorage) SetRelationship(ctx sdk.Context, me types.AccountKey, other types.AccountKey, relationship *Relationship) sdk.Error
SetRelationship - sets relationship for two accounts
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.
func (AccountStorage) SetRewardHistory ¶
func (as AccountStorage) SetRewardHistory( ctx sdk.Context, me types.AccountKey, bucketSlot int64, history *RewardHistory) sdk.Error
SetRewardHistory - sets reward history
type BalanceHistory ¶
type BalanceHistory struct {
Details []Detail `json:"details"`
}
BalanceHistory - records all transactions belong to the user Currently one balance history bundle can store at most 1000 transactions If number of transaction exceeds the limitation, a new bundle will be generated in KVStore Total number of history bundle is defined in metadata
type Detail ¶
type Detail struct { DetailType types.TransferDetailType `json:"detail_type"` From types.AccountKey `json:"from"` To types.AccountKey `json:"to"` Amount types.Coin `json:"amount"` Balance types.Coin `json:"balance"` CreatedAt int64 `json:"created_at"` Memo string `json:"memo"` }
Detail - detail of each income and outcome
type FollowerMeta ¶
type FollowerMeta struct { CreatedAt int64 `json:"created_at"` FollowerName types.AccountKey `json:"follower_name"` }
FollowerMeta - record all meta info about this relation
type FollowingMeta ¶
type FollowingMeta struct { CreatedAt int64 `json:"created_at"` FollowingName types.AccountKey `json:"following_name"` }
FollowingMeta - record all meta info about this relation
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 GrantPubKey ¶
type GrantPubKey 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"` }
GrantPubKey - user grant permission to a public key with a certain permission
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.Rat `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
type Relationship ¶
type Relationship struct {
DonationTimes int64 `json:"donation_times"`
}
Relationship - relation between two users
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 RewardDetail ¶
type RewardDetail struct { OriginalDonation types.Coin `json:"original_donation"` FrictionDonation types.Coin `json:"friction_donation"` ActualReward types.Coin `json:"actual_reward"` Consumer types.AccountKey `json:"consumer"` PostAuthor types.AccountKey `json:"post_author"` PostID string `json:"post_id"` }
RewardDetail - reward detail
type RewardHistory ¶
type RewardHistory struct {
Details []RewardDetail `json:"details"`
}
RewardHistory - reward history