tx · 8CpaQCAme6hnohpxa8WakW6bb8FtYJCx2GvJrBJ7AQpX 3N666c9jMPp2LgthP7QpdaHbfcyCXp6pfk2: -0.01400000 Waves 2020.07.15 09:20 [1088059] smart account 3N666c9jMPp2LgthP7QpdaHbfcyCXp6pfk2 > SELF 0.00000000 Waves
{ "type": 13, "id": "8CpaQCAme6hnohpxa8WakW6bb8FtYJCx2GvJrBJ7AQpX", "fee": 1400000, "feeAssetId": null, "timestamp": 1594794081050, "version": 1, "sender": "3N666c9jMPp2LgthP7QpdaHbfcyCXp6pfk2", "senderPublicKey": "2K3zsM6XaqxaedbuC6dRB8cVX8TcnGRAXSkRyUmXiSAj", "proofs": [ "yih1u3Znu8hp7wJ13b3vGR5GMvz4yYYSTESow4QVGvdJPTRxEacJPTN7cQqgSRiVk4i6VnK28vQT8D6QpWPTsMZ" ], "script": "base64:AAIDAAAAAAAAAA8IARIECgICCBIFCgMICAEAAAARAAAAAAVXQVZFUwIAAAAFV0FWRVMBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAXYFAAAAByRtYXRjaDAFAAAAAXYAAAAAAAAAAAABAAAADWdldEJ5dGVzQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAXYFAAAAByRtYXRjaDAFAAAAAXYBAAAAA9AAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABdgUAAAAHJG1hdGNoMAUAAAABdgIAAAAAAQAAABhnZXRTdHJpbmdCeUFkZH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GkAAAAAQUAAAAHdkhlaWdodAIAAAAACQAAAgAAAAECAAAADmludmFsaWQgaGVpZ2h0AwkBAAAAAiE9AAAAAgkAAfUAAAABCQABmgAAAAEFAAAAAXYJAAJZAAAAAQkBAAAADmdldFN0cmluZ0J5S2V5AAAAAQkAAaQAAAABBQAAAAd2SGVpZ2h0CQAAAgAAAAEJAAEsAAAAAgIAAAAZaW52YWxpZCBrZWNjYWsyNTYodmFsdWUpIAkAAaQAAAABBQAAAAF2BgY1hhGn", "chainId": 84, "height": 1088059, "spentComplexity": 0 } View: original | compacted Prev: xFw7bKdZ1FREz1vDSaK9RqPBue9sf61ZphBRZEDsUsE Next: FCdpLwjPTJggzk2kV7cacvM5f3tfLBNewUD2gS8HvzGX Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | v | |
9 | 9 | case _ => | |
10 | 10 | 0 | |
11 | + | } | |
12 | + | ||
13 | + | ||
14 | + | func getBytesByKey (key) = match getBinary(this, key) { | |
15 | + | case v: ByteVector => | |
16 | + | v | |
17 | + | case _ => | |
18 | + | base58'2CsAf' | |
11 | 19 | } | |
12 | 20 | ||
13 | 21 | ||
62 | 70 | let count = ((((validateSign(hash, signList[0], oracles[0]) + validateSign(hash, signList[1], oracles[1])) + validateSign(hash, signList[2], oracles[2])) + validateSign(hash, signList[3], oracles[3])) + validateSign(hash, signList[4], oracles[4])) | |
63 | 71 | if ((count > bftCoefficient)) | |
64 | 72 | then throw("invalid bft count") | |
65 | - | else if (( | |
73 | + | else if ((getBytesByKey(toString(height)) != base58'2CsAf')) | |
66 | 74 | then throw("data is exist") | |
67 | 75 | else WriteSet([DataEntry(toString(height), hash)]) | |
68 | 76 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let WAVES = "WAVES" | |
5 | 5 | ||
6 | 6 | func getNumberByKey (key) = match getInteger(this, key) { | |
7 | 7 | case v: Int => | |
8 | 8 | v | |
9 | 9 | case _ => | |
10 | 10 | 0 | |
11 | + | } | |
12 | + | ||
13 | + | ||
14 | + | func getBytesByKey (key) = match getBinary(this, key) { | |
15 | + | case v: ByteVector => | |
16 | + | v | |
17 | + | case _ => | |
18 | + | base58'2CsAf' | |
11 | 19 | } | |
12 | 20 | ||
13 | 21 | ||
14 | 22 | func getStringByKey (key) = match getString(this, key) { | |
15 | 23 | case v: String => | |
16 | 24 | v | |
17 | 25 | case _ => | |
18 | 26 | "" | |
19 | 27 | } | |
20 | 28 | ||
21 | 29 | ||
22 | 30 | func getStringByAddressAndKey (address,key) = match getString(address, key) { | |
23 | 31 | case v: String => | |
24 | 32 | v | |
25 | 33 | case _ => | |
26 | 34 | "" | |
27 | 35 | } | |
28 | 36 | ||
29 | 37 | ||
30 | 38 | let OraclesKey = "oracles" | |
31 | 39 | ||
32 | 40 | let ConsulsKey = "consuls" | |
33 | 41 | ||
34 | 42 | let SubscriberAddressKey = "subscriber_address" | |
35 | 43 | ||
36 | 44 | let GravityContractKey = "gravity_contract" | |
37 | 45 | ||
38 | 46 | let BftCoefficientKey = "bft_coefficient" | |
39 | 47 | ||
40 | 48 | let LasrRoundKey = "last_round" | |
41 | 49 | ||
42 | 50 | let oracles = split(getStringByKey(OraclesKey), ",") | |
43 | 51 | ||
44 | 52 | let bftCoefficient = getNumberByKey(BftCoefficientKey) | |
45 | 53 | ||
46 | 54 | let gracityContract = addressFromStringValue(getStringByKey(GravityContractKey)) | |
47 | 55 | ||
48 | 56 | let consuls = split(getStringByAddressAndKey(gracityContract, ConsulsKey), ",") | |
49 | 57 | ||
50 | 58 | let subscriberAddress = getStringByKey(SubscriberAddressKey) | |
51 | 59 | ||
52 | 60 | func validateSign (hash,sign,oracle) = if ((sign != "nil")) | |
53 | 61 | then if (sigVerify(hash, fromBase58String(sign), fromBase58String(oracle))) | |
54 | 62 | then 1 | |
55 | 63 | else 0 | |
56 | 64 | else 0 | |
57 | 65 | ||
58 | 66 | ||
59 | 67 | @Callable(i) | |
60 | 68 | func confirmData (hash,signs) = { | |
61 | 69 | let signList = split(signs, ",") | |
62 | 70 | let count = ((((validateSign(hash, signList[0], oracles[0]) + validateSign(hash, signList[1], oracles[1])) + validateSign(hash, signList[2], oracles[2])) + validateSign(hash, signList[3], oracles[3])) + validateSign(hash, signList[4], oracles[4])) | |
63 | 71 | if ((count > bftCoefficient)) | |
64 | 72 | then throw("invalid bft count") | |
65 | - | else if (( | |
73 | + | else if ((getBytesByKey(toString(height)) != base58'2CsAf')) | |
66 | 74 | then throw("data is exist") | |
67 | 75 | else WriteSet([DataEntry(toString(height), hash)]) | |
68 | 76 | } | |
69 | 77 | ||
70 | 78 | ||
71 | 79 | ||
72 | 80 | @Callable(i) | |
73 | 81 | func setSortedOracles (newSortedOracles,stringSigns,round) = { | |
74 | 82 | let signs = split(stringSigns, ",") | |
75 | 83 | let count = ((((validateSign(toBytes(newSortedOracles), signs[0], consuls[0]) + validateSign(toBytes(newSortedOracles), signs[1], consuls[1])) + validateSign(toBytes(newSortedOracles), signs[2], consuls[2])) + validateSign(toBytes(newSortedOracles), signs[3], consuls[3])) + validateSign(toBytes(newSortedOracles), signs[4], consuls[4])) | |
76 | 84 | if ((count > bftCoefficient)) | |
77 | 85 | then throw("invalid bft count") | |
78 | 86 | else WriteSet([DataEntry(OraclesKey, newSortedOracles), DataEntry(((LasrRoundKey + "_") + toString(round)), round)]) | |
79 | 87 | } | |
80 | 88 | ||
81 | 89 | ||
82 | 90 | @Verifier(i) | |
83 | 91 | func sendData () = match i { | |
84 | 92 | case in: InvokeScriptTransaction => | |
85 | 93 | let v = match in.args[0] { | |
86 | 94 | case v: Int => | |
87 | 95 | v | |
88 | 96 | case _ => | |
89 | 97 | throw("invalid args[0] type") | |
90 | 98 | } | |
91 | 99 | let vHeight = match in.args[1] { | |
92 | 100 | case vHeight: Int => | |
93 | 101 | vHeight | |
94 | 102 | case _ => | |
95 | 103 | throw("invalid args[1] type") | |
96 | 104 | } | |
97 | 105 | if ((in.dApp != addressFromStringValue(subscriberAddress))) | |
98 | 106 | then throw("invalid dapp address") | |
99 | 107 | else if ((getStringByKey(toString(vHeight)) == "")) | |
100 | 108 | then throw("invalid height") | |
101 | 109 | else if ((keccak256(toBytes(v)) != fromBase58String(getStringByKey(toString(vHeight))))) | |
102 | 110 | then throw(("invalid keccak256(value) " + toString(v))) | |
103 | 111 | else true | |
104 | 112 | case _ => | |
105 | 113 | true | |
106 | 114 | } | |
107 | 115 |
github/deemru/w8io/169f3d6 23.13 ms ◑