account

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 18 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestAccountKVStoreKey = sdk.NewKVStoreKey("account")
	TestGlobalKVStoreKey  = sdk.NewKVStoreKey("global")
	TestParamKVStoreKey   = sdk.NewKVStoreKey("param")
)

Functions

func CreateCoinReturnEvents

func CreateCoinReturnEvents(
	username types.AccountKey, times int64, interval int64, coin types.Coin,
	returnType types.TransferDetailType) ([]types.Event, sdk.Error)

create coin return events

func ErrAccountAlreadyExists

func ErrAccountAlreadyExists(accKey types.AccountKey) sdk.Error

func ErrAccountNotFound

func ErrAccountNotFound(username types.AccountKey) sdk.Error

func ErrAccountSavingCoinNotEnough

func ErrAccountSavingCoinNotEnough() sdk.Error

func ErrAccountTPSCapacityNotEnough

func ErrAccountTPSCapacityNotEnough(accKey types.AccountKey) sdk.Error

func ErrAddSavingCoin

func ErrAddSavingCoin() sdk.Error

func ErrAddSavingCoinWithFullStake

func ErrAddSavingCoinWithFullStake() sdk.Error

func ErrAppGrantKeyMismatch

func ErrAppGrantKeyMismatch(owner types.AccountKey) sdk.Error

func ErrCheckAuthenticatePubKeyOwner

func ErrCheckAuthenticatePubKeyOwner(accKey types.AccountKey) sdk.Error

func ErrCheckGrantAppKey

func ErrCheckGrantAppKey() sdk.Error

func ErrCheckResetKey

func ErrCheckResetKey() sdk.Error

func ErrCheckTransactionKey

func ErrCheckTransactionKey() sdk.Error

func ErrCheckUserTPSCapacity

func ErrCheckUserTPSCapacity(accKey types.AccountKey) sdk.Error

func ErrFolloweeNotFound

func ErrFolloweeNotFound(username types.AccountKey) sdk.Error

func ErrFollowerNotFound

func ErrFollowerNotFound(username types.AccountKey) sdk.Error

func ErrGetAppKey

func ErrGetAppKey(accKey types.AccountKey) sdk.Error

func ErrGetFrozenMoneyList

func ErrGetFrozenMoneyList(err error) sdk.Error

func ErrGetLastReportOrUpvoteAt

func ErrGetLastReportOrUpvoteAt(err error) sdk.Error

func ErrGetResetKey

func ErrGetResetKey(accKey types.AccountKey) sdk.Error

func ErrGetSavingFromBank

func ErrGetSavingFromBank(err error) sdk.Error

func ErrGetSequence

func ErrGetSequence(err error) sdk.Error

func ErrGetTransactionKey

func ErrGetTransactionKey(accKey types.AccountKey) sdk.Error

func ErrGrantKeyExpired

func ErrGrantKeyExpired(owner types.AccountKey) sdk.Error

func ErrGrantKeyMismatch

func ErrGrantKeyMismatch(owner types.AccountKey) sdk.Error

func ErrGrantKeyNoLeftTimes

func ErrGrantKeyNoLeftTimes(owner types.AccountKey) sdk.Error

func ErrIncreaseSequenceByOne

func ErrIncreaseSequenceByOne(err error) sdk.Error

func ErrInvalidJSONMeta

func ErrInvalidJSONMeta() sdk.Error

func ErrInvalidMemo

func ErrInvalidMemo() sdk.Error

func ErrInvalidUsername

func ErrInvalidUsername(msg string) sdk.Error

func ErrPreAuthAmountInsufficient

func ErrPreAuthAmountInsufficient(owner types.AccountKey, balance, consume types.Coin) sdk.Error

func ErrPreAuthGrantKeyMismatch

func ErrPreAuthGrantKeyMismatch(owner types.AccountKey) sdk.Error

func ErrReceiverNotFound

func ErrReceiverNotFound(username types.AccountKey) sdk.Error

func ErrReferrerNotFound

func ErrReferrerNotFound(username types.AccountKey) sdk.Error

func ErrRegisterFeeInsufficient

func ErrRegisterFeeInsufficient() sdk.Error

func ErrRevokePermissionLevelMismatch

func ErrRevokePermissionLevelMismatch(got, expect types.Permission) sdk.Error

