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+vYqfUuwTAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAABFEYXRhR2FtZU51bWJlcktleQIAAAALQVBQX0dBTUVfSUQAAAAADURhdGFBbW91bnRLZXkCAAAABkFNT1VOVAAAAAAORGF0YVNlY3Rpb25LZXkCAAAAB1NFQ1RJT04AAAAADURhdGFTdGF0dXNLZXkCAAAABlNUQVRVUwAAAAANRGF0YVN0YXR1c05ldwIAAAADTkVXAAAAABZFcnJvck9ubHlXYXZlc0FjY2VwdGVkAgAAABllcnJvcl9vbmx5X3dhdmVzX2FjY2VwdGVkAAAAABVFcnJvck11c3RHcmVhdGVyVGhhbjACAAAAJVBhcmFtZXRlciBzaXplIG11c3QgYmUgZ3JlYXRlciB0aGFuIDAAAAAAFEVycm9yTXVzdExlc3NUaGFuMTAwAgAAACRQYXJhbWV0ZXIgc2l6ZSBtdXN0IGJlIGxlc3MgdGhhbiAxMDAAAAAAFUV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RTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwBgcHaUNugw==", "chainId": 84, "height": 556166, "spentComplexity": 0 } View: original | compacted Prev: 5tHV3wuijJHDsAixUxdf6yqZMs5kA1eFjWPLFtVoUUM3 Next: 7mVp76F4UpMeDWKvdDEYANqpQt8Ve2z29SWPoeifPe8m Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let RouletteSections = 21 | |
7 | 7 | ||
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" | |
9 | 17 | ||
10 | 18 | let ErrorOnlyWavesAccepted = "error_only_waves_accepted" | |
11 | 19 | ||
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 | + | ||
12 | 33 | func NewGameId () = { | |
13 | - | let gameNum = match getInteger(this, | |
34 | + | let gameNum = match getInteger(this, DataGameNumberKey) { | |
14 | 35 | case num: Int => | |
15 | 36 | num | |
16 | 37 | case _ => | |
36 | 57 | @Callable(i) | |
37 | 58 | func bet (expectedResult) = { | |
38 | 59 | let gameNumber = NewGameId() | |
39 | - | let gameId = toBase58String(i.transactionId) | |
60 | + | let gameTransactionId = toBase58String(i.transactionId) | |
61 | + | let address = toBase58String(i.caller.bytes) | |
40 | 62 | 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)]) | |
42 | 74 | } | |
43 | 75 | ||
44 | 76 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ServerPublicKey = base58'HSP9V7edVKjfLJUfRkEF6vfV9Tyz4Us4yqH9rkwqnHY' | |
5 | 5 | ||
6 | 6 | let RouletteSections = 21 | |
7 | 7 | ||
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" | |
9 | 17 | ||
10 | 18 | let ErrorOnlyWavesAccepted = "error_only_waves_accepted" | |
11 | 19 | ||
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 | + | ||
12 | 33 | func NewGameId () = { | |
13 | - | let gameNum = match getInteger(this, | |
34 | + | let gameNum = match getInteger(this, DataGameNumberKey) { | |
14 | 35 | case num: Int => | |
15 | 36 | num | |
16 | 37 | case _ => | |
17 | 38 | 0 | |
18 | 39 | } | |
19 | 40 | (gameNum + 1) | |
20 | 41 | } | |
21 | 42 | ||
22 | 43 | ||
23 | 44 | @Callable(i) | |
24 | 45 | func GenerateRandInt (gameId,rsaSign) = { | |
25 | 46 | let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), ServerPublicKey) | |
26 | 47 | if (rsaSigValid) | |
27 | 48 | then { | |
28 | 49 | let rand = (toInt(sha256(toBytes(rsaSign))) % RouletteSections) | |
29 | 50 | WriteSet([DataEntry("orig", toInt(sha256(toBytes(rsaSign)))), DataEntry("rand", rand)]) | |
30 | 51 | } | |
31 | 52 | else throw("Invalid RSA signature") | |
32 | 53 | } | |
33 | 54 | ||
34 | 55 | ||
35 | 56 | ||
36 | 57 | @Callable(i) | |
37 | 58 | func bet (expectedResult) = { | |
38 | 59 | let gameNumber = NewGameId() | |
39 | - | let gameId = toBase58String(i.transactionId) | |
60 | + | let gameTransactionId = toBase58String(i.transactionId) | |
61 | + | let address = toBase58String(i.caller.bytes) | |
40 | 62 | 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)]) | |
42 | 74 | } | |
43 | 75 | ||
44 | 76 | ||
45 | 77 | ||
46 | 78 | @Callable(i) | |
47 | 79 | func bet111 (expectedResult) = { | |
48 | 80 | let lastAuctionIdKey = "last_auction_id" | |
49 | 81 | let lastAuctionId = match getInteger(this, lastAuctionIdKey) { | |
50 | 82 | case a: Int => | |
51 | 83 | a | |
52 | 84 | case _ => | |
53 | 85 | 0 | |
54 | 86 | } | |
55 | 87 | let id = (lastAuctionId + 1) | |
56 | 88 | let newAuctionId = toString(id) | |
57 | 89 | let ownerWallet = toBase58String(i.caller.bytes) | |
58 | 90 | let pmt = value(i.payment) | |
59 | 91 | if (isDefined(pmt.assetId)) | |
60 | 92 | then throw(ErrorOnlyWavesAccepted) | |
61 | 93 | else { | |
62 | 94 | let assetId = toBase58String(value(pmt.assetId)) | |
63 | 95 | let auctionDurationKey = (("auction_" + newAuctionId) + "_duration") | |
64 | 96 | let auctionMinBidKey = (("auction_" + newAuctionId) + "_min_bid") | |
65 | 97 | let auctionLastBidKey = (("auction_" + newAuctionId) + "_last_bid") | |
66 | 98 | let auctionLastBidOwnerKey = (("auction_" + newAuctionId) + "_last_bid_owner") | |
67 | 99 | let auctionOwnerKey = (("auction_" + newAuctionId) + "_owner") | |
68 | 100 | let auctionAmountKey = (("auction_" + newAuctionId) + "_amount") | |
69 | 101 | let auctionAssetIdKey = (("auction_" + newAuctionId) + "_asset_id") | |
70 | 102 | let auctionIsActiveKey = (("auction_" + newAuctionId) + "_is_active") | |
71 | 103 | let userBalanceKey = ((("balance_" + ownerWallet) + "_") + assetId) | |
72 | 104 | let currentAmount = match getInteger(this, userBalanceKey) { | |
73 | 105 | case a: Int => | |
74 | 106 | a | |
75 | 107 | case _ => | |
76 | 108 | 0 | |
77 | 109 | } | |
78 | 110 | let newAmount = (currentAmount + pmt.amount) | |
79 | 111 | 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 | 112 | } | |
81 | 113 | } | |
82 | 114 | ||
83 | 115 | ||
84 | 116 | @Verifier(tx) | |
85 | 117 | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
86 | 118 | then match tx { | |
87 | 119 | case stx: SetScriptTransaction => | |
88 | 120 | true | |
89 | 121 | case _ => | |
90 | 122 | false | |
91 | 123 | } | |
92 | 124 | else false | |
93 | 125 |
github/deemru/w8io/026f985 38.78 ms ◑