Skip to content

Commit

Permalink
Merge pull request #124 from CirclesUBI/20240320-merge
Browse files Browse the repository at this point in the history
20240320 merge
  • Loading branch information
benjaminbollen authored Mar 26, 2024
2 parents f277e2c + 787fe9b commit 8571c0a
Show file tree
Hide file tree
Showing 38 changed files with 494 additions and 223 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ out/

# Dotenv file
.env

# OSX
.DS_Store
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
# Changelog
# CHANGELOG
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## v0.3.0

### Chiado deployment
```
Deployment Date: 2024-03-25 19:53:22 (GMT)
Version: 0.3.0
Git Commit: 63cc025a80350a453f7fefc3eedbd39e43d52075
Deployer Address: 0x7619F26728Ced663E50E578EB6ff42430931564c
Deployer Nonce: 63
Deployed Contracts:
Hub: 0xda2776764BF01DC7f77f5b58df62221c89958A89
Migration: 0xad0aeD7d4fdB82f6Ed3ddd851A7a3456c979dF7C
NameRegistry: 0x088D6f062fF77653D86BCcd6027CEa4CB09d9ACD
ERC20Lift: 0xa5c7ADAE2fd3844f12D52266Cb7926f8649869Da
StandardTreasury: 0xe1dCE89512bE1AeDf94faAb7115A1Ba6AEff4201
BaseGroupMintPolicy: 0x738fFee24770d0DE1f912adf2B48b0194780E9AD
MastercopyDemurrageERC20: 0xB6B79BeEfd58cf33b298A456934554cf440354aD
MastercopyInflationaryERC20: 0xbb76CF35ec106c5c7a447246257dcfCB7244cA04
MastercopyStandardVault: 0x5Ea08c967C69255d82a4d26e36823a720E7D0317
```
- first functionally complete implementation of ERC1155 Circles implementation

## [Unreleased]

- Make the trust relationship binary (and deprecate the trust limit). Rather than storing a binary mapping, we opt to store a linked list of the trusted nodes. This facilitates iterating from the contract state.
Expand Down
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,10 @@ 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:
To deploy the contracts to the Chiado testnet, run `./chiadoDeploy.sh` and supply a private key and API keys in `.env` file in the root directory (copy `.env.example` and set private information):
```shell
./deploy.sh <private_key>
./script/deployments/chiadoDeploy.sh
```
#### Local
1. [todo] To run a local development node, use the `anvil` command in a separate terminal:
```bash
anvil
```

2. [todo] Run a local network node:
```bash
forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```
3. To access RPC calls from CLI, see:
```bash
cast help
```

## Foundry as toolkit

Expand Down
50 changes: 0 additions & 50 deletions deploy.sh

This file was deleted.

8 changes: 8 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PRIVATE_KEY_CHIADO='YOUR_PRIVATE_KEY'
RPC_URL_CHIADO='https://rpc.chiadochain.net'
BLOCKSCOUT_API_KEY='YOUR_API_KEY'
BLOCKSCOUT_URL_CHIADO='https://gnosis-chiado.blockscout.com/api?'
BLOCKSCOUT_VERIFIER='blockscout'
GNOSISSCAN_API_KEY='YOUR_API_KEY'
GNOSISSCAN_URL='https://api.gnosisscan.io/api?'
GNOSISSCAN_VERIFIER='etherscan'
12 changes: 0 additions & 12 deletions script/Counter.s.sol

This file was deleted.

4 changes: 4 additions & 0 deletions script/deployments/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Node
node_modules
npm-debug.log
package-lock.json
1 change: 1 addition & 0 deletions script/deployments/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Deploying Circles contracts
104 changes: 104 additions & 0 deletions script/deployments/WIPchiadoVerify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/bin/bash

# note 26 march 2024: this does not work yet, the compiler version gets rejected

# Script to verify deployed contracts on a block explorer

# Function to verify contract on Block Explorer
verify_contract() {
local contractName=$1
local deployedAddress=$2
local sourcePath=$3
local constructorArgsFile=$4
local compilerVersion=$5

echo "Verifying ${contractName} at ${deployedAddress} with source ${sourcePath}"

# Perform verification using forge with constructor args from file
forge verify-contract --flatten --watch --compiler-version "${compilerVersion}" \
--constructor-args-path "${constructorArgsFile}" \
--chain-id 10200 \
--verifier-url $VERIFIER_URL \
--verifier $VERIFIER \
--etherscan-api-key ${VERIFIER_API_KEY} \
--delay 10 \
"${deployedAddress}" "${sourcePath}"

echo "Verification command for ${contractName} executed."
}

# Set the environment variables, also for use in node script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source "$DIR/../../.env"

