-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from subspace/ft/improveReadme
Improve Faucet readme
- Loading branch information
Showing
4 changed files
with
168 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,107 @@ | ||
## Setup Instructions: | ||
# Subspace Testnet Faucet | ||
|
||
### 1. **Environment Configuration:** | ||
* Set up the environment file. | ||
* Define `Guild ID`: | ||
- Navigate to Activate Developer Mode in Discord. | ||
- Copy the Server ID. | ||
## Workspace Setup | ||
|
||
### 2. **Bot Token:** | ||
* Navigate to Discord Developer Portal. | ||
* Under the bot section, grab the `Token`. | ||
* _Note_: This token is a one-time use token. | ||
- [Faucet Smart Contract](./smart_contract) - The Faucet Smart Contract, tests, deployment scripts and other related files. (HardHat&Foundry) | ||
- [Web App](./web-app) - The Web App, tests, request token with a GitHub&Discord Next-Auth integration. (React&Next.js) | ||
- [Discord Bot](./discord-bot) - The Discord Bot, request token on Discord (Node.js&AWL Lambda) | ||
- [Subgraph](./subgraph) - The Subgraph, faucet smart contract events indexed on Alchemy&The Graph (Alchemy&The Graph) | ||
|
||
### 3. **Client ID:** | ||
* Right-click the bot in your server. | ||
* Select and copy the `ID` for the Client ID. | ||
## Faucet Smart Contract | ||
|
||
### Move to the smart contract directory and install dependencies | ||
|
||
```bash | ||
cd smart_contract | ||
npm install | ||
``` | ||
|
||
### Compile the smart contract | ||
|
||
```bash | ||
npx hardhat compile | ||
``` | ||
|
||
### Run tests | ||
|
||
```bash | ||
npx hardhat test | ||
``` | ||
|
||
### Deploy the smart contract | ||
|
||
```bash | ||
npx hardhat run scripts/deploy.js --network <networkName> | ||
``` | ||
|
||
## Web App | ||
|
||
### Live Working Web App | ||
|
||
[![Netlify Status](https://api.netlify.com/api/v1/badges/53c4ebc2-182b-4b31-820e-9e4fb006f574/deploy-status)](https://app.netlify.com/sites/subspacefaucet/deploys) | ||
|
||
- [Subspace Faucet](https://subspacefaucet.com/) | ||
|
||
### Move to the web app directory and install dependencies | ||
|
||
```bash | ||
cd web-app | ||
yarn | ||
``` | ||
|
||
### Run the web app | ||
|
||
```bash | ||
yarn dev | ||
``` | ||
|
||
## Discord Bot | ||
|
||
### Move to the discord bot directory and install dependencies | ||
|
||
### 4. **Dependencies Installation:** | ||
```bash | ||
npm install discord.js ethers nodemon | ||
cd discord-bot | ||
npm install | ||
``` | ||
|
||
### 5. **Register Commands:** | ||
### Register the Discord commands | ||
|
||
```bash | ||
node src/register-commands.js | ||
npm run register | ||
``` | ||
|
||
### 6. **Run The Project:** | ||
### Deploy the Discord bot | ||
|
||
```bash | ||
nodemon src/index.js | ||
npm run deploy | ||
``` | ||
|
||
### 7. **Execute Bot Command:** | ||
* Go to your Discord server. | ||
* Run the command /request_tokens_guild_specific. | ||
* Provide an Ethereum Address when prompted. | ||
## Subgraph | ||
|
||
### Deployed Subgraph | ||
|
||
- [Subgraph on Alchemy for Faucet Contract on Goerli](https://subgraphs.alchemy.com/subgraphs/2634) | ||
- [Subgraph on TheGraph for Faucet Contract on Goerli](https://thegraph.com/studio/subgraph/faucet-goerli/) | ||
|
||
### Move to the subgraph directory and install dependencies | ||
|
||
```bash | ||
cd subgraph | ||
yarn global add @graphprotocol/graph-cli | ||
yarn | ||
``` | ||
|
||
### Initialize the subgraph | ||
|
||
```bash | ||
graph init --studio faucet-goerli | ||
``` | ||
|
||
### Deploy the subgraph | ||
|
||
```bash | ||
graph auth --studio <studio-access-token> | ||
cd faucet-goerli | ||
graph codegen && graph build | ||
graph deploy --studio faucet-goerli | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Discord Bot Faucet | ||
|
||
## Install dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
## Register the Discord commands | ||
|
||
```bash | ||
npm run register | ||
``` | ||
|
||
## Deploy the Discord bot | ||
|
||
```bash | ||
npm run deploy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Subgraph | ||
|
||
## Faucet Contract on Goerli | ||
|
||
Test contract deployed on Goerli to test the subgraph more easily. | ||
|
||
### Deployed Subgraph | ||
|
||
- [Subgraph on Alchemy for Faucet Contract on Goerli](https://subgraphs.alchemy.com/subgraphs/2634) | ||
- [Subgraph on TheGraph for Faucet Contract on Goerli](https://thegraph.com/studio/subgraph/faucet-goerli/) | ||
|
||
### Move to the subgraph directory and install dependencies | ||
|
||
```bash | ||
cd subgraph | ||
yarn global add @graphprotocol/graph-cli | ||
yarn | ||
``` | ||
|
||
### Initialize the subgraph | ||
|
||
```bash | ||
graph init --studio faucet-goerli | ||
``` | ||
|
||
### Deploy the subgraph | ||
|
||
```bash | ||
graph auth --studio <studio-access-token> | ||
cd faucet-goerli | ||
graph codegen && graph build | ||
graph deploy --studio faucet-goerli | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
# Faucet Web App | ||
|
||
[![Netlify Status](https://api.netlify.com/api/v1/badges/53c4ebc2-182b-4b31-820e-9e4fb006f574/deploy-status)](https://app.netlify.com/sites/subspacefaucet/deploys) | ||
|
||
This is a next.js web app that is used to interact with the faucet smart contract. | ||
We ask the user to connect using their wallet and a OAuth provider (GitHub or Discord) to protect against spam requests. | ||
|
||
## Environment Variables | ||
|
||
| Variables | Description | | ||
| -------- | ------- | | ||
| `NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID` | ProjectID use by WalletConnect connector https://cloud.walletconnect.com/ | | ||
| `GITHUB_CLIENT_ID` | GitHub App id https://github.com/settings/apps | | ||
| `GITHUB_CLIENT_SECRET` | GitHub App Secret | | ||
| `GITHUB_ACCOUNT_NAME` | Account name on GitHub we will be looking at to make sure the user is following this account before requesting token | | ||
| `DISCORD_CLIENT_ID` | Discord App Id | | ||
| `DISCORD_CLIENT_SECRET` | Discord App Secret | | ||
| `DISCORD_GUILD_ID` | Discord Guild Id we will be looking at to make sure the user is already a member of the server before requesting token | | ||
| `TWITTER_CLIENT_ID` | Twitter OAuth 2 Client Id (currently not used) | | ||
| `TWITTER_CLIENT_SECRET` | Twitter OAuth 2 Client Secret (currently not used)t | | ||
| `NEXTAUTH_SECRET` | Next-Auth secret to sign/verify the JWT token | | ||
| `NEXTAUTH_URL` | Url of the web app | | ||
| `PRIVATE_KEY` | Private key with Minter role on the Faucet smart contract | | ||
| `NEXT_PUBLIC_RPC_ENDPOINT` | RPC endpoint use to request token and as well to add to the user network (metamask) if the user does not has this network yet | | ||
| `SLACK_ENABLED` | true/false to enable slack alert and reporting | | ||
| `SLACK_BALANCE_NOTIFICATION_THRESHOLD` | This amount * the withdraw amount is the threshold | | ||
| `SLACK_TOKEN` | Slack token | | ||
| `SLACK_CONVERSATION_ID` | Slack conversation Id message will be sent to | | ||
| `FAUNA_DB_SECRET` | Fauna db secret | | ||
| Variables | Description | | ||
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | ||
| `NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID` | ProjectID use by WalletConnect connector https://cloud.walletconnect.com/ | | ||
| `GITHUB_CLIENT_ID` | GitHub App id https://github.com/settings/apps | | ||
| `GITHUB_CLIENT_SECRET` | GitHub App Secret | | ||
| `GITHUB_ACCOUNT_NAME` | Account name on GitHub we will be looking at to make sure the user is following this account before requesting token | | ||
| `DISCORD_CLIENT_ID` | Discord App Id | | ||
| `DISCORD_CLIENT_SECRET` | Discord App Secret | | ||
| `DISCORD_GUILD_ID` | Discord Guild Id we will be looking at to make sure the user is already a member of the server before requesting token | | ||
| `TWITTER_CLIENT_ID` | Twitter OAuth 2 Client Id (currently not used) | | ||
| `TWITTER_CLIENT_SECRET` | Twitter OAuth 2 Client Secret (currently not used)t | | ||
| `NEXTAUTH_SECRET` | Next-Auth secret to sign/verify the JWT token | | ||
| `NEXTAUTH_URL` | Url of the web app | | ||
| `PRIVATE_KEY` | Private key with Minter role on the Faucet smart contract | | ||
| `NEXT_PUBLIC_RPC_ENDPOINT` | RPC endpoint use to request token and as well to add to the user network (metamask) if the user does not has this network yet | | ||
| `SLACK_ENABLED` | true/false to enable slack alert and reporting | | ||
| `SLACK_BALANCE_NOTIFICATION_THRESHOLD` | This amount \* the withdraw amount is the threshold | | ||
| `SLACK_TOKEN` | Slack token | | ||
| `SLACK_CONVERSATION_ID` | Slack conversation Id message will be sent to | | ||
| `FAUNA_DB_SECRET` | Fauna db secret | |