-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move contract logic to contracts folder
- Loading branch information
Showing
37 changed files
with
269 additions
and
201 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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"addresses": { | ||
"groupMessagesDeployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", | ||
"groupMessagesImpl": "0x0a17FabeA4633ce714F1Fa4a2dcA62C3bAc4758d", | ||
"groupMessagesProxy": "0x3C1Cb427D20F15563aDa8C249E71db76d7183B6c", | ||
"groupMessagesImpl": "0x5f246ADDCF057E0f778CD422e20e413be70f9a0c", | ||
"groupMessagesProxy": "0xaD82Ecf79e232B0391C5479C7f632aA1EA701Ed1", | ||
"groupMessagesProxyAdmin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" | ||
}, | ||
"deploymentBlock": 65, | ||
"latestUpgradeBlock": 71 | ||
"deploymentBlock": 160, | ||
"latestUpgradeBlock": 160 | ||
} |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"addresses": { | ||
"identityUpdatesDeployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", | ||
"identityUpdatesImpl": "0x1343248Cbd4e291C6979e70a138f4c774e902561", | ||
"identityUpdatesProxy": "0x22a9B82A6c3D2BFB68F324B2e8367f346Dd6f32a", | ||
"identityUpdatesImpl": "0x4Dd5336F3C0D70893A7a86c6aEBe9B953E87c891", | ||
"identityUpdatesProxy": "0x91A1EeE63f300B8f41AE6AF67eDEa2e2ed8c3f79", | ||
"identityUpdatesProxyAdmin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" | ||
}, | ||
"deploymentBlock": 67, | ||
"latestUpgradeBlock": 67 | ||
"deploymentBlock": 162, | ||
"latestUpgradeBlock": 162 | ||
} |
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
File renamed without changes.
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,70 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# Default directories (can be overridden with environment variables) | ||
source_dir="${SOURCE_DIR:-src}" | ||
build_dir="${BUILD_DIR:-build}" | ||
output_dir="${OUTPUT_DIR:-pkg}" | ||
|
||
# Ensure required directories exist and clean up old artifacts | ||
function setup_directories() { | ||
mkdir -p "${build_dir}" "${output_dir}" | ||
} | ||
|
||
# Generate bindings for a given contract | ||
function generate_bindings() { | ||
local filename="$1" | ||
local package="$(echo "${filename}" | tr '[:upper:]' '[:lower:]')" | ||
local source_artifact="${source_dir}/${filename}.sol" | ||
local build_artifact="${build_dir}/${filename}" | ||
local output_artifact="${output_dir}/${package}/${filename}.go" | ||
|
||
rm -f "${build_artifact}".*.json | ||
mkdir -p "${output_dir}/${package}" | ||
rm -f "${output_dir}/${package}"/*.go | ||
|
||
# Generate ABI and bytecode | ||
if ! forge inspect "${source_artifact}:${filename}" abi > "${build_artifact}.abi.json"; then | ||
echo "ERROR: Failed to generate ABI for ${filename}" >&2 | ||
exit 1 | ||
fi | ||
|
||
if ! forge inspect "${source_artifact}:${filename}" bytecode > "${build_artifact}.bin.json"; then | ||
echo "ERROR: Failed to generate bytecode for ${filename}" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Generate Go bindings | ||
if ! abigen --abi "${build_artifact}.abi.json" \ | ||
--bin "${build_artifact}.bin.json" \ | ||
--pkg "${package}" \ | ||
--type "${filename}" \ | ||
--out "${output_artifact}" > /dev/null 2>&1; then | ||
echo "ERROR: Failed to generate bindings for ${filename}" >&2 | ||
exit 1 | ||
fi | ||
} | ||
|
||
function main() { | ||
# Always work from the contracts directory | ||
script_dir=$(dirname "$(realpath "$0")") | ||
repo_root=$(realpath "${script_dir}/../") | ||
cd "${repo_root}" | ||
|
||
setup_directories | ||
|
||
# Define contracts (pass as arguments or use a default list) | ||
local contracts=("$@") | ||
if [ "${#contracts[@]}" -eq 0 ]; then | ||
contracts=("Nodes" "GroupMessages" "IdentityUpdates") | ||
fi | ||
|
||
# Generate bindings for each contract | ||
for contract in "${contracts[@]}"; do | ||
echo "Processing contract: ${contract}" | ||
generate_bindings "${contract}" | ||
done | ||
} | ||
|
||
main "$@" |
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
pkg/abis/groupMessages.go → contracts/pkg/groupmessages/GroupMessages.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
pkg/abis/identityUpdates.go → ...ts/pkg/identityupdates/IdentityUpdates.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"detectors_to_exclude": "", | ||
"detectors_to_exclude": "unused-state,naming-convention,constable-states", | ||
"filter_paths": "dependencies" | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.