tx · 4B5FmH3iHf8UpAGV47T43rHmJ2YeH79qHiJdCoUSdCok 3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi: -0.01400000 Waves 2020.04.15 06:19 [954970] smart account 3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi > SELF 0.00000000 Waves
{ "type": 13, "id": "4B5FmH3iHf8UpAGV47T43rHmJ2YeH79qHiJdCoUSdCok", "fee": 1400000, "feeAssetId": null, "timestamp": 1586920991649, "version": 1, "sender": "3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi", "senderPublicKey": "BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH", "proofs": [ "57uQckEaYkZGXS3x7GULPKacwLTrPNGyGQkzEjWdRs1AJPjUbMXrN8gjJkXJfC35dz4Q41QvSkQ3aaxdBgzJmMsF" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAAJAAAAAA5vd25lclB1YmxpY0tleQEAAAAgnOTxzRGlQL/gVO1uf4r6ecWijHA9iBu9xK1V+iHbiGoAAAAADFJhbmRvbWl6ZUtleQkAAlkAAAABAgAAACxCWlQ1Znp2OFplSFZuOHhBR1pWWFpIVXZvQWtkUk5DYnRFdUJuM3BDdVhFSAAAAAAKZGVwbG95SW5mbwIAAAAkYWRkZWQgZGF0YSBmdW5jdGlvbmFsaXR5ICh0ZXN0cGhhc2UpAAAAAAVhc3NldAEAAAAgVXxs3EW2jBqsaGzTqhCj5Mw9QqAAJNYM2NtCErS5DvoBAAAAC2VuY3J5cHREYXRhAAAAAgAAAAdtZXNzYWdlAAAABHBLZXkEAAAABm91dHB1dAIAAAAkcnNhVmVyaWZ5KFNoYTI1NiAsbWVzc2FnZSxwS2V5LHBLZXkpBQAAAAZvdXRwdXQBAAAACXNlc3Npb25JZAAAAAAEAAAAA2dpZAkABLEAAAABCQAB9wAAAAEJAAGaAAAAAQgFAAAACWxhc3RCbG9jawAAAAZoZWlnaHQFAAAAA2dpZAEAAAA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ev: 9z689B4zqpZAcG8etkZSKGmrwumgfkkTxNRmgL2yiqcE Next: BuGHyhfMybY5W4ajDuWT7ZTKdwmG9eCou183Q8rUFE3L Diff:
Old | New | Differences | |
---|---|---|---|
81 | 81 | case _ => | |
82 | 82 | transactionId | |
83 | 83 | } | |
84 | - | WriteSet([DataEntry(transactionId, messageData), DataEntry((callerAccount + ":transactions"), returnTransactionList)]) | |
84 | + | WriteSet([DataEntry(((callerAccount + ":transaction:") + transactionId), messageData), DataEntry((callerAccount + ":transactions"), returnTransactionList)]) | |
85 | 85 | } | |
86 | 86 | } | |
87 | 87 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ownerPublicKey = base58'BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH' | |
5 | 5 | ||
6 | 6 | let RandomizeKey = fromBase58String("BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH") | |
7 | 7 | ||
8 | 8 | let deployInfo = "added data functionality (testphase)" | |
9 | 9 | ||
10 | 10 | let asset = base58'6khhQRn6E7dsLqxnkGHnEKoZZJv9U7bhadzprWvjAi6m' | |
11 | 11 | ||
12 | 12 | func encryptData (message,pKey) = { | |
13 | 13 | let output = "rsaVerify(Sha256 ,message,pKey,pKey)" | |
14 | 14 | output | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func sessionId () = { | |
19 | 19 | let gid = toInt(sha256(toBytes(lastBlock.height))) | |
20 | 20 | gid | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func getData (dataKey) = { | |
25 | 25 | let dataPackage = getStringValue(this, dataKey) | |
26 | 26 | dataPackage | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func updateUserTXrecord (callerAddress,newTXid) = { | |
31 | 31 | let currentRecord = getData(callerAddress) | |
32 | 32 | let newRecord = ((newTXid + ";") + currentRecord) | |
33 | 33 | let response = WriteSet([DataEntry(callerAddress, newRecord)]) | |
34 | 34 | response | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func updateField (dataList,listSeparator,fieldIndex,newFieldData) = { | |
39 | 39 | let numFields = size(dataList) | |
40 | 40 | if ((numFields >= fieldIndex)) | |
41 | 41 | then if ((fieldIndex == 0)) | |
42 | 42 | then { | |
43 | 43 | let field0 = newFieldData | |
44 | 44 | let field1 = extract(split(dataList, ";")[1]) | |
45 | 45 | let field2 = extract(split(dataList, ";")[2]) | |
46 | 46 | let field3 = extract(split(dataList, ";")[3]) | |
47 | 47 | let field4 = extract(split(dataList, ";")[4]) | |
48 | 48 | let field5 = extract(split(dataList, ";")[5]) | |
49 | 49 | let field6 = extract(split(dataList, ";")[6]) | |
50 | 50 | let field7 = extract(split(dataList, ";")[7]) | |
51 | 51 | let returnString = ((((((((((((((field0 + listSeparator) + field1) + listSeparator) + field2) + listSeparator) + field3) + listSeparator) + field4) + listSeparator) + field5) + listSeparator) + field6) + listSeparator) + field7) | |
52 | 52 | returnString | |
53 | 53 | } | |
54 | 54 | else throw("error creating datastring") | |
55 | 55 | else throw(("field index out of range. Number of fields for string is: " + toString(numFields))) | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | @Callable(i) | |
60 | 60 | func initiate () = { | |
61 | 61 | let transactionId = toBase58String(i.transactionId) | |
62 | 62 | let paid = extract(i.payment) | |
63 | 63 | let message = "default message for now" | |
64 | 64 | let callerAccount = toBase58String(extract(i.callerPublicKey)) | |
65 | 65 | let callerAddress = toBase58String(extract(i.caller.bytes)) | |
66 | 66 | let callerTxId = i.transactionId | |
67 | 67 | let sizing = if ((paid.amount == 100000000)) | |
68 | 68 | then "S" | |
69 | 69 | else if ((paid.amount == 200000000)) | |
70 | 70 | then "M" | |
71 | 71 | else if ((paid.amount == 400000000)) | |
72 | 72 | then "L" | |
73 | 73 | else "error" | |
74 | 74 | let messageData = (((((((("SUBMITTED" + ";") + toBase58String(extract(i.caller.bytes))) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + sizing) | |
75 | 75 | if ((sizing == "error")) | |
76 | 76 | then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract") | |
77 | 77 | else { | |
78 | 78 | let returnTransactionList = match getString(this, (callerAccount + ":transactions")) { | |
79 | 79 | case c: String => | |
80 | 80 | ((transactionId + ";") + c) | |
81 | 81 | case _ => | |
82 | 82 | transactionId | |
83 | 83 | } | |
84 | - | WriteSet([DataEntry(transactionId, messageData), DataEntry((callerAccount + ":transactions"), returnTransactionList)]) | |
84 | + | WriteSet([DataEntry(((callerAccount + ":transaction:") + transactionId), messageData), DataEntry((callerAccount + ":transactions"), returnTransactionList)]) | |
85 | 85 | } | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(i) | |
91 | 91 | func finalize (txId) = if ((i.callerPublicKey != ownerPublicKey)) | |
92 | 92 | then throw("Only owner can call finalize function") | |
93 | 93 | else { | |
94 | 94 | let coinData = getData(txId) | |
95 | 95 | let coinAmount = parseIntValue(extract(split(coinData, ";")[8])) | |
96 | 96 | let statusField = parseIntValue(extract(split(coinData, ";")[0])) | |
97 | 97 | let messageData = updateField(coinData, ";", 0, "COMPLETED") | |
98 | 98 | ScriptResult(WriteSet([DataEntry(txId, messageData)]), TransferSet([ScriptTransfer(i.caller, coinAmount, asset)])) | |
99 | 99 | } | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | @Verifier(tx) | |
103 | 103 | func verify () = match tx { | |
104 | 104 | case d: TransferTransaction|ReissueTransaction|IssueTransaction|SetScriptTransaction => | |
105 | 105 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
106 | 106 | case d: DataTransaction => | |
107 | 107 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
108 | 108 | case _ => | |
109 | 109 | false | |
110 | 110 | } | |
111 | 111 |
github/deemru/w8io/169f3d6 28.86 ms ◑