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 ¶
- type Detector
- func (d *Detector) Analyze() (*audit.Report, error)
- func (d *Detector) Build() error
- func (d *Detector) GetABI() *abi.Builder
- func (d *Detector) GetAST() *ast.ASTBuilder
- func (d *Detector) GetAuditor() *audit.Auditor
- func (d *Detector) GetContext() context.Context
- func (d *Detector) GetIR() *ir.Builder
- func (d *Detector) GetOpcodes(data []byte) (*opcode.Decompiler, error)
- func (d *Detector) GetOpcodesFromHex(data string) (*opcode.Decompiler, error)
- func (d *Detector) GetParser() *solgo.Parser
- func (d *Detector) GetSolc() *solc.Solc
- func (d *Detector) GetSources() *solgo.Sources
- func (d *Detector) Parse() []error
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 ¶
Compile compiles the Solidity source code using the solc compiler and returns the errors encountered during the process.
func (*Detector) Build ¶
Build builds the ABI from the parsed source code and returns the errors encountered during the process.
func (*Detector) GetAST ¶
func (d *Detector) GetAST() *ast.ASTBuilder
GetAST returns the abstract syntax tree (AST) builder associated with the Detector.
func (*Detector) GetAuditor ¶
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) GetContext ¶
GetContext returns the context associated with the Detector.
func (*Detector) GetIR ¶
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) GetSolc ¶
func (d *Detector) GetSolc() *solc.Solc
GetSolc returns the solc compiler selector associated with the Detector.
func (*Detector) GetSources ¶
GetSources returns the Solidity source files associated with the Detector.