Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
[tezos] - Generify tezos subscriber
Browse files Browse the repository at this point in the history
* Use type annotations to identify the values and their respective field names;
* Validate big_map identifier when accessing the big_map_diff;
* Support custom contract storage as long as mandatory annotations exist in the storage type (%requests, %id, %jobId, %parameters).
  • Loading branch information
RomarQ committed Apr 26, 2021
1 parent 3b386d7 commit f12b72f
Show file tree
Hide file tree
Showing 13 changed files with 2,390 additions and 1,395 deletions.
602 changes: 602 additions & 0 deletions blockchain/testdata/tezos/block_operations_with_internal_calls.json

Large diffs are not rendered by default.

200 changes: 200 additions & 0 deletions blockchain/testdata/tezos/contract_script_normalized.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
{
"code": [
{
"prim": "parameter",
"args": []
},
{
"prim": "storage",
"args": [
{
"prim": "pair",
"args": [
{
"prim": "pair",
"args": [
{
"prim": "pair",
"args": [
{
"prim": "bool",
"annots": [
"%active"
]
},
{
"prim": "address",
"annots": [
"%adminAddress"
]
}
]
},
{
"prim": "int",
"annots": [
"%minCancelTimeout"
]
},
{
"prim": "nat",
"annots": [
"%minPayment"
]
},
{
"prim": "address",
"annots": [
"%tokenAddress"
]
}
],
"annots": [
"%config"
]
},
{
"prim": "big_map",
"args": [
{
"prim": "bytes"
},
{
"prim": "pair",
"args": [
{
"prim": "nat",
"annots": [
"%payment"
]
},
{
"prim": "pair",
"args": [
{
"prim": "address",
"annots": [
"%callbackAddress"
]
},
{
"prim": "timestamp",
"annots": [
"%cancelTimeout"
]
},
{
"prim": "address",
"annots": [
"%clientAddress"
]
},
{
"prim": "nat",
"annots": [
"%id"
]
},
{
"prim": "string",
"annots": [
"%jobId"
]
},
{
"prim": "address",
"annots": [
"%oracleAddress"
]
},
{
"prim": "map",
"args": [
{
"prim": "string"
},
{
"prim": "or",
"args": [
{
"prim": "bytes",
"annots": [
"%bytes"
]
},
{
"prim": "or",
"args": [
{
"prim": "int",
"annots": [
"%int"
]
},
{
"prim": "string",
"annots": [
"%string"
]
}
]
}
]
}
],
"annots": [
"%parameters"
]
}
],
"annots": [
"%request"
]
}
]
}
],
"annots": [
"%requests"
]
}
]
}
]
},
{
"prim": "code",
"args": []
}
],
"storage": {
"prim": "Pair",
"args": [
[
{
"prim": "Pair",
"args": [
{
"prim": "True"
},
{
"bytes": "0000d3789f9f4223c271403bde738fd304691e796ee8"
}
]
},
{
"int": "5"
},
{
"int": "1"
},
{
"bytes": "019e5225d7e53fce0fe227ced8286460e91f78cd3e00"
}
],
{
"int": "6"
}
]
}
}
44 changes: 44 additions & 0 deletions blockchain/testdata/tezos/invalid_map_value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[
{
"prim": "Pair",
"args": [
{
"string": "from"
},
{
"prim": "Right",
"args": [
{
"prim": "Right",
"args": [
{
"string": "EUR"
}
]
}
]
}
]
},
{
"prim": "Pair",
"args": [
{
"string": "to"
},
{
"prim": "Right",
"args": [
{
"prim": "Right",
"args": [
{
"string": "XTZ"
}
]
}
]
}
]
}
]
44 changes: 44 additions & 0 deletions blockchain/testdata/tezos/map_value.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[
{
"prim": "Elt",
"args": [
{
"string": "from"
},
{
"prim": "Right",
"args": [
{
"prim": "Right",
"args": [
{
"string": "EUR"
}
]
}
]
}
]
},
{
"prim": "Elt",
"args": [
{
"string": "to"
},
{
"prim": "Right",
"args": [
{
"prim": "Right",
"args": [
{
"string": "XTZ"
}
]
}
]
}
]
}
]
94 changes: 94 additions & 0 deletions blockchain/testdata/tezos/request_type_normalized.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"prim": "pair",
"args": [
{
"prim": "nat",
"annots": [
"%payment"
]
},
{
"prim": "pair",
"args": [
{
"prim": "address",
"annots": [
"%callbackAddress"
]
},
{
"prim": "timestamp",
"annots": [
"%cancelTimeout"
]
},
{
"prim": "address",
"annots": [
"%clientAddress"
]
},
{
"prim": "nat",
"annots": [
"%id"
]
},
{
"prim": "string",
"annots": [
"%jobId"
]
},
{
"prim": "address",
"annots": [
"%oracleAddress"
]
},
{
"prim": "map",
"args": [
{
"prim": "string"
},
{
"prim": "or",
"args": [
{
"prim": "bytes",
"annots": [
"%bytes"
]
},
{
"prim": "or",
"args": [
{
"prim": "int",
"annots": [
"%int"
]
},
{
"prim": "string",
"annots": [
"%string"
]
}
]
}
]
}
],
"annots": [
"%parameters"
]
}
],
"annots": [
"%request"
]
}
]
}
Loading

0 comments on commit f12b72f

Please sign in to comment.