tx · EGiRnhZ2zb6ppaNAcbGuqtdcXPPQGh8Edt8NcUDywvB6

3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT:  -0.01400000 Waves

2019.06.24 15:27 [556166] smart account 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT > SELF 0.00000000 Waves

{ "type": 13, "id": "EGiRnhZ2zb6ppaNAcbGuqtdcXPPQGh8Edt8NcUDywvB6", "fee": 1400000, "feeAssetId": null, "timestamp": 1561379230365, "version": 1, "sender": "3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT", "senderPublicKey": "Bhyvkx4xdbEi4KPJNZSzx9gZgzgyLEsavuj2kYSt7SST", "proofs": [ "4oYXNyaKL55TsrCvNQcjQzha2QMpRuWYJA4pJAF9vuW99kxeDUkPvTzDnKDg2PdgcCTPzG13ZPUXFMQ4bm4xHnLK" ], "script": "base64:AAIDAAAAAAAAAAAAAAAPAAAAAA9TZXJ2ZXJQdWJsaWNLZXkBAAAAIAQ1/gW4L6VUuKyMox3deX07Tu0dL8x1obg+vYqfUuwTAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAABFEYXRhR2FtZU51bWJlcktleQIAAAALQVBQX0dBTUVfSUQAAAAADURhdGFBbW91bnRLZXkCAAAABkFNT1VOVAAAAAAORGF0YVNlY3Rpb25LZXkCAAAAB1NFQ1RJT04AAAAADURhdGFTdGF0dXNLZXkCAAAABlNUQVRVUwAAAAANRGF0YVN0YXR1c05ldwIAAAADTkVXAAAAABZFcnJvck9ubHlXYXZlc0FjY2VwdGVkAgAAABllcnJvcl9vbmx5X3dhdmVzX2FjY2VwdGVkAAAAABVFcnJvck11c3RHcmVhdGVyVGhhbjACAAAAJVBhcmFtZXRlciBzaXplIG11c3QgYmUgZ3JlYXRlciB0aGFuIDAAAAAAFEVycm9yTXVzdExlc3NUaGFuMTAwAgAAACRQYXJhbWV0ZXIgc2l6ZSBtdXN0IGJlIGxlc3MgdGhhbiAxMDAAAAAAFU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XRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwBgcHaUNugw==", "chainId": 84, "height": 556166, "spentComplexity": 0 } View: original | compacted Prev: 5tHV3wuijJHDsAixUxdf6yqZMs5kA1eFjWPLFtVoUUM3 Next: 7mVp76F4UpMeDWKvdDEYANqpQt8Ve2z29SWPoeifPe8m Diff:
OldNewDifferences
55
66 let RouletteSections = 21
77
8-let DataGameIdKey = "APP_GAME_ID"
8+let DataGameNumberKey = "APP_GAME_ID"
9+
10+let DataAmountKey = "AMOUNT"
11+
12+let DataSectionKey = "SECTION"
13+
14+let DataStatusKey = "STATUS"
15+
16+let DataStatusNew = "NEW"
917
1018 let ErrorOnlyWavesAccepted = "error_only_waves_accepted"
1119
20+let ErrorMustGreaterThan0 = "Parameter size must be greater than 0"
21+
22+let ErrorMustLessThan100 = "Parameter size must be less than 100"
23+
24+let ErrorBetMustBeInWaves = "Bet amount must be in Waves"
25+
26+let ErrorTransactionMustBeInWaves = "Transaction's fee must be in Waves"
27+
28+let ErrorTransactionUsed = "Passed txId had been used before. Game aborted."
29+
30+func StoreData (transactionId,key,value) = DataEntry(((transactionId + "_") + key), value)
31+
32+
1233 func NewGameId () = {
13- let gameNum = match getInteger(this, DataGameIdKey) {
34+ let gameNum = match getInteger(this, DataGameNumberKey) {
1435 case num: Int =>
1536 num
1637 case _ =>
3657 @Callable(i)
3758 func bet (expectedResult) = {
3859 let gameNumber = NewGameId()
39- let gameId = toBase58String(i.transactionId)
60+ let gameTransactionId = toBase58String(i.transactionId)
61+ let address = toBase58String(i.caller.bytes)
4062 let pmt = extract(i.payment)
41- WriteSet([DataEntry("orig", ""), DataEntry("rand", "")])
63+ let txIdUsed = isDefined(getString(this, gameTransactionId))
64+ let betNotInWaves = isDefined(pmt.assetId)
65+ let feeNotInWaves = isDefined(pmt.assetId)
66+ let amount = pmt.amount
67+ if (betNotInWaves)
68+ then throw(ErrorBetMustBeInWaves)
69+ else if (feeNotInWaves)
70+ then throw(ErrorTransactionMustBeInWaves)
71+ else if (txIdUsed)
72+ 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)])
4274 }
4375
4476
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
8-let DataGameIdKey = "APP_GAME_ID"
8+let DataGameNumberKey = "APP_GAME_ID"
9+
10+let DataAmountKey = "AMOUNT"
11+
12+let DataSectionKey = "SECTION"
13+
14+let DataStatusKey = "STATUS"
15+
16+let DataStatusNew = "NEW"
917
1018 let ErrorOnlyWavesAccepted = "error_only_waves_accepted"
1119
20+let ErrorMustGreaterThan0 = "Parameter size must be greater than 0"
21+
22+let ErrorMustLessThan100 = "Parameter size must be less than 100"
23+
24+let ErrorBetMustBeInWaves = "Bet amount must be in Waves"
25+
26+let ErrorTransactionMustBeInWaves = "Transaction's fee must be in Waves"
27+
28+let ErrorTransactionUsed = "Passed txId had been used before. Game aborted."
29+
30+func StoreData (transactionId,key,value) = DataEntry(((transactionId + "_") + key), value)
31+
32+
1233 func NewGameId () = {
13- let gameNum = match getInteger(this, DataGameIdKey) {
34+ let gameNum = match getInteger(this, DataGameNumberKey) {
1435 case num: Int =>
1536 num
1637 case _ =>
1738 0
1839 }
1940 (gameNum + 1)
2041 }
2142
2243
2344 @Callable(i)
2445 func GenerateRandInt (gameId,rsaSign) = {
2546 let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), ServerPublicKey)
2647 if (rsaSigValid)
2748 then {
2849 let rand = (toInt(sha256(toBytes(rsaSign))) % RouletteSections)
2950 WriteSet([DataEntry("orig", toInt(sha256(toBytes(rsaSign)))), DataEntry("rand", rand)])
3051 }
3152 else throw("Invalid RSA signature")
3253 }
3354
3455
3556
3657 @Callable(i)
3758 func bet (expectedResult) = {
3859 let gameNumber = NewGameId()
39- let gameId = toBase58String(i.transactionId)
60+ let gameTransactionId = toBase58String(i.transactionId)
61+ let address = toBase58String(i.caller.bytes)
4062 let pmt = extract(i.payment)
41- WriteSet([DataEntry("orig", ""), DataEntry("rand", "")])
63+ let txIdUsed = isDefined(getString(this, gameTransactionId))
64+ let betNotInWaves = isDefined(pmt.assetId)
65+ let feeNotInWaves = isDefined(pmt.assetId)
66+ let amount = pmt.amount
67+ if (betNotInWaves)
68+ then throw(ErrorBetMustBeInWaves)
69+ else if (feeNotInWaves)
70+ then throw(ErrorTransactionMustBeInWaves)
71+ else if (txIdUsed)
72+ 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)])
4274 }
4375
4476
4577
4678 @Callable(i)
4779 func bet111 (expectedResult) = {
4880 let lastAuctionIdKey = "last_auction_id"
4981 let lastAuctionId = match getInteger(this, lastAuctionIdKey) {
5082 case a: Int =>
5183 a
5284 case _ =>
5385 0
5486 }
5587 let id = (lastAuctionId + 1)
5688 let newAuctionId = toString(id)
5789 let ownerWallet = toBase58String(i.caller.bytes)
5890 let pmt = value(i.payment)
5991 if (isDefined(pmt.assetId))
6092 then throw(ErrorOnlyWavesAccepted)
6193 else {
6294 let assetId = toBase58String(value(pmt.assetId))
6395 let auctionDurationKey = (("auction_" + newAuctionId) + "_duration")
6496 let auctionMinBidKey = (("auction_" + newAuctionId) + "_min_bid")
6597 let auctionLastBidKey = (("auction_" + newAuctionId) + "_last_bid")
6698 let auctionLastBidOwnerKey = (("auction_" + newAuctionId) + "_last_bid_owner")
6799 let auctionOwnerKey = (("auction_" + newAuctionId) + "_owner")
68100 let auctionAmountKey = (("auction_" + newAuctionId) + "_amount")
69101 let auctionAssetIdKey = (("auction_" + newAuctionId) + "_asset_id")
70102 let auctionIsActiveKey = (("auction_" + newAuctionId) + "_is_active")
71103 let userBalanceKey = ((("balance_" + ownerWallet) + "_") + assetId)
72104 let currentAmount = match getInteger(this, userBalanceKey) {
73105 case a: Int =>
74106 a
75107 case _ =>
76108 0
77109 }
78110 let newAmount = (currentAmount + pmt.amount)
79111 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)])
80112 }
81113 }
82114
83115
84116 @Verifier(tx)
85117 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
86118 then match tx {
87119 case stx: SetScriptTransaction =>
88120 true
89121 case _ =>
90122 false
91123 }
92124 else false
93125

github/deemru/w8io/026f985 
38.78 ms