smartcontract

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team

  • Copyright (C) 2018 The ontology Authors
  • This file is part of The ontology library. *
  • The ontology is free software: you can redistribute it and/or modify
  • it under the terms of the GNU Lesser General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version. *
  • The ontology is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Lesser General Public License for more details. *
  • You should have received a copy of the GNU Lesser General Public License
  • along with The ontology. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	MAX_EXECUTE_ENGINE = 128
)

Variables

This section is empty.

Functions

func NewVmFeatureFlag

func NewVmFeatureFlag(blockHeight uint32) vm.VmFeatureFlag

Types

type Config

type Config struct {
	Time      uint32              // current block timestamp
	Height    uint32              // current block height
	BlockHash common.Uint256      // current block hash
	Tx        *ctypes.Transaction // current transaction
}

Config describe smart contract need parameters configuration

type SmartContract

type SmartContract struct {
	Contexts      []*context.Context // all execute smart contract context
	CacheDB       *storage.CacheDB   // state cache
	Store         store.LedgerStore  // ledger store
	Config        *Config
	Notifications []*event.NotifyEventInfo // all execute smart contract event notify info
	GasTable      map[string]uint64
	Gas           uint64
	ExecStep      int
	WasmExecStep  uint64
	PreExec       bool
}

SmartContract describe smart contract execute engine

func (*SmartContract) CallingContext

func (this *SmartContract) CallingContext() *context.Context

CallingContext return smart contract caller context

func (*SmartContract) CheckExecStep

func (this *SmartContract) CheckExecStep() bool

func (*SmartContract) CheckUseGas

func (this *SmartContract) CheckUseGas(gas uint64) bool

func (*SmartContract) CheckWitness

func (this *SmartContract) CheckWitness(address common.Address) bool

CheckWitness check whether authorization correct If address is wallet address, check whether in the signature addressed list Else check whether address is calling contract address Param address: wallet address or contract address

func (*SmartContract) CurrentContext

func (this *SmartContract) CurrentContext() *context.Context

CurrentContext return smart contract current context

func (*SmartContract) EntryContext

func (this *SmartContract) EntryContext() *context.Context

EntryContext return smart contract entry entrance context

func (*SmartContract) NewExecuteEngine

func (this *SmartContract) NewExecuteEngine(code []byte, txtype ctypes.TransactionType) (context.Engine, error)

Execute is smart contract execute manager According different vm type to launch different service

func (*SmartContract) NewNativeService

func (this *SmartContract) NewNativeService() (*native.NativeService, error)

func (*SmartContract) PopContext

func (this *SmartContract) PopContext()

PopContext pop smart contract current context

func (*SmartContract) PushContext

func (this *SmartContract) PushContext(context *context.Context)

PushContext push current context to smart contract

func (*SmartContract) PushNotifications

func (this *SmartContract) PushNotifications(notifications []*event.NotifyEventInfo)

PushNotifications push smart contract event info

Directories

Path Synopsis
service
native/did
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
native/governance
Governance contract: Users can apply for a candidate node to join consensus selection, deposit ONT to authorize for candidate nodes, quit selection and unAuthorize for candidate nodes through this contract.
Governance contract: Users can apply for a candidate node to join consensus selection, deposit ONT to authorize for candidate nodes, quit selection and unAuthorize for candidate nodes through this contract.
native/testsuite
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
native/utils
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
neovm
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
util
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
wasmvm
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.
SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team * Copyright (C) 2018 The ontology Authors * This file is part of The ontology library.

Jump to

Keyboard shortcuts

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