Skip to content

Commit

Permalink
feat : updated contract builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ocdbytes committed Nov 22, 2024
1 parent 782967e commit c7f4e9d
Show file tree
Hide file tree
Showing 47 changed files with 1,302 additions and 18,459 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ script/anvil.json

.idea

artifacts/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "lib/piltover"]
path = lib/piltover
url = https://github.com/keep-starknet-strange/piltover
[submodule "lib/starkgate-contracts"]
path = lib/starkgate-contracts
url = https://github.com/starknet-io/starkgate-contracts
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[workspace]
resolver = "2"
members = [
"crates/l2/utils",
"crates/l2/starknet-core-contract-client",
"crates/l2/ethereum-instance",
"crates/l2/starknet-eth-bridge-client",
"crates/l2/starknet-token-bridge-client",
"crates/l2/starkgate-manager-client",
"crates/l2/utils",
"crates/l2/starknet-erc20-client",
"crates/l2/starkgate-registry-client",
"crates/l2/starknet-proxy-client",
Expand Down
38 changes: 36 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,46 @@
# Moreover, any project using sandbox as dependency won't build unless
# there's Foundry installed on the machine.

.PHONY: artifacts
.PHONY: artifacts cairo-lang local-contracts starkgate-contracts

CAIRO_LANG_COMMIT_HASH="8e11b8cc65ae1d0959328b1b4a40b92df8b58595"
STARKGATE_CONTRACTS_COMMIT_HASH="45941888479663ac93e898cd7f8504fa9066c54c"

artifacts:
mkdir crates/starknet-proxy-client/src/artifacts || true
mkdir crates/starknet-core-contract-client/src/artifacts || true
forge build
cp out/UnsafeProxy.sol/UnsafeProxy.json crates/starknet-proxy-client/src/artifacts/
cp out/StarknetSovereign.sol/Starknet.json crates/starknet-core-contract-client/src/artifacts/
(cd lib/piltover && scarb build && cp target/dev/* ../../crates/l3/appchain-core-contract-client/artifacts)
(cd lib/piltover && scarb build && cp target/dev/* ../../crates/l3/appchain-core-contract-client/artifacts)

cairo-lang:
cp build-artifacts/foundry.toml lib/cairo-lang/foundry.toml
cd lib/cairo-lang && \
git checkout $(CAIRO_LANG_COMMIT_HASH) && \
forge build
# Copying Contracts :
mkdir -p artifacts/cairo-lang
cp lib/cairo-lang/out/Starknet.sol/Starknet.json artifacts/cairo-lang/Starknet.json

local-contracts:
forge build
# Copying Contracts :
cp out/StarknetOverride.sol/Starknet.json artifacts/StarknetOverride.json
cp out/UnsafeProxy.sol/UnsafeProxy.json artifacts/UnsafeProxy.json

starkgate-contracts:
cd lib/starkgate-contracts && \
git checkout $(STARKGATE_CONTRACTS_COMMIT_HASH) && \
./scripts/setup.sh && \
FILES=$$(cat src/solidity/files_to_compile.txt) && \
solc $$FILES --allow-paths .=., --optimize --optimize-runs 200 --overwrite --combined-json abi,bin -o artifacts && \
./scripts/extract_artifacts.py
# Copying Contracts :
mkdir -p artifacts/starkgate-contracts
cp lib/starkgate-contracts/artifacts/LegacyBridge.json artifacts/starkgate-contracts/LegacyBridge.json
cp lib/starkgate-contracts/artifacts/StarkgateManager.json artifacts/starkgate-contracts/StarkgateManager.json
cp lib/starkgate-contracts/artifacts/StarkgateRegistry.json artifacts/starkgate-contracts/StarkgateRegistry.json
cp lib/starkgate-contracts/artifacts/Proxy.json artifacts/starkgate-contracts/Proxy_5_0_0.json
cp lib/starkgate-contracts/artifacts/StarknetTokenBridge.json artifacts/starkgate-contracts/StarknetTokenBridge.json
cp lib/starkgate-contracts/artifacts/ERC20.json artifacts/starkgate-contracts/ERC20.json
9 changes: 9 additions & 0 deletions build-artifacts/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[profile.default]
src = "src/starkware/starknet/solidity"
out = "out"
libs = ["lib"]
solc = "0.8.27"
evm_version = "cancun"
remappings = [
"starkware=src/starkware"
]
Loading

0 comments on commit c7f4e9d

Please sign in to comment.