Skip to content

Commit

Permalink
feat: Create deployment script (#15)
Browse files Browse the repository at this point in the history
* work on new deployment

* first mvp working

* get version of contract predeploy

* add constructor args resolution

* fix error

* update package

* compile synchronously and fix deployment files

* remove temporary file

* add worflow draft (#16)

* add worflow draft

* try to get it runable from non-main branch

* use ts node

* try fix ts-node error

* try fix ts-node error again

* install Foundry

* use ts deploy script

* remove base sepolia deploy to test deploy

* set basescan key to env

* commit deploys

* set commit config

* CI deployment of Dropper

* format deployment file prior to commit

* CI deployment of Dropper

---------

Co-authored-by: Arr00 <[email protected]>
Co-authored-by: GitHub Actions Bot <>

* remove unnecessary node opt

---------

Co-authored-by: Brian Le <[email protected]>
  • Loading branch information
arr00 and 0xble authored May 23, 2024
1 parent 55458f6 commit d1a9474
Show file tree
Hide file tree
Showing 6 changed files with 389 additions and 86 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Deploy

on:
workflow_dispatch:
inputs:
network:
type: choice
description: Network
options:
- mainnet
- sepolia
- base
- base-sepolia
contract:
description: Contract to deploy
required: true

jobs:
deploy-contract:
name: Deploy Contract
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: "16"

- name: Install packages
run: npm install

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

- name: Set RPC URL for mainnet
if: ${{ github.event.inputs.network == 'mainnet' }}
run: echo "RPC_URL=${{ secrets.MAINNET_RPC_URL }}" >> $GITHUB_ENV

- name: Set RPC URL for sepolia
if: ${{ github.event.inputs.network == 'sepolia' }}
run: echo "RPC_URL=${{ secrets.SEPOLIA_RPC_URL }}" >> $GITHUB_ENV

- name: Set RPC URL for base
if: ${{ github.event.inputs.network == 'base' }}
run: echo "RPC_URL=${{ secrets.BASE_RPC_URL }}" >> $GITHUB_ENV

- name: Set RPC URL for base-sepolia
if: ${{ github.event.inputs.network == 'base-sepolia' }}
run: echo "RPC_URL=${{ secrets.BASE_SEPOLIA_RPC_URL }}" >> $GITHUB_ENV

- name: Run Deploy
run: |
npx ts-node script/deploy.ts deploy ${{ github.event.inputs.contract }} --rpc ${{ env.RPC_URL }} --pk ${{ secrets.private_key }}
env:
NETWORK: ${{ github.event.inputs.network }}
CONTRACT: ${{ github.event.inputs.contract }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
RPC_URL: ${{ env.RPC_URL }}
BASESCAN_API_KEY: ${{ secrets.BASESCAN_API_KEY }}

- name: Prettier Fix
run: npm run prettier:write

- name: Commit and push changes
run: |
git config --global user.name 'GitHub Actions Bot'
git config --global user.email '<>'
git commit -a -m "CI deployment of ${{ github.event.inputs.contract }}"
git push
11 changes: 11 additions & 0 deletions deployments/8453.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"contracts": {
"Dropper": {
"deploys": [
{ "deployedArgs": "0x", "version": "1.0.0", "address": "0xf7dfc33c76f84a5c852f5366598e67cce91bad53" }
],
"constructorArgs": []
}
},
"constants": {}
}
13 changes: 8 additions & 5 deletions deployments/84532.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"Dropper": [
{
"version": "1.0.0",
"address": "0x2871e49a08acee842c8f225be7bff9cc311b9f43"
"contracts": {
"Dropper": {
"deploys": [
{ "deployedArgs": "0x", "version": "1.0.0", "address": "0x680168736298451b945F1Dc5D952408C102E7De7" }
],
"constructorArgs": []
}
]
},
"constants": {}
}
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"url": "https://github.com/PartyDAO"
},
"devDependencies": {
"@types/node": "^20.12.10",
"@types/yargs": "^17.0.32",
"prettier": "^3.0.0",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^3.6.2"
Expand All @@ -30,5 +32,11 @@
"test": "forge test",
"test:coverage": "forge coverage",
"test:coverage:report": "forge coverage --report lcov && genhtml lcov.info --branch-coverage --output-dir coverage"
},
"dependencies": {
"ethers": "^6.12.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"yargs": "^17.7.2"
}
}
81 changes: 0 additions & 81 deletions script/Deploy.s.sol

This file was deleted.

Loading

0 comments on commit d1a9474

Please sign in to comment.