tx · 23uNSTdLVq9AJYdPTqaUC1sWqEtuiRFqzz63v1XtuaHh 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT: -0.01400000 Waves 2019.06.23 14:06 [554604] smart account 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT > SELF 0.00000000 Waves
{ "type": 13, "id": "23uNSTdLVq9AJYdPTqaUC1sWqEtuiRFqzz63v1XtuaHh", "fee": 1400000, "feeAssetId": null, "timestamp": 1561288059932, "version": 1, "sender": "3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT", "senderPublicKey": "Bhyvkx4xdbEi4KPJNZSzx9gZgzgyLEsavuj2kYSt7SST", "proofs": [ "38LE3WA8oW37AQ53t59atfDdBFvMogEK1Ec69bp4CQmAQ9BQySGnNFphmky24oAKCQTDEpiBV7XMLPyP7Lk8Be8R" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAABZFcnJvck9ubHlXYXZlc0FjY2VwdGVkAgAAABllcnJvcl9vbmx5X3dhdmVzX2FjY2VwdGVkAAAAAA9TZXJ2ZXJQdWJsaWNLZXkBAAAAGgFUyizbHfX10DqIle41wD/n3rZAR7k35/dEAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAAgAAAAFpAQAAAA9HZW5lcmF0ZVJhbmRJbnQAAAACAAAABmdhbWVJZAAAAAdyc2FTaWduBAAAAAtyc2FTaWdWYWxpZAkAAfQAAAADCQACWQAAAAEFAAAABmdhbWVJZAkAAlkAAAABBQAAAAdyc2FTaWduBQAAAA9TZXJ2ZXJQdWJsaWNLZXkDBQAAAAtyc2FTaWdWYWxpZAQAAAAEcmFuZAkAAGoAAAACCQAEsQAAAAEJAAH3AAAAAQkAAZsAAAABBQAAAAdyc2FTaWduBQAAABBSb3VsZXR0ZVNlY3Rpb25zCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAARvcmlnCQAEsQAAAAEJAAH3AAAAAQkA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View: original | compacted Prev: 31GxSwSmiVzH3wLTdCjjLf2WZjKuRhXvejftbzSt2Dqb Next: 469nR6kLbqvmHhEbJJUes3SiKNzuykLrQXUuhqW9G8Dx Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ErrorOnlyWavesAccepted = "error_only_waves_accepted" | |
5 | 5 | ||
6 | - | let publicKey = base58'3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT' | |
6 | + | let ServerPublicKey = base58'3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT' | |
7 | + | ||
8 | + | let RouletteSections = 21 | |
7 | 9 | ||
8 | 10 | @Callable(i) | |
9 | 11 | func GenerateRandInt (gameId,rsaSign) = { | |
10 | - | let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), | |
12 | + | let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), ServerPublicKey) | |
11 | 13 | if (rsaSigValid) | |
12 | 14 | then { | |
13 | - | let rand = (toInt(sha256(toBytes(rsaSign))) % | |
15 | + | let rand = (toInt(sha256(toBytes(rsaSign))) % RouletteSections) | |
14 | 16 | WriteSet([DataEntry("orig", toInt(sha256(toBytes(rsaSign)))), DataEntry("rand", rand)]) | |
15 | 17 | } | |
16 | 18 | else throw("Invalid RSA signature") | |
17 | 19 | } | |
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | @Callable(i) | |
22 | - | func SetData (k,v) = if ((k == "hello")) | |
23 | - | then throw("NONONON!!") | |
24 | - | else WriteSet([DataEntry(k, v)]) | |
25 | 20 | ||
26 | 21 | ||
27 | 22 | ||
63 | 58 | } | |
64 | 59 | ||
65 | 60 | ||
61 | + | @Verifier(tx) | |
62 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
63 | + | then match tx { | |
64 | + | case ttx: TransferTransaction => | |
65 | + | ((wavesBalance(this) - ttx.amount) >= 0) | |
66 | + | case stx: SetScriptTransaction => | |
67 | + | true | |
68 | + | case _ => | |
69 | + | false | |
70 | + | } | |
71 | + | else false | |
72 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ErrorOnlyWavesAccepted = "error_only_waves_accepted" | |
5 | 5 | ||
6 | - | let publicKey = base58'3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT' | |
6 | + | let ServerPublicKey = base58'3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT' | |
7 | + | ||
8 | + | let RouletteSections = 21 | |
7 | 9 | ||
8 | 10 | @Callable(i) | |
9 | 11 | func GenerateRandInt (gameId,rsaSign) = { | |
10 | - | let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), | |
12 | + | let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), ServerPublicKey) | |
11 | 13 | if (rsaSigValid) | |
12 | 14 | then { | |
13 | - | let rand = (toInt(sha256(toBytes(rsaSign))) % | |
15 | + | let rand = (toInt(sha256(toBytes(rsaSign))) % RouletteSections) | |
14 | 16 | WriteSet([DataEntry("orig", toInt(sha256(toBytes(rsaSign)))), DataEntry("rand", rand)]) | |
15 | 17 | } | |
16 | 18 | else throw("Invalid RSA signature") | |
17 | 19 | } | |
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | @Callable(i) | |
22 | - | func SetData (k,v) = if ((k == "hello")) | |
23 | - | then throw("NONONON!!") | |
24 | - | else WriteSet([DataEntry(k, v)]) | |
25 | 20 | ||
26 | 21 | ||
27 | 22 | ||
28 | 23 | @Callable(i) | |
29 | 24 | func bet (expectedResult) = { | |
30 | 25 | let lastAuctionIdKey = "last_auction_id" | |
31 | 26 | let lastAuctionId = match getInteger(this, lastAuctionIdKey) { | |
32 | 27 | case a: Int => | |
33 | 28 | a | |
34 | 29 | case _ => | |
35 | 30 | 0 | |
36 | 31 | } | |
37 | 32 | let id = (lastAuctionId + 1) | |
38 | 33 | let newAuctionId = toString(id) | |
39 | 34 | let ownerWallet = toBase58String(i.caller.bytes) | |
40 | 35 | let pmt = value(i.payment) | |
41 | 36 | if (isDefined(pmt.assetId)) | |
42 | 37 | then throw(ErrorOnlyWavesAccepted) | |
43 | 38 | else { | |
44 | 39 | let assetId = toBase58String(value(pmt.assetId)) | |
45 | 40 | let auctionDurationKey = (("auction_" + newAuctionId) + "_duration") | |
46 | 41 | let auctionMinBidKey = (("auction_" + newAuctionId) + "_min_bid") | |
47 | 42 | let auctionLastBidKey = (("auction_" + newAuctionId) + "_last_bid") | |
48 | 43 | let auctionLastBidOwnerKey = (("auction_" + newAuctionId) + "_last_bid_owner") | |
49 | 44 | let auctionOwnerKey = (("auction_" + newAuctionId) + "_owner") | |
50 | 45 | let auctionAmountKey = (("auction_" + newAuctionId) + "_amount") | |
51 | 46 | let auctionAssetIdKey = (("auction_" + newAuctionId) + "_asset_id") | |
52 | 47 | let auctionIsActiveKey = (("auction_" + newAuctionId) + "_is_active") | |
53 | 48 | let userBalanceKey = ((("balance_" + ownerWallet) + "_") + assetId) | |
54 | 49 | let currentAmount = match getInteger(this, userBalanceKey) { | |
55 | 50 | case a: Int => | |
56 | 51 | a | |
57 | 52 | case _ => | |
58 | 53 | 0 | |
59 | 54 | } | |
60 | 55 | let newAmount = (currentAmount + pmt.amount) | |
61 | 56 | 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)]) | |
62 | 57 | } | |
63 | 58 | } | |
64 | 59 | ||
65 | 60 | ||
61 | + | @Verifier(tx) | |
62 | + | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
63 | + | then match tx { | |
64 | + | case ttx: TransferTransaction => | |
65 | + | ((wavesBalance(this) - ttx.amount) >= 0) | |
66 | + | case stx: SetScriptTransaction => | |
67 | + | true | |
68 | + | case _ => | |
69 | + | false | |
70 | + | } | |
71 | + | else false | |
72 | + |
github/deemru/w8io/169f3d6 41.44 ms ◑