Skip to content
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

update the origional branch #18

Merged
merged 30 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7a38671
feat: add is synced field to peer-info command
kehiy Nov 25, 2023
ec6dfee
chore: change user grpc port
kehiy Nov 25, 2023
1d6176c
fix: wrong data in network status
kehiy Dec 2, 2023
ff35cb8
feat: referral system (#9)
kehiy Dec 7, 2023
256cddb
chore: fix get all referrals
kehiy Dec 7, 2023
2117aa8
chore: fix get all referrals
kehiy Dec 7, 2023
960718b
chore: fix get all referrals
kehiy Dec 7, 2023
e0699ad
chore: fix get all referrals
kehiy Dec 7, 2023
8de206b
fix: faucet referral command parsing
kehiy Dec 8, 2023
76a8932
fix: referral codes
kehiy Dec 8, 2023
73fe448
fix: retuen in referral command
kehiy Dec 8, 2023
b8db497
chore: more detail on my-referral command result
kehiy Dec 11, 2023
919e2ed
fix: accept message only from pactus server
kehiy Dec 17, 2023
c22df68
fix: only first validator will get stake faucet
kehiy Dec 17, 2023
bb6944d
feat: adding python module to get validator information (#10)
b00f Dec 17, 2023
3244179
feat: updating discord messages, adding memo to faucet bond transaction
kehiy Dec 19, 2023
00149c3
feat: updating discord messages
kehiy Dec 19, 2023
3fd74f1
feat: enhancing tx hash in faucet message
kehiy Dec 19, 2023
0e3ce84
feat: enhancing messages
kehiy Dec 19, 2023
55b4ec0
chore: else if for facuet command
kehiy Dec 19, 2023
02f38f0
fix: fixing add point fucntion issue
kehiy Dec 19, 2023
3ec768b
fix: referral store messages update
kehiy Dec 19, 2023
7a97189
fix: referral store messages update
kehiy Dec 19, 2023
f84e22c
fix: typo
kehiy Dec 19, 2023
5fdad8a
feat: adding referrer discord ID to validator strcut (#11)
kehiy Dec 20, 2023
48d2286
feat: adding pactusscan transaction link
kehiy Dec 21, 2023
ed710cc
feat: adding top10 referral script
kehiy Dec 21, 2023
a608b7e
feat: adding check for same referral and user
kehiy Dec 22, 2023
77b910b
fix: mistakes in network detail command response
kehiy Dec 27, 2023
8d7f798
fix: mistakes in network detail command response
kehiy Dec 27, 2023
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ pactus-*
cmd/data/wallet.json
cmd/data/config.json
cmd/data/validators.json
cmd/bin
cmd/bin
__pycache__
/scripts/go/referral.json
/scripts/go/top10.json
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ check:
golangci-lint run --build-tags "${BUILD_TAG}" --timeout=20m0s

### building
build:
discord-bot:
go build -o build/main cmd/app.go

9 changes: 9 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ func (c *Client) LastBlockTime() (uint32, error) {
return lastBlockTime.BlockTime, err
}

func (c *Client) GetNodeInfo() (*pactus.GetNodeInfoResponse, error) {
info, err := c.networkClient.GetNodeInfo(context.Background(), &pactus.GetNodeInfoRequest{})
if err != nil {
return &pactus.GetNodeInfoResponse{}, err
}

return info, err
}

func (c *Client) Close() error {
return c.conn.Close()
}
5 changes: 4 additions & 1 deletion client/client_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ func (cm *Mgr) GetPeerInfo(address string) (*pactus.PeerInfo, *bls.PublicKey, er

if networkInfo != nil {
for _, p := range networkInfo.Peers {
for _, key := range p.ConsensusKeys {
for i, key := range p.ConsensusKeys {
pub, _ := bls.PublicKeyFromString(key)
if pub != nil {
if pub.ValidatorAddress().String() == address {
if i != 0 {
return nil, nil, errors.New("please enter the first validator address")
}
return p, pub, nil
}
}
Expand Down
9 changes: 8 additions & 1 deletion cmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ func main() {
return
}

// load list of validators already received faucet
rs, err := discord.LoadReferralData(cfg)
if err != nil {
log.Println(err)
return
}

///start discord bot
bot, err := discord.Start(cfg, w, ss)
bot, err := discord.Start(cfg, w, ss, rs)
if err != nil {
log.Printf("could not start discord bot: %v\n", err)
return
Expand Down
16 changes: 9 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import (
)

type Config struct {
DiscordToken string `json:"discord_token"`
WalletPath string `json:"wallet_path"`
WalletPassword string `json:"wallet_password"`
Servers []string `json:"servers"`
FaucetAddress string `json:"faucet_address"`
FaucetAmount float64 `json:"faucet_amount"`
ValidatorDataPath string `json:"validator_data_path"`
DiscordToken string `json:"discord_token"`
WalletPath string `json:"wallet_path"`
WalletPassword string `json:"wallet_password"`
Servers []string `json:"servers"`
FaucetAddress string `json:"faucet_address"`
FaucetAmount float64 `json:"faucet_amount"`
ReferralerStakeAmount float64 `json:"referraler_stake_amount"` // who get faucet
ValidatorDataPath string `json:"validator_data_path"`
ReferralDataPath string `json:"referral_data_path"`
}

func Load(path string) (*Config, error) {
Expand Down
Loading