tx · HvQcUZTTj3PXorsqk5LniFZcPa2tmQr1c9uTHkAHsq8u

3N54eKW5ZucDaRaGVUfzX8xRXv6Ve8M71tM:  -0.01400000 Waves

2020.06.25 10:05 [1058891] smart account 3N54eKW5ZucDaRaGVUfzX8xRXv6Ve8M71tM > SELF 0.00000000 Waves

{ "type": 13, "id": "HvQcUZTTj3PXorsqk5LniFZcPa2tmQr1c9uTHkAHsq8u", "fee": 1400000, "feeAssetId": null, "timestamp": 1593068717309, "version": 1, "sender": "3N54eKW5ZucDaRaGVUfzX8xRXv6Ve8M71tM", "senderPublicKey": "FmnQ1LwTnauTS2BSrZivE1nSF1A9MY9hyYB72pyh5hw9", "proofs": [ "2U7XxGEcfKRMZwJNsrk31SB2LJW7B5eFHgb4GbgvD7dwTu9QXffR9zuEZ9c5HgQTpRxBNhwUKnpjcNEyd7iUgHDb" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQIAAAAOAQAAAApkZWNvZGVJbnQ4AAAAAgAAAARkYXRhAAAABm9mZnNldAMJAABmAAAAAgAAAAAAAAAAAQkAAMgAAAABBQAAAARkYXRhCQAAAgAAAAECAAAALWRlY29kZSB1OCBlcnJvciwgZGF0YSBtdXN0IGJlIGF0IGxlYXN0IDEgYnl0ZQMJAABmAAAAAgUAAAAGb2Zmc2V0CQAAyAAAAAEFAAAABGRhdGEJAAACAAAAAQIAAAAjZGVjb2RlIHU4IGVycm9yLCBkZWNvZGluZyBpcyBmaW5pc2gEAAAAAngwCQAAyQAAAAIJAADKAAAAAgUAAAAEZGF0YQUAAAAGb2Zmc2V0AAAAAAAAAAABBAAAAAJ4MQkABLIAAAACCQAAywAAAAIBAAAABwAAAAAAAAAFAAAAAngwAAAAAAAAAAAACQAETAAAAAIJAASyAAAAAgkAAMsAAAACAQAAAAcAAAAAAAAABQAAAAJ4MAAAAAAAAAAAAAkABEwAAAACCQAAZAAAAAIFAAAABm9mZnNldAAAAAAAAAAAAQUAAAADbmlsAQAAAAtkZWNv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ACBQAAAARyZXM3AAAAAAAAAAAAAAAABXZhbHVlBQAAAANuaWwAAAAA+2jhjA==", "chainId": 84, "height": 1058891, "spentComplexity": 0 } View: original | compacted Prev: 3VNxqGa3MMfcQH7M3eoTGp1tf88fGMs2rPXiCB6fDbzT Next: CmmTBgbYZzDqbmKGNADMXjMvvNGcE4WEGSnGs4SpiwbW Diff:
OldNewDifferences
120120
121121
122122 @Callable(contextObj)
123-func relayAndVerify (data) = {
124- let req1 = decodeString(data, 0)
125- let req2 = decodeInt64(data, getOffset(req1))
126- let req3 = decodeBytes(data, req2[1])
127- let req4 = decodeInt64(data, getOffset(req3))
128- let req5 = decodeInt64(data, req4[1])
129- let res1 = decodeString(data, req5[1])
130- let res2 = decodeInt64(data, getOffset(res1))
131- let res3 = decodeInt64(data, res2[1])
132- let res4 = decodeInt64(data, res3[1])
133- let res5 = decodeInt64(data, res4[1])
134- let res6 = decodeInt8(data, res5[1])
135- let res7 = decodeBytes(data, res6[1])
136- let requestID = toString(res2[0])
137- WriteSet([DataEntry((requestID + "-clientId"), req1[0].value), DataEntry((requestID + "-oracleScriptId"), req2[0]), DataEntry((requestID + "-calldata"), req3[0].value), DataEntry((requestID + "-askCount"), req4[0]), DataEntry((requestID + "-minCount"), req5[0]), DataEntry((requestID + "-ansCount"), res3[0]), DataEntry((requestID + "-requestTime"), res4[0]), DataEntry((requestID + "-resolveTime"), res5[0]), DataEntry((requestID + "-resolveStatus"), res6[0]), DataEntry((requestID + "-result"), res7[0].value)])
138- }
123+func relayAndVerify (data) = if ((contextObj.caller != addressFromString("3N54eKW5ZucDaRaGVUfzX8xRXv6Ve8M71tM")))
124+ then throw("Unauthorized caller")
125+ else {
126+ let req1 = decodeString(data, 0)
127+ let req2 = decodeInt64(data, getOffset(req1))
128+ let req3 = decodeBytes(data, req2[1])
129+ let req4 = decodeInt64(data, getOffset(req3))
130+ let req5 = decodeInt64(data, req4[1])
131+ let res1 = decodeString(data, req5[1])
132+ let res2 = decodeInt64(data, getOffset(res1))
133+ let res3 = decodeInt64(data, res2[1])
134+ let res4 = decodeInt64(data, res3[1])
135+ let res5 = decodeInt64(data, res4[1])
136+ let res6 = decodeInt8(data, res5[1])
137+ let res7 = decodeBytes(data, res6[1])
138+ let requestID = toString(res2[0])
139+ WriteSet([DataEntry((requestID + "-clientId"), req1[0].value), DataEntry((requestID + "-oracleScriptId"), req2[0]), DataEntry((requestID + "-calldata"), req3[0].value), DataEntry((requestID + "-askCount"), req4[0]), DataEntry((requestID + "-minCount"), req5[0]), DataEntry((requestID + "-ansCount"), res3[0]), DataEntry((requestID + "-requestTime"), res4[0]), DataEntry((requestID + "-resolveTime"), res5[0]), DataEntry((requestID + "-resolveStatus"), res6[0]), DataEntry((requestID + "-result"), res7[0].value)])
140+ }
139141
140142
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func decodeInt8 (data,offset) = if ((1 > size(data)))
55 then throw("decode u8 error, data must be at least 1 byte")
66 else if ((offset > size(data)))
77 then throw("decode u8 error, decoding is finish")
88 else {
99 let x0 = take(drop(data, offset), 1)
1010 let x1 = toInt((base58'1111111' + x0), 0)
1111 [toInt((base58'1111111' + x0), 0), (offset + 1)]
1212 }
1313
1414
1515 func decodeInt16 (data,offset) = if ((2 > size(data)))
1616 then throw("decode u16 error, data must be at least 2 bytes")
1717 else if ((offset > size(data)))
1818 then throw("decode u16 error, decoding is finish")
1919 else {
2020 let x0 = drop(data, offset)
2121 let x1 = take(x0, 2)
2222 [toInt((base58'111111' + x1), 0), (offset + 2)]
2323 }
2424
2525
2626 func decodeInt32 (data,offset) = if ((4 > size(data)))
2727 then throw("decode u32 error, data must be at least 4 bytes")
2828 else if ((offset > size(data)))
2929 then throw("decode u32 error, decoding is finish")
3030 else {
3131 let x0 = drop(data, offset)
3232 let x1 = take(x0, 4)
3333 [toInt((base58'1111' + x1), 0), (offset + 4)]
3434 }
3535
3636
3737 func decodeInt64 (data,offset) = if ((8 > size(data)))
3838 then throw("decode u32 error, data must be at least 8 bytes")
3939 else if ((offset > size(data)))
4040 then throw("decode u32 error, decoding is finish")
4141 else {
4242 let x0 = drop(data, offset)
4343 let x1 = take(x0, 8)
4444 [toInt(x1, 0), (offset + 8)]
4545 }
4646
4747
4848 func decodeBool (data,offset) = {
4949 let decoded1 = decodeInt8(data, offset)
5050 [DataEntry("bool", (decoded1[0] != 0)), DataEntry("int", decoded1[1])]
5151 }
5252
5353
5454 func decodeBytes32 (data,offset) = if ((32 > size(data)))
5555 then throw("decode bytes32 error, data must be at least 32 bytes")
5656 else [DataEntry("byte_vector", take(drop(data, offset), 32)), DataEntry("int", (offset + 32))]
5757
5858
5959 func decodeBytes64 (data,offset) = if ((64 > size(data)))
6060 then throw("decode bytes64 error, data must be at least 64 bytes")
6161 else [DataEntry("byte_vector", take(drop(data, offset), 64)), DataEntry("int", (offset + 64))]
6262
6363
6464 func decodeBytes65 (data,offset) = if ((65 > size(data)))
6565 then throw("decode bytes65 error, data must be at least 65 bytes")
6666 else [DataEntry("byte_vector", take(drop(data, offset), 65)), DataEntry("int", (offset + 65))]
6767
6868
6969 func decodeBytes (data,offset) = {
7070 let decoded1 = decodeInt32(data, offset)
7171 let bytesSize = decoded1[0]
7272 let nextOffset = decoded1[1]
7373 [DataEntry("byte_vector", take(drop(data, nextOffset), bytesSize)), DataEntry("int", (nextOffset + bytesSize))]
7474 }
7575
7676
7777 func decodeString (data,offset) = {
7878 let decoded1 = decodeInt32(data, offset)
7979 let bytesSize = decoded1[0]
8080 let nextOffset = decoded1[1]
8181 [DataEntry("string", toUtf8String(take(drop(data, nextOffset), bytesSize))), DataEntry("int", (nextOffset + bytesSize))]
8282 }
8383
8484
8585 func getAsBool (tuple) = match tuple[0].value {
8686 case b: Boolean =>
8787 b
8888 case _ =>
8989 throw("not a Boolean")
9090 }
9191
9292
9393 func getAsByteVector (tuple) = match tuple[0].value {
9494 case bv: ByteVector =>
9595 bv
9696 case _ =>
9797 throw("not a ByteVector")
9898 }
9999
100100
101101 func getAsString (tuple) = match tuple[0].value {
102102 case s: String =>
103103 s
104104 case _ =>
105105 throw("not a String")
106106 }
107107
108108
109109 func getOffset (tuple) = match tuple[1].value {
110110 case i: Int =>
111111 i
112112 case _ =>
113113 throw("not a Int")
114114 }
115115
116116
117117 @Callable(contextObj)
118118 func testSaveString (data) = WriteSet([DataEntry("testSaveString", data)])
119119
120120
121121
122122 @Callable(contextObj)
123-func relayAndVerify (data) = {
124- let req1 = decodeString(data, 0)
125- let req2 = decodeInt64(data, getOffset(req1))
126- let req3 = decodeBytes(data, req2[1])
127- let req4 = decodeInt64(data, getOffset(req3))
128- let req5 = decodeInt64(data, req4[1])
129- let res1 = decodeString(data, req5[1])
130- let res2 = decodeInt64(data, getOffset(res1))
131- let res3 = decodeInt64(data, res2[1])
132- let res4 = decodeInt64(data, res3[1])
133- let res5 = decodeInt64(data, res4[1])
134- let res6 = decodeInt8(data, res5[1])
135- let res7 = decodeBytes(data, res6[1])
136- let requestID = toString(res2[0])
137- WriteSet([DataEntry((requestID + "-clientId"), req1[0].value), DataEntry((requestID + "-oracleScriptId"), req2[0]), DataEntry((requestID + "-calldata"), req3[0].value), DataEntry((requestID + "-askCount"), req4[0]), DataEntry((requestID + "-minCount"), req5[0]), DataEntry((requestID + "-ansCount"), res3[0]), DataEntry((requestID + "-requestTime"), res4[0]), DataEntry((requestID + "-resolveTime"), res5[0]), DataEntry((requestID + "-resolveStatus"), res6[0]), DataEntry((requestID + "-result"), res7[0].value)])
138- }
123+func relayAndVerify (data) = if ((contextObj.caller != addressFromString("3N54eKW5ZucDaRaGVUfzX8xRXv6Ve8M71tM")))
124+ then throw("Unauthorized caller")
125+ else {
126+ let req1 = decodeString(data, 0)
127+ let req2 = decodeInt64(data, getOffset(req1))
128+ let req3 = decodeBytes(data, req2[1])
129+ let req4 = decodeInt64(data, getOffset(req3))
130+ let req5 = decodeInt64(data, req4[1])
131+ let res1 = decodeString(data, req5[1])
132+ let res2 = decodeInt64(data, getOffset(res1))
133+ let res3 = decodeInt64(data, res2[1])
134+ let res4 = decodeInt64(data, res3[1])
135+ let res5 = decodeInt64(data, res4[1])
136+ let res6 = decodeInt8(data, res5[1])
137+ let res7 = decodeBytes(data, res6[1])
138+ let requestID = toString(res2[0])
139+ WriteSet([DataEntry((requestID + "-clientId"), req1[0].value), DataEntry((requestID + "-oracleScriptId"), req2[0]), DataEntry((requestID + "-calldata"), req3[0].value), DataEntry((requestID + "-askCount"), req4[0]), DataEntry((requestID + "-minCount"), req5[0]), DataEntry((requestID + "-ansCount"), res3[0]), DataEntry((requestID + "-requestTime"), res4[0]), DataEntry((requestID + "-resolveTime"), res5[0]), DataEntry((requestID + "-resolveStatus"), res6[0]), DataEntry((requestID + "-result"), res7[0].value)])
140+ }
139141
140142

github/deemru/w8io/026f985 
39.74 ms