# The identifier containing deployment details
DEPLOYMENT_IDENTIFIER=$1
# The file containing deployment details
ARTEFACTS_FILE="${DEPLOYMENT_IDENTIFIER}/${DEPLOYMENT_IDENTIFIER}.txt"
PATH_CONSTRUCTOR_ARGS="${DEPLOYMENT_IDENTIFIER}"

echo "Using artefacts file: ${ARTEFACTS_FILE}"

# taking parameters from .env file for Chiado
VERIFIER_URL=$BLOCKSCOUT_URL_CHIADO
VERIFIER_API_KEY=$BLOCKSCOUT_API_KEY
VERIFIER=$BLOCKSCOUT_VERIFIER
COMPILER_VERSION="v0.8.23+commit.f704f362"

# Assuming jq is installed for JSON parsing
# Reading the JSON file and extracting required information
while IFS= read -r line; do
contractName=$(echo "$line" | jq -r '.contractName')
deployedAddress=$(echo "$line" | jq -r '.deployedAddress')
sourcePath=$(echo "$line" | jq -r '.sourcePath')
argumentsFile="${PATH_CONSTRUCTOR_ARGS}/$(echo "$line" | jq -r '.argumentsFile')"
compilerVersion=${COMPILER_VERSION}

# Construct the full path to the constructor args file
constructorArgsFile="${DIR}/${argumentsFile}"

verify_contract "$contractName" "$deployedAddress" "$sourcePath" "$constructorArgsFile" "$compilerVersion"
done < "${ARTEFACTS_FILE}"

echo "All contracts submitted for verification."


# deploy_and_verify() {
# local contract_name=$1
# local precalculated_address=$2
# local deployment_output
# local deployed_address

# echo "" >&2
# echo "Deploying ${contract_name}..." >&2
# deployment_output=$(forge create \
# --rpc-url ${RPC_URL} \
# --private-key ${PRIVATE_KEY} \
# --optimizer-runs 200 \
# --chain-id 10200 \
# --verify \
# --verifier-url $VERIFIER_URL \
# --verifier $VERIFIER \
# --etherscan-api-key ${VERIFIER_API_KEY} \
# --delay 20 \
# "${@:3}") # Passes all arguments beyond the second to forge create

# deployed_address=$(echo "$deployment_output" | grep "Deployed to:" | awk '{print $3}')
# echo "${contract_name} deployed at ${deployed_address}" >&2

# # Verify that the deployed address matches the precalculated address
# if [ "$deployed_address" = "$precalculated_address" ]; then
# echo "Verification Successful: Deployed address matches the precalculated address for ${contract_name}." >&2
# else
# echo "Verification Failed: Deployed address does not match the precalculated address for ${contract_name}." >&2
# echo "Precalculated Address: $precalculated_address" >&2
# echo "Deployed Address: $deployed_address" >&2
# # exit the script if the addresses don't match
# exit 1
# fi

# echo "sleeping for 10 seconds to allow verifier to verify" >&2
# sleep 10

# echo "$deployed_address"
# }
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Chiado deployment
=================
Deployment Date: 2024-03-25 19:53:22
Version: 0.3.0
Git Commit: 63cc025a80350a453f7fefc3eedbd39e43d52075
Deployer Address: 0x7619F26728Ced663E50E578EB6ff42430931564c
Deployer Nonce: 63

