detector

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package detector provides helpers for accessing solgo packages. It's basically a wrapper around solgo. Most of the features supported by solgo are implemented in this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

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

Detector is a utility structure that provides functionalities to detect and analyze Solidity source code. It encapsulates the context, sources, ABI builder, and solc compiler selector.

func NewDetectorFromSources

func NewDetectorFromSources(ctx context.Context, compiler *solc.Solc, sources *solgo.Sources) (*Detector, error)

NewDetectorFromSources initializes a new Detector instance using the provided sources. It sets up the ABI builder and solc compiler selector which provide access to Global parser, AST and IR.

func (*Detector) Analyze

func (d *Detector) Analyze() (*audit.Report, error)

Compile compiles the Solidity source code using the solc compiler and returns the errors encountered during the process.

func (*Detector) Build

func (d *Detector) Build() error

Build builds the ABI from the parsed source code and returns the errors encountered during the process.

func (*Detector) GetABI

func (d *Detector) GetABI() *abi.Builder

GetABI returns the ABI builder associated with the Detector.

func (*Detector) GetAST

func (d *Detector) GetAST() *ast.ASTBuilder

GetAST returns the abstract syntax tree (AST) builder associated with the Detector.

func (*Detector) GetAuditor

func (d *Detector) GetAuditor() *audit.Auditor

GetAuditor returns the static analysis auditor associated with the Detector. It provides access to the auditor's report and the audit configuration as well as the ability to run the auditor on the source code.

func (*Detector) GetCFG added in v0.3.5

func (d *Detector) GetCFG() *cfg.Builder

GetCFG returns the control flow graph (CFG) builder

func (*Detector) GetContext

func (d *Detector) GetContext() context.Context

GetContext returns the context associated with the Detector.

func (*Detector) GetIR

func (d *Detector) GetIR() *ir.Builder

GetIR returns the intermediate representation (IR) builder associated with the Detector.

func (*Detector) GetOpcodes

func (d *Detector) GetOpcodes(data []byte) (*opcode.Decompiler, error)

GetOpcodes returns the opcodes decompiler from provided byte array. It decompiles the bytecode of the contract, transaction, log to EVM opcodes.

func (*Detector) GetOpcodesFromHex

func (d *Detector) GetOpcodesFromHex(data string) (*opcode.Decompiler, error)

GetOpcodesFromHex returns the opcodes decompiler from provided hexadecimal string. It decompiles the bytecode of the contract, transaction, log to EVM opcodes.

func (*Detector) GetParser

func (d *Detector) GetParser() *solgo.Parser

GetParser returns the parser associated with the Detector.

func (*Detector) GetSolc

func (d *Detector) GetSolc() *solc.Solc

GetSolc returns the solc compiler selector associated with the Detector.

func (*Detector) GetSources

func (d *Detector) GetSources() *solgo.Sources

GetSources returns the Solidity source files associated with the Detector.

func (*Detector) Parse

func (d *Detector) Parse() []error

Parse parses the Solidity source code and returns the errors encountered during the process.

Jump to

Keyboard shortcuts

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