const MinAmount, MaxAmount, MinPeriod, MaxPeriod, MaxTerm, FeeAllowance, MaxTitleLen, PageSize, MaxSessionsPerWallet
1const (
2 // MinAmount is the smallest plan amount, 0.1 GNOT. A Pull uses about
3 // 8-9M gas on a local chain, and the chain charges the whole fee the
4 // signer sets, not the gas used: the pages set 20,000 ugnot for 20M gas
5 // wanted (Onyx's minimum price of 1 ugnot per 1,000 gas). At 0.1 GNOT that
6 // fee is already a fifth of the payment; below it, fees would dominate.
7 MinAmount int64 = 100_000
8 // MaxAmount is 1,000,000 GNOT per period: far above any real plan, and
9 // low enough that totals cannot overflow int64 for millions of pulls.
10 MaxAmount int64 = 1_000_000_000_000
11 // MinPeriod is one minute: block times are a few seconds, and the
12 // chain's spend period is counted in seconds. Short periods exist for
13 // demos and tests; pages flag any period under a day.
14 MinPeriod int64 = 60
15 // MaxPeriod is 30 days, exactly the chain's limit on a session's spend
16 // period (tm2 std.MaxSpendPeriod). The session's spend period is always
17 // the plan's period, so the cap the pages promise ("at most price +
18 // allowance per period") is exactly what the chain enforces. No yearly
19 // plans: the chain refuses a session whose spend period is longer.
20 MaxPeriod int64 = 30 * 24 * 60 * 60
21 // MaxTerm is the longest a mandate may run from the moment it is
22 // created: 366 days. A payer renews once a year at most; the chain's own
23 // cap on a session's expiry is 4 x 365 days (tm2 std.MaxSessionDuration).
24 MaxTerm int64 = 366 * 24 * 60 * 60
25 // FeeAllowance is what the pages add to the session's spend limit for
26 // fees and storage (0.1 GNOT). The chain accepts a fee when fee / gas
27 // wanted is at least the current gas price (1 ugnot per 1,000 gas on
28 // Onyx, raised by the chain when blocks are full), and counts the Pull's
29 // storage deposit against the same limit. With the pages' 20M gas wanted
30 // the minimum fee is 20,000 ugnot. A Pull creates no object: a first
31 // payment adds at most 78 bytes measured (7,800 ugnot at 100 ugnot per
32 // byte), later ones nothing. So the worst pull costs about 28,000 ugnot
33 // and the allowance covers a gas price up to about 4.5x Onyx's current
34 // one (docs/design.md, "Pull's budget").
35 FeeAllowance int64 = 100_000
36 // MaxTitleLen is the longest plan title, in characters.
37 MaxTitleLen = 80
38 // PageSize is the number of rows per list page and per read call.
39 PageSize = 20
40 // MaxSessionsPerWallet is the chain's limit (tm2 std.MaxSessionsPerAccount).
41 MaxSessionsPerWallet = 16
42)Limits. See docs/design.md for the reasoning behind each value.