tx · HgL6UbkM4vQu8DZwttCYXJ8BTyeYWQJXq5rtwdAykSeo 3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA: -0.02000000 Waves 2020.04.28 12:28 [974403] smart account 3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA > SELF 0.00000000 Waves
{ "type": 13, "id": "HgL6UbkM4vQu8DZwttCYXJ8BTyeYWQJXq5rtwdAykSeo", "fee": 2000000, "feeAssetId": null, "timestamp": 1588066105002, "version": 1, "sender": "3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA", "senderPublicKey": "Aj2RvtYHTSnDfcwYBCD5ZEwG3V483xJe2L1n13KPsi3a", "proofs": [ "5fAFwYaWr39rst6xpsihyTMowLx4p4NGaShj6cpRqVrpadRqGhCgKP9ujGw6ye1UQ96DumoH1mSjXXLzedYvRgH4" ], "script": "base64:AAIDAAAAAAAAACAIARIDCgECEgMKAQISAwoBAhIDCgECEgMKAQISAwoBCAAAAAQBAAAACGRlY29kZVU4AAAAAgAAAARkYXRhAAAABm9mZnNldAMJAAAAAAAAAgkAAMgAAAABBQAAAARkYXRhAAAAAAAAAAAACQAAAgAAAAECAAAAJ2RlY29kZSB1OCBlcnJvciwgZGF0YSBpcyBhbiBlbXB0eSBieXRlcwMJAABmAAAAAgUAAAAGb2Zmc2V0CQAAyAAAAAEFAAAABGRhdGEJAAACAAAAAQIAAAAjZGVjb2RlIHU4IGVycm9yLCBkZWNvZGluZyBpcyBmaW5pc2gJAARMAAAAAgkABLIAAAACCQAAywAAAAIBAAAABwAAAAAAAAAJAADJAAAAAgkAAMoAAAACBQAAAARkYXRhBQAAAAZvZmZzZXQAAAAAAAAAAAEAAAAAAAAAAAAJAARMAAAAAgkAAGQAAAACBQAAAAZvZmZzZXQAAAAAAAAAAAEFAAAAA25pbAEAAAAJZGVjb2RlVTE2AAAAAgAAAARkYXRhAAAABm9mZnNldAQAAAAIZGVjb2RlZDEJAQAAAAhkZWNvZGVVOAAAAAIFAAAAB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b250ZXh0T2JqAAAABmNhbGxlcgUAAAAEdGhpcwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAJdmFsaWRhdG9yBQAAAAl2YWxpZGF0b3IFAAAAA25pbAkAAAIAAAABAgAAACFPbmx5IG93bmVyIGNhbiB1c2UgdGhpcyBmdW5jdGlvbi4AAAAKY29udGV4dE9iagEAAAAKcmVwb3J0RGF0YQAAAAEAAAAEZGF0YQQAAAAJdmFsaWRhdG9yCQAEHAAAAAIFAAAABHRoaXMCAAAACXZhbGlkYXRvcgMJAAAAAAAAAggIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgAAAAVieXRlcwUAAAAJdmFsaWRhdG9yCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAA1kYXRhX3JlcG9ydGVkBQAAAARkYXRhBQAAAANuaWwJAAACAAAAAQIAAAAlT25seSB2YWxpZGF0b3IgY2FuIHVzZSB0aGlzIGZ1bmN0aW9uLgAAAABFWtUr", "chainId": 84, "height": 974403, "spentComplexity": 0 } View: original | compacted Prev: JBub4wQTFdbT7a4QGmzRsshvHzc3ajZJ7DVCRxsbThUH Next: Ffo6dWghRQSscgJig3ccGHiqcfBqYadR5Nvj7xSw3TvS Diff:
Old | New | Differences | |
---|---|---|---|
27 | 27 | let decoded2 = decodeU32(data, decoded1[1]) | |
28 | 28 | [(decoded1[0] + (((decoded2[0] * 256) * 256) * 256)), decoded2[1]] | |
29 | 29 | } | |
30 | + | ||
31 | + | ||
32 | + | @Callable(contextObj) | |
33 | + | func testDecodeU32 (data) = { | |
34 | + | let offset = 0 | |
35 | + | let decoded = decodeU32(data, offset) | |
36 | + | WriteSet([DataEntry("u32", decoded[0])]) | |
37 | + | } | |
38 | + | ||
30 | 39 | ||
31 | 40 | ||
32 | 41 | @Callable(contextObj) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func decodeU8 (data,offset) = if ((size(data) == 0)) | |
5 | 5 | then throw("decode u8 error, data is an empty bytes") | |
6 | 6 | else if ((offset > size(data))) | |
7 | 7 | then throw("decode u8 error, decoding is finish") | |
8 | 8 | else [toInt((base58'1111111' + take(drop(data, offset), 1)), 0), (offset + 1)] | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func decodeU16 (data,offset) = { | |
12 | 12 | let decoded1 = decodeU8(data, offset) | |
13 | 13 | let decoded2 = decodeU8(data, decoded1[1]) | |
14 | 14 | [(decoded1[0] + (decoded2[0] * 256)), decoded2[1]] | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func decodeU32 (data,offset) = { | |
19 | 19 | let decoded1 = decodeU16(data, offset) | |
20 | 20 | let decoded2 = decodeU16(data, decoded1[1]) | |
21 | 21 | [(decoded1[0] + ((decoded2[0] * 256) * 256)), decoded2[1]] | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func decodeU64 (data,offset) = { | |
26 | 26 | let decoded1 = decodeU32(data, offset) | |
27 | 27 | let decoded2 = decodeU32(data, decoded1[1]) | |
28 | 28 | [(decoded1[0] + (((decoded2[0] * 256) * 256) * 256)), decoded2[1]] | |
29 | 29 | } | |
30 | + | ||
31 | + | ||
32 | + | @Callable(contextObj) | |
33 | + | func testDecodeU32 (data) = { | |
34 | + | let offset = 0 | |
35 | + | let decoded = decodeU32(data, offset) | |
36 | + | WriteSet([DataEntry("u32", decoded[0])]) | |
37 | + | } | |
38 | + | ||
30 | 39 | ||
31 | 40 | ||
32 | 41 | @Callable(contextObj) | |
33 | 42 | func testDecodeU64 (data) = { | |
34 | 43 | let offset = 0 | |
35 | 44 | let decoded = decodeU64(data, offset) | |
36 | 45 | WriteSet([DataEntry("u64", decoded[0])]) | |
37 | 46 | } | |
38 | 47 | ||
39 | 48 | ||
40 | 49 | ||
41 | 50 | @Callable(contextObj) | |
42 | 51 | func testIntFromBytes (data) = WriteSet([DataEntry("bytesToInt", toInt(data, 0))]) | |
43 | 52 | ||
44 | 53 | ||
45 | 54 | ||
46 | 55 | @Callable(contextObj) | |
47 | 56 | func testStringFromBytes (data) = WriteSet([DataEntry("bytesToString", toUtf8String(data))]) | |
48 | 57 | ||
49 | 58 | ||
50 | 59 | ||
51 | 60 | @Callable(contextObj) | |
52 | 61 | func setValidator (validator) = if ((contextObj.caller == this)) | |
53 | 62 | then WriteSet([DataEntry("validator", validator)]) | |
54 | 63 | else throw("Only owner can use this function.") | |
55 | 64 | ||
56 | 65 | ||
57 | 66 | ||
58 | 67 | @Callable(contextObj) | |
59 | 68 | func reportData (data) = { | |
60 | 69 | let validator = getBinary(this, "validator") | |
61 | 70 | if ((contextObj.caller.bytes == validator)) | |
62 | 71 | then WriteSet([DataEntry("data_reported", data)]) | |
63 | 72 | else throw("Only validator can use this function.") | |
64 | 73 | } | |
65 | 74 | ||
66 | 75 |
github/deemru/w8io/169f3d6 51.27 ms ◑