Technical Requirements
This project has been developed in the Solidity and TypeScript languages, using Foundry as a development environment. Rust is used for the backend to enable fast bridging, while Solidity is used for smart contracts and contract tests.
The project utilizes the OpenZeppelin libraries as well as forge-std
for testing.
Architecture Overview
SkyBridge is built on the existing Optimism bridge, using it wherever possible to ensure the most secure transfer of funds. Most calls mirror the calls in the Optimism bridge, except for the fast bridging functionality. We also augmented the basic transfer functions in the L1 contract to collect fees to fund the liquidity pool used in L1 to enable fast transfers.
Fast transfers are powered by our backend, which captures events from L2 and uses them to instruct the LiquidityPool.sol
to send funds to the user so they don’t have to wait for the 7-day lockout imposed by the Optimism Standard Bridge.
Contract Information
In the src/universal
directory one will find two abstract contracts: AviBridge.sol
and AviERC721Bridge.sol
. These contracts provide the shared code that is used by both the Layer 1 and Layer 2 bridge contracts.
In the src/L1
directory are three contracts: the two L1 implementations of the AviBridge and AviERC721Bridge. Additionally, and uniquely to Layer 1, there is a LiquidityPool.sol
. This LiquidityPool contract is utilized to provide a central place to hold funds for fast bridging and the fees from Layer 1 to Layer 2 transfers.
In the src/L2
directory, unsurprisingly, there are two contracts: The Layer 2 implementations of the AviBridge and AviERC721Bridge.
Lastly, in the src/libraries
directory is the Predeploys.sol
. This contract holds constants that should never change. They are contracts that already exist on a destination Layer 2, and need to be set before deployment.