govern_token

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 11 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 {
	// 基础上下文
	xcontext.BaseCtx
	BcName   string
	Ledger   LedgerRely
	Contract contract.Manager
}

func NewGovCtx

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

type GovManager

type GovManager interface {
	GetGovTokenBalance(accountName string) (*pb.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      []xledger.Predistribution
}

func NewKernContractMethod

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

func (*KernMethod) AddTokens

func (t *KernMethod) AddTokens(ctx contract.KContext) (*contract.Response, error)

func (*KernMethod) CheckTokens

func (t *KernMethod) CheckTokens(ctx contract.KContext, amount *big.Int) error

func (*KernMethod) GetRatio

func (t *KernMethod) GetRatio(ctx contract.KContext) (map[string]int64, error)

获取分红比例

func (*KernMethod) GetRewardRatio

func (t *KernMethod) GetRewardRatio(ctx contract.KContext, name string) int64

获取分红比

func (*KernMethod) GetVoters

func (t *KernMethod) GetVoters(ctx contract.KContext, name string) (map[string]*big.Int, *big.Int, int64)

获取投票数

func (*KernMethod) InitGovernTokens

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

func (*KernMethod) LockGovernTokens

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

func (*KernMethod) QueryAccountGovernTokens

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

func (*KernMethod) SubTokens

func (t *KernMethod) SubTokens(ctx contract.KContext) (*contract.Response, error)

func (*KernMethod) TotalSupply

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

func (*KernMethod) TransferGovernTokens

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

func (*KernMethod) UnLockGovernTokens

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

func (*KernMethod) UpdateCacheTable

func (t *KernMethod) UpdateCacheTable(ctx contract.KContext) error

type LedgerRely

type LedgerRely interface {
	// 从创世块获取创建合约账户消耗gas
	GetNewGovGas() (int64, error)
	// 从创世块获取创建合约账户消耗gas
	GetGenesisPreDistribution() ([]xledger.Predistribution, error)
	// 获取状态机最新确认快照
	GetTipXMSnapshotReader() (ledger.XMSnapshotReader, 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) (*pb.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