tx · ANxWRmH7i5BAqzJ5YRdhXuvBCX4WV4CM89AP6gWm1k2s 3N4gGXLoQLDL8J6rHho3CK714TWiAw3ahi4: -0.01400000 Waves 2020.09.11 16:44 [1172728] smart account 3N4gGXLoQLDL8J6rHho3CK714TWiAw3ahi4 > SELF 0.00000000 Waves
{ "type": 13, "id": "ANxWRmH7i5BAqzJ5YRdhXuvBCX4WV4CM89AP6gWm1k2s", "fee": 1400000, "feeAssetId": null, "timestamp": 1599831965481, "version": 1, "sender": "3N4gGXLoQLDL8J6rHho3CK714TWiAw3ahi4", "senderPublicKey": "2G2SB6hLj6PxUgshtzMt5QLV3XzLbQNhvXk5f6QTkTZy", "proofs": [ "5UKUpP7GXejibvAfZNQGrzUg1zfg1WvAM15BYiHWRiARFaThg25zUKp5SLTFfs5ZWJTQLTdiHZhmEWGEt98XZNs3" ], "script": "base64:AAIDAAAAAAAAAA8IARIECgICCBIFCgMICAEAAAAfAAAAAAVXQVZFUwIAAAAFV0FWRVMAAAAAB0ludFR5cGUAAAAAAAAAAAAAAAAAClN0cmluZ1R5cGUAAAAAAAAAAAEAAAAACUJ5dGVzVHlwZQAAAAAAAAAAAgEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABdgUAAAAHJG1hdGNoMAUAAAABdgAAAAAAAAAAAAEAAAANZ2V0Qnl0ZXNCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHAAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABdgUAAAAHJG1hdGNoMAUAAAABdgEAAAAD0AAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJ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AIAAAABAgAAABVpbnZhbGlkIGZ1bmN0aW9uIG5hbWUDCQEAAAACIT0AAAACCQABkAAAAAEIBQAAAAhpbnZva2VUeAAAAARhcmdzAAAAAAAAAAACCQAAAgAAAAECAAAAEWludmFsaWQgYXJncyBzaXplAwkBAAAAAiE9AAAAAggFAAAACGludm9rZVR4AAAABGRBcHAJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAARc3Vic2NyaWJlckFkZHJlc3MJAAACAAAAAQIAAAAUaW52YWxpZCBkYXBwIGFkZHJlc3MDCQEAAAACIT0AAAACCQEAAAAQZ2V0SGVpZ2h0QnlQdWxzZQAAAAEFAAAACHZQdWxzZUlkBQAAAAZoZWlnaHQJAAACAAAAAQIAAAAOaW52YWxpZCBoZWlnaHQDCQAAAAAAAAIJAQAAAAtnZXRIYXNoRGF0YQAAAAEFAAAACHZQdWxzZUlkAQAAAAPQAAAJAAACAAAAAQIAAAAQaW52YWxpZCBwdWxzZSBpZAMJAQAAAAIhPQAAAAIJAAH1AAAAAQUAAAAGdkJ5dGVzCQEAAAALZ2V0SGFzaERhdGEAAAABBQAAAAh2UHVsc2VJZAkAAAIAAAABAgAAABhpbnZhbGlkIGtlY2NhazI1Nih2YWx1ZSkGCQAB9AAAAAMIBQAAAAFpAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAABaQAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAFpAAAAD3NlbmRlclB1YmxpY0tleYYJPvA=", "chainId": 84, "height": 1172728, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FwkgAqTcGuJuEiLXG2r9rG3zV8cDryidaFZLHxxp9Ux7 Next: none Full:
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 | let IntType = 0 | |
7 | 7 | ||
8 | 8 | let StringType = 1 | |
9 | 9 | ||
10 | 10 | let BytesType = 2 | |
11 | 11 | ||
12 | 12 | func getNumberByKey (key) = match getInteger(this, key) { | |
13 | 13 | case v: Int => | |
14 | 14 | v | |
15 | 15 | case _ => | |
16 | 16 | 0 | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getBytesByKey (key) = match getBinary(this, key) { | |
21 | 21 | case v: ByteVector => | |
22 | 22 | v | |
23 | 23 | case _ => | |
24 | 24 | base58'2CsAf' | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getStringByKey (key) = match getString(this, key) { | |
29 | 29 | case v: String => | |
30 | 30 | v | |
31 | 31 | case _ => | |
32 | 32 | "" | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getStringByAddressAndKey (address,key) = match getString(address, key) { | |
37 | 37 | case v: String => | |
38 | 38 | v | |
39 | 39 | case _ => | |
40 | 40 | "" | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func getNumberByAddressAndKey (address,key) = match getInteger(address, key) { | |
45 | 45 | case v: Int => | |
46 | 46 | v | |
47 | 47 | case _ => | |
48 | 48 | 0 | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | let OraclesKey = "oracles" | |
53 | 53 | ||
54 | 54 | let SubscriberAddressKey = "subscriber_address" | |
55 | 55 | ||
56 | 56 | let TypeKey = "type" | |
57 | 57 | ||
58 | 58 | let GravityContractKey = "gravity_contract" | |
59 | 59 | ||
60 | 60 | let BftCoefficientKey = "bft_coefficient" | |
61 | 61 | ||
62 | 62 | let LastHeightKey = "last_height" | |
63 | 63 | ||
64 | 64 | let LastRoundKey = "last_round" | |
65 | 65 | ||
66 | 66 | let LastPulseIdKey = "last_pulse_id" | |
67 | 67 | ||
68 | 68 | func getHashDataKey (pulseId) = ("data_hash_" + toString(pulseId)) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func getHeightByPulseKey (pulseId) = ("height_" + toString(pulseId)) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func ConsulsKey (round) = ("consuls_" + toString(round)) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | let oracles = split(getStringByKey(OraclesKey), ",") | |
78 | 78 | ||
79 | 79 | let bftCoefficient = getNumberByKey(BftCoefficientKey) | |
80 | 80 | ||
81 | 81 | let gracityContract = addressFromStringValue(getStringByKey(GravityContractKey)) | |
82 | 82 | ||
83 | 83 | let lastGravityRound = getNumberByAddressAndKey(gracityContract, LastRoundKey) | |
84 | 84 | ||
85 | 85 | let consuls = split(getStringByAddressAndKey(gracityContract, ConsulsKey(lastGravityRound)), ",") | |
86 | 86 | ||
87 | 87 | let subscriberAddress = getStringByKey(SubscriberAddressKey) | |
88 | 88 | ||
89 | 89 | let type = getNumberByKey(TypeKey) | |
90 | 90 | ||
91 | 91 | let lastPulseId = getNumberByKey(LastPulseIdKey) | |
92 | 92 | ||
93 | 93 | func getHashData (pulseId) = getBytesByKey(getHashDataKey(pulseId)) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func getHeightByPulse (pulseId) = getNumberByKey(getHeightByPulseKey(pulseId)) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func validateSign (hash,sign,oracle) = if ((sign != "nil")) | |
100 | 100 | then if (sigVerify(hash, fromBase58String(sign), fromBase58String(oracle))) | |
101 | 101 | then 1 | |
102 | 102 | else 0 | |
103 | 103 | else 0 | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | @Callable(i) | |
107 | 107 | func sendHashValue (hash,signs) = { | |
108 | 108 | let signList = split(signs, ",") | |
109 | 109 | 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])) | |
110 | 110 | if ((bftCoefficient > count)) | |
111 | 111 | then throw("invalid bft count") | |
112 | 112 | else if ((getBytesByKey(toString(height)) != base58'2CsAf')) | |
113 | 113 | then throw("data is exist") | |
114 | 114 | else { | |
115 | 115 | let pulseId = (lastPulseId + 1) | |
116 | 116 | WriteSet([DataEntry(getHashDataKey(lastPulseId), hash), DataEntry(getHeightByPulseKey(lastPulseId), height), DataEntry(LastHeightKey, height), DataEntry(LastPulseIdKey, pulseId)]) | |
117 | 117 | } | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | @Callable(i) | |
123 | 123 | func updateOracles (newSortedOracles,stringSigns,round) = { | |
124 | 124 | let signs = split(stringSigns, ",") | |
125 | 125 | 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])) | |
126 | 126 | if ((count > bftCoefficient)) | |
127 | 127 | then throw("invalid bft count") | |
128 | 128 | else WriteSet([DataEntry(OraclesKey, newSortedOracles), DataEntry(((LastRoundKey + "_") + toString(round)), round)]) | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | @Verifier(i) | |
133 | 133 | func sendValueToSub () = match i { | |
134 | 134 | case invokeTx: InvokeScriptTransaction => | |
135 | 135 | let vBytes = if ((type == IntType)) | |
136 | 136 | then { | |
137 | 137 | let v = match invokeTx.args[0] { | |
138 | 138 | case v: Int => | |
139 | 139 | v | |
140 | 140 | case _ => | |
141 | 141 | throw("invalid value type") | |
142 | 142 | } | |
143 | 143 | toBytes(v) | |
144 | 144 | } | |
145 | 145 | else if ((type == StringType)) | |
146 | 146 | then { | |
147 | 147 | let v = match invokeTx.args[0] { | |
148 | 148 | case v: String => | |
149 | 149 | v | |
150 | 150 | case _ => | |
151 | 151 | throw("invalid value type") | |
152 | 152 | } | |
153 | 153 | toBytes(v) | |
154 | 154 | } | |
155 | 155 | else if ((type == BytesType)) | |
156 | 156 | then { | |
157 | 157 | let v = match invokeTx.args[0] { | |
158 | 158 | case v: ByteVector => | |
159 | 159 | v | |
160 | 160 | case _ => | |
161 | 161 | throw("invalid value type") | |
162 | 162 | } | |
163 | 163 | v | |
164 | 164 | } | |
165 | 165 | else throw("invalid value type") | |
166 | 166 | let vPulseId = match invokeTx.args[1] { | |
167 | 167 | case vPulseId: Int => | |
168 | 168 | vPulseId | |
169 | 169 | case _ => | |
170 | 170 | throw("invalid height type") | |
171 | 171 | } | |
172 | 172 | if ((invokeTx.function != "attachValue")) | |
173 | 173 | then throw("invalid function name") | |
174 | 174 | else if ((size(invokeTx.args) != 2)) | |
175 | 175 | then throw("invalid args size") | |
176 | 176 | else if ((invokeTx.dApp != addressFromStringValue(subscriberAddress))) | |
177 | 177 | then throw("invalid dapp address") | |
178 | 178 | else if ((getHeightByPulse(vPulseId) != height)) | |
179 | 179 | then throw("invalid height") | |
180 | 180 | else if ((getHashData(vPulseId) == base58'2CsAf')) | |
181 | 181 | then throw("invalid pulse id") | |
182 | 182 | else if ((keccak256(vBytes) != getHashData(vPulseId))) | |
183 | 183 | then throw("invalid keccak256(value)") | |
184 | 184 | else true | |
185 | 185 | case _ => | |
186 | 186 | sigVerify(i.bodyBytes, i.proofs[0], i.senderPublicKey) | |
187 | 187 | } | |
188 | 188 |
github/deemru/w8io/169f3d6 31.71 ms ◑