Skip to content

Commit

Permalink
Merge pull request #69 from CirclesUBI/68-first-deployment-of-the-con…
Browse files Browse the repository at this point in the history
…tracts-to-chiado

added a script to deploy the contracts via "forge create"
  • Loading branch information
jaensen authored Jan 27, 2024
2 parents 2a54ba7 + 48995c6 commit ae58292
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ This Solidity project uses Foundry as a toolkit. If you don't have Foundry insta
```

### Deploying the contracts
#### Chiado
To deploy the contracts to the Chiado testnet, run `./deploy.sh` and supply a private key that has enough funds to pay for the gas:
```shell
./deploy.sh <private_key>
```
#### Local
1. [todo] To run a local development node, use the `anvil` command in a separate terminal:
```bash
anvil
Expand Down
50 changes: 50 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
RPC_URL=https://rpc.chiado.gnosis.gateway.fm
PRIVATE_KEY=$1

V1_HUB_ADDRESS='0xdbF22D4e8962Db3b2F1d9Ff55be728A887e47710'

echo "Deploying MintSplitter..."
MINT_SPLITTER_DEPLOYMENT=$(forge create \
--rpc-url ${RPC_URL} \
--private-key ${PRIVATE_KEY} \
src/mint/MintSplitter.sol:MintSplitter \
--constructor-args ${V1_HUB_ADDRESS})

MINT_SPLITTER_ADDRESS=$(echo "$MINT_SPLITTER_DEPLOYMENT" | grep "Deployed to:" | awk '{print $3}')
echo "MintSplitter deployed at ${MINT_SPLITTER_ADDRESS}"

echo "Deploying TimeCircle..."
TIME_CIRCLE_DEPLOYMENT=$(forge create \
--rpc-url ${RPC_URL} \
--private-key ${PRIVATE_KEY} \
src/circles/TimeCircle.sol:TimeCircle)

TIME_CIRCLE_ADDRESS=$(echo "$TIME_CIRCLE_DEPLOYMENT" | grep "Deployed to:" | awk '{print $3}')
echo "TimeCircle deployed at ${TIME_CIRCLE_ADDRESS}"

echo "Deploying GroupCircle..."
GROUP_CIRCLES_DEPLOYMENT=$(forge create \
--rpc-url ${RPC_URL} \
--private-key ${PRIVATE_KEY} \
src/circles/GroupCircle.sol:GroupCircle)

GROUP_CIRCLES_ADDRESS=$(echo "$GROUP_CIRCLES_DEPLOYMENT" | grep "Deployed to:" | awk '{print $3}')
echo "GroupCircle deployed at ${GROUP_CIRCLES_ADDRESS}"

echo "Deploying Graph..."
GRAPH_DEPLOYMENT=$(forge create \
--rpc-url ${RPC_URL} \
--private-key ${PRIVATE_KEY} \
src/graph/Graph.sol:Graph \
--constructor-args ${MINT_SPLITTER_ADDRESS} '0x0000000000000000000000000000000000000000' ${TIME_CIRCLE_ADDRESS} ${GROUP_CIRCLES_ADDRESS})

GRAPH_ADDRESS=$(echo "$GRAPH_DEPLOYMENT" | grep "Deployed to:" | awk '{print $3}')
echo "Graph deployed at ${GRAPH_ADDRESS}"

echo ""
echo "Summary:"
echo "========"
echo "MintSplitter: ${MINT_SPLITTER_ADDRESS}"
echo "TimeCircle: ${TIME_CIRCLE_ADDRESS}"
echo "GroupCircle: ${GROUP_CIRCLES_ADDRESS}"
echo "Graph: ${GRAPH_ADDRESS}"

0 comments on commit ae58292

Please sign in to comment.