definitions

package
v0.0.0-...-c187892 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2016 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// chain permissions
	MintRoot           MintPermFlag = 1 << iota // 1
	MintSend                                    // 2
	MintCall                                    // 4
	MintCreateContract                          // 8
	MintCreateAccount                           // 16
	MintBond                                    // 32
	MintName                                    // 64

	// application permissions
	MintHasBase
	MintSetBase
	MintUnsetBase
	MintSetGlobal
	MintHasRole
	MintAddRole
	MintRmRole

	MintNumPermissions uint = 14 // NOTE Adjust this too. We can support upto 64

	MintTopPermFlag      MintPermFlag = 1 << (MintNumPermissions - 1)
	MintAllPermFlags     MintPermFlag = MintTopPermFlag | (MintTopPermFlag - 1)
	MintDefaultPermFlags MintPermFlag = MintSend | MintCall | MintCreateContract | MintCreateAccount | MintBond | MintName | MintHasBase | MintHasRole
)

Base permission references are like unix (the index is already bit shifted)

Variables

View Source
var (
	MintZeroBasePermissions    = &MintBasePermissions{zeroPerm, zeroPerm}
	MintZeroAccountPermissions = MintAccountPermissions{
		MintBase: MintZeroBasePermissions,
	}
)

Functions

func Set

func Set(p *MintBasePermissions, ty MintPermFlag, value bool) error

Set a permission bit. Will set the permission's set bit to true.

Types

type Account

type Account struct {
	Name    string `mapstructure:"," json:"," yaml:"," toml:","`
	Address string `mapstructure:"," json:"," yaml:"," toml:","`
	PubKey  string `mapstructure:"," json:"," yaml:"," toml:","`
	Tokens  int    `mapstructure:"," json:"," yaml:"," toml:","`
	ToBond  int    `mapstructure:"," json:"," yaml:"," toml:","`

	Validator       bool
	PermissionsMap  map[string]int
	MintPermissions *MintAccountPermissions
	MintKey         *MintPrivValidator
}

type AccountType

type AccountType struct {
	Name        string         `mapstructure:"name" json:"name" yaml:"name" toml:"name"`
	Definition  string         `mapstructure:"definition" json:"definition" yaml:"definition" toml:"definition"`
	TypicalUser string         `mapstructure:"typical_user" json:"typical_user" yaml:"typical_user" toml:"typical_user"`
	Number      int            `mapstructure:"default_number" json:"default_number" yaml:"default_number" toml:"default_number"`
	Tokens      int            `mapstructure:"default_tokens" json:"default_tokens" yaml:"default_tokens" toml:"default_tokens"`
	ToBond      int            `mapstructure:"default_bond" json:"default_bond" yaml:"default_bond" toml:"default_bond"`
	Perms       map[string]int `mapstructure:"perms" json:"perms" yaml:"perms" toml:"perms"`
}

func BlankAccountType

func BlankAccountType() *AccountType

type Chain

type Chain struct {
	Name    string
	Type    string
	Genesis *interface{}
}

func BlankChain

func BlankChain() *Chain

type ChainType

type ChainType struct {
	Name         string         `mapstructure:"name" json:"name" yaml:"name" toml:"name"`
	AccountTypes map[string]int `mapstructure:"account_types" json:"account_types" yaml:"account_types" toml:"account_types"`

	// currently unused
	ConsensusEngine    map[string]string `mapstructure:"consensus" json:"consensus" yaml:"consensus" toml:"consensus"`
	ApplicationManager map[string]string `mapstructure:"manager" json:"manager" yaml:"manager" toml:"manager"`
	Messenger          map[string]string `mapstructure:"messenger" json:"messenger" yaml:"messenger" toml:"messenger"`
}

func BlankChainType

func BlankChainType() *ChainType

type Do

type Do struct {
	Debug        bool
	Verbose      bool
	Name         string
	ChainType    string
	CSV          string
	AccountTypes []string
	Zip          bool
	Tarball      bool
	Output       bool
	Accounts     []*Account
	Result       string
}

func NowDo

func NowDo() *Do

type MintAccount

type MintAccount struct {
	Address     string                  `json:"address"`
	Amount      int                     `json:"amount"`
	Name        string                  `json:"name"`
	Permissions *MintAccountPermissions `json:"permissions"`
}

type MintAccountPermissions

type MintAccountPermissions struct {
	MintBase  *MintBasePermissions `json:"base"`
	MintRoles []string             `json:"roles"`
}

type MintBasePermissions

type MintBasePermissions struct {
	MintPerms  MintPermFlag `json:"perms"`
	MintSetBit MintPermFlag `json:"set"`
}

type MintGenesis

type MintGenesis struct {
	ChainID    string           `json:"chain_id"`
	Accounts   []*MintAccount   `json:"accounts"`
	Validators []*MintValidator `json:"validators"`
}

func BlankGenesis

func BlankGenesis() *MintGenesis

type MintPermFlag

type MintPermFlag uint64

type MintPrivValidator

type MintPrivValidator struct {
	Address    string        `json:"address"`
	PubKey     []interface{} `json:"pub_key"`
	PrivKey    []interface{} `json:"priv_key"`
	LastHeight int           `json:"last_height"`
	LastRound  int           `json:"last_round"`
	LastStep   int           `json:"last_step"`
}

type MintTxOutput

type MintTxOutput struct {
	Address string `json:"address"`
	Amount  int    `json:"amount"`
}

type MintValidator

type MintValidator struct {
	PubKey   []interface{}   `json:"pub_key"`
	Name     string          `json:"name"`
	Amount   int             `json:"amount"`
	UnbondTo []*MintTxOutput `json:"unbond_to"`
}

Jump to

Keyboard shortcuts

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