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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

setup_test.gno

1.09 Kb · 45 lines
 1package admin
 2
 3import (
 4	"testing"
 5
 6	"chain"
 7
 8	"gno.land/p/nt/bptree/v0"
 9	"gno.land/p/nt/testutils/v0"
10)
11
12var (
13	testAdmin        = testutils.TestAddress("testAdmin")
14	testOperator     = testutils.TestAddress("testOperator")
15	testUser         = testutils.TestAddress("testUser")
16	testUser2        = testutils.TestAddress("testUser2")
17	unauthorizedUser = testutils.TestAddress("unauthorizedUser")
18	testProtocol     = testutils.TestAddress("testProtocol")
19)
20
21// setupCommonAdminTests initializes common admin test environment.
22func setupCommonAdminTests(cur realm, t *testing.T) {
23	t.Helper()
24	admin = testAdmin
25	pendingAdmin = address("")
26	operatorAddrs = bptree.NewBPTree32()
27	operatorAddrs.Set(testAdmin.String(), true)
28	feeCollectorAddr = adminRealmAddr()
29	protocolAddr = testAdmin
30	faucetTargetAmount = 0
31	explorerURL = "https://app.beta.akkadia.land"
32}
33
34func adminRealmAddr() address {
35	return chain.PackageAddress("gno.land/r/akkadia/beta/admin")
36}
37
38func containsOperator(operators []address, addr address) bool {
39	for _, operator := range operators {
40		if operator == addr {
41			return true
42		}
43	}
44	return false
45}