Skip to content

Commit

Permalink
backupp
Browse files Browse the repository at this point in the history
  • Loading branch information
Villaquiranm committed Oct 6, 2024
1 parent be85651 commit 4667bd8
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 40 deletions.
38 changes: 4 additions & 34 deletions gno_github_agent/.env
Original file line number Diff line number Diff line change
@@ -1,34 +1,4 @@
INDEXER_NETWORK_ID=teritori-testnet
TERITORI_MINTER_CODE_IDS=10
TENDERMINT_WEBSOCKET_ENDPOINT=wss://rpc.testnet.teritori.com/websocket
TERITORI_COLLECTION_WHITELIST=testeth-0x43cc70bf324d716782628bed38af97e4afe92f69,mumbai-0x916ad9d549907ccbbaf9ba65526826bfc3a9c0c4,testori-tori1r8raaqul4j05qtn0t05603mgquxfl8e9p7kcf7smwzcv2hc5rrlq0vket0,testori-tori1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgsjscd88

#Just for DB local instance
POSTGRES_USER=postgres
POSTGRES_PASSWORD=1234
DATABASE_NAME=postgres
# indexer RW DB
DB_INDEXER_HOST=127.0.0.1
DB_INDEXER_PORT=7654
# dapp RO DB
DB_DAPP_HOST=127.0.0.1
DB_DAPP_PORT=7654

PRICES_DB_HOST=127.0.0.1
PRICES_DB_PORT=5433
PRICES_DB_NAME=postgres
PRICES_DB_USER=postgres
PRICES_DB_PASSWORD=1234

PRICES_SERVICE_URI=prices.mainnet.teritori.com:443

SUBSTREAMS_API_TOKEN=<get_from_substream_site>

#app env
EXPO_PUBLIC_IMG_PROXY_URL=https://imgproxy.tools.teritori.com/insecure/
EXPO_PUBLIC_PUBLIC_TENOR_KEY=AIzaSyA8TpVfoyoBaDdLww6wJ1Xe0OVN-Hi8qPE

#map token
EXPO_PUBLIC_LEAFLET_MAP_TOKEN=QkwJFLzzxPan25YCgnDExGpMFPxA3x4lnyKiUf8zmaqXLP5XyOR8n3yEM8jlKV3W

# MULTISIG_BACKEND_URL=http://localhost:9091 # you can use this for local testing
GNO_MNEMONIC=scissors razor beauty delay derive chronic toss burger gravity shallow couch slogan change tray connect frame token slight zone usage sad monkey pyramid change
GNO_CHAIN_ID=dev
GNO_RPC_ADDR=http://127.0.0.1:26657
GNO_REALM_PATH=gno.land/r/teritori/ghverify
95 changes: 95 additions & 0 deletions gno_github_agent/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
KEY = MyKey
BASE = teritori
REMOTE = http://127.0.0.1:26657
CHAIN_ID = dev

.PHONY: add_social_feeds_realm add_utf16_pkg add_ujson_pkg add_flags_index_pkg add_dao_interfaces_pkg add_social_feed all

add_gh_verify_realm:
gnokey maketx addpkg \
-deposit="1ugnot" \
-gas-fee="1ugnot" \
-gas-wanted="50000000" \
-broadcast="true" \
-chainid="${CHAIN_ID}" \
-remote="${REMOTE}" \
-pkgdir="./r/gnoland/ghverify" \
-pkgpath="gno.land/r/${BASE}/ghverify" \
${KEY}

request_verification:
gnokey maketx call \
-pkgpath "gno.land/r/${BASE}/ghverify" \
-func="RequestVerification" \
-gas-fee="1000000ugnot" \
-gas-wanted="3000000" \
-remote="${REMOTE}" \
-chainid="${CHAIN_ID}" \
-broadcast \
-args "villaquiranm" \
MyKey

check_current_feeds:
gnokey query vm/qeval --data 'gno.land/r/${BASE}/ghverify.GnorkleEntrypoint("request")'
-remote="${REMOTE}" \
${KEY}

set_owner:
gnokey maketx call \
-pkgpath "gno.land/r/${BASE}/ghverify" \
-func="SetOwner" \
-gas-fee="1000000ugnot" \
-gas-wanted="3000000" \
-remote="${REMOTE}" \
-chainid="${CHAIN_ID}" \
-broadcast \
-args "g1yr5sts6w9k2arsuk858lh6phegcfvg0y4d0pgf" \
${KEY}

