tx · CFeayaLFwaaudQsbRgtySCuzH3icP7cgU5EANERNNyhE

3N7oes1Mab9zmCWuTdXSnKvkN6Y2pJc1dDe:  -0.05000000 Waves

2021.04.14 12:42 [1481955] smart account 3N7oes1Mab9zmCWuTdXSnKvkN6Y2pJc1dDe > SELF 0.00000000 Waves

{ "type": 13, "id": "CFeayaLFwaaudQsbRgtySCuzH3icP7cgU5EANERNNyhE", "fee": 5000000, "feeAssetId": null, "timestamp": 1618393385355, "version": 2, "chainId": 84, "sender": "3N7oes1Mab9zmCWuTdXSnKvkN6Y2pJc1dDe", "senderPublicKey": "4MMreyp5fK9PfGwiJTaZTXuPjY9Tj3qHt6pHiGJ8uyXJ", "proofs": [ "4fkbDNwcvLgHisBJ7nETVqf1vf4BpZBWqcTAg1kSfR9mF7gJ2AoALDdkc1kx4NfQZGht4T7UBnJj1vjVMQfQrDYs" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgcKBQgIAQEIAAAABwAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXhYSXVxbWZ4RE5rVjVKbzlheG51RnBBaktIMmN5R3FRY2tqd0JwRnoydFlKWE4vTXNEdVJraC90WkJ0bm5RVEczRUsrWGJ3V0ZjWUhzNEJvSHpoYUtGb2c0eEtyVDRudFViY1RFMkFxUHNoWGlPc0llSnZlR2RJVDdoL0gySmRBVUZNdXIzdGxQVlhBMWZScGxWMVc2NTFPSWFFOEYrQ252QjlZV2NBVEJxcVVLM1lZaHc3VmErRG96dHZKd3ZOcXVjb1ltZG5uaTZ6NXYwckNsSm1pZk9IQlhGczBVUW83UnFqV2gzTDkrZkdqT2pxUUxzQ2VtYklRYmwvU0lxUm1YMUhZZW1CMUdRQlNsM3U1TGlNOU43aEdTT3V2N01GSWYyZXpReWFnU2JxK3YvM3dBRHZQL1d3K3FTbHhpa0pOYmp4WHBMYUxMSlh6V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QABLAAAAAIJAAEsAAAAAgUAAAANY2FsbGVyQWRkcmVzcwIAAAAHdXNlcmlkOgUAAAAGdXNlcmlkCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFcmFuZDoJAAGkAAAAAQUAAAAEcmFuZAIAAAAFcmlzazoJAAGkAAAAAQUAAAAEcmlzawIAAAAEd29uOgkAAaQAAAABCQAAaAAAAAIFAAAABmFtb3VudAAAAAAAAAAAAwUAAAADbmlsCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAANY2FsbGVyQWRkcmVzcwIAAAAHdXNlcmlkOgUAAAAGdXNlcmlkCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFcmFuZDoJAAGkAAAAAQUAAAAEcmFuZAIAAAAFcmlzazoJAAGkAAAAAQUAAAAEcmlzawIAAAAFbG9zdDoJAAGkAAAAAQUAAAAGYW1vdW50BQAAAANuaWwAAAAAlbtLrA==", "height": 1481955, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: wJtSY2Ajtmdv7bFsxePuyDcLGGZR1paK2cRMxXQ2jY6 Next: 7GbNcyxrLPiYtFA7Y9gbwBfTiJLwiPPx8rmshvsuH8oM Diff:
OldNewDifferences
3939 func init () = {
4040 let callerAddress = toBase58String(i.caller.bytes)
4141 let gameId = toBase58String(i.transactionId)
42- let userid = "1234"
43- let rand = 120
44- let risk = 3
45- let amount = 10000
46- WriteSet([DataEntry(((callerAddress + "userid:") + userid), ((((("rand:" + toString(rand)) + "risk:") + toString(risk)) + "won:") + toString((amount * 2))))])
42+ WriteSet([DataEntry((callerAddress + "_g"), gameId)])
4743 }
4844
4945
5248 func game (gameId,rsaSignr,risk,amount,userid) = {
5349 let rsaSign = fromBase64String(rsaSignr)
5450 let callerAddress = toBase58String(i.caller.bytes)
55- let rand = GenerateRandInt(gameId, rsaSign)
51+ let rand = 120
5652 if ((risk == 2))
5753 then if ((73 > rand))
5854 then WriteSet([DataEntry(((callerAddress + "userid:") + userid), ((((("rand:" + toString(rand)) + "risk:") + toString(risk)) + "won:") + toString((amount * 2))))])
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxXIuqmfxDNkV5Jo9axnuFpAjKH2cyGqQckjwBpFz2tYJXN/MsDuRkh/tZBtnnQTG3EK+XbwWFcYHs4BoHzhaKFog4xKrT4ntUbcTE2AqPshXiOsIeJveGdIT7h/H2JdAUFMur3tlPVXA1fRplV1W651OIaE8F+CnvB9YWcATBqqUK3YYhw7Va+DoztvJwvNqucoYmdnni6z5v0rClJmifOHBXFs0UQo7RqjWh3L9+fGjOjqQLsCembIQbl/SIqRmX1HYemB1GQBSl3u5LiM9N7hGSOuv7MFIf2ezQyagSbq+v/3wADvP/Ww+qSlxikJNbjxXpLaLLJXzTyeJD+kt4wIDAQAB")
55
66 let GAMESCOUNTERKEY = "$GAME_NUM"
77
88 let STATESUBMITTED = "SUBMITTED"
99
1010 let STATEWON = "WON"
1111
1212 let STATELOST = "LOST"
1313
1414 func IncrementGameNum () = {
1515 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
1616 case num: Int =>
1717 num
1818 case _ =>
1919 0
2020 }
2121 (gameNum + 1)
2222 }
2323
2424
2525 func GenerateRandInt (gameId,rsaSign) = {
2626 let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
2727 if (rsaSigValid)
2828 then {
2929 let rand = (toInt(sha256(rsaSign)) % 150)
3030 if ((0 > rand))
3131 then ((-1 * rand) + 1)
3232 else (rand + 1)
3333 }
3434 else throw("Invalid RSA signature")
3535 }
3636
3737
3838 @Callable(i)
3939 func init () = {
4040 let callerAddress = toBase58String(i.caller.bytes)
4141 let gameId = toBase58String(i.transactionId)
42- let userid = "1234"
43- let rand = 120
44- let risk = 3
45- let amount = 10000
46- WriteSet([DataEntry(((callerAddress + "userid:") + userid), ((((("rand:" + toString(rand)) + "risk:") + toString(risk)) + "won:") + toString((amount * 2))))])
42+ WriteSet([DataEntry((callerAddress + "_g"), gameId)])
4743 }
4844
4945
5046
5147 @Callable(i)
5248 func game (gameId,rsaSignr,risk,amount,userid) = {
5349 let rsaSign = fromBase64String(rsaSignr)
5450 let callerAddress = toBase58String(i.caller.bytes)
55- let rand = GenerateRandInt(gameId, rsaSign)
51+ let rand = 120
5652 if ((risk == 2))
5753 then if ((73 > rand))
5854 then WriteSet([DataEntry(((callerAddress + "userid:") + userid), ((((("rand:" + toString(rand)) + "risk:") + toString(risk)) + "won:") + toString((amount * 2))))])
5955 else WriteSet([DataEntry(((callerAddress + "userid:") + userid), ((((("rand:" + toString(rand)) + "risk:") + toString(risk)) + "lost:") + toString(amount)))])
6056 else if ((48 > rand))
6157 then WriteSet([DataEntry(((callerAddress + "userid:") + userid), ((((("rand:" + toString(rand)) + "risk:") + toString(risk)) + "won:") + toString((amount * 3))))])
6258 else WriteSet([DataEntry(((callerAddress + "userid:") + userid), ((((("rand:" + toString(rand)) + "risk:") + toString(risk)) + "lost:") + toString(amount)))])
6359 }
6460
6561

github/deemru/w8io/169f3d6 
44.70 ms