model

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DeveloperSubstore     = []byte{0x00}
	IdaSubstore           = []byte{0x01}
	IdaBalanceSubstore    = []byte{0x02}
	ReservePoolSubstore   = []byte{0x03}
	AffiliatedAccSubstore = []byte{0x04} // (app, user)
	UserRoleSubstore      = []byte{0x05} // user role.
	IdaStatsSubstore      = []byte{0x06}
)

Functions

func DumpToFile added in v0.3.0

func DumpToFile(ctx sdk.Context, store DeveloperStorage, filepath string)

func GetAffiliatedAccAppPrefix added in v0.3.0

func GetAffiliatedAccAppPrefix(app linotypes.AccountKey) []byte

GetAffiliatedAccAppPrefix - "affiliated account substore" + "app" + "/"

func GetAffiliatedAccKey added in v0.3.0

func GetAffiliatedAccKey(app linotypes.AccountKey, user linotypes.AccountKey) []byte

GetAffiliatedAccKey - "affiliated app prefix" + "user"

func GetDeveloperKey

func GetDeveloperKey(accKey linotypes.AccountKey) []byte

GetDeveloperKey - "developer substore" + "developer"

func GetIDABalanceKey added in v0.3.0

func GetIDABalanceKey(app linotypes.AccountKey, user linotypes.AccountKey) []byte

GetIDABalanceKey - "ida balance substore" + "app" + "/" + "user"

func GetIDAKey added in v0.3.0

func GetIDAKey(accKey linotypes.AccountKey) []byte

GetIDAKey - "ida substore" + "developer"

func GetIDAStatsKey added in v0.3.0

func GetIDAStatsKey(accKey linotypes.AccountKey) []byte

GetIDAStatsKey - "ida stats substore" + "developer"

func GetReservePoolKey added in v0.3.0

func GetReservePoolKey() []byte

GetReservePoolKey - reserve pool key

func GetUserRoleKey added in v0.3.0

func GetUserRoleKey(user linotypes.AccountKey) []byte

GetUserRoleKey - "user" -> role

func LoadFromFile added in v0.3.0

func LoadFromFile(ctx sdk.Context, store DeveloperStorage, filepath string)

func NewDeveloperDumper added in v0.3.0

func NewDeveloperDumper(store DeveloperStorage) *testutils.Dumper

func ParseAffiliatedAccKey added in v0.4.0

func ParseAffiliatedAccKey(key []byte) (app linotypes.AccountKey, user linotypes.AccountKey)

ParseAffiliatedAccKey parse affiliated account key.

func ParseIDABalanceKey added in v0.4.0

func ParseIDABalanceKey(key []byte) (app linotypes.AccountKey, user linotypes.AccountKey)

ParseIDABalanceKey parse balance key.

Types

type AffiliatedAccIR added in v0.4.0

type AffiliatedAccIR struct {
	App  types.AccountKey `json:"app"`  // pk
	User types.AccountKey `json:"user"` // pk
}

type AppIDA added in v0.3.0

type AppIDA struct {
	App             types.AccountKey `json:"app"`
	Name            string           `json:"name"`
	MiniIDAPrice    types.MiniDollar `json:"price"`
	IsRevoked       bool             `json:"is_revoked"`
	RevokeCoinPrice types.MiniDollar `json:"revoke_coin_price"` // the price of one coin upon revoke.
}

AppIDA - app issued IDA.

type AppIDAIR added in v0.4.0

type AppIDAIR struct {
	App             types.AccountKey `json:"app"` // pk
	Name            string           `json:"name"`
	MiniIDAPrice    types.MiniDollar `json:"price"`
	IsRevoked       bool             `json:"is_revoked"`
	RevokeCoinPrice types.MiniDollar `json:"revoke_coin_price"` // the price of one coin upon revoke.
}

AppIDAIR - app issued IDA.

type AppIDAStats added in v0.3.0

type AppIDAStats struct {
	Total types.MiniDollar `json:"total"`
}

AppIDAStats - app ida stats

type Developer

