tx · FbLfUuHxhBHJyyH9spkhGqtfp8TGDHhAHhYcFCX9LanU

3N5uzQBRwhLHDpXkQXKAKXLgsbfa9Sf2Hjf:  -0.01400000 Waves

2019.07.03 08:33 [568821] smart account 3N5uzQBRwhLHDpXkQXKAKXLgsbfa9Sf2Hjf > SELF 0.00000000 Waves

{ "type": 13, "id": "FbLfUuHxhBHJyyH9spkhGqtfp8TGDHhAHhYcFCX9LanU", "fee": 1400000, "feeAssetId": null, "timestamp": 1562132066006, "version": 1, "sender": "3N5uzQBRwhLHDpXkQXKAKXLgsbfa9Sf2Hjf", "senderPublicKey": "35Xxuggtoeee4EV6BV6Y1s3pVar8eTJby7uFDU7i9tz6", "proofs": [ "3n3wuQTorf4mKX5j7WJ13LRmyarU2bmssPPMGNzp1JQqf82r6BNzMPCMQLcs45AGucaS3JF3U6BFLsdVFATaGEQQ" ], "script": "base64:AAIDAAAAAAAAAAAAAAAFAAAAAA9TZXJ2ZXJQdWJsaWNLZXkBAAAAIB7gtUehm6JC0/WALGrP9fklFpOaZB03pVThYrhCe2prAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAAA1EYXRhR2FtZUlkS2V5AgAAAAtBUFBfR0FNRV9JRAAAAAAWRXJyb3JPbmx5V2F2ZXNBY2NlcHRlZAIAAAAZZXJyb3Jfb25seV93YXZlc19hY2NlcHRlZAEAAAAJTmV3R2FtZUlkAAAAAAQAAAAHZ2FtZU51bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAA1EYXRhR2FtZUlkS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAA251bQUAAAAHJG1hdGNoMAUAAAADbnVtAAAAAAAAAAAACQAAZAAAAAIFAAAAB2dhbWVOdW0AAAAAAAAAAAEAAAADAAAAAWkBAAAAD0dlbmVyYXRlUmFuZEludAAAAAIAAAAGZ2FtZUlkAAAAB3JzYVNpZ24EAAAAC3JzYVNpZ1ZhbGlkCQA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EYXRhRW50cnkAAAACBQAAABZhdWN0aW9uTGFzdEJpZE93bmVyS2V5AgAAAAAJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEGxhc3RBdWN0aW9uSWRLZXkFAAAAAmlkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwBgcH+54uUQ==", "chainId": 84, "height": 568821, "spentComplexity": 0 } View: original | compacted Prev: 2mEKx4MyAMWiZ2yq99TmeHrdCc4PbXvpdwzjUC5D5UTd Next: 9oiWzGwKxUiZajjpzdfMUexkdrGqHz4BRVywRBP7kBvF Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let ServerPublicKey = base58'35Xxuggtoeee4EV6BV6Y1s3pVar8eTJby7uFDU7i9tz6'
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+ }
421
522
623 @Callable(i)
7-func deposit () = {
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)
840 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)
959 if (isDefined(pmt.assetId))
10- then throw("can hold waves only at the moment")
60+ then throw(ErrorOnlyWavesAccepted)
1161 else {
12- let currentKey = toBase58String(i.caller.bytes)
13- let currentAmount = match getInteger(this, currentKey) {
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) {
1473 case a: Int =>
1574 a
1675 case _ =>
1776 0
1877 }
1978 let newAmount = (currentAmount + pmt.amount)
20- WriteSet([DataEntry(currentKey, newAmount)])
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)])
2180 }
2281 }
2382
2483
25-
26-@Callable(i)
27-func withdraw (amount) = {
28- let currentKey = toBase58String(i.caller.bytes)
29- let currentAmount = match getInteger(this, currentKey) {
30- case a: Int =>
31- a
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
3289 case _ =>
33- 0
90+ false
3491 }
35- let newAmount = (currentAmount - amount)
36- if ((0 > amount))
37- then throw("Can't withdraw negative amount")
38- else if ((0 > newAmount))
39- then throw("Not enough balance")
40- else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
41- }
42-
43-
44-@Verifier(tx)
45-func verify () = true
92+ else false
4693

github/deemru/w8io/026f985 
23.31 ms