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

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

admin.gno

2.06 Kb · 46 lines
 1package pool
 2
 3import (
 4	mimir "gno.land/p/g12dcsmwccgdxasqde2eumua88tlrkw83kqf6tcz/mimir"
 5)
 6
 7// Role administration. The rules live in mimir.Roles; see its doc.
 8
 9func TransferOwnership(cur realm, next address) { roles.TransferOwnership(caller(cur), next, now()) }
10func CancelOwnershipTransfer(cur realm)         { roles.CancelOwnershipTransfer(caller(cur)) }
11func AcceptOwnership(cur realm)                 { roles.AcceptOwnership(caller(cur), now()) }
12func QueueOracle(cur realm, next address)       { roles.QueueOracle(caller(cur), next, now()) }
13func RevokeOracle(cur realm)                    { roles.RevokeOracle(caller(cur)) }
14func CancelOracle(cur realm)                    { roles.CancelOracle(caller(cur)) }
15func ExecuteOracle(cur realm)                   { roles.ExecuteOracle(now()) }
16func SetArbiter(cur realm, next address)        { roles.SetArbiter(caller(cur), next) }
17func QueueFeeRecipient(cur realm, next address) { roles.QueueFeeRecipient(caller(cur), next, now()) }
18func CancelFeeRecipient(cur realm)              { roles.CancelFeeRecipient(caller(cur)) }
19func ExecuteFeeRecipient(cur realm)             { roles.ExecuteFeeRecipient(now()) }
20func SetPaused(cur realm, p bool)               { roles.SetPaused(caller(cur), p) }
21
22// SetAuditAgent appoints the reviewer that may dispute with a bond; "" disables it.
23func SetAuditAgent(cur realm, next string) {
24	roles.SetAuditAgent(caller(cur), mimir.ParseOptional(next))
25}
26
27// SetCaps sets guarded launch caps in net mUSD units (0 = none). They only gate new stakes.
28func SetCaps(cur realm, market, account int64) { roles.SetCaps(caller(cur), market, account) }
29
30// SetLockAt closes a market to new stakes early (kickoff), by its creator or
31// the owner. Only ever earlier.
32func SetLockAt(cur realm, id int64, at int64) {
33	m := getMarket(id)
34	c := caller(cur)
35	if c != m.Creator && c != roles.Owner {
36		panic("BadLock")
37	}
38	if m.State != StOpen || at < now() || at+LockSeconds > m.Deadline {
39		panic("BadLock")
40	}
41	if m.LockAt != 0 && at > m.LockAt {
42		panic("BadLock")
43	}
44	m.LockAt = at
45	emit("LockSet", "id", itoa(id), "lockAt", itoa(at))
46}