tx · GZdtS2Lx7B8ZKHimU6Joos35qyhTsShn2W5RE6Vk1NSU

3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT:  -0.01400000 Waves

2019.06.24 18:44 [556367] smart account 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT > SELF 0.00000000 Waves

{ "type": 13, "id": "GZdtS2Lx7B8ZKHimU6Joos35qyhTsShn2W5RE6Vk1NSU", "fee": 1400000, "feeAssetId": null, "timestamp": 1561391066088, "version": 1, "sender": "3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT", "senderPublicKey": "Bhyvkx4xdbEi4KPJNZSzx9gZgzgyLEsavuj2kYSt7SST", "proofs": [ "5Dc7c6BYCzokt1BPpNSPpyGM2m8sehUf9xDCTQkJgxCU6cwcC4qUqEiZGdundinbhdDfwYw6BAV2boPxJsHv2Pgi" ], "script": "base64:AAIDAAAAAAAAAAAAAAAPAAAAAA9TZXJ2ZXJQdWJsaWNLZXkBAAAAIAQ1/gW4L6VUuKyMox3deX07Tu0dL8x1obg+vYqfUuwTAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAABFEYXRhR2FtZU51bWJlcktleQIAAAALQVBQX0dBTUVfSUQAAAAADURhdGFBbW91bnRLZXkCAAAABkFNT1VOVAAAAAAORGF0YVNlY3Rpb25LZXkCAAAAB1NFQ1RJT04AAAAADURhdGFTdGF0dXNLZXkCAAAABlNUQVRVUwAAAAANRGF0YVN0YXR1c05ldwIAAAADTkVXAAAAABZFcnJvck9ubHlXYXZlc0FjY2VwdGVkAgAAABllcnJvcl9vbmx5X3dhdmVzX2FjY2VwdGVkAAAAABVFcnJvck11c3RHcmVhdGVyVGhhbjACAAAAJVBhcmFtZXRlciBzaXplIG11c3QgYmUgZ3JlYXRlciB0aGFuIDAAAAAAFEVycm9yTXVzdExlc3NUaGFuMTAwAgAAACRQYXJhbWV0ZXIgc2l6ZSBtdXN0IGJlIGxlc3MgdGhhbiAxMDAAAAAAFUVycm9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0U2NyaXB0VHJhbnNhY3Rpb24EAAAAA3N0eAUAAAAHJG1hdGNoMAYHB1jraV8=", "chainId": 84, "height": 556367, "spentComplexity": 0 } View: original | compacted Prev: 7mVp76F4UpMeDWKvdDEYANqpQt8Ve2z29SWPoeifPe8m Next: 56smDaFiP2ABtobgZiYiF3esvnAKwFVZ5PCKPMQCLwuU Diff:
OldNewDifferences
7070 then throw(ErrorTransactionMustBeInWaves)
7171 else if (txIdUsed)
7272 then throw(ErrorTransactionUsed)
73- else WriteSet([DataEntry(gameTransactionId, address), DataEntry(DataGameNumberKey, toString(gameNumber)), StoreData(gameTransactionId, DataAmountKey, toString(amount)), StoreData(gameTransactionId, DataSectionKey, toString(expectedResult)), StoreData(gameTransactionId, DataStatusKey, DataStatusNew)])
73+ else WriteSet([DataEntry(gameTransactionId, address), DataEntry(DataGameNumberKey, gameNumber), StoreData(gameTransactionId, DataAmountKey, toString(amount)), StoreData(gameTransactionId, DataSectionKey, toString(expectedResult)), StoreData(gameTransactionId, DataStatusKey, DataStatusNew)])
7474 }
7575
7676
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ServerPublicKey = base58'HSP9V7edVKjfLJUfRkEF6vfV9Tyz4Us4yqH9rkwqnHY'
55
66 let RouletteSections = 21
77
88 let DataGameNumberKey = "APP_GAME_ID"
99
1010 let DataAmountKey = "AMOUNT"
1111
1212 let DataSectionKey = "SECTION"
1313
1414 let DataStatusKey = "STATUS"
1515
1616 let DataStatusNew = "NEW"
1717
1818 let ErrorOnlyWavesAccepted = "error_only_waves_accepted"
1919
2020 let ErrorMustGreaterThan0 = "Parameter size must be greater than 0"
2121
2222 let ErrorMustLessThan100 = "Parameter size must be less than 100"
2323
2424 let ErrorBetMustBeInWaves = "Bet amount must be in Waves"
2525
2626 let ErrorTransactionMustBeInWaves = "Transaction's fee must be in Waves"
2727
2828 let ErrorTransactionUsed = "Passed txId had been used before. Game aborted."
2929
3030 func StoreData (transactionId,key,value) = DataEntry(((transactionId + "_") + key), value)
3131
3232
3333 func NewGameId () = {
3434 let gameNum = match getInteger(this, DataGameNumberKey) {
3535 case num: Int =>
3636 num
3737 case _ =>
3838 0
3939 }
4040 (gameNum + 1)
4141 }
4242
4343
4444 @Callable(i)
4545 func GenerateRandInt (gameId,rsaSign) = {
4646 let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), ServerPublicKey)
4747 if (rsaSigValid)
4848 then {
4949 let rand = (toInt(sha256(toBytes(rsaSign))) % RouletteSections)
5050 WriteSet([DataEntry("orig", toInt(sha256(toBytes(rsaSign)))), DataEntry("rand", rand)])
5151 }
5252 else throw("Invalid RSA signature")
5353 }
5454
5555
5656
5757 @Callable(i)
5858 func bet (expectedResult) = {
5959 let gameNumber = NewGameId()
6060 let gameTransactionId = toBase58String(i.transactionId)
6161 let address = toBase58String(i.caller.bytes)
6262 let pmt = extract(i.payment)
6363 let txIdUsed = isDefined(getString(this, gameTransactionId))
6464 let betNotInWaves = isDefined(pmt.assetId)
6565 let feeNotInWaves = isDefined(pmt.assetId)
6666 let amount = pmt.amount
6767 if (betNotInWaves)
6868 then throw(ErrorBetMustBeInWaves)
6969 else if (feeNotInWaves)
7070 then throw(ErrorTransactionMustBeInWaves)
7171 else if (txIdUsed)
7272 then throw(ErrorTransactionUsed)
73- else WriteSet([DataEntry(gameTransactionId, address), DataEntry(DataGameNumberKey, toString(gameNumber)), StoreData(gameTransactionId, DataAmountKey, toString(amount)), StoreData(gameTransactionId, DataSectionKey, toString(expectedResult)), StoreData(gameTransactionId, DataStatusKey, DataStatusNew)])
73+ else WriteSet([DataEntry(gameTransactionId, address), DataEntry(DataGameNumberKey, gameNumber), StoreData(gameTransactionId, DataAmountKey, toString(amount)), StoreData(gameTransactionId, DataSectionKey, toString(expectedResult)), StoreData(gameTransactionId, DataStatusKey, DataStatusNew)])
7474 }
7575
7676
7777
7878 @Callable(i)
7979 func bet111 (expectedResult) = {
8080 let lastAuctionIdKey = "last_auction_id"
8181 let lastAuctionId = match getInteger(this, lastAuctionIdKey) {
8282 case a: Int =>
8383 a
8484 case _ =>
8585 0
8686 }
8787 let id = (lastAuctionId + 1)
8888 let newAuctionId = toString(id)
8989 let ownerWallet = toBase58String(i.caller.bytes)
9090 let pmt = value(i.payment)
9191 if (isDefined(pmt.assetId))
9292 then throw(ErrorOnlyWavesAccepted)
9393 else {
9494 let assetId = toBase58String(value(pmt.assetId))
9595 let auctionDurationKey = (("auction_" + newAuctionId) + "_duration")
9696 let auctionMinBidKey = (("auction_" + newAuctionId) + "_min_bid")
9797 let auctionLastBidKey = (("auction_" + newAuctionId) + "_last_bid")
9898 let auctionLastBidOwnerKey = (("auction_" + newAuctionId) + "_last_bid_owner")
9999 let auctionOwnerKey = (("auction_" + newAuctionId) + "_owner")
100100 let auctionAmountKey = (("auction_" + newAuctionId) + "_amount")
101101 let auctionAssetIdKey = (("auction_" + newAuctionId) + "_asset_id")
102102 let auctionIsActiveKey = (("auction_" + newAuctionId) + "_is_active")
103103 let userBalanceKey = ((("balance_" + ownerWallet) + "_") + assetId)
104104 let currentAmount = match getInteger(this, userBalanceKey) {
105105 case a: Int =>
106106 a
107107 case _ =>
108108 0
109109 }
110110 let newAmount = (currentAmount + pmt.amount)
111111 WriteSet([DataEntry(auctionLastBidKey, 0), DataEntry(auctionOwnerKey, ownerWallet), DataEntry(auctionAmountKey, pmt.amount), DataEntry(auctionAssetIdKey, assetId), DataEntry(userBalanceKey, newAmount), DataEntry(auctionIsActiveKey, true), DataEntry(auctionLastBidOwnerKey, ""), DataEntry(lastAuctionIdKey, id)])
112112 }
113113 }
114114
115115
116116 @Verifier(tx)
117117 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
118118 then match tx {
119119 case stx: SetScriptTransaction =>
120120 true
121121 case _ =>
122122 false
123123 }
124124 else false
125125

github/deemru/w8io/026f985 
53.95 ms