tx · E1x1qRdbqayi6HGBkecMcSADfUvHttcbbiSofg4AcFwE 3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi: -0.01400000 Waves 2020.03.11 04:49 [903849] smart account 3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi > SELF 0.00000000 Waves
{ "type": 13, "id": "E1x1qRdbqayi6HGBkecMcSADfUvHttcbbiSofg4AcFwE", "fee": 1400000, "feeAssetId": null, "timestamp": 1583891511610, "version": 1, "sender": "3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi", "senderPublicKey": "BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH", "proofs": [ "2m4erRqejPeyPEdx5CTeNUVsdbR6m5VKdZgnghRqbrUxgayLvVN2q7ybgoQzTtNPH9FoSxafZGrFUBfWXt43GVC3" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAAIAAAAAA5vd25lclB1YmxpY0tleQEAAAAgnOTxzRGlQL/gVO1uf4r6ecWijHA9iBu9xK1V+iHbiGoAAAAADFJhbmRvbWl6ZUtleQkAAlkAAAABAgAAACxCWlQ1Znp2OFplSFZuOHhBR1pWWFpIVXZvQWtkUk5DYnRFdUJuM3BDdVhFSAAAAAAKZGVwbG95SW5mbwIAAAAkYWRkZWQgZGF0YSBmdW5jdGlvbmFsaXR5ICh0ZXN0cGhhc2UpAAAAAAVhc3NldAEAAAAgVXxs3EW2jBqsaGzTqhCj5Mw9QqAAJNYM2NtCErS5DvoBAAAAC2VuY3J5cHREYXRhAAAAAgAAAAdtZXNzYWdlAAAABHBLZXkEAAAABm91dHB1dAIAAAAkcnNhVmVyaWZ5KFNoYTI1NiAsbWVzc2FnZSxwS2V5LHBLZXkpBQAAAAZvdXRwdXQBAAAACXNlc3Npb25JZAAAAAAEAAAAA2dpZAkABLEAAAABCQAB9wAAAAEJAAGaAAAAAQgFAAAACWxhc3RCbG9jawAAAAZoZWlnaHQFAAAAA2dpZAEAAAAHZ2V0R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AAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADm93bmVyUHVibGljS2V5B0Mm5+o=", "chainId": 84, "height": 903849, "spentComplexity": 0 } View: original | compacted Prev: HfsuBxwEwcqAbd26XgsgHLCqhuxCy1547RLSCuUTtG8n Next: E9NCyoFAUqQxX9z3VX6Y57f5jVV2CJuyS825qCwRVXZi Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | let RandomizeKey = fromBase58String("BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH") | |
7 | 7 | ||
8 | 8 | let deployInfo = "added data functionality (testphase)" | |
9 | + | ||
10 | + | let asset = base58'6khhQRn6E7dsLqxnkGHnEKoZZJv9U7bhadzprWvjAi6m' | |
9 | 11 | ||
10 | 12 | func encryptData (message,pKey) = { | |
11 | 13 | let output = "rsaVerify(Sha256 ,message,pKey,pKey)" | |
19 | 21 | } | |
20 | 22 | ||
21 | 23 | ||
22 | - | func randomize (rsaSign,thisSession) = { | |
23 | - | let gameId = thisSession | |
24 | - | let rsaSigValid = sigVerify(toBytes(gameId), toBytes(rsaSign), RandomizeKey) | |
25 | - | if (rsaSigValid) | |
26 | - | then { | |
27 | - | let rand = (toInt(sha256(toBytes(rsaSign))) % 6) | |
28 | - | if ((0 > rand)) | |
29 | - | then ((-1 * rand) + 1) | |
30 | - | else (rand + 1) | |
31 | - | } | |
32 | - | else throw("Invalid RSA signature") | |
24 | + | func getData (dataKey) = { | |
25 | + | let dataPackage = getStringValue(this, dataKey) | |
26 | + | dataPackage | |
33 | 27 | } | |
34 | 28 | ||
35 | 29 | ||
36 | - | func listParser (dataString,separator) = { | |
37 | - | let choppedlist = "x" | |
38 | - | choppedlist | |
39 | - | } | |
40 | - | ||
41 | - | ||
42 | - | func listBuilder (receiver,amount,txid) = { | |
43 | - | let compiledList = "placeholder" | |
44 | - | compiledList | |
45 | - | } | |
46 | - | ||
47 | - | ||
48 | - | func getData (dataKey) = { | |
49 | - | let dataPackage = getStringValue(this, dataKey) | |
50 | - | dataPackage | |
30 | + | func updateField (dataList,listSeparator,fieldIndex,newFieldData) = { | |
31 | + | let numFields = size(dataList) | |
32 | + | if ((numFields >= fieldIndex)) | |
33 | + | then if ((fieldIndex == 0)) | |
34 | + | then { | |
35 | + | let field0 = newFieldData | |
36 | + | let field1 = extract(split(dataList, ";")[1]) | |
37 | + | let field2 = extract(split(dataList, ";")[2]) | |
38 | + | let field3 = extract(split(dataList, ";")[3]) | |
39 | + | let field4 = extract(split(dataList, ";")[4]) | |
40 | + | let field5 = extract(split(dataList, ";")[5]) | |
41 | + | let field6 = extract(split(dataList, ";")[6]) | |
42 | + | let field7 = extract(split(dataList, ";")[7]) | |
43 | + | let returnString = ((((((((((((((field0 + listSeparator) + field1) + listSeparator) + field2) + listSeparator) + field3) + listSeparator) + field4) + listSeparator) + field5) + listSeparator) + field6) + listSeparator) + field7) | |
44 | + | returnString | |
45 | + | } | |
46 | + | else throw("error creating datastring") | |
47 | + | else throw(("field index out of range. Number of fields for string is: " + toString(numFields))) | |
51 | 48 | } | |
52 | 49 | ||
53 | 50 | ||
59 | 56 | let callerAccount = toBase58String(extract(i.callerPublicKey)) | |
60 | 57 | let callerAddress = toBase58String(extract(i.caller.bytes)) | |
61 | 58 | let callerTxId = i.transactionId | |
62 | - | let asset = base58'6khhQRn6E7dsLqxnkGHnEKoZZJv9U7bhadzprWvjAi6m' | |
63 | 59 | let sizing = if ((paid.amount == 100000000)) | |
64 | 60 | then "S" | |
65 | 61 | else if ((paid.amount == 200000000)) | |
70 | 66 | let messageData = (((((((("SUBMITTED" + ";") + toBase58String(extract(i.caller.bytes))) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + sizing) | |
71 | 67 | if ((sizing == "error")) | |
72 | 68 | then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract") | |
73 | - | else { | |
74 | - | let tokenAmount = (paid.amount * 3) | |
75 | - | WriteSet([DataEntry(gameId, messageData)]) | |
76 | - | } | |
69 | + | else WriteSet([DataEntry(gameId, messageData)]) | |
77 | 70 | } | |
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | @Callable(i) | |
75 | + | func finalize (txId) = if ((i.callerPublicKey != ownerPublicKey)) | |
76 | + | then throw("Only owner can call finalize function") | |
77 | + | else { | |
78 | + | let coinData = getData(txId) | |
79 | + | let coinAmount = parseIntValue(extract(split(coinData, ";")[8])) | |
80 | + | let statusField = parseIntValue(extract(split(coinData, ";")[0])) | |
81 | + | let messageData = updateField(coinData, ";", 0, "COMPLETED") | |
82 | + | ScriptResult(WriteSet([DataEntry(txId, messageData)]), TransferSet([ScriptTransfer(i.caller, coinAmount, asset)])) | |
83 | + | } | |
78 | 84 | ||
79 | 85 | ||
80 | 86 | @Verifier(tx) | |
81 | 87 | func verify () = match tx { | |
82 | - | case d: ReissueTransaction|IssueTransaction|SetScriptTransaction => | |
88 | + | case d: TransferTransaction|ReissueTransaction|IssueTransaction|SetScriptTransaction => | |
83 | 89 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
84 | 90 | case d: DataTransaction => | |
85 | 91 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
86 | - | case d: TransferTransaction => | |
87 | - | true | |
88 | 92 | case _ => | |
89 | 93 | false | |
90 | 94 | } |
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 | + | ||
10 | + | let asset = base58'6khhQRn6E7dsLqxnkGHnEKoZZJv9U7bhadzprWvjAi6m' | |
9 | 11 | ||
10 | 12 | func encryptData (message,pKey) = { | |
11 | 13 | let output = "rsaVerify(Sha256 ,message,pKey,pKey)" | |
12 | 14 | output | |
13 | 15 | } | |
14 | 16 | ||
15 | 17 | ||
16 | 18 | func sessionId () = { | |
17 | 19 | let gid = toInt(sha256(toBytes(lastBlock.height))) | |
18 | 20 | gid | |
19 | 21 | } | |
20 | 22 | ||
21 | 23 | ||
22 | - | func randomize (rsaSign,thisSession) = { | |
23 | - | let gameId = thisSession | |
24 | - | let rsaSigValid = sigVerify(toBytes(gameId), toBytes(rsaSign), RandomizeKey) | |
25 | - | if (rsaSigValid) | |
26 | - | then { | |
27 | - | let rand = (toInt(sha256(toBytes(rsaSign))) % 6) | |
28 | - | if ((0 > rand)) | |
29 | - | then ((-1 * rand) + 1) | |
30 | - | else (rand + 1) | |
31 | - | } | |
32 | - | else throw("Invalid RSA signature") | |
24 | + | func getData (dataKey) = { | |
25 | + | let dataPackage = getStringValue(this, dataKey) | |
26 | + | dataPackage | |
33 | 27 | } | |
34 | 28 | ||
35 | 29 | ||
36 | - | func listParser (dataString,separator) = { | |
37 | - | let choppedlist = "x" | |
38 | - | choppedlist | |
39 | - | } | |
40 | - | ||
41 | - | ||
42 | - | func listBuilder (receiver,amount,txid) = { | |
43 | - | let compiledList = "placeholder" | |
44 | - | compiledList | |
45 | - | } | |
46 | - | ||
47 | - | ||
48 | - | func getData (dataKey) = { | |
49 | - | let dataPackage = getStringValue(this, dataKey) | |
50 | - | dataPackage | |
30 | + | func updateField (dataList,listSeparator,fieldIndex,newFieldData) = { | |
31 | + | let numFields = size(dataList) | |
32 | + | if ((numFields >= fieldIndex)) | |
33 | + | then if ((fieldIndex == 0)) | |
34 | + | then { | |
35 | + | let field0 = newFieldData | |
36 | + | let field1 = extract(split(dataList, ";")[1]) | |
37 | + | let field2 = extract(split(dataList, ";")[2]) | |
38 | + | let field3 = extract(split(dataList, ";")[3]) | |
39 | + | let field4 = extract(split(dataList, ";")[4]) | |
40 | + | let field5 = extract(split(dataList, ";")[5]) | |
41 | + | let field6 = extract(split(dataList, ";")[6]) | |
42 | + | let field7 = extract(split(dataList, ";")[7]) | |
43 | + | let returnString = ((((((((((((((field0 + listSeparator) + field1) + listSeparator) + field2) + listSeparator) + field3) + listSeparator) + field4) + listSeparator) + field5) + listSeparator) + field6) + listSeparator) + field7) | |
44 | + | returnString | |
45 | + | } | |
46 | + | else throw("error creating datastring") | |
47 | + | else throw(("field index out of range. Number of fields for string is: " + toString(numFields))) | |
51 | 48 | } | |
52 | 49 | ||
53 | 50 | ||
54 | 51 | @Callable(i) | |
55 | 52 | func initiate () = { | |
56 | 53 | let gameId = toBase58String(i.transactionId) | |
57 | 54 | let paid = extract(i.payment) | |
58 | 55 | let message = "default message for now" | |
59 | 56 | let callerAccount = toBase58String(extract(i.callerPublicKey)) | |
60 | 57 | let callerAddress = toBase58String(extract(i.caller.bytes)) | |
61 | 58 | let callerTxId = i.transactionId | |
62 | - | let asset = base58'6khhQRn6E7dsLqxnkGHnEKoZZJv9U7bhadzprWvjAi6m' | |
63 | 59 | let sizing = if ((paid.amount == 100000000)) | |
64 | 60 | then "S" | |
65 | 61 | else if ((paid.amount == 200000000)) | |
66 | 62 | then "M" | |
67 | 63 | else if ((paid.amount == 400000000)) | |
68 | 64 | then "L" | |
69 | 65 | else "error" | |
70 | 66 | let messageData = (((((((("SUBMITTED" + ";") + toBase58String(extract(i.caller.bytes))) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + sizing) | |
71 | 67 | if ((sizing == "error")) | |
72 | 68 | then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract") | |
73 | - | else { | |
74 | - | let tokenAmount = (paid.amount * 3) | |
75 | - | WriteSet([DataEntry(gameId, messageData)]) | |
76 | - | } | |
69 | + | else WriteSet([DataEntry(gameId, messageData)]) | |
77 | 70 | } | |
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | @Callable(i) | |
75 | + | func finalize (txId) = if ((i.callerPublicKey != ownerPublicKey)) | |
76 | + | then throw("Only owner can call finalize function") | |
77 | + | else { | |
78 | + | let coinData = getData(txId) | |
79 | + | let coinAmount = parseIntValue(extract(split(coinData, ";")[8])) | |
80 | + | let statusField = parseIntValue(extract(split(coinData, ";")[0])) | |
81 | + | let messageData = updateField(coinData, ";", 0, "COMPLETED") | |
82 | + | ScriptResult(WriteSet([DataEntry(txId, messageData)]), TransferSet([ScriptTransfer(i.caller, coinAmount, asset)])) | |
83 | + | } | |
78 | 84 | ||
79 | 85 | ||
80 | 86 | @Verifier(tx) | |
81 | 87 | func verify () = match tx { | |
82 | - | case d: ReissueTransaction|IssueTransaction|SetScriptTransaction => | |
88 | + | case d: TransferTransaction|ReissueTransaction|IssueTransaction|SetScriptTransaction => | |
83 | 89 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
84 | 90 | case d: DataTransaction => | |
85 | 91 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
86 | - | case d: TransferTransaction => | |
87 | - | true | |
88 | 92 | case _ => | |
89 | 93 | false | |
90 | 94 | } | |
91 | 95 |
github/deemru/w8io/169f3d6 28.40 ms ◑