Search Apps Documentation Source Content File Folder Download Copy Actions Download

callback.gno

0.90 Kb ยท 46 lines
 1package valopers_prop_1
 2
 3import (
 4	"strings"
 5
 6	"gno.land/p/nt/ownable"
 7	"gno.land/p/sys/validators"
 8	"gno.land/r/gnops/valopers"
 9)
10
11var owner = ownable.New()
12
13// SetInitialVals updates the validator addresses for the batch
14func SetInitialVals(_ realm, newVals string) {
15	owner.AssertOwnedByCurrent()
16
17	initialVals = strings.Split(newVals, ",")
18}
19
20var initialVals = []string{
21	"g16tfqqk6wvtzkuaw7g79eun2nvpz0xq34gv2p4x", // Samourai
22}
23
24// Callback is the main importable GovDAO prop callback
25func Callback() []validators.Validator {
26	vals := make([]validators.Validator, 0, len(initialVals))
27
28	for _, addr := range initialVals {
29		profile := valopers.GetByAddr(address(addr))
30
31		// Check if the profile is active
32		if !profile.KeepRunning {
33			continue
34		}
35
36		val := validators.Validator{
37			Address:     profile.Address,
38			PubKey:      profile.PubKey,
39			VotingPower: 1,
40		}
41
42		vals = append(vals, val)
43	}
44
45	return vals
46}