remove length, add price as explicit allowed conversion

This commit is contained in:
Stefan Schießl 2018-07-29 07:10:44 +02:00 committed by GitHub
parent 2051ff38f8
commit 6df4a3824b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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`.