Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tmp/
.pnp
.pnp.js
tools/bin/abigen
tools/bin/forge_zksync

/chainlink
core/chainlink
Expand Down
1 change: 1 addition & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ artifacts
cache
node_modules
solc
zkout
abi
coverage
coverage.json
Expand Down
1 change: 1 addition & 0 deletions contracts/FOUNDRY_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Check out the official [Foundry best practices section](https://book.getfoundry.
- Use `make snapshot` to generate the correct snapshot for the selected Foundry profile.
- Use `make snapshot-diff` to see the diff between the local snapshot and your latest changes.
- use `make wrappers` to generate the gethwrappers for the selected Foundry profile.
- use `make wrappers-zksync` to generate the gethwrappers for ZK Sync deployments.
- Use `vm.recordLogs();` to record all logs emitted
- Use `vm.getRecordedLogs()` to get the logs emitted.
- This way you can assert that a log was *not* emitted.
Expand Down
8 changes: 8 additions & 0 deletions contracts/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ mockery: $(mockery) ## Install mockery.
foundry: ## Install foundry.
foundryup --install v1.0.0

../tools/bin/forge_zksync:
../tools/bin/install_forge_zksync

.PHONY: foundry-refresh
foundry-refresh: foundry
git submodule deinit -f .
Expand Down Expand Up @@ -97,6 +100,11 @@ wrappers-all: pnpmdep mockery abigen ## Recompiles solidity contracts and their
# go_generate contains a call to compile all contracts before generating wrappers
go generate ../gethwrappers/go_generate.go

.PHONY: wrappers-zksync
wrappers-zksync: pnpmdep ../tools/bin/forge_zksync
# only compilation now. go wrappers to be added
./scripts/zksync_compile_all

# Use this to generate compiled JSON artifacts for gauntlet-plus-plus.
# This is currently only used for CCIP.
# example: make artifact-generate contract=LockReleaseTokenPoolAndProxy solcversion=0.8.24 artifactpath=../../gauntlet-plus-plus/packages-ethereum/operations-ccip/src/artifacts/1.5.0/lock-release-token-pool-and-proxy.json
Expand Down
33 changes: 33 additions & 0 deletions contracts/scripts/zksync_compile_all
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -e

echo " ┌──────────────────────────────────────────────┐"
echo " │ Compiling ZKSync contracts... │"
echo " └──────────────────────────────────────────────┘"

FOUNDRY_PROJECT_SUFFIX=""
CONTRACTS_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../ && pwd -P )"

compileContract() {
local contract
contract=$(basename "$1")
echo "Compiling" "$contract"

PROJECT=$2
export FOUNDRY_PROFILE="$PROJECT"$FOUNDRY_PROJECT_SUFFIX

${CONTRACTS_DIR}/../tools/bin/forge_zksync build $CONTRACTS_DIR/src/v0.8/$PROJECT/"$1.sol" --zksync \
--root $CONTRACTS_DIR \
$3
}

compileContract token/ERC677/LinkToken shared "--use 0.8.19"
compileContract token/ERC677/BurnMintERC677 shared "--use 0.8.19"
compileContract multicall/ebd8b64/src/Multicall3 vendor "--use 0.8.19"
compileContract CapabilitiesRegistry keystone

# simplest way without modifications to list all ccip contracts
for x in $(grep "^compileContract .*$" ${CONTRACTS_DIR}/scripts/native_solc_compile_all_ccip | sed 's/compileContract //'); do \
compileContract $x ccip; \
done
22 changes: 22 additions & 0 deletions tools/bin/install_forge_zksync
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -e

VERSION="0.0.12"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS="linux"
ARCH="x86_64"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="darwin"
ARCH=$(uname -m)
else
echo "Unsupported OS: $OSTYPE"
exit 1
fi

ARTIFACT_URL="https://github.com/matter-labs/foundry-zksync/releases/download/foundry-zksync-v${VERSION}/foundry_zksync_v${VERSION}_${OS}_${ARCH}.tar.gz"
THIS_DIR="$(realpath "$(dirname $0)")"
echo $ARTIFACT_URL
curl $ARTIFACT_URL -L -o- | tar -xv -C $THIS_DIR
rm $THIS_DIR/cast
mv $THIS_DIR/forge $THIS_DIR/forge_zksync
Loading