-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POC: run all contracts through solc with bazel
- Loading branch information
Showing
24 changed files
with
1,733 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,2 @@ | ||
node_modules/ | ||
bazel-out/ |
This file contains 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 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 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,7 @@ | ||
load("//sol:defs.bzl", "sol_binary") | ||
|
||
sol_binary( | ||
name = "crypto", | ||
srcs = glob(["*.sol"]), | ||
deps = ["//:node_modules/@openzeppelin/contracts"], | ||
) |
This file contains 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,11 @@ | ||
load("//sol:defs.bzl", "sol_binary") | ||
|
||
sol_binary( | ||
name = "erc721", | ||
srcs = glob(["*.sol"]), | ||
deps = [ | ||
"//contracts/utils", | ||
"//:node_modules/@openzeppelin/contracts", | ||
"//:node_modules/erc721a", | ||
], | ||
) |
This file contains 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,6 @@ | ||
load("//sol:defs.bzl", "sol_binary") | ||
|
||
sol_binary( | ||
name = "factories", | ||
srcs = glob(["*.sol"]), | ||
) |
This file contains 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,6 @@ | ||
load("//sol:defs.bzl", "sol_binary") | ||
|
||
sol_binary( | ||
name = "random", | ||
srcs = glob(["*.sol"]), | ||
) |
This file contains 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,10 @@ | ||
load("//sol:defs.bzl", "sol_binary") | ||
|
||
sol_binary( | ||
name = "sales", | ||
srcs = glob(["*.sol"]), | ||
deps = [ | ||
"//contracts/utils", | ||
"//:node_modules/@openzeppelin/contracts", | ||
], | ||
) |
This file contains 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,10 @@ | ||
load("//sol:defs.bzl", "sol_binary") | ||
|
||
sol_binary( | ||
name = "chainlink", | ||
srcs = glob(["*.sol"]), | ||
deps = [ | ||
"//:node_modules/@chainlink/contracts", | ||
"//:node_modules/@openzeppelin/contracts", | ||
], | ||
) |
This file contains 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,10 @@ | ||
load("//sol:defs.bzl", "sol_binary") | ||
|
||
sol_binary( | ||
name = "opensea", | ||
srcs = glob(["*.sol"]), | ||
deps = [ | ||
"//contracts/utils", | ||
"//:node_modules/@openzeppelin/contracts", | ||
], | ||
) |
This file contains 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,6 @@ | ||
load("//sol:defs.bzl", "sol_binary") | ||
|
||
sol_binary( | ||
name = "weth", | ||
srcs = glob(["*.sol"]), | ||
) |
This file contains 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,8 @@ | ||
load("//sol:defs.bzl", "sol_sources") | ||
|
||
sol_sources( | ||
name = "utils", | ||
srcs = glob(["*.sol"]), | ||
visibility = ["//visibility:public"], | ||
deps = ["//:node_modules/@openzeppelin/contracts"], | ||
) |
This file contains 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,46 @@ | ||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | ||
|
||
# For stardoc to reference the files | ||
exports_files(["defs.bzl"]) | ||
|
||
# This is the target rule authors should put in their "toolchains" | ||
# attribute in order to get a runtime for the correct platform. | ||
# See https://docs.bazel.build/versions/main/toolchains.html#writing-rules-that-use-toolchains | ||
toolchain_type( | ||
name = "toolchain_type", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
bzl_library( | ||
name = "repositories", | ||
srcs = ["repositories.bzl"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//sol/private:toolchains_repo", | ||
"//sol/private:versions", | ||
"@bazel_tools//tools/build_defs/repo:http.bzl", | ||
"@bazel_tools//tools/build_defs/repo:utils.bzl", | ||
], | ||
) | ||
|
||
bzl_library( | ||
name = "defs", | ||
srcs = ["defs.bzl"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//sol/private:sol_binary", | ||
"//sol/private:sol_sources", | ||
], | ||
) | ||
|
||
bzl_library( | ||
name = "providers", | ||
srcs = ["providers.bzl"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
bzl_library( | ||
name = "toolchain", | ||
srcs = ["toolchain.bzl"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains 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,24 @@ | ||
"""# Bazel rules for Solidity | ||
See <https://docs.soliditylang.org> | ||
""" | ||
|
||
load("//sol/private:sol_binary.bzl", lib = "sol_binary") | ||
load("//sol/private:sol_sources.bzl", src = "sol_sources") | ||
load(":providers.bzl", "SolSourcesInfo") | ||
|
||
sol_binary = rule( | ||
implementation = lib.implementation, | ||
attrs = lib.attrs, | ||
doc = """sol_binary compiles Solidity source files with solc""", | ||
toolchains = lib.toolchains, | ||
) | ||
|
||
sol_sources = rule( | ||
implementation = src.implementation, | ||
attrs = src.attrs, | ||
doc = """Collect .sol source files to be imported as library code. | ||
Performs no actions, so semantically equivalent to filegroup(). | ||
""", | ||
provides = [SolSourcesInfo], | ||
) |
This file contains 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,36 @@ | ||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | ||
|
||
bzl_library( | ||
name = "toolchains_repo", | ||
srcs = ["toolchains_repo.bzl"], | ||
visibility = ["//sol:__subpackages__"], | ||
) | ||
|
||
bzl_library( | ||
name = "versions", | ||
srcs = ["versions.bzl"], | ||
visibility = ["//sol:__subpackages__"], | ||
) | ||
|
||
bzl_library( | ||
name = "sol_binary", | ||
srcs = ["sol_binary.bzl"], | ||
visibility = ["//sol:__subpackages__"], | ||
deps = [ | ||
"//sol:providers", | ||
"@aspect_rules_js//js:libs", | ||
"@aspect_rules_js//js:providers", | ||
"@bazel_skylib//lib:paths", | ||
], | ||
) | ||
|
||
bzl_library( | ||
name = "sol_sources", | ||
srcs = ["sol_sources.bzl"], | ||
visibility = ["//sol:__subpackages__"], | ||
deps = [ | ||
"//sol:providers", | ||
"@aspect_rules_js//js:libs", | ||
"@aspect_rules_js//js:providers", | ||
], | ||
) |
Oops, something went wrong.