tx · 8Qkj7nvKRjWn4gVvi2RbJMkR2WqF1aTPJuJXrwdWfVed

3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk:  -0.01000000 Waves

2021.10.20 13:15 [1754472] smart account 3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk > SELF 0.00000000 Waves

{ "type": 13, "id": "8Qkj7nvKRjWn4gVvi2RbJMkR2WqF1aTPJuJXrwdWfVed", "fee": 1000000, "feeAssetId": null, "timestamp": 1634724975543, "version": 2, "chainId": 84, "sender": "3Mu9qAjmg8fVTxxpwPZnBAH948ujt4m6Xvk", "senderPublicKey": "8v9pmcXqHz9DTc5k1Z8duTYyDwykFxN3EzdZ9WAn3KXJ", "proofs": [ "3TYqTywA8gjfBcEtweLgVk5Sib3QHWMGVk28qHH8suFZjVULnod8tEWxoaiWLDPss4J5R1Gjpr2VDCZ3StJZT8R" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAAMAAAAAA1nYW1lTnVtYmVyS2V5AgAAAAwkR0FNRV9OVU1CRVIAAAAAB3Rlc3RLZXkCAAAABSRURVNUAAAAAAxkZWxheUZvckdhbWUAAAAAAAAAAAIAAAAAC0dhbWVTdGFydGVkAAAAAAAAAAABAAAAAAxHYW1lRmluaXNoZWQAAAAAAAAAAAIBAAAAEGdldEdhbWVTdGF0dXNLZXkAAAACAAAAB2FkZHJlc3MAAAAGZ2FtZUlkCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAdhZGRyZXNzAgAAAAFfCQABpAAAAAEFAAAABmdhbWVJZAIAAAAHX3N0YXR1cwEAAAAOZ2V0R2FtZVR4SWRLZXkAAAACAAAAB2FkZHJlc3MAAAAGZ2FtZUlkCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAdhZGRyZXNzAgAAAAFfCQABpAAAAAEFAAAABmdhbWVJZAIAAAAFX3R4aWQBAAAAGWdldEdhbWVpbmdGaW5pc2hIZWlnaHRLZXkAAAACAAAAB2Fk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FAAAAE2dhbWVpbmdGaW5pc2hIZWlnaHQFAAAABmhlaWdodAIAAAAnIGJsb2NrcyByZW1haW5pbmcsIGl0IHdpbGwgdGFrZSBhcm91bmQgCQABpAAAAAEJAABlAAAAAgUAAAATZ2FtZWluZ0ZpbmlzaEhlaWdodAUAAAAGaGVpZ2h0AgAAAAggbWludXRlcwQAAAAKcmFuZG9uTmFtZQkBAAAADWdldFJhbmRvbU5hbWUAAAACBQAAAAhnYW1lVHhJZAUAAAATZ2FtZWluZ0ZpbmlzaEhlaWdodAQAAAAFYXNzZXQJAARDAAAABwUAAAAKcmFuZG9uTmFtZQUAAAAKcmFuZG9uTmFtZQAAAAAAAAAAAQAAAAAAAAAAAAcFAAAABHVuaXQFAAAAE2dhbWVpbmdGaW5pc2hIZWlnaHQEAAAAB2Fzc2V0SWQJAAQ4AAAAAQUAAAAFYXNzZXQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAEGdhbWVpbmdTdGF0dXNLZXkFAAAADEdhbWVGaW5pc2hlZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAphc3NldElkS2V5CQACWAAAAAEFAAAAB2Fzc2V0SWQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAAlgAAAABBQAAAAdhc3NldElkBQAAAAphc3NldElkS2V5CQAETAAAAAIFAAAABWFzc2V0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAAHYXNzZXRJZAUAAAADbmlsAAAAAGibb4g=", "height": 1754472, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3At9CmPFub6bK7pDm9CEiiuyr6xuPaxxfnsKvmDUKuHY Next: none Diff:
OldNewDifferences
1111
1212 let GameFinished = 2
1313
14-func getGameStatusKey (address,gameId) = "a"
14+func getGameStatusKey (address,gameId) = (((address + "_") + toString(gameId)) + "_status")
1515
1616
1717 func getGameTxIdKey (address,gameId) = (((address + "_") + toString(gameId)) + "_txid")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let gameNumberKey = "$GAME_NUMBER"
55
66 let testKey = "$TEST"
77
88 let delayForGame = 2
99
1010 let GameStarted = 1
1111
1212 let GameFinished = 2
1313
14-func getGameStatusKey (address,gameId) = "a"
14+func getGameStatusKey (address,gameId) = (((address + "_") + toString(gameId)) + "_status")
1515
1616
1717 func getGameTxIdKey (address,gameId) = (((address + "_") + toString(gameId)) + "_txid")
1818
1919
2020 func getGameingFinishHeightKey (address,gameId) = (((address + "_") + toString(gameId)) + "_fh")
2121
2222
2323 func getAssetIdKey (address,gameId) = (((address + "_") + toString(gameId)) + "_di")
2424
2525
2626 func tryGetInteger (key) = {
2727 let val = match getInteger(this, key) {
2828 case b: Int =>
2929 b
3030 case _ =>
3131 0
3232 }
3333 val
3434 }
3535
3636
3737 func getRandomNumber (variants,txId,gameingFinishHeight,offset) = {
3838 let randomSeedBlock = value(blockInfoByHeight((gameingFinishHeight - 1)))
3939 let randomHash = sha256((txId + value(randomSeedBlock.vrf)))
4040 (toInt(randomHash, (offset * 8)) % variants)
4141 }
4242
4343
4444 func getRandomName (txId,gameingFinishHeight) = {
4545 let rand = getRandomNumber(2, txId, gameingFinishHeight, 0)
4646 if ((rand == 0))
4747 then "type1"
4848 else "type2"
4949 }
5050
5151
5252 @Callable(i)
5353 func startAssetGaming () = {
5454 let firstPayment = value(i.payments[0])
5555 let gameId = tryGetInteger(gameNumberKey)
5656 [IntegerEntry(getGameStatusKey(toString(i.caller), gameId), GameStarted), StringEntry(getGameTxIdKey(toString(i.caller), gameId), toBase58String(i.transactionId)), IntegerEntry(getGameingFinishHeightKey(toString(i.caller), gameId), (height + delayForGame)), IntegerEntry(gameNumberKey, (gameId + 1))]
5757 }
5858
5959
6060
6161 @Callable(i)
6262 func finishAssetGaming (gameId) = {
6363 let gameingStatusKey = getGameStatusKey(toString(i.caller), gameId)
6464 let finishHeightKey = getGameingFinishHeightKey(toString(i.caller), gameId)
6565 let assetIdKey = getAssetIdKey(toString(i.caller), gameId)
6666 let gameTxIdKey = getGameTxIdKey(toString(i.caller), gameId)
6767 let gameingTxStatus = tryGetInteger(gameingStatusKey)
6868 let gameingFinishHeight = getIntegerValue(this, finishHeightKey)
6969 let gameTxId = fromBase58String(getStringValue(this, gameTxIdKey))
7070 if ((gameingTxStatus == GameFinished))
7171 then {
7272 let assetId = getStringValue(this, getAssetIdKey(toString(i.caller), gameId))
7373 throw(("The asset was gamed and claimed already, here is the folowing: " + assetId))
7474 }
7575 else if ((gameingFinishHeight > height))
7676 then throw((((("Gaming is not finished yet " + toString((gameingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((gameingFinishHeight - height))) + " minutes"))
7777 else {
7878 let randonName = getRandomName(gameTxId, gameingFinishHeight)
7979 let asset = Issue(randonName, randonName, 1, 0, false, unit, gameingFinishHeight)
8080 let assetId = calculateAssetId(asset)
8181 [IntegerEntry(gameingStatusKey, GameFinished), StringEntry(assetIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), assetIdKey), asset, ScriptTransfer(i.caller, 1, assetId)]
8282 }
8383 }
8484
8585

github/deemru/w8io/026f985 
29.26 ms