Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danhper committed May 10, 2024
0 parents commit b60f366
Show file tree
Hide file tree
Showing 26 changed files with 5,066 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: test

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
env:
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}
ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL }}
run: |
forge test -vvv
id: test
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

# Dotenv file
.env
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/openzeppelin/openzeppelin-contracts-upgradeable
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## CCIP GYD Bridge

The code is based on the [zkEVM DAI bridge](https://github.com/pyk/zkevm-dai)

### Introduction

Bridged GYD implementation consists of two smart contracts:

1. **GydL1Escrow**: This contract is deployed on Ethereum mainnet.
2. **L2Gyd**: This contract is deployed on L2s.

The user can do the following:

1. Bridge GYD from Ethereum mainnet to an L2 via `GydL1Escrow` contract.
2. Bridge GYD from an L2 to Ethereum mainnet via `L2Gyd` contract.

## Get started

### Requirements

This repository uses foundry. You can install foundry via
[foundryup](https://book.getfoundry.sh/getting-started/installation).

### Setup

Clone the repository:

```sh
git clone git@github.com:gyrostable/ccip-gyd.git
cd ccip-gyd/
```

Install the dependencies:

```sh
forge install
```

### Tests

Create `.env` with the following contents:

```
ETH_RPC_URL=""
ARBITRUM_RPC_URL="https://arb1.arbitrum.io/rpc"
ETHERSCAN_API_KEY=""
```

Use the following command to run the test:

```sh
forge test
```

> **Note**
> You can set `ETHERSCAN_API_KEY` to helps you debug the call trace.
## Deployment

Deployment scripts are located in the [`script`](./script/) directory.

## Contract addresses

| Smart contract | Network | Address |
| -------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| GYD | Mainnet | [0xe07F9D810a48ab5c3c914BA3cA53AF14E4491e8A](https://etherscan.io/address/0xe07F9D810a48ab5c3c914BA3cA53AF14E4491e8A) |
| CCIP router | Mainnet | [0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D](https://etherscan.io/address/0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D) |
| | Arbitrum | [0x141fa059441E0ca23ce184B6A78bafD2A517DdE8](https://arbiscan.io/address/0x141fa059441E0ca23ce184B6A78bafD2A517DdE8) |
| GydL1CCIPEscrow | Mainnet | [0xa1886c8d748DeB3774225593a70c79454B1DA8a6](https://etherscan.io/address/0xa1886c8d748DeB3774225593a70c79454B1DA8a6) |
| L2Gyd | Arbitrum | [0xCA5d8F8a8d49439357d3CF46Ca2e720702F132b8](https://arbiscan.io/address/0xCA5d8F8a8d49439357d3CF46Ca2e720702F132b8) |

173 changes: 173 additions & 0 deletions broadcast/DeployGydL1CCIPEscrow.s.sol/1/run-1715381332.json

Large diffs are not rendered by default.

173 changes: 173 additions & 0 deletions broadcast/DeployGydL1CCIPEscrow.s.sol/1/run-latest.json

Large diffs are not rendered by default.

161 changes: 161 additions & 0 deletions broadcast/DeployL2GydArbitrum.s.sol/42161/run-latest.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[profile.default]
solc = "0.8.24"
src = "src"
out = "out"
libs = ["lib"]
evm_version = "shanghai"
remappings = [
"src/=src/",
"oz/=lib/openzeppelin-contracts/contracts/",
"upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"ccip/=node_modules/@chainlink/contracts-ccip/src/v0.8/ccip/",
]

[fmt]
line_length = 79
tab_width = 2
number_underscore = "thousands"
wrap_comments = true
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at 978ac6
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at dbb610
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts-upgradeable
Loading

0 comments on commit b60f366

Please sign in to comment.