Skip to content

Update README.md

Update README.md #22

Workflow file for this run

name: Smart Contract Deployment
on:
push:
branches: [ "main", "curator" ]
env:
FOUNDRY_PROFILE: ci
jobs:
check:
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: Install Dependencies
run: forge install
- name: Run tests
run: |
forge build --sizes
forge test -vvv
id: test
- name: Run snapshot
run: |
forge snapshot
id: snapshot
deploy-mainnet-beta:
needs: check
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/curator') ||
(github.event_name == 'pull_request' && github.base_ref == 'curator')
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: Set up environment
run: |
echo "PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}" >> .env
echo "BASE_RPC_URL=${{ secrets.BASE_RPC_URL }}" >> .env
echo "BASESCAN_API_KEY=${{ secrets.BASESCAN_API_KEY }}" >> .env
- name: Make deploy script executable
run: chmod +x ./shell/deploy.sh
- name: Deploy to Mainnet Beta
run: |
echo -e "\n" | ./shell/deploy.sh --network=base | tee deployment.log
env:
CI: true
- name: Extract Contract Addresses
if: success()
run: |
mkdir -p deployments/beta
grep "Contract deployed at:" deployment.log | while read -r line; do
CONTRACT_NAME=$(echo $line | cut -d' ' -f1)
ADDRESS=$(echo $line | cut -d' ' -f4)
echo "$ADDRESS" > "deployments/beta/${CONTRACT_NAME}.addr"
done
- name: Update Documentation
if: success()
run: |
mkdir -p docs/src
cat > docs/src/deployments-beta.md << EOF
# Beta Deployments
Network: Base Mainnet (Beta)
| Contract | Address | Verify |
|----------|---------|--------|
$(grep "Contract deployed at:" deployment.log | while read -r line; do
CONTRACT_NAME=$(echo $line | cut -d' ' -f1)
ADDRESS=$(echo $line | cut -d' ' -f4)
echo "| $CONTRACT_NAME | [\`$ADDRESS\`](https://basescan.org/address/$ADDRESS) | [Source](https://basescan.org/address/$ADDRESS#code) |"
done)
Last updated: $(date -u)
EOF
deploy-mainnet:
needs: check
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
cache: false
- name: Set up environment
run: |
echo "PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}" >> .env
echo "BASE_RPC_URL=${{ secrets.BASE_RPC_URL }}" >> .env
echo "BASESCAN_API_KEY=${{ secrets.BASESCAN_API_KEY }}" >> .env
- name: Make base deploy script executable
run: chmod +x ./shell/deploy.base.sh
- name: Make deploy script executable
run: chmod +x ./shell/deploy.sh
- name: Deploy to Mainnet
run: |
echo -e "\n" | ./shell/deploy.sh --network=base | tee deployment.log
env:
CI: true
- name: Extract Contract Addresses
if: success()
run: |
mkdir -p deployments/mainnet
grep "Contract deployed at:" deployment.log | while read -r line; do
CONTRACT_NAME=$(echo $line | cut -d' ' -f1)
ADDRESS=$(echo $line | cut -d' ' -f4)
echo "$ADDRESS" > "deployments/mainnet/${CONTRACT_NAME}.addr"
done
- name: Update Documentation
if: success()
run: |
mkdir -p docs/src
cat > docs/src/deployments-mainnet.md << EOF
# Mainnet Deployments
Network: Base Mainnet
| Contract | Address | Verify |
|----------|---------|--------|
$(grep "Contract deployed at:" deployment.log | while read -r line; do
CONTRACT_NAME=$(echo $line | cut -d' ' -f1)
ADDRESS=$(echo $line | cut -d' ' -f4)
echo "| $CONTRACT_NAME | [\`$ADDRESS\`](https://basescan.org/address/$ADDRESS) | [Source](https://basescan.org/address/$ADDRESS#code) |"
done)
Last updated: $(date -u)
EOF
- name: Save Deployment Artifacts
if: success()
run: |
mkdir -p deployments
cp broadcast/contracts.s.sol/*.json deployments/
cp docs/src/deployments-mainnet.md deployments/
- name: Upload Deployment Artifacts
uses: actions/upload-artifact@v3
with:
name: deployment-artifacts
path: deployments/
- name: Create Release
if: success()
uses: softprops/action-gh-release@v1
with:
files: |
deployments/*.json
deployments/deployments-mainnet.md
name: Release ${{ github.sha }}
body: |
Base Mainnet Deployment
Commit: ${{ github.sha }}
See deployments-mainnet.md for contract addresses.
draft: false
prerelease: false