type Developer struct {
	Username types.AccountKey `json:"username"`
	// Deprecated field, use stakein amount as requirement since upgrade2.
	Deposit        types.Coin       `json:"deposit"`
	AppConsumption types.MiniDollar `json:"app_consumption"`
	Website        string           `json:"web_site"`
	Description    string           `json:"description"`
	AppMetaData    string           `json:"app_meta_data"`
	IsDeleted      bool             `json:"is_deleted"`
	NAffiliated    int64            `json:"n_affiliated"`
}

Developer - developer is account with developer deposit, can get developer inflation

type DeveloperIR added in v0.4.0

type DeveloperIR struct {
	Username       types.AccountKey `json:"username"` // pk
	AppConsumption types.MiniDollar `json:"app_consumption"`
	Website        string           `json:"web_site"`
	Description    string           `json:"description"`
	AppMetaData    string           `json:"app_meta_data"`
	IsDeleted      bool             `json:"is_deleted"`
	NAffiliated    int64            `json:"n_affiliated"`
}

DeveloperIR - apps

type DeveloperStorage

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

DeveloperStorage - developer storage

func NewDeveloperStorage

func NewDeveloperStorage(key sdk.StoreKey) DeveloperStorage

DeveloperStorage - new developer storage

func (DeveloperStorage) DelAffiliatedAcc added in v0.3.0

func (ds DeveloperStorage) DelAffiliatedAcc(ctx sdk.Context, app, user linotypes.AccountKey)

DelAffiliatedAcc - remove this affiliated acc.

func (DeveloperStorage) DelUserRole added in v0.3.0

func (ds DeveloperStorage) DelUserRole(ctx sdk.Context, user linotypes.AccountKey)

func (DeveloperStorage) GetAllAffiliatedAcc added in v0.3.0

func (ds DeveloperStorage) GetAllAffiliatedAcc(ctx sdk.Context, app linotypes.AccountKey) []linotypes.AccountKey

func (DeveloperStorage) GetAllDevelopers added in v0.3.0

func (ds DeveloperStorage) GetAllDevelopers(ctx sdk.Context) []Developer

GetAllDevelopers - get developer list from KVStore. NOTE, the result includes the all developers even if it's marked in value as deleted.

func (DeveloperStorage) GetDeveloper

func (ds DeveloperStorage) GetDeveloper(ctx sdk.Context, accKey linotypes.AccountKey) (*Developer, sdk.Error)

GetDeveloper - get developer from KVStore

func (DeveloperStorage) GetIDA added in v0.3.0

func (ds DeveloperStorage) GetIDA(ctx sdk.Context, accKey linotypes.AccountKey) (*AppIDA, sdk.Error)

GetIDA - get ida of a developer KVStore

func (DeveloperStorage) GetIDABank added in v0.3.0

GetIDABalance - get ida balance of (app, user)

func (DeveloperStorage) GetIDAStats added in v0.3.0

func (ds DeveloperStorage) GetIDAStats(ctx sdk.Context, app linotypes.AccountKey) *AppIDAStats

GetIDAStats returns the stats of the IDA.

func (DeveloperStorage) GetReservePool added in v0.3.0

func (ds DeveloperStorage) GetReservePool(ctx sdk.Context) *ReservePool

GetReservePool - get IDA's lino reserve pool.

func (DeveloperStorage) GetUserRole added in v0.3.0

func (ds DeveloperStorage) GetUserRole(ctx sdk.Context, user linotypes.AccountKey) (*Role, sdk.Error)

func (DeveloperStorage) HasAffiliatedAcc added in v0.3.0

func (ds DeveloperStorage) HasAffiliatedAcc(ctx sdk.Context, app, user linotypes.AccountKey) bool

HasAffiliateAcc - has this affiliated account..

func (DeveloperStorage) HasDeveloper added in v0.3.0

func (ds DeveloperStorage) HasDeveloper(ctx sdk.Context, accKey linotypes.AccountKey) bool

HasDeveloper - check if developer in KVStore or not

func (DeveloperStorage) HasIDA added in v0.3.0

func (ds DeveloperStorage) HasIDA(ctx sdk.Context, accKey linotypes.AccountKey) bool

