govern

package
v0.0.0-...-b124b1e Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GovCtx

type GovCtx struct {
	// 基础上下文
	xctx.BaseCtx
	BcName   string
	Ledger   LedgerRely
	Contract base.Manager
}

func NewGovCtx

func NewGovCtx(bcName string, leg LedgerRely, contract base.Manager) (*GovCtx, error)

type GovManager

type GovManager interface {
	GetGovTokenBalance(accountName string) (*protos.GovernTokenBalance, error)
	DetermineGovTokenIfInitialized() (bool, error)
}

func NewGovManager

func NewGovManager(ctx *GovCtx) (GovManager, error)

NewGovManager create instance of GovManager

type KernMethod

type KernMethod struct {
	BcName               string
	NewGovResourceAmount int64
	Predistribution      []ledger.Predistribution
}

func NewKernContractMethod

func NewKernContractMethod(bcName string, NewGovResourceAmount int64, Predistribution []ledger.Predistribution) *KernMethod

func (*KernMethod) InitGovernTokens

func (t *KernMethod) InitGovernTokens(ctx base.KContext) (*base.Response, error)

func (*KernMethod) LockGovernTokens

func (t *KernMethod) LockGovernTokens(ctx base.KContext) (*base.Response, error)

func (*KernMethod) QueryAccountGovernTokens

func (t *KernMethod) QueryAccountGovernTokens(ctx base.KContext) (*base.Response, error)

func (*KernMethod) TotalSupply

func (t *KernMethod) TotalSupply(ctx base.KContext) (*base.Response, error)

func (*KernMethod) TransferGovernTokens

func (t *KernMethod) TransferGovernTokens(ctx base.KContext) (*base.Response, error)

func (*KernMethod) UnLockGovernTokens

func (t *KernMethod) UnLockGovernTokens(ctx base.KContext) (*base.Response, error)

type LedgerRely

type LedgerRely interface {
	// 从创世块获取创建合约账户消耗gas
	GetNewGovGas() (int64, error)
	// 从创世块获取创建合约账户消耗gas
	GetGenesisPreDistribution() ([]ledger.Predistribution, error)
	// 获取状态机最新确认快照
	GetTipXMSnapshotReader() (ledger.SnapshotReader, error)
}

type Manager

type Manager struct {
	Ctx *GovCtx
}

Manager manages all gov releated data, providing read/write interface

func (*Manager) DetermineGovTokenIfInitialized

func (mgr *Manager) DetermineGovTokenIfInitialized() (bool, error)

DetermineGovTokenIfInitialized

func (*Manager) GetGovTokenBalance

func (mgr *Manager) GetGovTokenBalance(accountName string) (*protos.GovernTokenBalance, error)

GetGovTokenBalance get govern token balance of an account

func (*Manager) GetObjectBySnapshot

func (mgr *Manager) GetObjectBySnapshot(bucket string, object []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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