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

whitelist.gno

0.97 Kb · 29 lines
 1package whitelist
 2
 3import (
 4	"gno.land/r/gnoswap/order/keeper"
 5)
 6
 7// AddWhitelistedPool permits target's orders to trade on an existing pool.
 8// Admin, governance, or the role assigned to this selector may call it.
 9func AddWhitelistedPool(cur realm, target, poolPath string) {
10	prev := assertIsManagerCall(0, cur, keeper.SelectorAddWhitelistedPool)
11	state := getState(target)
12
13	assertIsExistingPool(poolPath)
14	assertIsNotWhitelistedPool(state, target, poolPath)
15
16	state.AddPool(poolPath)
17	emitPoolUpdated(0, prev, target, poolPath, true)
18}
19
20// RemoveWhitelistedPool stops only target's orders from using this pool.
21// Existing orders remain cancellable. Authorization matches AddWhitelistedPool.
22func RemoveWhitelistedPool(cur realm, target, poolPath string) {
23	prev := assertIsManagerCall(0, cur, keeper.SelectorRemoveWhitelistedPool)
24	state := getState(target)
25	assertIsWhitelistedPool(state, target, poolPath)
26
27	state.RemovePool(poolPath)
28	emitPoolUpdated(0, prev, target, poolPath, false)
29}