func ErrSenderNotFound

func ErrSenderNotFound(username types.AccountKey) sdk.Error

func ErrUnsupportGrantLevel

func ErrUnsupportGrantLevel() sdk.Error

func ErrUpdateLastReportOrUpvoteAt

func ErrUpdateLastReportOrUpvoteAt(err error) sdk.Error

func InitGlobalManager

func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error

func NewHandler

func NewHandler(am AccountManager, gm global.GlobalManager) sdk.Handler

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

Types

type AccountManager

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

linoaccount encapsulates all basic struct

func NewAccountManager

func NewAccountManager(key sdk.StoreKey, holder param.ParamHolder) AccountManager

NewLinoAccount return the account pointer

func (AccountManager) AddBalanceHistory

func (accManager AccountManager) AddBalanceHistory(
	ctx sdk.Context, username types.AccountKey, numOfTx int64,
	transactionDetail model.Detail) sdk.Error

func (AccountManager) AddDirectDeposit

func (accManager AccountManager) AddDirectDeposit(
	ctx sdk.Context, username types.AccountKey, directDeposit types.Coin) sdk.Error

When user received the donation, the donation except friction will be added to total income and original income

func (AccountManager) AddFrozenMoney

func (accManager AccountManager) AddFrozenMoney(
	ctx sdk.Context, username types.AccountKey,
	amount types.Coin, start, interval, times int64) sdk.Error

func (AccountManager) AddIncomeAndReward

func (accManager AccountManager) AddIncomeAndReward(
	ctx sdk.Context, username types.AccountKey,
	originalDonation, friction, actualReward types.Coin,
	consumer, postAuthor types.AccountKey, postID string) sdk.Error

After the evaluate of content value, the original friction will be added to original income and friciton income. The actual inflation will be added to inflation income, total income and unclaim reward

func (AccountManager) AddRewardHistory

func (accManager AccountManager) AddRewardHistory(
	ctx sdk.Context, username types.AccountKey, numOfReward int64,
	rewardDetail model.RewardDetail) sdk.Error

func (AccountManager) AddSavingCoin

func (accManager AccountManager) AddSavingCoin(
	ctx sdk.Context, username types.AccountKey, coin types.Coin, from types.AccountKey, memo string,
	detailType types.TransferDetailType) (err sdk.Error)

func (AccountManager) AddSavingCoinWithFullStake

func (accManager AccountManager) AddSavingCoinWithFullStake(
	ctx sdk.Context, username types.AccountKey, coin types.Coin, from types.AccountKey, memo string,
	detailType types.TransferDetailType) (err sdk.Error)

func (AccountManager) AuthorizePermission

func (accManager AccountManager) AuthorizePermission(
	ctx sdk.Context, me types.AccountKey, authorizedUser types.AccountKey,
	validityPeriod int64, grantLevel types.Permission, amount types.Coin) sdk.Error

func (AccountManager) CheckSigningPubKeyOwner

func (accManager AccountManager) CheckSigningPubKeyOwner(
	ctx sdk.Context, me types.AccountKey, signKey crypto.PubKey,
	permission types.Permission, amount types.Coin) (types.AccountKey, sdk.Error)

func (AccountManager) CheckUserTPSCapacity

func (accManager AccountManager) CheckUserTPSCapacity(
	ctx sdk.Context, me types.AccountKey, tpsCapacityRatio sdk.Rat) sdk.Error

func (AccountManager) ClaimReward

func (accManager AccountManager) ClaimReward(
	ctx sdk.Context, username types.AccountKey) sdk.Error

func (AccountManager) ClearRewardHistory

func (accManager AccountManager) ClearRewardHistory(
	ctx sdk.Context, username types.AccountKey) sdk.Error

func (AccountManager) CreateAccount

func (accManager AccountManager) CreateAccount(
	ctx sdk.Context, referrer types.AccountKey, username types.AccountKey,
	resetKey, transactionKey, appKey crypto.PubKey, registerDeposit types.Coin) sdk.Error

create account, caller should make sure the register fee is valid

func (AccountManager) DoesAccountExist

func (accManager AccountManager) DoesAccountExist(ctx sdk.Context, username types.AccountKey) bool

check if account exist

func (AccountManager) GetAppKey

