tx · CyznAYK1MMwKnvXmPQ4EhEY2eYNZdCt5B64S5aqd1AY2

3N9XoQ1oUiBiqtysprGZiLDRLJMgnyBbupt:  -0.01400000 Waves

2019.06.21 21:01 [552105] smart account 3N9XoQ1oUiBiqtysprGZiLDRLJMgnyBbupt > SELF 0.00000000 Waves

{ "type": 13, "id": "CyznAYK1MMwKnvXmPQ4EhEY2eYNZdCt5B64S5aqd1AY2", "fee": 1400000, "feeAssetId": null, "timestamp": 1561140060090, "version": 1, "sender": "3N9XoQ1oUiBiqtysprGZiLDRLJMgnyBbupt", "senderPublicKey": "FMwW45Ub2Vxf7kiLFvt5frX87gi4xowYAkfwNA2A3yAz", "proofs": [ "5sGAoV3wQmTqrBxSspEpwheUVuE3QCrL1tc2VVzw17qvLLFqLETHibpqvhwh6H3jqns77itmwQFruWTkXytiT4mZ" ], "script": "base64:AAIDAAAAAAAAAAAAAAAFAAAAAA1nYW1pbmdBc3NldElkCQACWQAAAAECAAAALEN3aDlMTW5NY05SSHpmcmNvMnA5ZkFpVEtLUXY4emZjcThRZTlkQ1cyYWp3AQAAABZnZXRTZW5kZXJGcm9tUGF5bWVudFR4AAAAAQAAAAx0cmFuc2ZlclR4SWQEAAAAEHRyYW5zZmVyVHhTZW5kZXIEAAAAByRtYXRjaDAJAAPuAAAAAQkAAlkAAAABCQEAAAAHZXh0cmFjdAAAAAEFAAAADHRyYW5zZmVyVHhJZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAACdHgFAAAAByRtYXRjaDAIBQAAAAJ0eAAAAAZzZW5kZXIJAAACAAAAAQIAAAAeVHJhbnNhY3Rpb24gaXMgbm8gdHJhbnNmZXIgdHghBQAAABB0cmFuc2ZlclR4U2VuZGVyAQAAABZnZXRBbW91bnRGcm9tUGF5bWVudFR4AAAAAQAAAAx0cmFuc2ZlclR4SWQEAAAABmFtb3VudAQAAAAHJG1hdGNoMAkAA+4AAAABCQACWQAAAAEJA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AAABJtYXRjaGluZ1Njb3JlVmFsdWUFAAAACnRoaXNTZW5kZXIFAAAADm1hdGNoaW5nU2VuZGVyBAAAAARkcmF3CQAAAAAAAAIFAAAAEm1hdGNoaW5nU2NvcmVWYWx1ZQUAAAAOdGhpc1Njb3JlVmFsdWUDBQAAAARkcmF3CQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAIb3BlbkdhbWUCAAAABG5vbmUFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAA5tYXRjaGluZ1NlbmRlcgAAAAAABfXhAAUAAAANZ2FtaW5nQXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAp0aGlzU2VuZGVyAAAAAAAF9eEABQAAAA1nYW1pbmdBc3NldElkBQAAAANuaWwJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAhvcGVuR2FtZQIAAAAEbm9uZQUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAABndpbm5lcgAAAAAAC+vCAAUAAAANZ2FtaW5nQXNzZXRJZAUAAAADbmlsCQAAAgAAAAECAAAAGVRoaXMgc2hvdWxkIG5ldmVyIGhhcHBlbiEJAAACAAAAAQIAAAAZVGhpcyBzaG91bGQgbmV2ZXIgaGFwcGVuIQkAAAIAAAABAgAAABNJbnZhbGlkIHBheW1lbnQgdHghAAAAAG724Zo=", "chainId": 84, "height": 552105, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let gamingAssetId = fromBase58String("Cwh9LMnMcNRHzfrco2p9fAiTKKQv8zfcq8Qe9dCW2ajw")
5+
6+func getSenderFromPaymentTx (transferTxId) = {
7+ let transferTxSender = match transferTransactionById(fromBase58String(extract(transferTxId))) {
8+ case tx: TransferTransaction =>
9+ tx.sender
10+ case _ =>
11+ throw("Transaction is no transfer tx!")
12+ }
13+ transferTxSender
14+ }
15+
16+
17+func getAmountFromPaymentTx (transferTxId) = {
18+ let amount = match transferTransactionById(fromBase58String(extract(transferTxId))) {
19+ case tx: TransferTransaction =>
20+ tx.amount
21+ case _ =>
22+ throw("Transaction is no transfer tx!")
23+ }
24+ amount
25+ }
26+
27+
28+func getAssetFromPaymentTx (transferTxId) = {
29+ let assetId = match transferTransactionById(fromBase58String(extract(transferTxId))) {
30+ case tx: TransferTransaction =>
31+ tx.assetId
32+ case _ =>
33+ throw("Transaction is no transfer tx!")
34+ }
35+ assetId
36+ }
37+
38+
39+func checkPaymentTx (paymentTxId,thisSender) = {
40+ let amount = getAmountFromPaymentTx(paymentTxId)
41+ let sender = getSenderFromPaymentTx(paymentTxId)
42+ let assetId = getAssetFromPaymentTx(paymentTxId)
43+ if (if ((sender == thisSender))
44+ then (amount == 100000000)
45+ else false)
46+ then (assetId == gamingAssetId)
47+ else false
48+ }
49+
50+
51+@Callable(i)
52+func registerGame (txId) = {
53+ let open = match getString(this, "openGame") {
54+ case openTxId: String =>
55+ openTxId
56+ case _ =>
57+ throw("This should never happen!")
58+ }
59+ let thisSender = getSenderFromPaymentTx(txId)
60+ let txValid = checkPaymentTx(txId, thisSender)
61+ if (txValid)
62+ then if ((open == "none"))
63+ then WriteSet([DataEntry("openGame", txId)])
64+ else {
65+ let matchingSender = getSenderFromPaymentTx(open)
66+ let matchingScore = getInteger(matchingSender, (open + "_score"))
67+ let thisScore = getInteger(thisSender, (txId + "_score"))
68+ match matchingScore {
69+ case matchingScoreValue: Int =>
70+ match thisScore {
71+ case thisScoreValue: Int =>
72+ let winner = if ((thisScoreValue > matchingScoreValue))
73+ then thisSender
74+ else matchingSender
75+ let draw = (matchingScoreValue == thisScoreValue)
76+ if (draw)
77+ then ScriptResult(WriteSet([DataEntry("openGame", "none")]), TransferSet([ScriptTransfer(matchingSender, 100000000, gamingAssetId), ScriptTransfer(thisSender, 100000000, gamingAssetId)]))
78+ else ScriptResult(WriteSet([DataEntry("openGame", "none")]), TransferSet([ScriptTransfer(winner, 200000000, gamingAssetId)]))
79+ case _ =>
80+ throw("This should never happen!")
81+ }
82+ case _ =>
83+ throw("This should never happen!")
84+ }
85+ }
86+ else throw("Invalid payment tx!")
87+ }
88+
89+

github/deemru/w8io/169f3d6 
18.67 ms