model

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

GetIDABalanceKey - "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

Types

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 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 DeveloperRow added in v0.2.0

type DeveloperRow struct {
	Username  types.AccountKey `json:"username"`
	Developer DeveloperV1      `json:"developer"`
}

DeveloperRow - pk: Username

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)

type DeveloperTables added in v0.2.0

type DeveloperTables struct {
	Developers []DeveloperRow `json:"developers"`
}

// DeveloperTables is the state of developer storage, organized as a table.

func (DeveloperTables) ToIR added in v0.2.0

ToIR -

type DeveloperTablesIR added in v0.2.0

type DeveloperTablesIR = DeveloperTables

DeveloperTablesIR -

type DeveloperV1 added in v0.3.0

type DeveloperV1 struct {
	Username       types.AccountKey `json:"username"`
	Deposit        types.Coin       `json:"deposit"`
	AppConsumption types.Coin       `json:"app_consumption"`
	Website        string           `json:"web_site"`
	Description    string           `json:"description"`
	AppMetaData    string           `json:"app_meta_data"`
}

Developer -

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 ReservePool added in v0.3.0

type ReservePool 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

Jump to

Keyboard shortcuts

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