Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ node_modules/


*.DS_Store

pkg/bindings/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/Openzeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/murky"]
path = lib/murky
url = https://github.com/dmfxyz/murky
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
storage-report:
bash ".github/bin/storage-report.sh" "docs/storage-report/"
bash ".github/bin/storage-report.sh" "docs/storage-report/"

compile:
forge build

bindings: compile
./bin/generate-bindings.sh
40 changes: 40 additions & 0 deletions bin/generate-bindings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

BINDING_DIR=./pkg/bindings
JSON_DIR=./out

function create_binding {
contract_name=$1

mkdir -p $BINDING_DIR/${contract_name}

contract_json_path="${JSON_DIR}/${contract_name}.sol/${contract_name}.json"

binding_out_dir="${BINDING_DIR}/${contract_name}"
mkdir -p $binding_out_dir || true

cat $contract_json_path | jq -r '.abi' > $binding_out_dir/tmp.abi
cat $contract_json_path | jq -r '.bytecode.object' > $binding_out_dir/tmp.bin

abigen \
--bin=$binding_out_dir/tmp.bin \
--abi=$binding_out_dir/tmp.abi \
--pkg="${contract_name}" \
--out=$BINDING_DIR/$contract_name/binding.go \
> /dev/null 2>&1

if [[ $? == "1" ]];
then
echo "Failed to generate binding for $contract_json_path"
fi
rm $binding_out_dir/tmp.abi
rm $binding_out_dir/tmp.bin
}

contracts=$(find src -type f -name "*.sol" )
IFS=$'\n'

for contract_name in $contracts; do
contract_name=$(basename $contract_name .sol)
create_binding $contract_name
done
Empty file modified bin/storage-report.sh
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
"@openzeppelin/=lib/openzeppelin-contracts/",
"@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/",
"eigenlayer-contracts/=lib/eigenlayer-contracts/",

"murky/=lib/murky/src/"
]

# Specifies the exact version of Solidity to use, overriding auto-detection.
solc_version = '0.8.27'
# If enabled, treats Solidity compiler warnings as errors, preventing artifact generation if warnings are present.
Expand Down
1 change: 1 addition & 0 deletions lib/murky
Submodule murky added at 5feccd
Loading
Loading