tx · GQvkN1PUKZTuwakr1NGNf69FKVF6iCXYFpmPdrC5x9EA 3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA: -0.02000000 Waves 2020.04.28 16:38 [974662] smart account 3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA > SELF 0.00000000 Waves
{ "type": 13, "id": "GQvkN1PUKZTuwakr1NGNf69FKVF6iCXYFpmPdrC5x9EA", "fee": 2000000, "feeAssetId": null, "timestamp": 1588081159542, "version": 1, "sender": "3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA", "senderPublicKey": "Aj2RvtYHTSnDfcwYBCD5ZEwG3V483xJe2L1n13KPsi3a", "proofs": [ "4hxD7hwQzKzVHaSPKQXEL7kbKT8CRgwqoAsALev45mtQtNdVWby8K1ybMviPkPAfvn4wQPj2SjuheFeCeo8kotCZ" ], "script": "base64:AAIDAAAAAAAAACoIARIDCgECEgMKAQISAwoBAhIDCgECEgMKAQISAwoBAhIDCgECEgMKAQgAAAAHAQAAAApkZWNvZGVJbnQ4AAAAAgAAAARkYXRhAAAABm9mZnNldAMJAABmAAAAAgAAAAAAAAAAAQkAAMgAAAABBQAAAARkYXRhCQAAAgAAAAECAAAALWRlY29kZSB1OCBlcnJvciwgZGF0YSBtdXN0IGJlIGF0IGxlYXN0IDEgYnl0ZQMJAABmAAAAAgUAAAAGb2Zmc2V0CQAAyAAAAAEFAAAABGRhdGEJAAACAAAAAQIAAAAjZGVjb2RlIHU4IGVycm9yLCBkZWNvZGluZyBpcyBmaW5pc2gEAAAAAngwCQAAyQAAAAIJAADKAAAAAgUAAAAEZGF0YQUAAAAGb2Zmc2V0AAAAAAAAAAABBAAAAAJ4MQkABLIAAAACCQAAywAAAAIBAAAABwAAAAAAAAAFAAAAAngwAAAAAAAAAAAAAwkAAGYAAAACAAAAAAAAAACABQAAAAJ4MQkABEwAAAACBQAAAAJ4MQkABEwAAAACCQAAZAAAAAIFAAAABm9mZnNldAAAAAAAAAAAAQUAAAADbml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AAAAAAAAAAAFAAAAA25pbAAAAApjb250ZXh0T2JqAQAAABN0ZXN0U3RyaW5nRnJvbUJ5dGVzAAAAAQAAAARkYXRhCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAA1ieXRlc1RvU3RyaW5nCQAEsAAAAAEFAAAABGRhdGEFAAAAA25pbAAAAApjb250ZXh0T2JqAQAAAAxzZXRWYWxpZGF0b3IAAAABAAAACXZhbGlkYXRvcgMJAAAAAAAAAggFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAAR0aGlzCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAl2YWxpZGF0b3IFAAAACXZhbGlkYXRvcgUAAAADbmlsCQAAAgAAAAECAAAAIU9ubHkgb3duZXIgY2FuIHVzZSB0aGlzIGZ1bmN0aW9uLgAAAApjb250ZXh0T2JqAQAAAApyZXBvcnREYXRhAAAAAQAAAARkYXRhBAAAAAl2YWxpZGF0b3IJAAQcAAAAAgUAAAAEdGhpcwIAAAAJdmFsaWRhdG9yAwkAAAAAAAACCAgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAAl2YWxpZGF0b3IJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAADWRhdGFfcmVwb3J0ZWQFAAAABGRhdGEFAAAAA25pbAkAAAIAAAABAgAAACVPbmx5IHZhbGlkYXRvciBjYW4gdXNlIHRoaXMgZnVuY3Rpb24uAAAAAFl3g2o=", "chainId": 84, "height": 974662, "spentComplexity": 0 } View: original | compacted Prev: Bjp3jDvvFe2qrwKpCYe5CA2b7oeiUFfXRpnpar4GmFAZ Next: 3PzDaRvPnUAh6HAYzq4e5jWCXCWgHSfJWogMxSWdjN8r Diff:
Old | New | Differences | |
---|---|---|---|
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(contextObj) | |
115 | + | func testDecodeBytes (data) = { | |
116 | + | let offset = 0 | |
117 | + | let decoded = decodeBytes(data, offset) | |
118 | + | WriteSet([DataEntry("bytes", decoded[0])]) | |
119 | + | } | |
120 | + | ||
121 | + | ||
122 | + | ||
123 | + | @Callable(contextObj) | |
115 | 124 | func testIntFromBytes (data) = WriteSet([DataEntry("bytesToInt", toInt(data, 0))]) | |
116 | 125 | ||
117 | 126 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func decodeInt8 (data,offset) = if ((1 > size(data))) | |
5 | 5 | then throw("decode u8 error, data must be at least 1 byte") | |
6 | 6 | else if ((offset > size(data))) | |
7 | 7 | then throw("decode u8 error, decoding is finish") | |
8 | 8 | else { | |
9 | 9 | let x0 = take(drop(data, offset), 1) | |
10 | 10 | let x1 = toInt((base58'1111111' + x0), 0) | |
11 | 11 | if ((128 > x1)) | |
12 | 12 | then [x1, (offset + 1)] | |
13 | 13 | else [toInt((base58'Ahg1opVcGW' + x0), 0), (offset + 1)] | |
14 | 14 | } | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func decodeInt16 (data,offset) = if ((2 > size(data))) | |
18 | 18 | then throw("decode u16 error, data must be at least 2 bytes") | |
19 | 19 | else if ((offset > size(data))) | |
20 | 20 | then throw("decode u16 error, decoding is finish") | |
21 | 21 | else { | |
22 | 22 | let x0 = drop(data, offset) | |
23 | 23 | let x1 = take(x0, 1) | |
24 | 24 | let x2 = take(drop(x0, 1), 1) | |
25 | 25 | if ((decodeInt8(x2, 0)[0] >= 0)) | |
26 | 26 | then [toInt(((base58'111111' + x2) + x1), 0), (offset + 2)] | |
27 | 27 | else [toInt(((base58'3CUsUpv9t' + x2) + x1), 0), (offset + 2)] | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func decodeInt32 (data,offset) = if ((4 > size(data))) | |
32 | 32 | then throw("decode u32 error, data must be at least 4 bytes") | |
33 | 33 | else if ((offset > size(data))) | |
34 | 34 | then throw("decode u32 error, decoding is finish") | |
35 | 35 | else { | |
36 | 36 | let x0 = drop(data, offset) | |
37 | 37 | let x1 = take(x0, 1) | |
38 | 38 | let x2 = take(drop(x0, 1), 1) | |
39 | 39 | let x3 = take(drop(x0, 2), 1) | |
40 | 40 | let x4 = take(drop(x0, 3), 1) | |
41 | 41 | if ((decodeInt8(x4, 0)[0] >= 0)) | |
42 | 42 | then [toInt(((((base58'1111' + x4) + x3) + x2) + x1), 0), (offset + 4)] | |
43 | 43 | else [toInt(((((base58'7YXq9G' + x4) + x3) + x2) + x1), 0), (offset + 4)] | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func decodeInt64 (data,offset) = if ((8 > size(data))) | |
48 | 48 | then throw("decode u32 error, data must be at least 8 bytes") | |
49 | 49 | else if ((offset > size(data))) | |
50 | 50 | then throw("decode u32 error, decoding is finish") | |
51 | 51 | else { | |
52 | 52 | let x0 = drop(data, offset) | |
53 | 53 | let x1 = take(x0, 1) | |
54 | 54 | let x2 = take(drop(x0, 1), 1) | |
55 | 55 | let x3 = take(drop(x0, 2), 1) | |
56 | 56 | let x4 = take(drop(x0, 3), 1) | |
57 | 57 | let x5 = take(drop(x0, 4), 1) | |
58 | 58 | let x6 = take(drop(x0, 5), 1) | |
59 | 59 | let x7 = take(drop(x0, 6), 1) | |
60 | 60 | let x8 = take(drop(x0, 7), 1) | |
61 | 61 | [toInt((((((((x8 + x7) + x6) + x5) + x4) + x3) + x2) + x1), 0), (offset + 8)] | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func decodeBool (data,offset) = { | |
66 | 66 | let decoded1 = decodeInt8(data, offset) | |
67 | 67 | [(decoded1[0] != 0), decoded1[1]] | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func decodeBytes (data,offset) = { | |
72 | 72 | let decoded1 = decodeInt32(data, offset) | |
73 | 73 | let bytesSize = decoded1[0] | |
74 | 74 | let nextOffset = decoded1[1] | |
75 | 75 | [take(drop(data, nextOffset), bytesSize), (nextOffset + bytesSize)] | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func decodeString (data,offset) = { | |
80 | 80 | let decoded1 = decodeInt32(data, offset) | |
81 | 81 | let bytesSize = decoded1[0] | |
82 | 82 | let nextOffset = decoded1[1] | |
83 | 83 | [toUtf8String(take(drop(data, nextOffset), bytesSize)), (nextOffset + bytesSize)] | |
84 | 84 | } | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | @Callable(contextObj) | |
88 | 88 | func testDecodeInt16 (data) = { | |
89 | 89 | let offset = 0 | |
90 | 90 | let x1 = decodeInt16(data, offset) | |
91 | 91 | WriteSet([DataEntry("i16", x1[0])]) | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(contextObj) | |
97 | 97 | func testDecodeInt64 (data) = { | |
98 | 98 | let offset = 0 | |
99 | 99 | let decoded = decodeInt64(data, offset) | |
100 | 100 | WriteSet([DataEntry("i64", decoded[0])]) | |
101 | 101 | } | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | 105 | @Callable(contextObj) | |
106 | 106 | func testDecodeString (data) = { | |
107 | 107 | let offset = 0 | |
108 | 108 | let decoded = decodeString(data, offset) | |
109 | 109 | WriteSet([DataEntry("string", decoded[0])]) | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(contextObj) | |
115 | + | func testDecodeBytes (data) = { | |
116 | + | let offset = 0 | |
117 | + | let decoded = decodeBytes(data, offset) | |
118 | + | WriteSet([DataEntry("bytes", decoded[0])]) | |
119 | + | } | |
120 | + | ||
121 | + | ||
122 | + | ||
123 | + | @Callable(contextObj) | |
115 | 124 | func testIntFromBytes (data) = WriteSet([DataEntry("bytesToInt", toInt(data, 0))]) | |
116 | 125 | ||
117 | 126 | ||
118 | 127 | ||
119 | 128 | @Callable(contextObj) | |
120 | 129 | func testStringFromBytes (data) = WriteSet([DataEntry("bytesToString", toUtf8String(data))]) | |
121 | 130 | ||
122 | 131 | ||
123 | 132 | ||
124 | 133 | @Callable(contextObj) | |
125 | 134 | func setValidator (validator) = if ((contextObj.caller == this)) | |
126 | 135 | then WriteSet([DataEntry("validator", validator)]) | |
127 | 136 | else throw("Only owner can use this function.") | |
128 | 137 | ||
129 | 138 | ||
130 | 139 | ||
131 | 140 | @Callable(contextObj) | |
132 | 141 | func reportData (data) = { | |
133 | 142 | let validator = getBinary(this, "validator") | |
134 | 143 | if ((contextObj.caller.bytes == validator)) | |
135 | 144 | then WriteSet([DataEntry("data_reported", data)]) | |
136 | 145 | else throw("Only validator can use this function.") | |
137 | 146 | } | |
138 | 147 | ||
139 | 148 |
github/deemru/w8io/169f3d6 78.43 ms ◑