-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updated instructions and script #3
base: main
Are you sure you want to change the base?
Changes from 3 commits
cedfd0e
dbbdabc
593657a
638b3ed
31cd29c
de534fe
0bcaf98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||
# community-faucet-bot | ||||||
the community bot(s) interacting with r/faucet | ||||||
the community bot(s) interacting with gno.land/r/gnoland/faucet | ||||||
|
||||||
See https://github.com/gnolang/gno/issues/364. | ||||||
|
||||||
|
@@ -14,15 +14,15 @@ In addition, it adds operational complexity and cost to operating an endpoint. | |||||
|
||||||
### Details | ||||||
|
||||||
There are three issues we try to solve in the web-based faucet. | ||||||
There are four issues we try to solve in the web-based faucet. | ||||||
|
||||||
1) It is centralized and can be an abuse target. | ||||||
|
||||||
2) First-time users need to understand the fee structure to register and interact with the board and require multiple requests to get in fees | ||||||
|
||||||
3) There need to be more tokens allocated to the faucet wallet to support many user registrations and board creation. | ||||||
|
||||||
|
||||||
4) Faucet need to use fund from a contract instead of a user account. | ||||||
|
||||||
## Solution | ||||||
|
||||||
|
@@ -50,7 +50,7 @@ We can set a limit for each, say 400gnot per account. We give max 400gnot for fi | |||||
|
||||||
4) We can also recycle the tokens from the user and broad contract back to the faucet manually or automatically. | ||||||
|
||||||
5) 200 gnot user registration fee is to prevent people from spamming the user board. We can add a limited number of users can register per day and lower the fee. It slows down the pace that the faucets drain out. | ||||||
5) 200 gnot user registration fee is to prevent people from spamming the user board. We can add a limited number of users can register per day and lower the fee. It slows down the pace that the faucet drains out. | ||||||
|
||||||
## Features | ||||||
|
||||||
|
@@ -61,6 +61,8 @@ We can set a limit for each, say 400gnot per account. We give max 400gnot for fi | |||||
|
||||||
#### 0) Install the gnokey | ||||||
|
||||||
the discord bot will need to access local key store | ||||||
|
||||||
git clone https://github.com/gnolang/gno | ||||||
cd gno | ||||||
make install_gnokey | ||||||
|
@@ -69,28 +71,46 @@ make sure you include $GOPATH/bin in $PATH | |||||
|
||||||
#### 0.1) create admin and controller accounts | ||||||
|
||||||
gnokey add admin | ||||||
We use test1 to fund admin and controllers. The admin account address is hard coded in the faucet.gno | ||||||
piux2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
We could set the contract deployer as faucet contract admin. However, it is less secure. | ||||||
|
||||||
// only use test1 for testing | ||||||
gnokey add test1 --recover | ||||||
|
||||||
// import faucet admin key for testing, on production admin should have been already created for it to be included in the contract. | ||||||
|
||||||
gnokey add admin --recover | ||||||
|
||||||
gnokey add controller1 | ||||||
|
||||||
gnokey add controller2 | ||||||
|
||||||
|
||||||
#### 1) build gnobot | ||||||
|
||||||
make | ||||||
|
||||||
#### 2) Deploy faucet contract and assign controller the faucet | ||||||
#### 2) Assign controller to the faucet | ||||||
|
||||||
Please modify the controller address in ./provision.sh | ||||||
|
||||||
please modify the the address in the script. | ||||||
On production, please use a separate admin account than test1 ( g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 ) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
piux2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
DO NOT use test1 as admin in production, and mnemonic code is published on github. | ||||||
adminkey's address should match with the admin address in faucet.gno | ||||||
|
||||||
./provison.sh | ||||||
./provision.sh | ||||||
|
||||||
#### 3) start the bot | ||||||
|
||||||
check out | ||||||
Review the flag in the script, and provide a gnokey account that can instruct the faucet contract to distribute funds. | ||||||
|
||||||
./startbot.sh controller1 DISCORDBOT_TOKEN | ||||||
|
||||||
|
||||||
the executed command and flags | ||||||
|
||||||
|
||||||
./build/gnobot faucet controller1 --chain-id test3 --token DISCORDBOT_TOKEN --channel DISCORD_CHANNELID -bot-name DISCORD_BOTNAME --guild $DISCORD_GUILD --remote test3.gno.land:36657 | ||||||
|
||||||
./startbot.sh | ||||||
|
||||||
The following flags are required when you run the gnobot. We do not recommend storing the discord token on your local machine, not even in the env file. | ||||||
|
||||||
|
@@ -110,19 +130,26 @@ The following flags are required when you run the gnobot. We do not recommend st | |||||
|
||||||
DISCORDBOT_TOKEN: | ||||||
|
||||||
Your discord application bot token. (NOT OAuth2 token ) | ||||||
Your discord application bot token. (It is NOT a OAuth2 token ) | ||||||
|
||||||
DISCORD_CHANNELID: | ||||||
|
||||||
The id of a channel that you add the bot to | ||||||
|
||||||
DISCORD_GUILD: | ||||||
|
||||||
The id of the discord server that you add the bot to | ||||||
The server id of the discord server that you added the bot | ||||||
|
||||||
DISCORD_BOTNAME: | ||||||
|
||||||
The name of your bot | ||||||
|
||||||
|
||||||
./build/gnodiscord faucet test1 --chain-id test3 --token DISCORDBOT_TOKEN --channel DISCORD_CHANNELID -bot-name DISCORD_BOTNAME --guild $DISCORD_GUILD --remote test3.gno.land:36657 | ||||||
#### 4) Final step, fund the faucet contract! | ||||||
|
||||||
Once the bot starts, you will see a contract package address printed. | ||||||
|
||||||
Please verify the address with the contract deployed on the chain for gno.land/r/gnoland/faucet | ||||||
Please make sure to deposit funds to this faucet contract: g1ttrq7mp4zy6dssnmgyyktnn4hcj3ys8xhju0n7 | ||||||
|
||||||
./send.sh test1 g1ttrq7mp4zy6dssnmgyyktnn4hcj3ys8xhju0n7 200000000000ugnot | ||||||
piux2 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import ( | |
"github.com/bwmarrin/discordgo" | ||
"github.com/gnolang/gno/pkgs/amino" | ||
"github.com/gnolang/gno/pkgs/command" | ||
"github.com/gnolang/gno/pkgs/crypto" | ||
"github.com/gnolang/gno/pkgs/crypto/keys" | ||
"github.com/gnolang/gno/pkgs/crypto/keys/client" | ||
"github.com/gnolang/gno/pkgs/errors" | ||
|
@@ -151,6 +152,13 @@ func faucetApp(cmd *command.Command, args []string, iopts interface{}) error { | |
|
||
// validate password | ||
|
||
// Print faucet contract address | ||
// This is a hack, we should use gno.DerivePkgAddr(pkgPath string), | ||
// I had a problem to import github.com/gnolang/gno properly. Will fix it later. | ||
pkgAddr := crypto.AddressFromPreimage([]byte("pkgPath:" + opts.PkgPath)).Bech32() | ||
fmt.Println("- Please verify the address with contract deloyed on chain for ", opts.PkgPath) | ||
fmt.Println("- Please make sure deposit fund to this faucet contract: ", pkgAddr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, add a TODO here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
// start a discord session | ||
df, err := NewDiscordFaucet(name, pass, opts) | ||
if err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
# Please use a separate admin account than test1 ( g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 ) | ||
# DO NOT use test1 ( g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 ) in production. Mnemonic code is published on github. | ||
# adminkey's address should match with the admin address in faucet.gno | ||
# admin key to add controllers in the faucet | ||
adminkey='test1' | ||
|
||
# funding key to provide funding for controllers, admin and faucet contracts | ||
fundingkey='test1' | ||
|
||
# chain rpc endpoint | ||
rpc='test3.gno.land:36657' | ||
|
||
# chain id | ||
chainid='dev' |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider revision:
There are four issues from the Web-Based Faucet that the Community Faucet Bot aims to solve:
A larger token allocation for the faucet account is needed to support a growing number of user registrations and requests to the board.
The faucet needs to utilize funds from a contract instead of a user account for added security and improved management going forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done