From 6df4a3824bb5f8bf578244ebb3c183a7834cfebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Schie=C3=9Fl?= Date: Sun, 29 Jul 2018 07:10:44 +0200 Subject: [PATCH] remove length, add price as explicit allowed conversion --- bsip-0040.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bsip-0040.md b/bsip-0040.md index 24e2516..fd7df57 100644 --- a/bsip-0040.md +++ b/bsip-0040.md @@ -47,7 +47,7 @@ All descriptions in this section are on a pseudo/prosa level and no recommendati ### Custom active permission and custom active authority -A `custom_active_permission` looks like follows (in JSON/pseudo for clarification): +A `custom_active_permission` looks like follows (in JSON-like/pseudo for clarification): ``` custom_active_permission = list of custom_active_authority items custom_active_authority = { @@ -94,15 +94,17 @@ Stateless assert, all argument types. `Argument value` must be equal to one of v Stateless assert, all argument types. `Argument value` must NOT be equal to any of the values in the list. #### `lt, le, gt, ge` -Stateless assert, applies to `int` and `string` type arguments. If argument is `string` type, use its length as `argument value`. +Stateless assert. Allows explicit type converstion: +- `int` type: use as is +- `string` type: user `length` as `argument value` +- `price` struct `{base = {amount, asset_id}, quote = {amount, asset_id}}`: convert to float price `argument value = base.amount/quote.amount` + +The different asserts read as: - `lt`: `Argument value` must be less than `comparative` - `le`: `Argument value` must be less than or equal to `comparative` - `gt`: `Argument value` must be greater than `comparative` - `ge`: `Argument value` must be greater than or equal to `comparative` -#### `length` -Stateless assert, only `string` type arguments. Length of string (or encrypted string in case of memo) must be within `min` and `max`, inclusive. One of the bounds can be empty to indicate unlimited. - #### `limit` Statefull assert, only `int` type arguments. When the authority is created, `interval_began` is set to `valid_from` from its custom active authority and `max_cumsum` to `0`. Incoming operations are first tried to match all stateless asserts, and if all passes continue with statefull asserts. If `now > interval_began + interval_in_sec`, then set `max_cumsum = 0` and set `interval_began = now`.