modulepackage
0.0.4
Repository: https://github.com/postapocalypsecore/solc.git
Documentation: pkg.go.dev
# README
go-solc
: Go Bindings for the Solidity Compiler
go-solc
provides an easy way to compile Solidity contracts from Go.
go get github.com/lmittmann/go-solc
Getting Started
go-solc
automatically downloads the specified version of the Solidity compiler from https://binaries.soliditylang.org and caches it at .solc/bin/
.
Example test:
// contract_test.go
func TestContract(t *testing.T) {
c := solc.New("0.8.21")
contract, err := c.Compile("src", "Test",
solc.WithOptimizer(&solc.Optimizer{Enabled: true, Runs: 999999}),
)
// ...
}
Example directory structure:
workspace/
├── .solc/
│ └── bin/ # cached solc binaries
│ └── solc_v0.8.21
├── src/
│ └── test.sol
├── contract_test.go
├── go.mod
└── go.sum
generate *.sol and compile it at runtime
[!WARNING]
This package is pre-1.0. There might be breaking changes between minor versions.
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewConsole returns a [vm.EVMLogger] that logs calls of console.sol to the given testing.TB.
WithEVMVersion configures the compilation [Settings] to set the given EVM version.
WithOptimizer configures the compilation [Settings] to set the given [Optimizer].
WithViaIR configures the compilation [Settings] to set viaIR to the given parameter "enabled".
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
Contract represents a compiled contract.
No description provided by the author
No description provided by the author
No description provided by the author
Settings for the compilation.
No description provided by the author
# Type aliases
EVMVersion represents the EVM version to compile for.
An Option configures the compilation [Settings].