Skip to content

Commit

Permalink
Add vrfAdmin initializer to avoid interruption during the deployment …
Browse files Browse the repository at this point in the history
…process
  • Loading branch information
go7066 committed Dec 29, 2023
1 parent 515dd3e commit 8db3d0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/gno.land/r/demo/teritori/vrf/vrf.gno
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ const (
"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
)

func init() {
config.vrfAdmin = std.GetOrigCaller().String()
}

// ErrLength reports an attempt to decode an odd-length input
// using Decode or DecodeString.
// The stream-based Decoder returns io.ErrUnexpectedEOF instead of ErrLength.
Expand Down Expand Up @@ -159,10 +163,6 @@ func RenderRequests(startAfter uint64, limit uint64) string {
}

func SetVRFAdmin(vrfAdmin string) {
if config.vrfAdmin == "" {
config.vrfAdmin = vrfAdmin
return
}
caller := std.GetOrigCaller()
if config.vrfAdmin != caller.String() {
panic("not allowed to update vrfAdmin")
Expand All @@ -172,12 +172,12 @@ func SetVRFAdmin(vrfAdmin string) {
}

func SetFeeders(feedersText string) {
feeders := strings.Split(feedersText, ",")
caller := std.GetOrigCaller()
if config.vrfAdmin != caller.String() {
panic("not allowed set feeders")
}

feeders := strings.Split(feedersText, ",")
config.feeders = feeders
}

Expand Down

0 comments on commit 8db3d0d

Please sign in to comment.