func (accManager AccountManager) GetAppKey(
	ctx sdk.Context, username types.AccountKey) (crypto.PubKey, sdk.Error)

func (AccountManager) GetDonationRelationship

func (accManager AccountManager) GetDonationRelationship(
	ctx sdk.Context, me, other types.AccountKey) (int64, sdk.Error)

func (AccountManager) GetFrozenMoneyList

func (accManager AccountManager) GetFrozenMoneyList(
	ctx sdk.Context, username types.AccountKey) ([]model.FrozenMoney, sdk.Error)

func (AccountManager) GetLastReportOrUpvoteAt

func (accManager AccountManager) GetLastReportOrUpvoteAt(
	ctx sdk.Context, username types.AccountKey) (int64, sdk.Error)

check if account exist

func (AccountManager) GetRegisterFee

func (accManager AccountManager) GetRegisterFee(ctx sdk.Context) (types.Coin, sdk.Error)

get register fee

func (AccountManager) GetResetKey

func (accManager AccountManager) GetResetKey(
	ctx sdk.Context, username types.AccountKey) (crypto.PubKey, sdk.Error)

func (AccountManager) GetSavingFromBank

func (accManager AccountManager) GetSavingFromBank(
	ctx sdk.Context, username types.AccountKey) (types.Coin, sdk.Error)

func (AccountManager) GetSequence

func (accManager AccountManager) GetSequence(
	ctx sdk.Context, username types.AccountKey) (int64, sdk.Error)

func (AccountManager) GetStake

func (accManager AccountManager) GetStake(
	ctx sdk.Context, username types.AccountKey) (types.Coin, sdk.Error)

use coin to present stake to prevent overflow

func (AccountManager) GetTransactionKey

func (accManager AccountManager) GetTransactionKey(
	ctx sdk.Context, username types.AccountKey) (crypto.PubKey, sdk.Error)

func (AccountManager) IncreaseSequenceByOne

func (accManager AccountManager) IncreaseSequenceByOne(
	ctx sdk.Context, username types.AccountKey) sdk.Error

func (AccountManager) IsMyFollower

func (accManager AccountManager) IsMyFollower(
	ctx sdk.Context, me types.AccountKey, follower types.AccountKey) bool

func (AccountManager) IsMyFollowing

func (accManager AccountManager) IsMyFollowing(
	ctx sdk.Context, me types.AccountKey, following types.AccountKey) bool

func (AccountManager) IterateAccounts

func (accManager AccountManager) IterateAccounts(ctx sdk.Context, process func(model.AccountInfo, model.AccountBank) (stop bool))

func (AccountManager) MinusSavingCoin

func (accManager AccountManager) MinusSavingCoin(
	ctx sdk.Context, username types.AccountKey, coin types.Coin, to types.AccountKey,
	memo string, detailType types.TransferDetailType) (err sdk.Error)

func (AccountManager) RecoverAccount

func (accManager AccountManager) RecoverAccount(
	ctx sdk.Context, username types.AccountKey,
	newResetPubKey, newTransactionPubKey, newAppPubKey crypto.PubKey) sdk.Error

func (AccountManager) RemoveFollower

func (accManager AccountManager) RemoveFollower(
	ctx sdk.Context, me types.AccountKey, follower types.AccountKey) sdk.Error

func (AccountManager) RemoveFollowing

func (accManager AccountManager) RemoveFollowing(
	ctx sdk.Context, me types.AccountKey, following types.AccountKey) sdk.Error

func (AccountManager) RevokePermission

func (accManager AccountManager) RevokePermission(
	ctx sdk.Context, me types.AccountKey, pubKey crypto.PubKey) sdk.Error

func (AccountManager) SetFollower

func (accManager AccountManager) SetFollower(
	ctx sdk.Context, me types.AccountKey, follower types.AccountKey) sdk.Error

func (AccountManager) SetFollowing

func (accManager AccountManager) SetFollowing(
	ctx sdk.Context, me types.AccountKey, following types.AccountKey) sdk.Error

func (AccountManager) UpdateDonationRelationship

func (accManager AccountManager) UpdateDonationRelationship(
	ctx sdk.Context, me, other types.AccountKey) sdk.Error

func (AccountManager) UpdateJSONMeta

func (accManager AccountManager) UpdateJSONMeta(
	ctx sdk.Context, username types.AccountKey, JSONMeta string) sdk.Error

