syscontract

package
v0.0.0-...-7ee7fde Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2018-2020. The asimov developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Index

Constants

View Source
const (
	TEMPLATE_STATUS_SUBMIT   uint8 = 0
	TEMPLATE_STATUS_APPROVE  uint8 = 1
	TEMPLATE_STATUS_NOTEXIST uint8 = 2
	TEMPLATE_STATUS_DISABLE  uint8 = 3
)

Variables

This section is empty.

Functions

func NewContractManager

func NewContractManager() ainterface.ContractManager

NewContractManager returns an empty struct of Manager

Types

type Manager

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

Manager defines an contract manager that manages multiple system contracts and implements the blockchain.ContractManager interface so it can be seamlessly plugged into normal chain processing.

func (*Manager) DisconnectBlock

func (m *Manager) DisconnectBlock(block *asiutil.Block)

DisconnectBlock delete unrestricted asset of cache which is in the block.

func (*Manager) GetActiveContractByHeight

func (m *Manager) GetActiveContractByHeight(height int32, delegateAddr common.Address) *chaincfg.ContractInfo

Get latest contract by height.

func (*Manager) GetAssetInfoByAssetId

func (m *Manager) GetAssetInfoByAssetId(
	block *asiutil.Block,
	stateDB vm.StateDB,
	chainConfig *params.ChainConfig,
	assets []string) ([]ainterface.AssetInfo, error)

GetAssetInfoByAssetId returns asset information by parameter asset id asset id is consist of organization id and asset index

func (*Manager) GetContractAddressByAsset

func (m *Manager) GetContractAddressByAsset(
	gas uint64,
	block *asiutil.Block,
	stateDB vm.StateDB,
	chainConfig *params.ChainConfig,
	assets []string) ([]common.Address, bool, uint64)

GetContractAddressByAsset returns organization addresses by calling system contract of registry according to parameter assets

func (*Manager) GetFees

func (m *Manager) GetFees(
	block *asiutil.Block,
	stateDB vm.StateDB,
	chainConfig *params.ChainConfig) (map[protos.Asset]int32, error)

GetFees returns an asset list and their valid heights asset in list are used as transaction fees heights describe the assets formally effective the asset list is submitted by members of validator committee

func (*Manager) GetSignedUpValidators

func (m *Manager) GetSignedUpValidators(
	proxyAddr common.Address,
	block *asiutil.Block,
	stateDB vm.StateDB,
	chainConfig *params.ChainConfig,
	miners []string) ([]common.Address, []uint32, error)

GetSignedUpValidators returns validators and their rounds information by calling system contract of consensus_satoshiplus. some of these validators will mine next round by checking their rounds if match our mining rules. for rules, one validator may offline. he must sign up to update his round to newest. if not, he will lose the chance to mine for the chain

func (*Manager) GetTemplate

func (m *Manager) GetTemplate(
	block *asiutil.Block,
	gas uint64,
	stateDB vm.StateDB,
	chainConfig *params.ChainConfig,
	category uint16,
	name string) (ainterface.TemplateWarehouseContent, bool, uint64)

GetTemplate returns template detail by its template name

func (*Manager) GetTemplates

func (m *Manager) GetTemplates(
	block *asiutil.Block,
	gas uint64,
	stateDB vm.StateDB,
	chainConfig *params.ChainConfig,
	getCountFunc string,
	getTemplatesFunc string,
	category uint16,
	pageNo int,
	pageSize int) (int, []ainterface.TemplateWarehouseContent, error, uint64)

GetTemplates returns all submitted templates by calling system contract of template_warehouse

func (*Manager) Init

func (m *Manager) Init(chain fvm.ChainContext, dataBytes []byte) error

Init manager by genesis data.

func (*Manager) IsLimit

func (m *Manager) IsLimit(block *asiutil.Block,
	stateDB vm.StateDB, asset *protos.Asset) int

IsLimit returns a number of int type by find in memory or calling system contract of registry the number represents if an asset is restricted

func (*Manager) IsLimitInCache

func (m *Manager) IsLimitInCache(asset *protos.Asset) bool

func (*Manager) IsSupport

func (m *Manager) IsSupport(block *asiutil.Block,
	stateDB vm.StateDB, gasLimit uint64, asset *protos.Asset, address []byte) (bool, uint64)

IsSupport returns a bool result, which represents if a restricted asset can be transfer

Jump to

Keyboard shortcuts

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