Skip to content

Commit

Permalink
Use abigen for bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
pcw109550 committed Jun 12, 2024
1 parent de1d237 commit 08936f2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 60 deletions.
19 changes: 3 additions & 16 deletions rvgo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ lint-fix:
golangci-lint run --fix
.PHONY: lint-fix

build-bindgen:
cd ../rvsol/lib/optimism/op-bindings && \
go build -o ./bin/op-bindings ./cmd/. && \
cp ./bin/op-bindings ../../../../rvgo/
.PHONY: build-bindgen

bindgen-generate-local:
./op-bindings \
generate \
--metadata-out ./bindings \
--bindings-package bindings \
--contracts-list ../rvsol/artifacts.json \
--log.level info \
local \
--forge-artifacts ../rvsol/out
.PHONY: bindgen-generate-local
gen-bindings:
just bindings-upgrades
.PHONY: gen-bindings
22 changes: 0 additions & 22 deletions rvgo/bindings/preimageoracle.go

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions rvgo/bindings/riscv.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions rvgo/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
out := '../rvsol/out'

bindings-upgrades:
#!/usr/bin/env bash
set -euxo pipefail
build_abi() {
jq .abi "{{out}}/$1.sol/$1.json" > "/tmp/$1.json"

local lowercase=$(echo "$1" | awk '{print tolower($0)}')
abigen \
--abi "/tmp/$1.json" \
--pkg bindings \
--out "bindings/$lowercase.go" \
--type $1
}

build_abi RISCV
build_abi PreimageOracle

0 comments on commit 08936f2

Please sign in to comment.