Skip to content

Commit

Permalink
feat: delete unused things
Browse files Browse the repository at this point in the history
  • Loading branch information
omarsy committed Jun 18, 2024
1 parent dfbfb98 commit f4a7556
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 59 deletions.
56 changes: 27 additions & 29 deletions gno/r/social_feeds/CMD.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,65 @@
gnokey maketx addpkg \
-deposit="1ugnot" \
-gas-fee="1ugnot" \
-gas-wanted="50000000" \
-broadcast="true" \
-remote="https://rpc.gno.land:443" \
-chainid="portal-loop" \
-pkgdir="." \
-pkgpath="gno.land/r/demo/teritori/social_feeds" \
mykey2

gnokey maketx call \
-pkgpath "gno.land/r/demo/social_feeds" \
-pkgpath "gno.land/r/demo/teritori/social_feeds" \
-func "CreateFeed" \
-gas-fee 1000000ugnot \
-gas-wanted 3000000 \
-send "" \
-remote="https://rpc.gno.land:443" \
-chainid="portal-loop" \
-broadcast \
-args "teritori" \
test1
mykey2

gnokey maketx call \
-pkgpath "gno.land/r/demo/social_feeds" \
-pkgpath "gno.land/r/demo/teritori/social_feeds" \
-func "CreatePost" \
-gas-fee 1000000ugnot \
-gas-wanted 2000000 \
-send "" \
-remote="https://rpc.gno.land:443" \
-chainid="portal-loop" \
-broadcast \
-args "1" \
-args "0" \
-args "2" \
-args '{"gifs": [], "files": [], "title": "", "message": "Hello world 2 !", "hashtags": [], "mentions": [], "createdAt": "2023-08-03T01:39:45.522Z", "updatedAt": "2023-08-03T01:39:45.522Z"}' \
test1
mykey2

gnokey maketx call \
-pkgpath "gno.land/r/demo/social_feeds" \
-pkgpath "gno.land/r/demo/teritori/social_feeds" \
-func "TipPost" \
-gas-fee 1000000ugnot \
-gas-wanted 3000000 \
-send "1000000ugnot" \
-send "1000ugnot" \
-remote="https://rpc.gno.land:443" \
-chainid="portal-loop" \
-broadcast \
-args "1" \
-args "1" \
test1
mykey2

gnokey maketx call \
-pkgpath "gno.land/r/demo/social_feeds" \
-pkgpath "gno.land/r/demo/teritori/social_feeds" \
-func "HidePostForMe" \
-gas-fee 1000000ugnot \
-gas-wanted 3000000 \
-send "" \
-broadcast \
-args "1" \
-args "1" \
test1
mykey2

// Query posts
gnokey query vm/qeval --data 'gno.land/r/demo/social_feeds
gnokey query vm/qeval --data 'gno.land/r/demo/teritori/social_feeds
GetPosts(1, "", []uint64{}, 0, 10)'

gnokey maketx addpkg \
-deposit="1ugnot" \
-gas-fee="1ugnot" \
-gas-wanted="5000000" \
-broadcast="true" \
-pkgdir="." \
-pkgpath="gno.land/r/demo/social_feeds_v2" \
test1

gnokey maketx call \
-pkgpath "gno.land/r/demo/social_feeds" \
-func "MigrateFromPreviousFeed" \
-gas-fee 1000000ugnot \
-gas-wanted 2000000 \
-send "" \
-broadcast \
test1

7 changes: 3 additions & 4 deletions gno/r/social_feeds/feeds.gno
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import (
// Realm (package) state

var (
gFeeds avl.Tree // id -> *Feed
gFeedsCtr int // increments Feed.id
gFeedsByName avl.Tree // name -> *Feed
gDefaultAnonFee = 100000000 // minimum fee required if anonymous
gFeeds avl.Tree // id -> *Feed
gFeedsCtr int // increments Feed.id
gFeedsByName avl.Tree // name -> *Feed
)

//----------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions gno/r/social_feeds/feeds_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ import (
"gno.land/p/demo/avl"
ujson "gno.land/p/demo/teritori/ujson"
"gno.land/p/demo/testutils"
"gno.land/r/demo/boards"
// Fake previous version for testing
feedsV7 "gno.land/r/demo/teritori/social_feeds"
"gno.land/r/demo/users"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions gno/r/social_feeds/flags.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"gno.land/p/demo/teritori/flags_index"
)

var SEPARATOR = "/"
var seperator = "/"

func getFlagID(fid FeedID, pid PostID) flags_index.FlagID {
return flags_index.FlagID(fid.String() + SEPARATOR + pid.String())
return flags_index.FlagID(fid.String() + seperator + pid.String())
}

func parseFlagID(flagID flags_index.FlagID) (FeedID, PostID) {
parts := strings.Split(string(flagID), SEPARATOR)
parts := strings.Split(string(flagID), seperator)
if len(parts) != 2 {
panic("invalid flag ID '" + string(flagID) + "'")
}
Expand Down
2 changes: 0 additions & 2 deletions gno/r/social_feeds/gno.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ require (
gno.land/p/demo/teritori/ujson v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
gno.land/p/demo/ufmt v0.0.0-latest
gno.land/r/demo/boards v0.0.0-latest
gno.land/r/demo/users v0.0.0-latest
)
2 changes: 0 additions & 2 deletions gno/r/social_feeds/messages.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"gno.land/p/demo/teritori/ujson"
)

var PKG_PATH = "gno.land/r/demo/teritori/social_feeds"

// Ban a post
type ExecutableMessageBanPost struct {
dao_interfaces.ExecutableMessage
Expand Down
17 changes: 0 additions & 17 deletions gno/r/social_feeds/misc.gno
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package social_feeds

import (
"encoding/base64"
"std"
"strconv"
"strings"

"gno.land/r/demo/users"
)

func getFeed(fid FeedID) *Feed {
Expand All @@ -32,15 +28,6 @@ func incGetFeedID() FeedID {
return FeedID(gFeedsCtr)
}

func usernameOf(addr std.Address) string {
user := users.GetUserByAddress(addr)
if user == nil {
return ""
} else {
return user.Name
}
}

func feedIDKey(fid FeedID) string {
return padZero(uint64(fid), 10)
}
Expand All @@ -66,10 +53,6 @@ func padZero(u64 uint64, length int) string {
}
}

func bytesToString(b []byte) string {
return base64.RawURLEncoding.EncodeToString(b)
}

func intToString(val int) string {
return strconv.Itoa(val)
}

0 comments on commit f4a7556

Please sign in to comment.