-
Notifications
You must be signed in to change notification settings - Fork 276
feat: Add solc-based contract compilation and Go binding generation (Phase 1) #1827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
43addc0
Phase 1: Add solc-based contract compilation and Go binding generation
JonathanOppenheimer 21abaf8
Apply suggestions from code review
JonathanOppenheimer 953b587
Arran suggestions
JonathanOppenheimer c546cdd
use proper version of solc
JonathanOppenheimer 4d43d99
Update contracts/compile.go
JonathanOppenheimer cfe7fc6
move compile to contracts folder
JonathanOppenheimer 4dcfc12
fix path
JonathanOppenheimer f5c360d
Update Taskfile.yml
JonathanOppenheimer 178ea1e
revert
JonathanOppenheimer 35d94c1
couple compiling of contracts
JonathanOppenheimer dfdcbfe
update readme
JonathanOppenheimer fcd044c
remove needless comment
JonathanOppenheimer 2b758ab
add lint exception
JonathanOppenheimer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JonathanOppenheimer marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "contracts/submodules/openzeppelin-contracts"] | ||
| path = contracts/submodules/openzeppelin-contracts | ||
| url = https://github.com/OpenZeppelin/openzeppelin-contracts.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. | ||
| // See the file LICENSE for licensing terms. | ||
|
|
||
| // Package bindings provides Go bindings for Solidity contracts. | ||
| // This file contains go:generate directives to generate Go bindings using abigen. | ||
| package bindings | ||
|
|
||
| // Generate bindings for main contracts | ||
JonathanOppenheimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type AllowList --abi ../artifacts/AllowList.abi --bin ../artifacts/AllowList.bin --out allowlist.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type ERC20NativeMinter --abi ../artifacts/ERC20NativeMinter.abi --bin ../artifacts/ERC20NativeMinter.bin --out erc20nativeminter.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type ExampleDeployerList --abi ../artifacts/ExampleDeployerList.abi --bin ../artifacts/ExampleDeployerList.bin --out exampledeployerlist.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type Example --abi ../artifacts/Example.abi --bin ../artifacts/Example.bin --out example.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type ExampleFeeManager --abi ../artifacts/ExampleFeeManager.abi --bin ../artifacts/ExampleFeeManager.bin --out examplefeemanager.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type ExampleRewardManager --abi ../artifacts/ExampleRewardManager.abi --bin ../artifacts/ExampleRewardManager.bin --out examplerewardmanager.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type ExampleTxAllowList --abi ../artifacts/ExampleTxAllowList.abi --bin ../artifacts/ExampleTxAllowList.bin --out exampletxallowlist.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type ExampleWarp --abi ../artifacts/ExampleWarp.abi --bin ../artifacts/ExampleWarp.bin --out examplewarp.go | ||
|
|
||
| // Generate bindings for interface contracts | ||
JonathanOppenheimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IAllowList --abi ../artifacts/IAllowList.abi --bin ../artifacts/IAllowList.bin --out iallowlist.go | ||
JonathanOppenheimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IFeeManager --abi ../artifacts/IFeeManager.abi --bin ../artifacts/IFeeManager.bin --out ifeemanager.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type INativeMinter --abi ../artifacts/INativeMinter.abi --bin ../artifacts/INativeMinter.bin --out inativeminter.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IRewardManager --abi ../artifacts/IRewardManager.abi --bin ../artifacts/IRewardManager.bin --out irewardmanager.go | ||
| //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IWarpMessenger --abi ../artifacts/IWarpMessenger.abi --bin ../artifacts/IWarpMessenger.bin --out iwarpmessenger.go | ||
|
|
||
| // NOTE: Test contract bindings are not generated here | ||
| // Test contracts use DS-Test which we're deprecating. Tests will be rewritten in Go in Phase 3. | ||
JonathanOppenheimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. | ||
| // See the file LICENSE for licensing terms. | ||
|
|
||
| // Package contracts provides contract compilation directives. | ||
| // This file contains go:generate directives to compile Solidity contracts using solc. | ||
| package contracts | ||
|
|
||
| // Compile main contracts | ||
JonathanOppenheimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/AllowList.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/ERC20NativeMinter.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/ExampleDeployerList.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/ExampleFeeManager.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/ExampleRewardManager.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/ExampleTxAllowList.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/ExampleWarp.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
JonathanOppenheimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // Compile interface contracts | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/interfaces/IAllowList.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/interfaces/IFeeManager.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/interfaces/INativeMinter.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/interfaces/IRewardManager.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
| //go:generate solc -o ./artifacts --overwrite --abi --bin --base-path . contracts/interfaces/IWarpMessenger.sol @openzeppelin/contracts/=submodules/openzeppelin-contracts/contracts/ | ||
|
|
||
| // NOTE: Test contracts (contracts/test/*Test.sol) are NOT compiled here | ||
| // They use DS-Test which we're deprecating. These will be replaced with Go tests in Phase 3. | ||
| // The existing TypeScript tests will continue to use Hardhat-compiled versions until migration is complete. | ||
JonathanOppenheimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
JonathanOppenheimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Submodule openzeppelin-contracts
added at
f95b9c
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.