precompile

package
v0.0.0-...-bf5c25a Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: LGPL-3.0-or-later Imports: 11 Imported by: 0

README

Precompile

Some precompile contracts, which are copied from go-ethereum.

Documentation

Overview

Copyright 2014 The go-ethereum Authors This file is part of the go-ethereum library.

The go-ethereum library 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 go-ethereum library 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 go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	GasEcrecover     uint64 = 3000
	GasSha256Base    uint64 = 60 // Base price for a SHA256 operation
	GasSha256PerWord uint64 = 12 // Per-word price for a SHA256 operation
)

Here defines some gas usage

Variables

This section is empty.

Functions

func IsPrecompile

func IsPrecompile(address []byte) bool

IsPrecompile return if an address is precompile contract

Types

type Contract

type Contract interface {
	RequiredGas(input []byte) uint64  // RequiredPrice calculates the contract gas use
	Run(input []byte) ([]byte, error) // Run runs the precompiled contract
}

Contract is the basic interface for native Go contracts. The implementation requires a deterministic gas count based on the input size of the Run method of the contract.

func New

func New(address []byte) (Contract, error)

New is the constructor of precompile contract

Jump to

Keyboard shortcuts

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