Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
594 changes: 498 additions & 96 deletions notebooks/01_github_issues.ipynb

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion notebooks/env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
GITHUB_TOKEN=
GITHUB_OWNER=
GITHUB_REPO=
GITHUB_API_URL=
GITHUB_API_URL=

BACKEND_API_URL=
2 changes: 2 additions & 0 deletions the-guild-smart-contracts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ CREATE2_SALT=1
# Generic fallback for any other network (used if chain isn't matched)
EAS_ADDRESS=

BADGE_REGISTRY_ADDRESS=

# RPC URLS
AMOY_RPC_URL=https://polygon-amoy.drpc.org
BASE_SEPOLIA_URL=https://base-sepolia.therpc.io
Expand Down
96 changes: 90 additions & 6 deletions the-guild-smart-contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,87 @@ forge script script/TheGuildBadgeRanking.s.sol:TheGuildBadgeRankingScript \
--broadcast
```

### Batch Badge Creation

The `CreateBadgesFromJson.s.sol` script allows batch creation of badges from JSON data.

#### JSON Format

Prepare your badges data in JSON format:
```json
{
"badges": [
{
"name": "Rust",
"description": "Know how to code in Rust"
},
{
"name": "Solidity",
"description": "Know how to code in Solidity"
}
]
}
```

- `name`: Name of the badge (max 32 characters, will be converted to bytes32)
- `description`: Description of the badge (max 32 characters, will be converted to bytes32)

#### Usage

```shell
# Using the helper script (recommended)
export PRIVATE_KEY=your_private_key
export RPC_URL=https://polygon-amoy.drpc.org
export BADGE_REGISTRY_ADDRESS=0x8ac95734e778322684f1d318fb7633777baa8427

# Dry run first (uses badges-latest.json by default)
./run_batch_badges.sh true

# Dry run with custom JSON file
./run_batch_badges.sh badges.json true

# Production run (uses badges-latest.json by default)
./run_batch_badges.sh false

# Production run with custom JSON file
./run_batch_badges.sh badges.json false

# Manual approach
# Set environment variables
export PRIVATE_KEY=your_private_key
export JSON_PATH=./badges.json
export BADGE_REGISTRY_ADDRESS=0x8ac95734e778322684f1d318fb7633777baa8427

# Dry run (recommended first)
export DRY_RUN=true
forge script script/CreateBadgesFromJson.s.sol:CreateBadgesFromJson \
--rpc-url <your_rpc_url>

# Production run
unset DRY_RUN
forge script script/CreateBadgesFromJson.s.sol:CreateBadgesFromJson \
--rpc-url <your_rpc_url> \
--broadcast
```

#### Environment Variables

- `PRIVATE_KEY`: Private key for transaction signing
- `JSON_PATH`: Path to the JSON file (default: `badges-latest.json`)
- `BADGE_REGISTRY_ADDRESS`: Address of the deployed TheGuildBadgeRegistry contract (required)
- `DRY_RUN`: Set to `true` for validation without broadcasting (default: `false`)
- `RPC_URL`: RPC endpoint URL (for helper script)

The script will:
1. Read the JSON file directly using `vm.readFile()`
2. Parse and validate all badges
3. Check if each badge already exists (skips if it does)
4. Create badges that don't exist yet
5. Log creation summary with success and skip counts

### Batch Attestations

The `EmitAttestationsCsv.s.sol` script allows batch creation of attestations from JSON data using EAS's `multiAttest()` function for gas efficiency.
The `EmitAttestationsJson.s.sol` script allows batch creation of attestations from JSON data using EAS's `multiAttest()` function for gas efficiency.

#### JSON Format

Expand Down Expand Up @@ -238,10 +316,16 @@ Prepare your attestations data in JSON format:
export PRIVATE_KEY=your_private_key
export RPC_URL=https://polygon-amoy.drpc.org

# Dry run first
# Dry run first (uses attestations-latest.json by default)
./run_batch_attestations.sh true

# Dry run with custom JSON file
./run_batch_attestations.sh attestations.json true

# Production run
# Production run (uses attestations-latest.json by default)
./run_batch_attestations.sh false

# Production run with custom JSON file
./run_batch_attestations.sh attestations.json false

# Manual approach
Expand All @@ -252,20 +336,20 @@ export SCHEMA_ID=0xbcd7561083784f9b5a1c2b3ddb7aa9db263d43c58f7374cfa4875646824a4

# Dry run (recommended first)
export DRY_RUN=true
forge script script/EmitAttestationsCsv.s.sol:EmitAttestationsCsv \
forge script script/EmitAttestationsJson.s.sol:EmitAttestationsJson \
--rpc-url <your_rpc_url>

# Production run
unset DRY_RUN
forge script script/EmitAttestationsCsv.s.sol:EmitAttestationsCsv \
forge script script/EmitAttestationsJson.s.sol:EmitAttestationsJson \
--rpc-url <your_rpc_url> \
--broadcast
```

#### Environment Variables

