Skip to content

Commit

Permalink
Merge pull request #3 from BootNodeDev/deployment-scripts
Browse files Browse the repository at this point in the history
Deployment scripts
  • Loading branch information
lmcorbalan authored May 13, 2024
2 parents 4f77153 + abb46b8 commit a9627a6
Show file tree
Hide file tree
Showing 25 changed files with 539 additions and 150 deletions.
61 changes: 55 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,60 @@
export API_KEY_ALCHEMY="YOUR_API_KEY_ALCHEMY"
export API_KEY_ARBISCAN="YOUR_API_KEY_ARBISCAN"
export API_KEY_BSCSCAN="YOUR_API_KEY_BSCSCAN"
export API_KEY_ETHERSCAN="YOUR_API_KEY_ETHERSCAN"
export API_KEY_GNOSISSCAN="YOUR_API_KEY_GNOSISSCAN"
export API_KEY_INFURA="YOUR_API_KEY_INFURA"
export API_KEY_OPTIMISTIC_ETHERSCAN="YOUR_API_KEY_OPTIMISTIC_ETHERSCAN"
export API_KEY_POLYGONSCAN="YOUR_API_KEY_POLYGONSCAN"
export API_KEY_SNOWTRACE="YOUR_API_KEY_SNOWTRACE"
export MNEMONIC="YOUR_MNEMONIC"
export FOUNDRY_PROFILE="default"

## All
export DEPLOYER_PK="your deployer private key"
export ETH_RPC_URL="some ethereum mainnet RPC URL"
export ARBITRUM_RPC_URL="some arbitrum RPC URL"
export SEPOLIA_RPC_URL="some sepolia RPC URL"
export ARBITRUM_SEPOLIA_RPC_URL="some arbitrum sepolia RPC URL"
export ETHERSCAN_API_KEY="your etherscan api key"
export ARBISCAN_API_KEY="your arbican api key"

## Gateways
export GATEWAY_SALT="some salt to use for deploying the gateways"
export CREATE3_FACTORY="the address of a CREATE3Factory present on all the chain you going to deploy"

### L1
export L1_GATEWAY_OWNER="address of the L1 gateway owner"
export L1_ARBITRUM_ROUTER="address of the arbitrum router on L1"
export L1_ARBITRUM_INBOX="address of the arbitrum inbox on L1"

### L2
export L1_GATEWAY="address of L1 gateway"
export L2_ARBITRUM_ROUTER="address of the arbitrum router on L2"

## XERC20
export XERC20_FACTORY="the address of a XERC20Factory present on all the chain you going to deploy"
export XERC20_NAME="name of the XERC20"
export XERC20_SYMBOL="symbol of the XERC20"
export XERC20_BURN_MINT_LIMITS="burn and mint limits for bridges separated by coma"
export XERC20_BRIDGES="bridges address separated by coma"

## Adapters
export ADAPTER_SALT="some salt for deploying the adapters"

### L1
export L1_ADAPTER_OWNER="address of the L1 adapter owner"
export L1_XERC20="address of the L1 XERC20 token"
export L1_GATEWAY="address of the L1 gateway"

### L2
export L2_ADAPTER_OWNER="address of the L2 adapter owner"
export L2_XERC20="address of the L2 XERC20 token"
export L2_GATEWAY="address of the L2 gateway"

## Register and adapter
export L1_ADAPTER_OWNER_PK="Owner of `L1XERC20Adapter` address private key"
export SEND_VALUE="Total amount of ETH to send for payment"
export L1_ADAPTER="Address `L1XERC20Adapter`"
export L2_ADAPTER="Address `L2XERC20Adapter`"
export MAX_SUBMISSION_COST_FOR_GATEWAY="Base submission cost L2 retryable tick3et for gateway"
export MAX_SUBMISSION_COST_FOR_ROUTER="Base submission cost L2 retryable tick3et for router"
export MAX_GAS_FOR_GATEWAY="Max gas for L2 retryable exrecution for gateway message"
export MAX_GAS_FOR_ROUTER="Max gas for L2 retryable exrecution for router message"
export GAS_PRICE_BID="Gas price for L2 retryable ticket"
export VALUE_FOR_GATEWAY="ETH value to transfer to the gateway"
export VALUE_FOR_ROUTER="ETH value to transfer to the gateway"
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
test:
needs: ["lint", "build"]
runs-on: "ubuntu-latest"
environment: "TEST"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"
Expand All @@ -85,6 +86,8 @@ jobs:
- name: "Run the tests"
run: "forge test"
env:
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}

- name: "Add test summary"
run: |
Expand Down
107 changes: 5 additions & 102 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,8 @@
# Foundry Template [![Open in Gitpod][gitpod-badge]][gitpod] [![Github Actions][gha-badge]][gha] [![Foundry][foundry-badge]][foundry] [![License: MIT][license-badge]][license]
# Arbitrum bridge XERC20