func (AccountManager) UpdateLastReportOrUpvoteAt

func (accManager AccountManager) UpdateLastReportOrUpvoteAt(
	ctx sdk.Context, username types.AccountKey) sdk.Error

check if account exist

type ClaimMsg

type ClaimMsg struct {
	Username types.AccountKey `json:"username"`
}

func NewClaimMsg

func NewClaimMsg(username string) ClaimMsg

Claim Msg Implementations

func (ClaimMsg) GetConsumeAmount

func (msg ClaimMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (ClaimMsg) GetPermission

func (msg ClaimMsg) GetPermission() types.Permission

func (ClaimMsg) GetSignBytes

func (msg ClaimMsg) GetSignBytes() []byte

func (ClaimMsg) GetSigners

func (msg ClaimMsg) GetSigners() []sdk.AccAddress

func (ClaimMsg) String

func (msg ClaimMsg) String() string

func (ClaimMsg) Type

func (msg ClaimMsg) Type() string

func (ClaimMsg) ValidateBasic

func (msg ClaimMsg) ValidateBasic() sdk.Error

type FollowMsg

type FollowMsg struct {
	Follower types.AccountKey `json:"follower"`
	Followee types.AccountKey `json:"followee"`
}

func NewFollowMsg

func NewFollowMsg(follower string, followee string) FollowMsg

Follow Msg Implementations

func (FollowMsg) GetConsumeAmount

func (msg FollowMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (FollowMsg) GetPermission

func (msg FollowMsg) GetPermission() types.Permission

Implements Msg.

func (FollowMsg) GetSignBytes

func (msg FollowMsg) GetSignBytes() []byte

func (FollowMsg) GetSigners

func (msg FollowMsg) GetSigners() []sdk.AccAddress

func (FollowMsg) String

func (msg FollowMsg) String() string

func (FollowMsg) Type

func (msg FollowMsg) Type() string

func (FollowMsg) ValidateBasic

func (msg FollowMsg) ValidateBasic() sdk.Error

type RecoverMsg

type RecoverMsg struct {
	Username             types.AccountKey `json:"username"`
	NewResetPubKey       crypto.PubKey    `json:"new_reset_public_key"`
	NewTransactionPubKey crypto.PubKey    `json:"new_transaction_public_key"`
	NewAppPubKey         crypto.PubKey    `json:"new_app_public_key"`
}

func NewRecoverMsg

func NewRecoverMsg(
	username string, resetPubkey, transactionPubkey,
	appPubkey crypto.PubKey) RecoverMsg

Recover Msg Implementations

func (RecoverMsg) GetConsumeAmount

func (msg RecoverMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (RecoverMsg) GetPermission

func (msg RecoverMsg) GetPermission() types.Permission

func (RecoverMsg) GetSignBytes

func (msg RecoverMsg) GetSignBytes() []byte

func (RecoverMsg) GetSigners

func (msg RecoverMsg) GetSigners() []sdk.AccAddress

func (RecoverMsg) String

func (msg RecoverMsg) String() string

func (RecoverMsg) Type

func (msg RecoverMsg) Type() string

func (RecoverMsg) ValidateBasic

func (msg RecoverMsg) ValidateBasic() sdk.Error

type RegisterMsg

type RegisterMsg struct {
	Referrer             types.AccountKey `json:"referrer"`
	RegisterFee          types.LNO        `json:"register_fee"`
	NewUser              types.AccountKey `json:"new_username"`
	NewResetPubKey       crypto.PubKey    `json:"new_reset_public_key"`
	NewTransactionPubKey crypto.PubKey    `json:"new_transaction_public_key"`
	NewAppPubKey         crypto.PubKey    `json:"new_app_public_key"`
}

RegisterMsg - bind username with public key, need to be referred by others (pay for it).

func NewRegisterMsg

func NewRegisterMsg(
	referrer string, newUser string, registerFee types.LNO,
	resetPubkey, transactionPubkey, appPubkey crypto.PubKey) RegisterMsg

NewRegisterMsg - construct register msg.

func (RegisterMsg) GetConsumeAmount

func (msg RegisterMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (RegisterMsg) GetPermission

func (msg RegisterMsg) GetPermission() types.Permission

func (RegisterMsg) GetSignBytes

func (msg RegisterMsg) GetSignBytes() []byte

Implements Msg.

func (RegisterMsg) GetSigners

func (msg RegisterMsg) GetSigners() []sdk.AccAddress

Implements Msg.

func (RegisterMsg) String

func (msg RegisterMsg) String() string

func (RegisterMsg) Type

func (msg RegisterMsg) Type() string

Implements Msg.

func (RegisterMsg) ValidateBasic

func (msg RegisterMsg) ValidateBasic() sdk.Error

Implements Msg.

type ReturnCoinEvent

type ReturnCoinEvent struct {
	Username   types.AccountKey         `json:"username"`
	Amount     types.Coin               `json:"amount"`
	ReturnType types.TransferDetailType `json:"return_type"`
}

ReturnCoin Event return a certain amount of coin to an account

func (ReturnCoinEvent) Execute

func (event ReturnCoinEvent) Execute(ctx sdk.Context, am AccountManager) sdk.Error

execute return coin event

type TransferMsg

type TransferMsg struct {
	Sender   types.AccountKey `json:"sender"`
	Receiver types.AccountKey `json:"receiver"`
	Amount   types.LNO        `json:"amount"`
	Memo     string           `json:"memo"`
}

we can support to transfer to an user or an address

func NewTransferMsg

func NewTransferMsg(sender, receiver string, amount types.LNO, memo string) TransferMsg

Transfer Msg Implementations

func (TransferMsg) GetConsumeAmount

func (msg TransferMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (TransferMsg) GetPermission

func (msg TransferMsg) GetPermission() types.Permission

func (TransferMsg) GetSignBytes

func (msg TransferMsg) GetSignBytes() []byte

func (TransferMsg) GetSigners

func (msg TransferMsg) GetSigners() []sdk.AccAddress

func (TransferMsg) String

func (msg TransferMsg) String() string

func (TransferMsg) Type

func (msg TransferMsg) Type() string

func (TransferMsg) ValidateBasic

func (msg TransferMsg) ValidateBasic() sdk.Error

type UnfollowMsg

type UnfollowMsg struct {
	Follower types.AccountKey `json:"follower"`
	Followee types.AccountKey `json:"followee"`
}

func NewUnfollowMsg

func NewUnfollowMsg(follower string, followee string) UnfollowMsg

Unfollow Msg Implementations

func (UnfollowMsg) GetConsumeAmount

func (msg UnfollowMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (UnfollowMsg) GetPermission

func (msg UnfollowMsg) GetPermission() types.Permission

Implements Msg.

func (UnfollowMsg) GetSignBytes

func (msg UnfollowMsg) GetSignBytes() []byte

func (UnfollowMsg) GetSigners

func (msg UnfollowMsg) GetSigners() []sdk.AccAddress

func (UnfollowMsg) String

func (msg UnfollowMsg) String() string

func (UnfollowMsg) Type

func (msg UnfollowMsg) Type() string

func (UnfollowMsg) ValidateBasic

func (msg UnfollowMsg) ValidateBasic() sdk.Error

type UpdateAccountMsg

type UpdateAccountMsg struct {
	Username types.AccountKey `json:"username"`
	JSONMeta string           `json:"json_meta"`
}

UpdateAccountMsg - update account JSON meta info.

func NewUpdateAccountMsg

func NewUpdateAccountMsg(username string, JSONMeta string) UpdateAccountMsg

NewUpdateAccountMsg - construct user update msg to update user JSON meta info.

func (UpdateAccountMsg) GetConsumeAmount

func (msg UpdateAccountMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (UpdateAccountMsg) GetPermission

func (msg UpdateAccountMsg) GetPermission() types.Permission

Implements Msg.

func (UpdateAccountMsg) GetSignBytes

func (msg UpdateAccountMsg) GetSignBytes() []byte

Implements Msg.

func (UpdateAccountMsg) GetSigners

func (msg UpdateAccountMsg) GetSigners() []sdk.AccAddress

Implements Msg.

func (UpdateAccountMsg) String

func (msg UpdateAccountMsg) String() string

func (UpdateAccountMsg) Type

func (msg UpdateAccountMsg) Type() string

Implements Msg.

func (UpdateAccountMsg) ValidateBasic

func (msg UpdateAccountMsg) ValidateBasic() sdk.Error

Implements Msg.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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