utils

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMinTerminalWidth added in v0.4.5

func CheckMinTerminalWidth() error

func GetBytecodeToValidate

func GetBytecodeToValidate(bytecode string, level string, filename string, levelsDir string, lang string) (string, string, error)

compiles the solution file and returns the bytecode + solution type (e.g. sol, yul, vyper, huff)

func GetSolves

func GetSolves(levels map[string]Level) map[string]string

Returns the amount of solves per level

func IsValidEthereumAddress added in v0.4.5

func IsValidEthereumAddress(address string) bool

func LoadLevels

func LoadLevels() (map[string]Level, error)

func ParseOutput

func ParseOutput(output string) (int, int, error)

parseOutput function to parse gas and size values of output from forge test

func RunTest

func RunTest(levelsDir string, testContract string, verbose bool) ([]byte, error)

Runs the forge test command with random values for block parameters

func WriteConfig

func WriteConfig(config Config) error

Types

type Config

type Config struct {
	EVMR_VERSION    string `mapstructure:"EVMR_VERSION"`
	EVMR_SERVER     string `mapstructure:"EVMR_SERVER"`
	EVMR_TOKEN      string `mapstructure:"EVMR_TOKEN"`
	EVMR_ID         string `mapstructure:"EVMR_ID"`
	EVMR_NAME       string `mapstructure:"EVMR_NAME"`
	EVMR_LEVELS_DIR string `mapstructure:"EVMR_LEVELS_DIR"`
}

func LoadConfig

func LoadConfig() (Config, error)

type Level

type Level struct {
	ID          string
	File        string
	Contract    string
	Type        string
	Description string
}

type SubmissionData

type SubmissionData struct {
	Id           string `json:"id"`
	LevelId      int    `json:"level_id"`
	UserId       int    `json:"user_id"`
	Gas          string `json:"gas"`
	Size         string `json:"size"`
	SubmittedAt  string `json:"submitted_at"`
	Type         string `json:"type"`
	OptimizedFor string `json:"optimized_for"`
	Username     string `json:"user_name"`
	LevelName    string `json:"level_name"`
}

func FetchSubmissionData

func FetchSubmissionData(config Config) ([]SubmissionData, error)

fetchSubmissionData function to fetch existing submission data

Jump to

Keyboard shortcuts

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