[gitpod]: https://gitpod.io/#https://github.com/BootNodeDev/arbitrum-bridge-erc7281-gateway
[gitpod-badge]: https://img.shields.io/badge/Gitpod-Open%20in%20Gitpod-FFB45B?logo=gitpod
[gha]: https://github.com/BootNodeDev/arbitrum-bridge-erc7281-gateway/actions
[gha-badge]: https://github.com/BootNodeDev/arbitrum-bridge-erc7281-gateway/actions/workflows/ci.yml/badge.svg
[foundry]: https://getfoundry.sh/
[foundry-badge]: https://img.shields.io/badge/Built%20with-Foundry-FFDB1C.svg
[license]: https://opensource.org/licenses/MIT
[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg
This repo contains a set of smart contracts meant for enabling XERC20 token bridging through Arbitrum canonical bridge.

A Foundry-based template for developing Solidity smart contracts, with sensible defaults.

## What's Inside

- [Forge](https://github.com/foundry-rs/foundry/blob/master/forge): compile, test, fuzz, format, and deploy smart
contracts
- [Forge Std](https://github.com/foundry-rs/forge-std): collection of helpful contracts and utilities for testing
- [Prettier](https://github.com/prettier/prettier): code formatter for non-Solidity files
- [Solhint](https://github.com/protofire/solhint): linter for Solidity code

## Getting Started

Click the [`Use this template`](https://github.com/PaulRBerg/foundry-template/generate) button at the top of the page to
create a new repository with this repo as the initial state.

Or, if you prefer to install the template manually:

```sh
$ mkdir my-project
$ cd my-project
$ forge init --template PaulRBerg/foundry-template
$ bun install # install Solhint, Prettier, and other Node.js deps
```

If this is your first time with Foundry, check out the
[installation](https://github.com/foundry-rs/foundry#installation) instructions.

## Features

This template builds upon the frameworks and libraries mentioned above, so please consult their respective documentation
for details about their specific features.

For example, if you're interested in exploring Foundry in more detail, you should look at the
[Foundry Book](https://book.getfoundry.sh/). In particular, you may be interested in reading the
[Writing Tests](https://book.getfoundry.sh/forge/writing-tests.html) tutorial.

### Sensible Defaults

This template comes with a set of sensible default configurations for you to use. These defaults can be found in the
following files:

```text
├── .editorconfig
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solhint.json
├── foundry.toml
└── remappings.txt
```

### VSCode Integration

This template is IDE agnostic, but for the best user experience, you may want to use it in VSCode alongside Nomic
Foundation's [Solidity extension](https://marketplace.visualstudio.com/items?itemName=NomicFoundation.hardhat-solidity).

For guidance on how to integrate a Foundry project in VSCode, please refer to this
[guide](https://book.getfoundry.sh/config/vscode).

### GitHub Actions

This template comes with GitHub Actions pre-configured. Your contracts will be linted and tested on every push and pull
request made to the `main` branch.

You can edit the CI script in [.github/workflows/ci.yml](./.github/workflows/ci.yml).
TODO - Add some specs, diagrams or whatever for improving this description

## Installing Dependencies

Expand All @@ -89,14 +18,9 @@ This is how to install dependencies:

Note that OpenZeppelin Contracts is pre-installed, so you can follow that as an example.

## Writing Tests
## Deployment Scripts

To write a new test contract, you start by importing `Test` from `forge-std`, and then you inherit it in your test
contract. Forge Std comes with a pre-instantiated [cheatcodes](https://book.getfoundry.sh/cheatcodes/) environment
accessible via the `vm` property. If you would like to view the logs in the terminal output, you can add the `-vvv` flag
and use [console.log](https://book.getfoundry.sh/faq?highlight=console.log#how-do-i-use-consolelog).

This template comes with an example test contract [Foo.t.sol](./test/Foo.t.sol)
Deployment script documentation can be found [here](./docs/deployment.md).

## Usage

Expand Down Expand Up @@ -134,20 +58,6 @@ Get a test coverage report:
$ forge coverage
```

### Deploy

Deploy to Anvil:

```sh
$ forge script script/Deploy.s.sol --broadcast --fork-url http://localhost:8545
```

For this script to work, you need to have a `MNEMONIC` environment variable set to a valid
[BIP39 mnemonic](https://iancoleman.io/bip39/).

For instructions on how to deploy to a testnet or mainnet, check out the
[Solidity Scripting](https://book.getfoundry.sh/tutorials/solidity-scripting.html) tutorial.

### Format

Format the contracts:
Expand Down Expand Up @@ -193,13 +103,6 @@ simply copy paste the path):
$ bun run test:coverage:report
```

## Related Efforts

- [abigger87/femplate](https://github.com/abigger87/femplate)
- [cleanunicorn/ethereum-smartcontract-template](https://github.com/cleanunicorn/ethereum-smartcontract-template)
- [foundry-rs/forge-template](https://github.com/foundry-rs/forge-template)
- [FrankieIsLost/forge-template](https://github.com/FrankieIsLost/forge-template)

## License

This project is licensed under MIT.
Binary file modified bun.lockb
Binary file not shown.
Loading

0 comments on commit a9627a6

Please sign in to comment.