Building an Optimistic Bridge on Facet
You can use facet-optimism
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.
Getting started
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.
Installation Instructions
Basic Setup
Use the
facetv1.9.1
branch.Follow Optimism's instructions for setup.
Use the provided
rollup-config.json
.Complete the
.envrc
file.Use
https://sepolia.facet.org
forOP_NODE_L2_ENGINE_RPC
.
Deploy the Contracts
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
).
Start op-node
and op-proposer
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.
Bridge a Token into Facet
Find your
createOptimismMintableERC20
transaction on the Facet testnet explorer.Edit
TestBridgeIn.s.sol
inpackages/contracts-bedrock/
.Run:
Verify the balance increase on the L2 explorer.
Bridge a Token out of Facet
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.
Prove and Finalize the Withdrawal
Use the provided example script, adapting it as needed for your specific withdrawal.
Last updated