-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Welcome to the "Getting Started" guide for SolGo! If you're excited about diving into the world of Solidity parsing with the power of Golang, you're in the right place. This guide will walk you through the initial setup and basic usage of SolGo.
Before you embark on your journey with SolGo, ensure you have the following:
SolGo is built with Golang, so you'll need it installed on your machine. If you haven't already, follow the official Go installation guide to get started.
Before you start, ensure you've set up the required environment variable for the GitHub personal access token:
export SOLC_SWITCH_GITHUB_TOKEN="{your_github_token_here}"
Replace {your_github_token_here} with your actual GitHub personal access token. If you don't have one, you can create it by following the instructions here.
It is used to fetch the latest Solidity compiler releases from the official Solidity GitHub repository. If you don't set it up, you'll get an rate limit error quite quickly.
In order to access openzeppelin sources submodules needs to be checked out.
make submodules
In order to run audit and discover security vulnerabilities, you need to have slither tool installed.
pip3 install slither-analyzer
Integrating SolGo into your Go projects is a breeze. To import SolGo, use the following line in your Go program:
import "github.com/unpackdev/solgo"
This will allow you to access all the functionalities that SolGo offers right within your Go environment.
For efficient and structured logging, SolGo employs the zap logger. Here's a quick guide to set it up:
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
config := zap.NewDevelopmentConfig()
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
logger, err := config.Build()
if err != nil {
panic(err)
}
zap.ReplaceGlobals(logger)
SolGo adopts a streamlined approach to logging. Instead of passing the logger around, you can use the zap.L()
function to retrieve the logger instance wherever needed. This design choice simplifies the logging process, ensuring you can focus on your core tasks without getting bogged down by logger management.
You can look into the zap github repository for more information about it.
NOTE: Not much is logged right now. Will be ensuring in future as one of improvements to add more logging. Logging right now is placed only where it's absolutely essential.
Now that you're set up, it's time to explore! Dive into the various features of SolGo, from AST generation to opcode decompilation. The Table of Contents in the Home page, along with the Usage page, provides a roadmap to guide you through the different facets of SolGo.