-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4e888d3
Showing
147 changed files
with
28,650 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This configuration only applies to the package manager root. | ||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
ignorePatterns: ["apps/**", "packages/**"], | ||
extends: ["@repo/eslint-config/library.js"], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Default Token List CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- "packages/token-list/**" | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "packages/token-list/**" | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./packages/token-list | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- name: Setup pnpm cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Run tests | ||
env: | ||
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} | ||
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }} | ||
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }} | ||
run: pnpm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Website CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- "apps/website/**" | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "apps/website/**" | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./apps/website | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- name: Setup pnpm cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Check formatting and linting | ||
run: pnpm run-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# Dependencies | ||
node_modules | ||
.pnp | ||
.pnp.js | ||
|
||
# Local env files | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# Testing | ||
coverage | ||
|
||
# Turbo | ||
.turbo | ||
|
||
# Vercel | ||
.vercel | ||
|
||
# Build Outputs | ||
.next/ | ||
out/ | ||
build | ||
dist | ||
|
||
|
||
# Debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Misc | ||
.DS_Store | ||
*.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
auto-install-peers=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"eslint.workingDirectories": [ | ||
{ | ||
"mode": "auto" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<!--  --> | ||
|
||
# Based Bridge - Native Superchain ERC721 Bridge | ||
|
||
The Based Bridge application allows you to bridge your NFTs from Ethereum to the Superchain - and back again if needed. It uses the Optimism developed smart contracts to bridge the NFTs between the two networks. | ||
|
||
- [L1ERC721Bridge](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L1/L1ERC721Bridge.sol) | ||
- [L2ERC721Bridge](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/L2ERC721Bridge.sol) | ||
- [OptimismMintableERC721](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/universal/OptimismMintableERC721.sol) | ||
- [OptimismMintableERC721Factory](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/universal/OptimismMintableERC721Factory.sol) | ||
|
||
Information about the deployment addresses can be found in the Optimism and Base documentation. | ||
|
||
- https://docs.optimism.io/chain/addresses | ||
- https://docs.base.org/base-contracts/ | ||
|
||
No third-party smart contracts are used in the bridging process. The bridge is fully decentralized and trustless using the native message and relayer system of the Superchain rollups. | ||
|
||
# Project Structure | ||
|
||
The project is structured as a monorepo with the following packages: | ||
|
||
- [`apps/website`](/apps/website/) - The application for bridging ERC721 collections. | ||
- [`apps/event-cache`](/apps/event-cache/) - [Ponder](https://ponder.sh/) indexer for ERC721 bridge events. | ||
- [`packages/token-list`](/packages/token-list/) - Token list for verifying NFTs on the bridge. | ||
|
||
# Supported Networks | ||
The application currently supports Optimism and Base, but in the future will support other Optimism based rollups. | ||
|
||
### Production | ||
|
||
- Ethereum (L1) | ||
- Optimism (L2) | ||
- Base (L2) | ||
|
||
### Testing | ||
|
||
- Sepolia (L1) | ||
- Optimism Sepolia (L2) | ||
- Base Sepolia (L2) | ||
|
||
# Verifying a new NFT contract | ||
The native Superchain ERC721 bridge is open and permissionless. | ||
|
||
However, the Base Bridge application has a token list that is used to verify new NFT contracts on the bridge. The District Labs, Inc. team is responsible for maintaining the token list and adding new NFT contracts to the list. | ||
|
||
To verify a new NFT contract on the bridge, you need to open a pull request adding the NFT contract address from the L1 network and the corresponding bridged contract address on the L2 network to the token list. | ||
|
||
The token list is located in the [`packages/token-list`](/packages/token-list/) package. | ||
|
||
It's recommended to make a public statement that can be linked to, using an official channel of the NFT project. This link will be added to the token list to verify the authenticity of the NFT contract. | ||
|
||
# Important Information | ||
|
||
The new Superchain ERC721 smart contract has a few differences from the standard ERC721 contract. | ||
|
||
First, minting authority is controlled by the `L1ERC721Bridge` and `L2ERC721Bridge` contracts. These contracts are the only contract that can mint new tokens on the L2 network. | ||
|
||
Second, the `tokenURI` metadata is stored on the L1 network and is accessed by the L2 network using EIP-681. | ||
|
||
```solidity | ||
// Creates a base URI in the format specified by EIP-681: | ||
// https://eips.ethereum.org/EIPS/eip-681 | ||
baseTokenURI = string( | ||
abi.encodePacked( | ||
"ethereum:", | ||
Strings.toHexString(uint160(_remoteToken), 20), | ||
"@", | ||
Strings.toString(_remoteChainId), | ||
"/tokenURI?uint256=" | ||
) | ||
); | ||
``` | ||
|
||
The `OptimismMintableERC721` smart contract uses EIP-681 to generate a reference to the mainnet storage object, which contains the original tokens' `tokenURI` metadata. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "ponder" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# Misc | ||
.DS_Store | ||
|
||
# Env files | ||
.env*.local | ||
|
||
# Ponder | ||
/generated/ | ||
/.ponder/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.16.0 |
Oops, something went wrong.