Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
opnode: Update and deploy contracts
Browse files Browse the repository at this point in the history
This is rather than hardcoding the contract value. It slows down the e2e
tests (by having to wait 1 L1 block for contracts to be ready), but it
is more accurate to what occurs (and is now required as we initialize
actions).
  • Loading branch information
trianglesphere committed Apr 11, 2022
1 parent 3307176 commit f648a12
Show file tree
Hide file tree
Showing 12 changed files with 4,067 additions and 568 deletions.
8 changes: 4 additions & 4 deletions l2os/bindings/l2oo/l2_output_oracle.go

Large diffs are not rendered by default.

81 changes: 37 additions & 44 deletions opnode/contracts/Makefile
Original file line number Diff line number Diff line change
@@ -1,56 +1,49 @@
SHELL := /bin/bash

CONTRACTS_PATH := "../../packages/contracts/artifacts/contracts"
CONTRACTS_PATH := "../../packages/contracts/"
OPTIMISM_PORTAL := ../../packages/contracts/contracts/L1/OptimismPortal.sol
L1_BLOCK_INFO := ../../packages/contracts/contracts/L2/L1Block.sol

binding: abi
$(eval temp := $(shell mktemp))

cat abis/DepositFeed.json \
| jq -r .bytecode > $(temp)
bindings: bindings-l1-block-info bindings-optimism-oracle deployed-bin-l1-block-info

cat abis/DepositFeed.json \
| jq .abi \
| abigen --pkg deposit \
--abi - \
--out deposit/deposit_feed_raw.go \
--type deposit \
--bin $(temp)

$(eval deployedBytecode := $(shell cat abis/DepositFeed.json | jq -r .deployedBytecode))
echo "// Code generated - DO NOT EDIT." > deposit/deposit_feed_deployed.go
echo "// This file is a generated binding and any manual changes will be lost." >> deposit/deposit_feed_deployed.go
echo "package deposit" >> deposit/deposit_feed_deployed.go
echo "var DepositDeployedBin = \"$(deployedBytecode)\"" >> deposit/deposit_feed_deployed.go
gofmt -s -w deposit/deposit_feed_deployed.go

rm $(temp)

$(eval temp := $(shell mktemp))

cat abis/L1Block.json \
| jq -r .bytecode > $(temp)

cat abis/L1Block.json \
| jq .abi \
| abigen --pkg l1block \
--abi - \
--out l1block/l1_block_info_raw.go \
--type l1block \
--bin $(temp)

$(eval deployedBytecode := $(shell cat abis/L1Block.json | jq -r .deployedBytecode))
# Split up b/c I don't know how to include this step in the L1 Block Info Bindings
# What is occuring is that the `temp` variable is hard to pull into the `eval`
deployed-bin-l1-block-info: bindings-l1-block-info
$(eval deployedBytecode := $(shell cat bin/l1block_deployed.hex))
echo "// Code generated - DO NOT EDIT." > l1block/l1_block_info_deployed.go
echo "// This file is a generated binding and any manual changes will be lost." >> l1block/l1_block_info_deployed.go
echo "package l1block" >> l1block/l1_block_info_deployed.go
echo "var L1blockDeployedBin = \"$(deployedBytecode)\"" >> l1block/l1_block_info_deployed.go
gofmt -s -w l1block/l1_block_info_deployed.go

rm $(temp)

abi:
cat $(CONTRACTS_PATH)/L1/DepositFeed.sol/DepositFeed.json \
| jq '{abi,bytecode,deployedBytecode}' \
> abis/DepositFeed.json
cat $(CONTRACTS_PATH)/L2/L1Block.sol/L1Block.json \
| jq '{abi,bytecode,deployedBytecode}' \
> abis/L1Block.json
bindings-l1-block-info:
$(eval temp := $(shell mktemp -d))
solc \
--abi $(L1_BLOCK_INFO) \
--bin $(L1_BLOCK_INFO) \
--combined-json abi,bin,bin-runtime \
--allow-paths $(CONTRACTS_PATH) \
-o $(temp)
abigen \
--combined-json $(temp)/combined.json \
--pkg l1block \
--type l1block \
--out ./l1block/l1_block_info_raw.go
cat $(temp)/combined.json | jq -r ".contracts | with_entries(select(.key | match(\"L1Block\")))[] | .\"bin-runtime\"" > bin/l1block_deployed.hex


bindings-optimism-oracle:
$(eval temp := $(shell mktemp -d))
solc \
--abi $(OPTIMISM_PORTAL) \
--bin $(OPTIMISM_PORTAL) \
--combined-json abi,bin,bin-runtime \
--allow-paths $(CONTRACTS_PATH) \
-o $(temp)
abigen \
--combined-json $(temp)/combined.json \
--pkg deposit \
--type deposit \
--out ./deposit/deposit_feed_raw.go
93 changes: 0 additions & 93 deletions opnode/contracts/abis/DepositFeed.json

This file was deleted.

104 changes: 0 additions & 104 deletions opnode/contracts/abis/L1Block.json

This file was deleted.

5 changes: 0 additions & 5 deletions opnode/contracts/deposit/deposit_feed_deployed.go

This file was deleted.

Loading

0 comments on commit f648a12

Please sign in to comment.