tx · F4iUoyskWsQTPCVaVaTatGU6uZ3ekW7tf49pgo6LRnZr 3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA: -0.02000000 Waves 2020.04.28 11:53 [974366] smart account 3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA > SELF 0.00000000 Waves
{ "type": 13, "id": "F4iUoyskWsQTPCVaVaTatGU6uZ3ekW7tf49pgo6LRnZr", "fee": 2000000, "feeAssetId": null, "timestamp": 1588064056268, "version": 1, "sender": "3NBCBtA1F4m6tBir7JX2dUtDNt4ujmHH5NA", "senderPublicKey": "Aj2RvtYHTSnDfcwYBCD5ZEwG3V483xJe2L1n13KPsi3a", "proofs": [ "3jKLwSDJ99hMr46sywtCPRE167CmQyN2ttRCcz7tVgcszBKHAFJkouztKEV8CxRbXsVcUc2Kpa9m7MTYBEkCMhx9" ], "script": "base64:AAIDAAAAAAAAABYIARIDCgECEgMKAQISAwoBAhIDCgEIAAAAAwEAAAAIZGVjb2RlVTgAAAACAAAABGRhdGEAAAAGb2Zmc2V0AwkAAAAAAAACCQAAyAAAAAEFAAAABGRhdGEAAAAAAAAAAAAJAAACAAAAAQIAAAAnZGVjb2RlIHU4IGVycm9yLCBkYXRhIGlzIGFuIGVtcHR5IGJ5dGVzAwkAAGYAAAACBQAAAAZvZmZzZXQJAADIAAAAAQUAAAAEZGF0YQkAAAIAAAABAgAAACNkZWNvZGUgdTggZXJyb3IsIGRlY29kaW5nIGlzIGZpbmlzaAkABEwAAAACCQAEsgAAAAIJAADLAAAAAgEAAAAHAAAAAAAAAAkAAMkAAAACCQAAygAAAAIFAAAABGRhdGEFAAAABm9mZnNldAAAAAAAAAAAAQAAAAAAAAAAAAkABEwAAAACCQAAZAAAAAIFAAAABm9mZnNldAAAAAAAAAAAAQUAAAADbmlsAQAAAAlkZWNvZGVVMTYAAAACAAAABGRhdGEAAAAGb2Zmc2V0BAAAAAhkZWNvZGVkMQkBAAAACGRlY29kZVU4AAAAAgUAAAAEZGF0YQU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VTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAN1MzIJAAGRAAAAAgUAAAAHZGVjb2RlZAAAAAAAAAAAAAUAAAADbmlsAAAACmNvbnRleHRPYmoBAAAADHNldFZhbGlkYXRvcgAAAAEAAAAJdmFsaWRhdG9yAwkAAAAAAAACCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAABHRoaXMJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAACXZhbGlkYXRvcgUAAAAJdmFsaWRhdG9yBQAAAANuaWwJAAACAAAAAQIAAAAhT25seSBvd25lciBjYW4gdXNlIHRoaXMgZnVuY3Rpb24uAAAACmNvbnRleHRPYmoBAAAACnJlcG9ydERhdGEAAAABAAAABGRhdGEEAAAACXZhbGlkYXRvcgkABBwAAAACBQAAAAR0aGlzAgAAAAl2YWxpZGF0b3IDCQAAAAAAAAIICAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIAAAAFYnl0ZXMFAAAACXZhbGlkYXRvcgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAANZGF0YV9yZXBvcnRlZAUAAAAEZGF0YQUAAAADbmlsCQAAAgAAAAECAAAAJU9ubHkgdmFsaWRhdG9yIGNhbiB1c2UgdGhpcyBmdW5jdGlvbi4AAAAAgSoXoQ==", "chainId": 84, "height": 974366, "spentComplexity": 0 } View: original | compacted Prev: 6nuyt12D2Kt7CTDjFkEToM3Dr8648WEvmGfL81KTsvhE Next: AZkWe6jvy66d4fFeyZYJ9tSkgTJkyZUZCvDw6Z1VXa2m Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | + | func decodeU32 (data,offset) = { | |
19 | + | let decoded1 = decodeU16(data, offset) | |
20 | + | let decoded2 = decodeU16(data, decoded1[1]) | |
21 | + | [(decoded1[0] + ((decoded2[0] * 256) * 256)), decoded2[1]] | |
22 | + | } | |
23 | + | ||
24 | + | ||
18 | 25 | @Callable(contextObj) | |
19 | 26 | func testWriteIntFromBytes (data) = WriteSet([DataEntry("bytesToInt", toInt(data, 0))]) | |
20 | 27 | ||
21 | 28 | ||
22 | 29 | ||
23 | 30 | @Callable(contextObj) | |
24 | - | func | |
31 | + | func testDecodeU32 (data) = { | |
25 | 32 | let offset = 0 | |
26 | - | let decoded = decodeU8(data, offset) | |
27 | - | WriteSet([DataEntry("u8", decoded[0])]) | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | @Callable(contextObj) | |
33 | - | func testDecodeU16 (data) = { | |
34 | - | let offset = 0 | |
35 | - | let decoded = decodeU16(data, offset) | |
36 | - | WriteSet([DataEntry("u16", decoded[0])]) | |
33 | + | let decoded = decodeU32(data, offset) | |
34 | + | WriteSet([DataEntry("u32", decoded[0])]) | |
37 | 35 | } | |
38 | 36 | ||
39 | 37 |
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 | + | func decodeU32 (data,offset) = { | |
19 | + | let decoded1 = decodeU16(data, offset) | |
20 | + | let decoded2 = decodeU16(data, decoded1[1]) | |
21 | + | [(decoded1[0] + ((decoded2[0] * 256) * 256)), decoded2[1]] | |
22 | + | } | |
23 | + | ||
24 | + | ||
18 | 25 | @Callable(contextObj) | |
19 | 26 | func testWriteIntFromBytes (data) = WriteSet([DataEntry("bytesToInt", toInt(data, 0))]) | |
20 | 27 | ||
21 | 28 | ||
22 | 29 | ||
23 | 30 | @Callable(contextObj) | |
24 | - | func | |
31 | + | func testDecodeU32 (data) = { | |
25 | 32 | let offset = 0 | |
26 | - | let decoded = decodeU8(data, offset) | |
27 | - | WriteSet([DataEntry("u8", decoded[0])]) | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | @Callable(contextObj) | |
33 | - | func testDecodeU16 (data) = { | |
34 | - | let offset = 0 | |
35 | - | let decoded = decodeU16(data, offset) | |
36 | - | WriteSet([DataEntry("u16", decoded[0])]) | |
33 | + | let decoded = decodeU32(data, offset) | |
34 | + | WriteSet([DataEntry("u32", decoded[0])]) | |
37 | 35 | } | |
38 | 36 | ||
39 | 37 | ||
40 | 38 | ||
41 | 39 | @Callable(contextObj) | |
42 | 40 | func setValidator (validator) = if ((contextObj.caller == this)) | |
43 | 41 | then WriteSet([DataEntry("validator", validator)]) | |
44 | 42 | else throw("Only owner can use this function.") | |
45 | 43 | ||
46 | 44 | ||
47 | 45 | ||
48 | 46 | @Callable(contextObj) | |
49 | 47 | func reportData (data) = { | |
50 | 48 | let validator = getBinary(this, "validator") | |
51 | 49 | if ((contextObj.caller.bytes == validator)) | |
52 | 50 | then WriteSet([DataEntry("data_reported", data)]) | |
53 | 51 | else throw("Only validator can use this function.") | |
54 | 52 | } | |
55 | 53 | ||
56 | 54 |
github/deemru/w8io/169f3d6 92.22 ms ◑