tx · BFZGexcE3uPKdyXBjSKPMRs3cHosT5yNHvxte9EsiYH2

3MxhV8QbgciCkAE5twYzDprkmDEGA4YxnwX:  -0.01400000 Waves

2019.06.23 18:08 [554852] smart account 3MxhV8QbgciCkAE5twYzDprkmDEGA4YxnwX > SELF 0.00000000 Waves

{ "type": 13, "id": "BFZGexcE3uPKdyXBjSKPMRs3cHosT5yNHvxte9EsiYH2", "fee": 1400000, "feeAssetId": null, "timestamp": 1561302555022, "version": 1, "sender": "3MxhV8QbgciCkAE5twYzDprkmDEGA4YxnwX", "senderPublicKey": "AqHMLr2PzT2K7S86S9F5zdWeMrL3zwY1iiXzigRitbxZ", "proofs": [ "65BHXQ3i1mpTjbSFZsvunwipMPBTDGwscvmh3hqjL6Pkzqbeh7oQPjECtw9ZbtPiXB2w7qgrtJtdjQH81d4wz14o" ], "script": "base64:AAIDAAAAAAAAAAAAAAAFAAAAAA9TZXJ2ZXJQdWJsaWNLZXkBAAAAIJIXjIssJPfgvbphWODVSbibY5Lqcz5CQaL3WdNEPrMmAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAAA1EYXRhR2FtZUlkS2V5AgAAAAtBUFBfR0FNRV9JRAAAAAAWRXJyb3JPbmx5V2F2ZXNBY2NlcHRlZAIAAAAZZXJyb3Jfb25seV93YXZlc19hY2NlcHRlZAEAAAAJTmV3R2FtZUlkAAAAAAQAAAAHZ2FtZU51bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAA1EYXRhR2FtZUlkS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAA251bQUAAAAHJG1hdGNoMAUAAAADbnVtAAAAAAAAAAAACQAAZAAAAAIFAAAAB2dhbWVOdW0AAAAAAAAAAAEAAAADAAAAAWkBAAAAD0dlbmVyYXRlUmFuZEludAAAAAIAAAAGZ2FtZUlkAAAAB3JzYVNpZ24EAAAAC3JzYVNpZ1ZhbGlkCQAB9AAAAAMJAA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AAAACBQAAABZhdWN0aW9uTGFzdEJpZE93bmVyS2V5AgAAAAAJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEGxhc3RBdWN0aW9uSWRLZXkFAAAAAmlkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwBgcHdNzN1Q==", "chainId": 84, "height": 554852, "spentComplexity": 0 } View: original | compacted Prev: none Next: GLRNZk6CSTBcsQ7cEzaxCwM3dYHDWPAXKiWPMdZrC9DE Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let ServerPublicKey = base58'AqHMLr2PzT2K7S86S9F5zdWeMrL3zwY1iiXzigRitbxZ'
5+
6+let RouletteSections = 21
7+
8+let DataGameIdKey = "APP_GAME_ID"
9+
10+let ErrorOnlyWavesAccepted = "error_only_waves_accepted"
11+
12+func NewGameId () = {
13+ let gameNum = match getInteger(this, DataGameIdKey) {
14+ case num: Int =>
15+ num
16+ case _ =>
17+ 0
18+ }
19+ (gameNum + 1)
20+ }
21+
22+
23+@Callable(i)
24+func GenerateRandInt (gameId,rsaSign) = {
25+ let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), ServerPublicKey)
26+ if (rsaSigValid)
27+ then {
28+ let rand = (toInt(sha256(toBytes(rsaSign))) % RouletteSections)
29+ WriteSet([DataEntry("orig", toInt(sha256(toBytes(rsaSign)))), DataEntry("rand", rand)])
30+ }
31+ else throw("Invalid RSA signature")
32+ }
33+
34+
35+
36+@Callable(i)
37+func bet (expectedResult) = {
38+ let gameNumber = NewGameId()
39+ let gameId = toBase58String(i.transactionId)
40+ let pmt = extract(i.payment)
41+ WriteSet([DataEntry("orig", ""), DataEntry("rand", "")])
42+ }
43+
44+
45+
46+@Callable(i)
47+func bet111 (expectedResult) = {
48+ let lastAuctionIdKey = "last_auction_id"
49+ let lastAuctionId = match getInteger(this, lastAuctionIdKey) {
50+ case a: Int =>
51+ a
52+ case _ =>
53+ 0
54+ }
55+ let id = (lastAuctionId + 1)
56+ let newAuctionId = toString(id)
57+ let ownerWallet = toBase58String(i.caller.bytes)
58+ let pmt = value(i.payment)
59+ if (isDefined(pmt.assetId))
60+ then throw(ErrorOnlyWavesAccepted)
61+ else {
62+ let assetId = toBase58String(value(pmt.assetId))
63+ let auctionDurationKey = (("auction_" + newAuctionId) + "_duration")
64+ let auctionMinBidKey = (("auction_" + newAuctionId) + "_min_bid")
65+ let auctionLastBidKey = (("auction_" + newAuctionId) + "_last_bid")
66+ let auctionLastBidOwnerKey = (("auction_" + newAuctionId) + "_last_bid_owner")
67+ let auctionOwnerKey = (("auction_" + newAuctionId) + "_owner")
68+ let auctionAmountKey = (("auction_" + newAuctionId) + "_amount")
69+ let auctionAssetIdKey = (("auction_" + newAuctionId) + "_asset_id")
70+ let auctionIsActiveKey = (("auction_" + newAuctionId) + "_is_active")
71+ let userBalanceKey = ((("balance_" + ownerWallet) + "_") + assetId)
72+ let currentAmount = match getInteger(this, userBalanceKey) {
73+ case a: Int =>
74+ a
75+ case _ =>
76+ 0
77+ }
78+ let newAmount = (currentAmount + pmt.amount)
79+ 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)])
80+ }
81+ }
82+
83+
84+@Verifier(tx)
85+func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
86+ then match tx {
87+ case stx: SetScriptTransaction =>
88+ true
89+ case _ =>
90+ false
91+ }
92+ else false
93+

github/deemru/w8io/169f3d6 
21.27 ms