HasIDA - check if developer has a IDA in KVStore or not

func (DeveloperStorage) HasUserRole added in v0.3.0

func (ds DeveloperStorage) HasUserRole(ctx sdk.Context, user linotypes.AccountKey) bool

func (DeveloperStorage) SetAffiliatedAcc added in v0.3.0

func (ds DeveloperStorage) SetAffiliatedAcc(ctx sdk.Context, app, user linotypes.AccountKey)

SetAffiliatedAcc - set affiliated account.

func (DeveloperStorage) SetDeveloper

func (ds DeveloperStorage) SetDeveloper(ctx sdk.Context, developer Developer)

SetDeveloper - set developer to KVStore

func (DeveloperStorage) SetIDA added in v0.3.0

func (ds DeveloperStorage) SetIDA(ctx sdk.Context, ida AppIDA)

SetIDA - set IDA to KVStore

func (DeveloperStorage) SetIDABank added in v0.3.0

func (ds DeveloperStorage) SetIDABank(ctx sdk.Context, app linotypes.AccountKey, user linotypes.AccountKey, bank *IDABank)

SetIDABalance - set (app, user)'s ida balance to amount

func (DeveloperStorage) SetIDAStats added in v0.3.0

func (ds DeveloperStorage) SetIDAStats(ctx sdk.Context, app linotypes.AccountKey, stats AppIDAStats)

SetIDAStats set ida stats of a app.

func (DeveloperStorage) SetReservePool added in v0.3.0

func (ds DeveloperStorage) SetReservePool(ctx sdk.Context, pool *ReservePool)

SetReservePool - get IDA's lino reserve pool.

func (DeveloperStorage) SetUserRole added in v0.3.0

func (ds DeveloperStorage) SetUserRole(ctx sdk.Context, user linotypes.AccountKey, role *Role)

func (DeveloperStorage) StoreMap added in v0.4.0

func (ds DeveloperStorage) StoreMap(ctx sdk.Context) utils.StoreMap

type DeveloperTablesIR added in v0.2.0

type DeveloperTablesIR struct {
	Version        int               `json:"version"`
	Developers     []DeveloperIR     `json:"developers"`
	IDAs           []AppIDAIR        `json:"id_as"`
	IDABanks       []IDABankIR       `json:"ida_banks"`
	ReservePool    ReservePoolIR     `json:"reserve_pool"`
	AffiliatedAccs []AffiliatedAccIR `json:"affiliated_accs"`
	UserRoles      []UserRoleIR      `json:"user_roles"`
	IDAStats       []IDAStatsIR      `json:"ida_stats"`
}

DeveloperTablesIR

type IDABank added in v0.3.0

type IDABank struct {
	Balance  types.MiniDollar `json:"b"`
	Unauthed bool             `json:"unauthed,omitempty"`
}

IDABank - IDA's bank

type IDABankIR added in v0.4.0

type IDABankIR struct {
	App      types.AccountKey `json:"app"`  // pk
	User     types.AccountKey `json:"user"` // pk
	Balance  types.MiniDollar `json:"b"`
	Unauthed bool             `json:"unauthed,omitempty"`
}

type IDAStatsIR added in v0.4.0

type IDAStatsIR struct {
	App   types.AccountKey `json:"app"` // pk
	Total types.MiniDollar `json:"total"`
}

type ReservePool added in v0.3.0

type ReservePool struct {
	Total           types.Coin       `json:"total"`
	TotalMiniDollar types.MiniDollar `json:"total_minidollar"`
}

type ReservePoolIR added in v0.4.0

type ReservePoolIR struct {
	Total           types.Coin       `json:"total"`
	TotalMiniDollar types.MiniDollar `json:"total_minidollar"`
}

type Role added in v0.3.0

type Role struct {
	AffiliatedApp types.AccountKey `json:"aa"`
}

Role - User Role

type UserRoleIR added in v0.4.0

type UserRoleIR struct {
	User          types.AccountKey `json:"user"` // pk
	AffiliatedApp types.AccountKey `json:"aa"`
}

Jump to

Keyboard shortcuts

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