accountlock

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OP_ADDLOCK    = uint32(1)
	OP_REMOVELOCK = uint32(2)
	OP_TRANSFER   = uint32(3)
	OP_GOVERNING  = uint32(100)
)

Variables

View Source
var (
	//0x6163636f756e742d6c6f636b2d61646472657373
	AccountLockAddr       = meter.BytesToAddress([]byte("account-lock-address"))
	AccountLockProfileKey = meter.Blake2b([]byte("account-lock-profile-list-key"))
)

the global variables in AccountLock

Functions

func AccountLockEncodeBytes

func AccountLockEncodeBytes(sb *AccountLockBody) []byte

func RestrictByAccountLock

func RestrictByAccountLock(addr meter.Address, state *state.State) (bool, *big.Int, *big.Int)

func SetAccountLockGlobInst

func SetAccountLockGlobInst(inst *AccountLock)

Types

type AccountLock

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

Candidate indicates the structure of a candidate

var (
	AccountLockGlobInst *AccountLock
)

func GetAccountLockGlobInst

func GetAccountLockGlobInst() *AccountLock

func NewAccountLock

func NewAccountLock(ch *chain.Chain, sc *state.Creator) *AccountLock

func (*AccountLock) GetCurrentEpoch

func (a *AccountLock) GetCurrentEpoch() uint32

func (*AccountLock) GetProfileList

func (a *AccountLock) GetProfileList(state *state.State) (result *ProfileList)

Profile List

func (*AccountLock) PrepareAccountLockHandler

func (a *AccountLock) PrepareAccountLockHandler() (AccountLockHandler func([]byte, *meter.Address, *xenv.TransactionContext, uint64, *state.State) (*setypes.ScriptEngineOutput, uint64, error))

func (*AccountLock) SetProfileList

func (a *AccountLock) SetProfileList(lockList *ProfileList, state *state.State)

func (*AccountLock) Start

func (a *AccountLock) Start() error

type AccountLockBody

type AccountLockBody struct {
	Opcode         uint32
	Version        uint32
	Option         uint32
	LockEpoch      uint32
	ReleaseEpoch   uint32
	FromAddr       meter.Address
	ToAddr         meter.Address
	MeterAmount    *big.Int
	MeterGovAmount *big.Int
	Memo           []byte
}

Candidate indicates the structure of a candidate

func AccountLockDecodeFromBytes

func AccountLockDecodeFromBytes(bytes []byte) (*AccountLockBody, error)

func (*AccountLockBody) GetOpName

func (a *AccountLockBody) GetOpName(op uint32) string

func (*AccountLockBody) GoverningHandler

func (ab *AccountLockBody) GoverningHandler(env *AccountLockEnviroment, gas uint64) (leftOverGas uint64, err error)

func (*AccountLockBody) HandleAccountLockAdd

func (ab *AccountLockBody) HandleAccountLockAdd(env *AccountLockEnviroment, gas uint64) (leftOverGas uint64, err error)

func (*AccountLockBody) HandleAccountLockRemove

func (ab *AccountLockBody) HandleAccountLockRemove(env *AccountLockEnviroment, gas uint64) (leftOverGas uint64, err error)

func (*AccountLockBody) HandleAccountLockTransfer

func (ab *AccountLockBody) HandleAccountLockTransfer(env *AccountLockEnviroment, gas uint64) (leftOverGas uint64, err error)

func (*AccountLockBody) String added in v1.2.0

func (sb *AccountLockBody) String() string

func (*AccountLockBody) ToString

func (a *AccountLockBody) ToString() string

func (*AccountLockBody) UniteHash added in v1.2.0

func (sb *AccountLockBody) UniteHash() (hash meter.Bytes32)

type AccountLockEnviroment

type AccountLockEnviroment struct {
	*setypes.ScriptEnv
	// contains filtered or unexported fields
}

func NewAccountLockEnviroment

func NewAccountLockEnviroment(accountLock *AccountLock, state *state.State, txCtx *xenv.TransactionContext, to *meter.Address) *AccountLockEnviroment

func (*AccountLockEnviroment) GetAccountLock

func (env *AccountLockEnviroment) GetAccountLock() *AccountLock

type Profile

type Profile struct {
	Addr           meter.Address
	Memo           []byte
	LockEpoch      uint32
	ReleaseEpoch   uint32
	MeterAmount    *big.Int
	MeterGovAmount *big.Int
}

Profile indicates the structure of a Profile

func NewProfile

func NewProfile(addr meter.Address, memo []byte, lock uint32, release uint32, mtr *big.Int, mtrg *big.Int) *Profile

func (*Profile) ToString

func (c *Profile) ToString() string

type ProfileList

type ProfileList struct {
	Profiles []*Profile
}

func GetLatestProfileList

func GetLatestProfileList() (*ProfileList, error)

api routine interface

func NewProfileList

func NewProfileList(Profiles []*Profile) *ProfileList

func (*ProfileList) Add

func (cl *ProfileList) Add(c *Profile)

func (*ProfileList) Count

func (cl *ProfileList) Count() int

func (*ProfileList) Exist

func (cl *ProfileList) Exist(addr meter.Address) bool

func (*ProfileList) Get

func (cl *ProfileList) Get(addr meter.Address) *Profile

func (*ProfileList) Remove

func (cl *ProfileList) Remove(addr meter.Address)

func (*ProfileList) ToList

func (l *ProfileList) ToList() []Profile

func (*ProfileList) ToString

func (cl *ProfileList) ToString() string

Jump to

Keyboard shortcuts

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