Deployed Contracts:
Hub: 0xda2776764BF01DC7f77f5b58df62221c89958A89
Migration: 0xad0aeD7d4fdB82f6Ed3ddd851A7a3456c979dF7C
NameRegistry: 0x088D6f062fF77653D86BCcd6027CEa4CB09d9ACD
ERC20Lift: 0xa5c7ADAE2fd3844f12D52266Cb7926f8649869Da
StandardTreasury: 0xe1dCE89512bE1AeDf94faAb7115A1Ba6AEff4201
BaseGroupMintPolicy: 0x738fFee24770d0DE1f912adf2B48b0194780E9AD
MastercopyDemurrageERC20: 0xB6B79BeEfd58cf33b298A456934554cf440354aD
MastercopyInflationaryERC20: 0xbb76CF35ec106c5c7a447246257dcfCB7244cA04
MastercopyStandardVault: 0x5Ea08c967C69255d82a4d26e36823a720E7D0317
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{"contractName":"Hub","deployedAddress":"0xda2776764BF01DC7f77f5b58df62221c89958A89","sourcePath":"src/hub/Hub.sol:Hub","constructor-args":"--constructor-args 0xdbF22D4e8962Db3b2F1d9Ff55be728A887e47710 0x088D6f062fF77653D86BCcd6027CEa4CB09d9ACD 0xad0aeD7d4fdB82f6Ed3ddd851A7a3456c979dF7C 0xa5c7ADAE2fd3844f12D52266Cb7926f8649869Da 0xe1dCE89512bE1AeDf94faAb7115A1Ba6AEff4201 1675209600 31540000 https://fallback.aboutcircles.com/v1/circles/{id}.json","argumentsFile":"constructorArgs_Hub.txt"}
{"contractName":"Migration","deployedAddress":"0xad0aeD7d4fdB82f6Ed3ddd851A7a3456c979dF7C","sourcePath":"src/migration/Migration.sol:Migration","constructor-args":"--constructor-args 0xdbF22D4e8962Db3b2F1d9Ff55be728A887e47710 0xda2776764BF01DC7f77f5b58df62221c89958A89","argumentsFile":"constructorArgs_Migration.txt"}
{"contractName":"NameRegistry","deployedAddress":"0x088D6f062fF77653D86BCcd6027CEa4CB09d9ACD","sourcePath":"src/names/NameRegistry.sol:NameRegistry","constructor-args":"--constructor-args 0xda2776764BF01DC7f77f5b58df62221c89958A89","argumentsFile":"constructorArgs_NameRegistry.txt"}
{"contractName":"ERC20Lift","deployedAddress":"0xa5c7ADAE2fd3844f12D52266Cb7926f8649869Da","sourcePath":"src/lift/ERC20Lift.sol:ERC20Lift","constructor-args":"--constructor-args 0xda2776764BF01DC7f77f5b58df62221c89958A89 0x088D6f062fF77653D86BCcd6027CEa4CB09d9ACD 0xB6B79BeEfd58cf33b298A456934554cf440354aD 0xbb76CF35ec106c5c7a447246257dcfCB7244cA04","argumentsFile":"constructorArgs_ERC20Lift.txt"}
{"contractName":"StandardTreasury","deployedAddress":"0xe1dCE89512bE1AeDf94faAb7115A1Ba6AEff4201","sourcePath":"src/treasury/StandardTreasury.sol:StandardTreasury","constructor-args":"--constructor-args 0xda2776764BF01DC7f77f5b58df62221c89958A89 0x5Ea08c967C69255d82a4d26e36823a720E7D0317","argumentsFile":"constructorArgs_StandardTreasury.txt"}
{"contractName":"BaseGroupMintPolicy","deployedAddress":"0x738fFee24770d0DE1f912adf2B48b0194780E9AD","sourcePath":"src/groups/BaseMintPolicy.sol:MintPolicy","constructor-args":"","argumentsFile":"constructorArgs_BaseGroupMintPolicy.txt"}
{"contractName":"MastercopyDemurrageERC20","deployedAddress":"0xB6B79BeEfd58cf33b298A456934554cf440354aD","sourcePath":"src/lift/DemurrageCircles.sol:DemurrageCircles","constructor-args":"","argumentsFile":"constructorArgs_MastercopyDemurrageERC20.txt"}
{"contractName":"MastercopyInflationaryERC20","deployedAddress":"0xbb76CF35ec106c5c7a447246257dcfCB7244cA04","sourcePath":"src/lift/InflationaryCircles.sol:InflationaryCircles","constructor-args":"","argumentsFile":"constructorArgs_MastercopyInflationaryERC20.txt"}
{"contractName":"MastercopyStandardVault","deployedAddress":"0x5Ea08c967C69255d82a4d26e36823a720E7D0317","sourcePath":"src/treasury/StandardVault.sol:StandardVault","constructor-args":"","argumentsFile":"constructorArgs_MastercopyStandardVault.txt"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xda2776764BF01DC7f77f5b58df62221c89958A89 0x088D6f062fF77653D86BCcd6027CEa4CB09d9ACD 0xB6B79BeEfd58cf33b298A456934554cf440354aD 0xbb76CF35ec106c5c7a447246257dcfCB7244cA04
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xdbF22D4e8962Db3b2F1d9Ff55be728A887e47710 0x088D6f062fF77653D86BCcd6027CEa4CB09d9ACD 0xad0aeD7d4fdB82f6Ed3ddd851A7a3456c979dF7C 0xa5c7ADAE2fd3844f12D52266Cb7926f8649869Da 0xe1dCE89512bE1AeDf94faAb7115A1Ba6AEff4201 1675209600 31540000 https://fallback.aboutcircles.com/v1/circles/{id}.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xdbF22D4e8962Db3b2F1d9Ff55be728A887e47710 0xda2776764BF01DC7f77f5b58df62221c89958A89
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xda2776764BF01DC7f77f5b58df62221c89958A89
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xda2776764BF01DC7f77f5b58df62221c89958A89 0x5Ea08c967C69255d82a4d26e36823a720E7D0317
Loading

0 comments on commit 8571c0a

Please sign in to comment.