tx · 4zScMVSEjUomSn2qj2bXPS4G76F9gAEShBkrxsQwCRd3 3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi: -0.01400000 Waves 2019.10.05 00:22 [705536] smart account 3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi > SELF 0.00000000 Waves
{ "type": 13, "id": "4zScMVSEjUomSn2qj2bXPS4G76F9gAEShBkrxsQwCRd3", "fee": 1400000, "feeAssetId": null, "timestamp": 1570224289892, "version": 1, "sender": "3MxorpV6jKdNhrzHSujnjVXu7fr8PCHhMwi", "senderPublicKey": "BZT5fzv8ZeHVn8xAGZVXZHUvoAkdRNCbtEuBn3pCuXEH", "proofs": [ "2gj3HT6pN5W4eQVdEBCmHLoha8bWZ21NCkQc31uhH4K6v5b8ZcZaYycXBvksbniL67xkqNu3SfBVthDaVc3gUgVH" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAA5vd25lclB1YmxpY0tleQEAAAAgnOTxzRGlQL/gVO1uf4r6ecWijHA9iBu9xK1V+iHbiGoAAAAADFJhbmRvbWl6ZUtleQkAAlkAAAABAgAAACxCWlQ1Znp2OFplSFZuOHhBR1pWWFpIVXZvQWtkUk5DYnRFdUJuM3BDdVhFSAAAAAAKZGVwbG95SW5mbwIAAAAkYWRkZWQgZGF0YSBmdW5jdGlvbmFsaXR5ICh0ZXN0cGhhc2UpAQAAAAtlbmNyeXB0RGF0YQAAAAIAAAAHbWVzc2FnZQAAAARwS2V5BAAAAAZvdXRwdXQCAAAAJHJzYVZlcmlmeShTaGEyNTYgLG1lc3NhZ2UscEtleSxwS2V5KQUAAAAGb3V0cHV0AQAAAAlzZXNzaW9uSWQAAAAABAAAAANnaWQJAASxAAAAAQkAAfcAAAABCQABmgAAAAEIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0BQAAAANnaWQBAAAACXJhbmRvbWl6ZQAAAAIAAAAHcnNhU2lnbgAAAAt0aGlzU2Vzc2lvbgQAAAAGZ2FtZUlkBQAAAA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AAAAttZXNzYWdlRGF0YQUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAALdG9rZW5BbW91bnQFAAAABWFzc2V0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAEElzc3VlVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABJSZWlzc3VlVHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAGB6QiFJ8=", "chainId": 84, "height": 705536, "spentComplexity": 0 } View: original | compacted Prev: 3Y61pD3A2KLV1vJA7MMu53hFE5xstD6iyNshVztvYg8e Next: 2VmMcdHo26tnp1JAaakP1VUMefPF8T2SkadYaHnuiZ4j Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | ||
54 | 54 | @Callable(i) | |
55 | 55 | func dispense () = { | |
56 | - | let | |
56 | + | let gameId = toBase58String(i.transactionId) | |
57 | 57 | let paid = extract(i.payment) | |
58 | 58 | let message = "default message for now" | |
59 | 59 | let callerAccount = toBase58String(extract(i.callerPublicKey)) | |
67 | 67 | else if ((paid.amount == 400000000)) | |
68 | 68 | then "L" | |
69 | 69 | else "error" | |
70 | - | let messageData = | |
70 | + | let messageData = ((((((((toBase58String(extract(i.callerPublicKey)) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + gameId) + ";") + sizing) | |
71 | 71 | if ((sizing == "error")) | |
72 | 72 | then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract") | |
73 | 73 | else { |
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 | func encryptData (message,pKey) = { | |
11 | 11 | let output = "rsaVerify(Sha256 ,message,pKey,pKey)" | |
12 | 12 | output | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func sessionId () = { | |
17 | 17 | let gid = toInt(sha256(toBytes(lastBlock.height))) | |
18 | 18 | gid | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func randomize (rsaSign,thisSession) = { | |
23 | 23 | let gameId = thisSession | |
24 | 24 | let rsaSigValid = sigVerify(toBytes(gameId), toBytes(rsaSign), RandomizeKey) | |
25 | 25 | if (rsaSigValid) | |
26 | 26 | then { | |
27 | 27 | let rand = (toInt(sha256(toBytes(rsaSign))) % 6) | |
28 | 28 | if ((0 > rand)) | |
29 | 29 | then ((-1 * rand) + 1) | |
30 | 30 | else (rand + 1) | |
31 | 31 | } | |
32 | 32 | else throw("Invalid RSA signature") | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func listParser (dataString,separator) = { | |
37 | 37 | let choppedlist = "x" | |
38 | 38 | choppedlist | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func listBuilder (receiver,amount,txid) = { | |
43 | 43 | let compiledList = "placeholder" | |
44 | 44 | compiledList | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getData (dataKey) = { | |
49 | 49 | let dataPackage = getStringValue(this, dataKey) | |
50 | 50 | dataPackage | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | @Callable(i) | |
55 | 55 | func dispense () = { | |
56 | - | let | |
56 | + | let gameId = toBase58String(i.transactionId) | |
57 | 57 | let paid = extract(i.payment) | |
58 | 58 | let message = "default message for now" | |
59 | 59 | let callerAccount = toBase58String(extract(i.callerPublicKey)) | |
60 | 60 | let callerAddress = toBase58String(extract(i.caller.bytes)) | |
61 | 61 | let callerTxId = i.transactionId | |
62 | 62 | let asset = base58'6khhQRn6E7dsLqxnkGHnEKoZZJv9U7bhadzprWvjAi6m' | |
63 | 63 | let sizing = if ((paid.amount == 100000000)) | |
64 | 64 | then "S" | |
65 | 65 | else if ((paid.amount == 200000000)) | |
66 | 66 | then "M" | |
67 | 67 | else if ((paid.amount == 400000000)) | |
68 | 68 | then "L" | |
69 | 69 | else "error" | |
70 | - | let messageData = | |
70 | + | let messageData = ((((((((toBase58String(extract(i.callerPublicKey)) + ";") + toString(paid.amount)) + ";") + toString(height)) + ";") + gameId) + ";") + sizing) | |
71 | 71 | if ((sizing == "error")) | |
72 | 72 | then throw("Prices are 1, 2, and 4 waves. Other amounts will be rejected by the smart contract") | |
73 | 73 | else { | |
74 | 74 | let tokenAmount = (paid.amount * 3) | |
75 | 75 | ScriptResult(WriteSet([DataEntry(callerAccount, messageData)]), TransferSet([ScriptTransfer(i.caller, tokenAmount, asset)])) | |
76 | 76 | } | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | @Verifier(tx) | |
81 | 81 | func verify () = match tx { | |
82 | 82 | case d: SetScriptTransaction => | |
83 | 83 | sigVerify(tx.bodyBytes, tx.proofs[0], ownerPublicKey) | |
84 | 84 | case d: DataTransaction => | |
85 | 85 | true | |
86 | 86 | case d: TransferTransaction => | |
87 | 87 | true | |
88 | 88 | case d: IssueTransaction => | |
89 | 89 | true | |
90 | 90 | case d: ReissueTransaction => | |
91 | 91 | true | |
92 | 92 | case _ => | |
93 | 93 | false | |
94 | 94 | } | |
95 | 95 |
github/deemru/w8io/169f3d6 84.19 ms ◑