- `PRIVATE_KEY`: Private key for transaction signing
- `JSON_PATH`: Path to the JSON file (default: `./attestations.json`)
- `JSON_PATH`: Path to the JSON file (default: `attestations-latest.json`)
- `SCHEMA_ID`: EAS schema ID to use (default: Amoy production schema)
- `DRY_RUN`: Set to `true` for validation without broadcasting (default: `false`)
- `EAS_ADDRESS`: EAS contract address (auto-detected for Amoy/Base Sepolia, required for other networks)
Expand Down
139 changes: 139 additions & 0 deletions the-guild-smart-contracts/attestations-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"attestations": [
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "Solidity",
"justification": "Awarded for contributions to issue #130: Add foundry batch attestation distribution script (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/130)\nAwarded for contributions to issue #122: Badge TCR/Vote ranking: Smart Contract (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/122)"
},
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "Foundry",
"justification": "Awarded for contributions to issue #130: Add foundry batch attestation distribution script (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/130)\nAwarded for contributions to issue #122: Badge TCR/Vote ranking: Smart Contract (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/122)"
},
{
"recipient": "0x0BAd9DaD98143b2E946e8A40E4f27537be2f55E2",
"badgeName": "Jupyter-notebook",
"justification": "Awarded for contributions to issue #126: Use jupyter notebook to analyze github issues (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/126)"
},
{
"recipient": "0x0BAd9DaD98143b2E946e8A40E4f27537be2f55E2",
"badgeName": "Python",
"justification": "Awarded for contributions to issue #126: Use jupyter notebook to analyze github issues (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/126)"
},
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "Blockchain",
"justification": "Awarded for contributions to issue #122: Badge TCR/Vote ranking: Smart Contract (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/122)"
},
{
"recipient": "0x0BAd9DaD98143b2E946e8A40E4f27537be2f55E2",
"badgeName": "Documentation",
"justification": "Awarded for contributions to issue #119: Discord Link (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/119)\nAwarded for contributions to issue #91: Improve instructions to run things locally (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/91)\nAwarded for contributions to issue #72: Contribution token feature plan (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/72)\nAwarded for contributions to issue #51: Add a Getting Started page on the front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/51)\nAwarded for contributions to issue #45: Update contribution guide (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/45)"
},
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "Rust",
"justification": "Awarded for contributions to issue #114: Github handle errors (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/114)\nAwarded for contributions to issue #42: Improve SIWE logic to use dynamic, user-specific nonce - backend (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/42)"
},
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "Back-end",
"justification": "Awarded for contributions to issue #114: Github handle errors (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/114)\nAwarded for contributions to issue #42: Improve SIWE logic to use dynamic, user-specific nonce - backend (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/42)"
},
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "Front end",
"justification": "Awarded for contributions to issue #107: Implement SIWE for the front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/107)\nAwarded for contributions to issue #50: Add copy to clipboard icons next to all ethereum addresses (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/50)\nAwarded for contributions to issue #49: Add description on the profile page (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/49)"
},
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "React",
"justification": "Awarded for contributions to issue #107: Implement SIWE for the front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/107)\nAwarded for contributions to issue #50: Add copy to clipboard icons next to all ethereum addresses (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/50)\nAwarded for contributions to issue #49: Add description on the profile page (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/49)"
},
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "TypeScript",
"justification": "Awarded for contributions to issue #107: Implement SIWE for the front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/107)\nAwarded for contributions to issue #49: Add description on the profile page (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/49)"
},
{
"recipient": "0x63E5a246937549b3ECcBB410AF42da54F999D172",
"badgeName": "Front end",
"justification": "Awarded for contributions to issue #98: Feature: add a github handle to profile in Front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/98)\nAwarded for contributions to issue #58: On the profile, there should be a section with the badges issued by that profile (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/58)"
},
{
"recipient": "0x63E5a246937549b3ECcBB410AF42da54F999D172",
"badgeName": "React",
"justification": "Awarded for contributions to issue #98: Feature: add a github handle to profile in Front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/98)\nAwarded for contributions to issue #58: On the profile, there should be a section with the badges issued by that profile (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/58)"
},
{
"recipient": "0x63E5a246937549b3ECcBB410AF42da54F999D172",
"badgeName": "TypeScript",
"justification": "Awarded for contributions to issue #98: Feature: add a github handle to profile in Front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/98)\nAwarded for contributions to issue #58: On the profile, there should be a section with the badges issued by that profile (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/58)"
},
{
"recipient": "0x63E5a246937549b3ECcBB410AF42da54F999D172",
"badgeName": "Documentation",
"justification": "Awarded for contributions to issue #83: Add doc for indexer (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/83)"
},
{
"recipient": "0x63E5a246937549b3ECcBB410AF42da54F999D172",
"badgeName": "Rust",
"justification": "Awarded for contributions to issue #83: Add doc for indexer (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/83)"
},
{
"recipient": "0x63E5a246937549b3ECcBB410AF42da54F999D172",
"badgeName": "Back-end",
"justification": "Awarded for contributions to issue #83: Add doc for indexer (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/83)"
},
{
"recipient": "0xB66442A4Bf0636B6b533D607dB6066AD987368FE",
"badgeName": "Front end",
"justification": "Awarded for contributions to issue #64: Implement 3D Card Component for Badge Page (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/64)\nAwarded for contributions to issue #63: Improve landing page design with animated background (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/63)"
},
{
"recipient": "0xB66442A4Bf0636B6b533D607dB6066AD987368FE",
"badgeName": "React",
"justification": "Awarded for contributions to issue #64: Implement 3D Card Component for Badge Page (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/64)\nAwarded for contributions to issue #63: Improve landing page design with animated background (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/63)"
},
{
"recipient": "0xB66442A4Bf0636B6b533D607dB6066AD987368FE",
"badgeName": "UX",
"justification": "Awarded for contributions to issue #64: Implement 3D Card Component for Badge Page (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/64)\nAwarded for contributions to issue #63: Improve landing page design with animated background (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/63)"
},
{
"recipient": "0xB66442A4Bf0636B6b533D607dB6066AD987368FE",
"badgeName": "Design",
"justification": "Awarded for contributions to issue #64: Implement 3D Card Component for Badge Page (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/64)"
},
{
"recipient": "0x0BAd9DaD98143b2E946e8A40E4f27537be2f55E2",
"badgeName": "Foundry",
"justification": "Awarded for contributions to issue #55: Could be a good idea to merge ActivityToken and BadgeRegistry contracts into one (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/55)\nAwarded for contributions to issue #48: Prevent duplicate attestations (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/48)"
},
{
"recipient": "0x0BAd9DaD98143b2E946e8A40E4f27537be2f55E2",
"badgeName": "Front end",
"justification": "Awarded for contributions to issue #54: Display user activity token balance in the top bar (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/54)\nAwarded for contributions to issue #51: Add a Getting Started page on the front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/51)\nAwarded for contributions to issue #47: Submitting too many attestations in a row emits error (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/47)\nAwarded for contributions to issue #34: Api doesn't seem to work on mobile (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/34)\nAwarded for contributions to issue #32: Issuer should link to profile (and use name) (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/32)\nAwarded for contributions to issue #22: Add basic project description in the front end (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/22)"
},
{
"recipient": "0x0BAd9DaD98143b2E946e8A40E4f27537be2f55E2",
"badgeName": "React",
"justification": "Awarded for contributions to issue #54: Display user activity token balance in the top bar (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/54)"
},
{
"recipient": "0x0BAd9DaD98143b2E946e8A40E4f27537be2f55E2",
"badgeName": "TypeScript",
"justification": "Awarded for contributions to issue #54: Display user activity token balance in the top bar (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/54)"
},
{
"recipient": "0x0BAd9DaD98143b2E946e8A40E4f27537be2f55E2",
"badgeName": "Wagmi",
"justification": "Awarded for contributions to issue #54: Display user activity token balance in the top bar (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/54)"
},
{
"recipient": "0x2b33E4D2bD2f34310956dCb462d58413d3dCcdf8",
"badgeName": "DB",
"justification": "Awarded for contributions to issue #42: Improve SIWE logic to use dynamic, user-specific nonce - backend (https://github.com/TheSoftwareDevGuild/TheGuildGenesis/issues/42)"
}
]
}
60 changes: 60 additions & 0 deletions the-guild-smart-contracts/badges-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"badges": [
{
"name": "Back-end",
"description": "Back-end services & APIs."
},
{
"name": "Blockchain",
"description": "Blockchain & dapp knowledge."
},
{
"name": "DB",
"description": "Design & query databases."
},
{
"name": "Design",
"description": "Visual design for products."
},
{
"name": "Discord-bot",
"description": "Discord bots & integrations."
},
{
"name": "Documentation",
"description": "Writes helpful documentation."
},
{
"name": "Foundry",
"description": "Foundry smart contract dev."
},
{
"name": "Front end",
"description": "Builds UI and client logic."
},
{
"name": "Jupyter-notebook",
"description": "Jupyter Notebooks for data."
},
{
"name": "Nodejs",
"description": "Node.js back-end services."
},
{
"name": "Planning",
"description": "Plans work and milestones."
},
{
"name": "React",
"description": "React components & apps."
},
{
"name": "UX",
"description": "User experience focus."
},
{
"name": "Wagmi",
"description": "Wagmi Web3 front-end use."
}
]
}
25 changes: 25 additions & 0 deletions the-guild-smart-contracts/badges.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"badges": [
{
"name": "Rust",
"description": "Know how to code in Rust"
},
{
"name": "Solidity",
"description": "Know how to code in Solidity"
},
{
"name": "TypeScript",
"description": "Know how to code in TypeScript"
},
{
"name": "Python",
"description": "Know how to code in Python"
},
{
"name": "JavaScript",
"description": "Know how to code in JavaScript"
}
]
}

Loading
Loading