Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z_create_thread_06_filetest.gno

0.90 Kb · 34 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v0/filetests/z_create_thread_06_filetest
 2
 3// Open board: Test creating a new thread as a non member user that has no GNOT
 4package z_create_thread_06_filetest
 5
 6import (
 7	"testing"
 8
 9	"gno.land/p/gnoland/boards/v0"
10
11	boards2 "gno.land/r/gnoland/boards2/v0"
12)
13
14const (
15	owner address = "g1skl80cuz8zq3lul9pgz5pc35l2pfzgxgfpsqkx"
16	user  address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
17)
18
19var bid boards.ID // Operate on board DAO
20
21func init(cur realm) {
22	testing.SetRealm(testing.NewUserRealm(owner))
23	bid = boards2.CreateBoard(cross(cur), "test123", false, true)
24}
25
26func main(cur realm) {
27	testing.SetRealm(testing.NewUserRealm(user))
28
29	// Non members should be able to create threads only if they have enough GNOT
30	boards2.CreateThread(cross(cur), bid, "Title", "Body")
31}
32
33// Error:
34// caller is not allowed to create threads: account amount is lower than 3000 GNOT