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

doc.gno

1.82 Kb · 34 lines
 1// Package keeper is the role-based access realm of the GnoSwap order realms.
 2//
 3// It owns a manager.State (gno.land/p/gnoswap/order/access/manager/v0).
 4// Roles are granted to keeper accounts, and each order realm function
 5// (target package path and selector) is assigned the role allowed to call
 6// it, or PublicRole for anyone.
 7//
 8// Administration is not a manager role: every management call is checked
 9// against the GnoSwap admin or governance (gno.land/r/gnoswap/access).
10// manager.AdminRole is never granted here.
11//
12// Roles registered at deployment:
13//   - DCAKeeperRole (1): DCA order keepers
14//   - LimitKeeperRole (2): limit order keepers
15//   - PoolManagerRole (3): DCA/Limit pool whitelist and DCA pool policy managers
16//
17// DCA ExecuteGroup and ForceCancelOrder are assigned to DCAKeeperRole at
18// deployment, so only granted keepers run DCA rounds and force-cancel orders that
19// block them. The whitelist realm's AddWhitelistedPool and RemoveWhitelistedPool,
20// and DCA's SetTokenMinAmountPerExecution and SetPairPriceLimit are assigned to
21// PoolManagerRole, so only granted managers pick the pools and the price
22// limits rounds trade with (admin and governance may call them too).
23// This role intentionally manages both targets' whitelists and DCA's token
24// minimums and pair price limits; target-specific manager roles are not required.
25// It does not grant ExecuteGroup, ForceCancelOrder, or ExecuteOrder.
26// Keeping the two roles on separate accounts means a single leaked key
27// cannot both choose a round's pool or price and run it.
28//
29// Admin or governance adds custom roles with AddRole.
30//
31// Order realms check authorization with IsAuthorized(target, selector,
32// caller), passing their own package path, or with the non-crossing
33// AssertIsAuthorizedCaller(0, cur, selector), which derives the target from cur.
34package keeper