verify:
gnokey maketx call \
-pkgpath "gno.land/r/${BASE}/ghverify" \
-func="GnorkleEntrypoint" \
-gas-fee="1000000ugnot" \
-gas-wanted="3000000" \
-remote="${REMOTE}" \
-chainid="${CHAIN_ID}" \
-broadcast \
-args "ingest,g1pwxuhltfqxcumjmuquuue6y3f2g3f2d0rcq52x,OK" \
${KEY}
relay_verify:
gnokey maketx call \
-pkgpath "gno.land/r/${BASE}/ghverify" \
-func="GnorkleEntrypoint" \
-gas-fee="1000000ugnot" \
-gas-wanted="3000000" \
-remote="${REMOTE}" \
-chainid="${CHAIN_ID}" \
-broadcast \
-args "relay,gpub1pgfj7ard9eg82cjtv4u4xetrwqer2dntxyfzxz3pqgfakcapzvuux7vug9vagyjmvj6k2w2xu723qnue69z9r7wlt9c6zeyxvt8,dd4b4012daddb14fe7587f4bbb5bef5f16d123032e5c6dc718528907c8f71ee267c1a051328d42991fe6f82cdba424efd3866251cf9411c8f38ebb1e144f10ce,ingest,g14vxq5e5pt5sev7rkz2ej438scmxtylnzv5vnkw,OK" \
newkey

check:
gnokey maketx call \
-pkgpath "gno.land/r/${BASE}/ghverify" \
-func="GnorkleEntrypoint" \
-gas-fee="1000000ugnot" \
-gas-wanted="3000000" \
-remote="${REMOTE}" \
-chainid="${CHAIN_ID}" \
-broadcast \
-args "request" \
${KEY}

send:
gnokey maketx send \
-gas-fee="1000000ugnot" \
-gas-wanted="3000000" \
-remote="${REMOTE}" \
-chainid="${CHAIN_ID}" \
-send="100000ugnot" \
-to "g1yr5sts6w9k2arsuk858lh6phegcfvg0y4d0pgf" \
-broadcast \
${KEY}


1 change: 1 addition & 0 deletions gno_github_agent/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions gno_github_agent/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down
9 changes: 8 additions & 1 deletion gno_github_agent/main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package main

import (
"log"
"os"
"time"

"github.com/TERITORI/gh-verify-agent/clientql"
"github.com/TERITORI/gh-verify-agent/db"
"github.com/TERITORI/gh-verify-agent/signer"
"github.com/go-co-op/gocron"
"github.com/joho/godotenv"
"go.uber.org/zap"
)

Expand All @@ -19,6 +21,11 @@ func main() {
panic(err)
}

err = godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}

db, err := db.New()
if err != nil {
panic(err)
Expand All @@ -33,7 +40,7 @@ func main() {
clientql := clientql.New("http://localhost:8546/graphql/query", db, logger.Sugar(), gnoSigner)
schedule := gocron.NewScheduler(time.UTC)

schedule.Every(2).Minutes().Do(func() {
schedule.Every(30).Seconds().Do(func() {
err = clientql.DealWithVerifications()
if err != nil {
logger.Error("failed to get names list", zap.Error(err))
Expand Down
16 changes: 11 additions & 5 deletions gno_github_agent/signer/signer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package signer

import (
"fmt"

"github.com/gnolang/gno/gno.land/pkg/gnoclient"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
rpcclient "github.com/gnolang/gno/tm2/pkg/bft/rpc/client"
Expand Down Expand Up @@ -57,12 +59,12 @@ func New(db *gorm.DB,
func (s *Signer) CallVerify(address string) error {
acc, _, err := s.gnoclient.QueryAccount(s.keyInfo.GetAddress())
if err != nil {
return err
return fmt.Errorf("failed to query account: %w", err)
}

baseCfg := gnoclient.BaseTxCfg{
GasFee: "1ugnot",
GasWanted: 100000,
GasFee: "1000000ugnot",
GasWanted: 3000000,
AccountNumber: acc.GetAccountNumber(),
SequenceNumber: acc.GetSequence(),
Memo: "ghverify-agent",
Expand All @@ -72,10 +74,14 @@ func (s *Signer) CallVerify(address string) error {

_, err = s.gnoclient.Call(baseCfg, vm.MsgCall{
Caller: s.keyInfo.GetAddress(),
Send: nil,
PkgPath: s.realmPath,
Func: "GnorkleEntryPoint",
Func: "GnorkleEntrypoint",
Args: []string{arg},
})
if err != nil {
return fmt.Errorf("failed to call gnoclient: %s", err.Error())
}

return err
return nil
}

0 comments on commit 4667bd8

Please sign in to comment.