tx · 7xhoFceM1rEpZJ5UPSCYMu3hwGWSpSeNgk9kWNE9Hz29 3MzUQnFjbyi1TY8hFtwGDS8n6HpvVbKui7s: -0.01000000 Waves 2020.05.09 19:49 [990892] smart account 3MzUQnFjbyi1TY8hFtwGDS8n6HpvVbKui7s > SELF 0.00000000 Waves
{ "type": 13, "id": "7xhoFceM1rEpZJ5UPSCYMu3hwGWSpSeNgk9kWNE9Hz29", "fee": 1000000, "feeAssetId": null, "timestamp": 1589043003923, "version": 1, "sender": "3MzUQnFjbyi1TY8hFtwGDS8n6HpvVbKui7s", "senderPublicKey": "387woTgM4ga2rKA8PeeX8v5eKzZsN9pkv7QsT2veEXKV", "proofs": [ "5ETr7hVqjqcmj7VYBsW7bsuAbaT9yiXR62nfpPLRdSrV1MGezYX97Fp8hcpPpwtHVoQwNA1qEjnYn1URyUW1FT94" ], "script": "base64:AAIDAAAAAAAAADkIARIDCgECEgMKAQISAwoBAhIDCgECEgMKAQISAwoBAhIDCgECEgMKAQISAwoBAhIDCgECEgMKAQgAAAAKAQAAAApkZWNvZGVJbnQ4AAAAAgAAAARkYXRhAAAABm9mZnNldAMJAABmAAAAAgAAAAAAAAAAAQkAAMgAAAABBQAAAARkYXRhCQAAAgAAAAECAAAALWRlY29kZSB1OCBlcnJvciwgZGF0YSBtdXN0IGJlIGF0IGxlYXN0IDEgYnl0ZQMJAABmAAAAAgUAAAAGb2Zmc2V0CQAAyAAAAAEFAAAABGRhdGEJAAACAAAAAQIAAAAjZGVjb2RlIHU4IGVycm9yLCBkZWNvZGluZyBpcyBmaW5pc2gEAAAAAngwCQAAyQAAAAIJAADKAAAAAgUAAAAEZGF0YQUAAAAGb2Zmc2V0AAAAAAAAAAABBAAAAAJ4MQkABLIAAAACCQAAywAAAAIBAAAABwAAAAAAAAAFAAAAAngwAAAAAAAAAAAAAwkAAGYAAAACAAAAAAAAAACABQAAAAJ4MQkABEwAAAACBQAAAAJ4MQkABEwAAAACCQAAZAAAAAIFAAAABm9mZnN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AAAgkAAMgAAAABBQAAAARkYXRhAAAAAAAAAAAIBQAAAAZvZmZzZXQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAAGnRlc3RfY3V0X2xvbmdfYnl0ZXNfdG9faTY0CQABkQAAAAIFAAAAB2RlY29kZWQAAAAAAAAAAAAFAAAAA25pbAAAAApjb250ZXh0T2JqAQAAAAxzZXRWYWxpZGF0b3IAAAABAAAACXZhbGlkYXRvcgMJAAAAAAAAAggFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAAR0aGlzCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAl2YWxpZGF0b3IFAAAACXZhbGlkYXRvcgUAAAADbmlsCQAAAgAAAAECAAAAIU9ubHkgb3duZXIgY2FuIHVzZSB0aGlzIGZ1bmN0aW9uLgAAAApjb250ZXh0T2JqAQAAAApyZXBvcnREYXRhAAAAAQAAAARkYXRhBAAAAAl2YWxpZGF0b3IJAAQcAAAAAgUAAAAEdGhpcwIAAAAJdmFsaWRhdG9yAwkAAAAAAAACCAgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAAl2YWxpZGF0b3IJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAADWRhdGFfcmVwb3J0ZWQFAAAABGRhdGEFAAAAA25pbAkAAAIAAAABAgAAACVPbmx5IHZhbGlkYXRvciBjYW4gdXNlIHRoaXMgZnVuY3Rpb24uAAAAAJbG310=", "chainId": 84, "height": 990892, "spentComplexity": 0 } View: original | compacted Prev: none Next: riQozEsCy9boF9YsGcMyGE2BLfuYxzm1oUd6zJ1zTYq Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func decodeInt8 (data,offset) = if ((1 > size(data))) | |
5 | + | then throw("decode u8 error, data must be at least 1 byte") | |
6 | + | else if ((offset > size(data))) | |
7 | + | then throw("decode u8 error, decoding is finish") | |
8 | + | else { | |
9 | + | let x0 = take(drop(data, offset), 1) | |
10 | + | let x1 = toInt((base58'1111111' + x0), 0) | |
11 | + | if ((128 > x1)) | |
12 | + | then [x1, (offset + 1)] | |
13 | + | else [toInt((base58'Ahg1opVcGW' + x0), 0), (offset + 1)] | |
14 | + | } | |
15 | + | ||
16 | + | ||
17 | + | func decodeInt16 (data,offset) = if ((2 > size(data))) | |
18 | + | then throw("decode u16 error, data must be at least 2 bytes") | |
19 | + | else if ((offset > size(data))) | |
20 | + | then throw("decode u16 error, decoding is finish") | |
21 | + | else { | |
22 | + | let x0 = drop(data, offset) | |
23 | + | let x1 = take(x0, 1) | |
24 | + | let x2 = take(drop(x0, 1), 1) | |
25 | + | if ((decodeInt8(x2, 0)[0] >= 0)) | |
26 | + | then [toInt(((base58'111111' + x2) + x1), 0), (offset + 2)] | |
27 | + | else [toInt(((base58'3CUsUpv9t' + x2) + x1), 0), (offset + 2)] | |
28 | + | } | |
29 | + | ||
30 | + | ||
31 | + | func decodeInt32 (data,offset) = if ((4 > size(data))) | |
32 | + | then throw("decode u32 error, data must be at least 4 bytes") | |
33 | + | else if ((offset > size(data))) | |
34 | + | then throw("decode u32 error, decoding is finish") | |
35 | + | else { | |
36 | + | let x0 = drop(data, offset) | |
37 | + | let x1 = take(x0, 1) | |
38 | + | let x2 = take(drop(x0, 1), 1) | |
39 | + | let x3 = take(drop(x0, 2), 1) | |
40 | + | let x4 = take(drop(x0, 3), 1) | |
41 | + | if ((decodeInt8(x4, 0)[0] >= 0)) | |
42 | + | then [toInt(((((base58'1111' + x4) + x3) + x2) + x1), 0), (offset + 4)] | |
43 | + | else [toInt(((((base58'7YXq9G' + x4) + x3) + x2) + x1), 0), (offset + 4)] | |
44 | + | } | |
45 | + | ||
46 | + | ||
47 | + | func decodeInt64 (data,offset) = if ((8 > size(data))) | |
48 | + | then throw("decode u32 error, data must be at least 8 bytes") | |
49 | + | else if ((offset > size(data))) | |
50 | + | then throw("decode u32 error, decoding is finish") | |
51 | + | else { | |
52 | + | let x0 = drop(data, offset) | |
53 | + | let x1 = take(x0, 1) | |
54 | + | let x2 = take(drop(x0, 1), 1) | |
55 | + | let x3 = take(drop(x0, 2), 1) | |
56 | + | let x4 = take(drop(x0, 3), 1) | |
57 | + | let x5 = take(drop(x0, 4), 1) | |
58 | + | let x6 = take(drop(x0, 5), 1) | |
59 | + | let x7 = take(drop(x0, 6), 1) | |
60 | + | let x8 = take(drop(x0, 7), 1) | |
61 | + | [toInt((((((((x8 + x7) + x6) + x5) + x4) + x3) + x2) + x1), 0), (offset + 8)] | |
62 | + | } | |
63 | + | ||
64 | + | ||
65 | + | func decodeBool (data,offset) = { | |
66 | + | let decoded1 = decodeInt8(data, offset) | |
67 | + | [(decoded1[0] != 0), decoded1[1]] | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | func decodeBytes32 (data,offset) = if ((32 > size(data))) | |
72 | + | then throw("decode bytes32 error, data must be at least 32 bytes") | |
73 | + | else [take(drop(data, offset), 32), (offset + 32)] | |
74 | + | ||
75 | + | ||
76 | + | func decodeBytes64 (data,offset) = if ((64 > size(data))) | |
77 | + | then throw("decode bytes64 error, data must be at least 64 bytes") | |
78 | + | else [take(drop(data, offset), 64), (offset + 64)] | |
79 | + | ||
80 | + | ||
81 | + | func decodeBytes65 (data,offset) = if ((65 > size(data))) | |
82 | + | then throw("decode bytes65 error, data must be at least 65 bytes") | |
83 | + | else [take(drop(data, offset), 65), (offset + 65)] | |
84 | + | ||
85 | + | ||
86 | + | func decodeBytes (data,offset) = { | |
87 | + | let decoded1 = decodeInt32(data, offset) | |
88 | + | let bytesSize = decoded1[0] | |
89 | + | let nextOffset = decoded1[1] | |
90 | + | [take(drop(data, nextOffset), bytesSize), (nextOffset + bytesSize)] | |
91 | + | } | |
92 | + | ||
93 | + | ||
94 | + | func decodeString (data,offset) = { | |
95 | + | let decoded1 = decodeInt32(data, offset) | |
96 | + | let bytesSize = decoded1[0] | |
97 | + | let nextOffset = decoded1[1] | |
98 | + | [toUtf8String(take(drop(data, nextOffset), bytesSize)), (nextOffset + bytesSize)] | |
99 | + | } | |
100 | + | ||
101 | + | ||
102 | + | @Callable(contextObj) | |
103 | + | func testDecodeInt16 (data) = { | |
104 | + | let offset = 0 | |
105 | + | let x1 = decodeInt16(data, offset) | |
106 | + | WriteSet([DataEntry("i16", x1[0])]) | |
107 | + | } | |
108 | + | ||
109 | + | ||
110 | + | ||
111 | + | @Callable(contextObj) | |
112 | + | func testDecodeInt64 (data) = { | |
113 | + | let offset = 0 | |
114 | + | let decoded = decodeInt64(data, offset) | |
115 | + | WriteSet([DataEntry("i64", decoded[0])]) | |
116 | + | } | |
117 | + | ||
118 | + | ||
119 | + | ||
120 | + | @Callable(contextObj) | |
121 | + | func testDecodeString (data) = { | |
122 | + | let offset = 0 | |
123 | + | let decoded = decodeString(data, offset) | |
124 | + | WriteSet([DataEntry("string", decoded[0])]) | |
125 | + | } | |
126 | + | ||
127 | + | ||
128 | + | ||
129 | + | @Callable(contextObj) | |
130 | + | func testDecodeBytes (data) = { | |
131 | + | let offset = 0 | |
132 | + | let decoded = decodeBytes(data, offset) | |
133 | + | WriteSet([DataEntry("bytes", decoded[0])]) | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | @Callable(contextObj) | |
139 | + | func testCryptoPrice (data) = { | |
140 | + | let offset = 0 | |
141 | + | let x1 = decodeString(data, offset) | |
142 | + | match x1[1] { | |
143 | + | case t: Int => | |
144 | + | let x2 = decodeInt64(data, t) | |
145 | + | WriteSet([DataEntry("symbol", x1[0]), DataEntry("multiplier", x2[0])]) | |
146 | + | case _ => | |
147 | + | throw("error decoding") | |
148 | + | } | |
149 | + | } | |
150 | + | ||
151 | + | ||
152 | + | ||
153 | + | @Callable(contextObj) | |
154 | + | func testDecodeBytes32 (data) = { | |
155 | + | let offset = 0 | |
156 | + | let decoded = decodeBytes32(data, offset) | |
157 | + | WriteSet([DataEntry("bytes", decoded[0])]) | |
158 | + | } | |
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | @Callable(contextObj) | |
163 | + | func testIntFromBytes (data) = WriteSet([DataEntry("bytesToInt", toInt(data, 0))]) | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(contextObj) | |
168 | + | func testStringFromBytes (data) = WriteSet([DataEntry("bytesToString", toUtf8String(data))]) | |
169 | + | ||
170 | + | ||
171 | + | ||
172 | + | @Callable(contextObj) | |
173 | + | func testCutLongBytes (data) = { | |
174 | + | let offset = 0 | |
175 | + | let decoded = decodeInt64(drop(data, (size(data) - 8)), offset) | |
176 | + | WriteSet([DataEntry("test_cut_long_bytes_to_i64", decoded[0])]) | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | ||
181 | + | @Callable(contextObj) | |
182 | + | func setValidator (validator) = if ((contextObj.caller == this)) | |
183 | + | then WriteSet([DataEntry("validator", validator)]) | |
184 | + | else throw("Only owner can use this function.") | |
185 | + | ||
186 | + | ||
187 | + | ||
188 | + | @Callable(contextObj) | |
189 | + | func reportData (data) = { | |
190 | + | let validator = getBinary(this, "validator") | |
191 | + | if ((contextObj.caller.bytes == validator)) | |
192 | + | then WriteSet([DataEntry("data_reported", data)]) | |
193 | + | else throw("Only validator can use this function.") | |
194 | + | } | |
195 | + | ||
196 | + |
github/deemru/w8io/026f985 27.66 ms ◑