Building an Optimistic Bridge on Facet
Last updated
Last updated
You can use to build an OP-style optimistic bridge on Facet. Facet Optimism provides tools to run an optimistic bridge on Facet using Optimism's technology. It includes modified versions of:
Op L1 smart contracts
Op L2 smart contracts
op-node
op-proposer
Unused components like op-challenger and op-batcher remain unmodified.
Key points:
This code is separate from the Facet protocol. It's a set of third-party tools for working with Facet.
These tools are read-only for the Facet protocol. The op-node
here only provides information about Facet and doesn't participate in L2 derivation.
git clone
Use the facetv1.9.1
branch.
Follow for setup.
Use the provided rollup-config.json
.
Complete the .envrc
file.
Use https://sepolia.facet.org
for OP_NODE_L2_ENGINE_RPC
.
This will deploy and verify all the L1 and L2 contracts you need to bridge. It will also create an L2 token you can bridge into using a public L1 Test Token (0x5589BB8228C07c4e15558875fAf2B859f678d129
).
op-node
and op-proposer
In one terminal: (Assuming you're still in packages/contracts-bedrock
)
In another terminal:
Now you are posting L2 outputs to the L2 Output Oracle. Make sure your proposer address has enough testnet ether!
From here on out it's exactly the same as how you'd bridge with Optimism.
Edit TestBridgeIn.s.sol
in packages/contracts-bedrock/
.
Run:
Verify the balance increase on the L2 explorer.
Visit the L2StandardBridge
page on the L2 explorer.
Use the bridgeERC20To
function.
Submit the transaction.
Wait for the output to be posted to the L2 Output Oracle (every 30 blocks by default).
You can bridge out the same token you bridged in.
Now wait for the corresponding output to be posted to the L2 Output Oracle. The default configuration is for this to happen every 30 blocks.
Use the provided example script, adapting it as needed for your specific withdrawal.
Find your createOptimismMintableERC20
transaction on the .