Include either or example
This commit is contained in:
parent
f0d16bb517
commit
63f6ddc6e3
1 changed files with 82 additions and 4 deletions
86
bsip-0040.md
86
bsip-0040.md
|
@ -102,7 +102,6 @@ Following cases must hold for a restriction:
|
|||
|
||||
Note:
|
||||
- If required a field can be added that stores the assumed type of the argument
|
||||
- If arguments are given by the operation that have no restriction they can have any value
|
||||
|
||||
In the following we list possible `restriction`s. Mentioning `argument value` in the text below refers to the value of
|
||||
the argument of the operation specified by `argument` of a restriction.
|
||||
|
@ -152,14 +151,14 @@ custom active authority = {
|
|||
operation_id: transfer,
|
||||
authority: {
|
||||
threshold: 1
|
||||
key_auth: [K, 1]
|
||||
key_auth: [key K, 1]
|
||||
account_auth: []
|
||||
},
|
||||
asserts: [
|
||||
restrictions: [
|
||||
{
|
||||
function: any,
|
||||
argument: to,
|
||||
data: [B]
|
||||
data: [account B]
|
||||
} // this restricts the argument identified with "to"
|
||||
]
|
||||
}
|
||||
|
@ -168,6 +167,85 @@ That has the consquence now that a transfer transaction sending funds away from
|
|||
|
||||
Note: This is just an illustration of a possible serialization, not a specification of the serialized format.
|
||||
|
||||
#### Example: Either or
|
||||
Assume account A, B and C and asset X and asset Y. Furthermore A has a custom active authority in the following way:
|
||||
```
|
||||
custom active authority = {
|
||||
valid_from: 7.7.2018 00:00
|
||||
valid_to: 8.7.2018 00:00
|
||||
operation_id: transfer,
|
||||
authority: {
|
||||
threshold: 1
|
||||
key_auth: []
|
||||
account_auth: [account B, 1]
|
||||
},
|
||||
restrictions: cut_out
|
||||
}
|
||||
|
||||
cut_out =[
|
||||
{
|
||||
function: logical,
|
||||
argument: OR,
|
||||
data: [ either_list, or_list ]
|
||||
}
|
||||
]
|
||||
|
||||
either_list =
|
||||
[
|
||||
{
|
||||
function: attribute_assert,
|
||||
argument: amount,
|
||||
data: [
|
||||
{
|
||||
function: lt,
|
||||
argument: amount,
|
||||
data: 10000
|
||||
},
|
||||
{
|
||||
function: any,
|
||||
argument: asset_id,
|
||||
data: [ asset X ]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
function: any,
|
||||
argument: to,
|
||||
data: [ account C ]
|
||||
}
|
||||
]
|
||||
|
||||
or_list =
|
||||
[
|
||||
{
|
||||
function: attribute_assert,
|
||||
argument: amount,
|
||||
data: [
|
||||
{
|
||||
function: le,
|
||||
argument: amount,
|
||||
data: 20000
|
||||
},
|
||||
{
|
||||
function: any,
|
||||
argument: asset_id,
|
||||
data: [ asset Y ]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
function: any,
|
||||
argument: to,
|
||||
data: [ account C ]
|
||||
}
|
||||
]
|
||||
```
|
||||
That has the consquence now that a transfer transaction sending funds away from A can be signed with with active authority of account B if
|
||||
- it sends less than 10000 of asset X to account C
|
||||
- it sends less than or equal to 20000 of asset Y to account C
|
||||
|
||||
Note: This is just an illustration of a possible serialization, not a specification of the serialized format.
|
||||
|
||||
### Outline of handling incoming transactions
|
||||
|
||||
When a signed transaction arrives and before the backend evaluates if all necessary authorities are present through the signatures, do the following:
|
||||
|
|
Loading…
Reference in a new issue