tx · 738Tdmgurm6whfqdVz7BoQuw5eEm7MA4K82Ln6nYLGwP 3N778wrQUp2Fm75ZTwtZ2WM7L9R2hT1Pavb: -0.01400000 Waves 2020.04.04 20:26 [939763] smart account 3N778wrQUp2Fm75ZTwtZ2WM7L9R2hT1Pavb > SELF 0.00000000 Waves
{ "type": 13, "id": "738Tdmgurm6whfqdVz7BoQuw5eEm7MA4K82Ln6nYLGwP", "fee": 1400000, "feeAssetId": null, "timestamp": 1586021192988, "version": 1, "sender": "3N778wrQUp2Fm75ZTwtZ2WM7L9R2hT1Pavb", "senderPublicKey": "GDLTHJjR9hamQRzEMe3M685bqZSbdGzjtEXWbQupogZQ", "proofs": [ "4KmrQnjk9B1XDJfKZaGJ48sEAZoZUjVGXtBa2Por3yNcZtkcmSS75Rv3a4eteJnX3yJcZ88nDyeVJKbiBBLd5cba" ], "script": "base64:AAIDAAAAAAAAAA4IARIDCgEIEgUKAwgIAgAAAA0AAAAACVJTQVBVQkxJQwkAAlsAAAABAgAAAY9iYXNlNjQ6TUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFnNGRBUjZYYkJEQVM5aHIvRWozZEp2NkZmYzQ2NngvbU9HTVdVM2xyQUJzM3FhOEJIbXVKR25rZmJwRWYydkF3WVRPV1B2dnpmTTEwT0JiZmxvU3lxM2M5TUt2eVRlMWx1QkxHcVc0dlpVWEl5dlNnejFsaXlVVmVmSVF5M2R5RjlqYmVUWmJDMGJiY1QvN08zREVMKzAxejZBK3JEQ2FjU1owbEdvbFNRNkFuaEx4eklrVnBPUUpickJtQyt4K1p1WlBDTVd6SnluZDVhZU9uN2phai9ta1JWeXhlNmcvME9oV3o0TmlpWlhldU1SQis4bUt5MGZXRC9VbElsWldIc0FTMlptcmtYS3FqTHEwLzB3cjhJTEprem5qU3Fkbkk1SWJqZzN1UXJqLzRBTitpOXIyOGFRNzMvWmtQdFk1U2J3MEFPaUFCQnU3Z0htcTlheVZ4W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VRZAAAAAAAAAABkBQAAAAlhc3NldFR5cGUJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAOV0FMTEVUV0FWRVNCRVQJAABrAAAAAwUAAAAGd2luQW10BQAAAAtGRUVXQVZFU0JFVAAAAAAAAAAAZAUAAAAJYXNzZXRUeXBlCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADFdBTExFVE1DQUZFRQkAAGsAAAADBQAAAAZ3aW5BbXQFAAAACUZFRU1DQUZFRQAAAAAAAAAAZAUAAAAJYXNzZXRUeXBlBQAAAANuaWwAAAAAMl/puA==", "chainId": 84, "height": 939763, "spentComplexity": 0 } View: original | compacted Prev: BEvNjZjdjVpSovCWuaaSHUAvphTmNqRxhy97oi3nWRq4 Next: HgXmS98moHnSCTah5zGDWPhjBLCPfdsrFno9AK6oTiAD Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4dAR6XbBDAS9hr/Ej3dJv6Ffc466x/mOGMWU3lrABs3qa8BHmuJGnkfbpEf2vAwYTOWPvvzfM10OBbfloSyq3c9MKvyTe1luBLGqW4vZUXIyvSgz1liyUVefIQy3dyF9jbeTZbC0bbcT/7O3DEL+01z6A+rDCacSZ0lGolSQ6AnhLxzIkVpOQJbrBmC+x+ZuZPCMWzJynd5aeOn7jaj/mkRVyxe6g/0OhWz4NiiZXeuMRB+8mKy0fWD/UlIlZWHsAS2ZmrkXKqjLq0/0wr8ILJkznjSqdnI5Ibjg3uQrj/4AN+i9r28aQ73/ZkPtY5Sbw0AOiABBu7gHmq9ayVxZQIDAQAB") | |
5 | 5 | ||
6 | - | let WAVES = base58'WAVES' | |
6 | + | let WAVES = assetInfo(base58'WAVES') | |
7 | 7 | ||
8 | 8 | let WBET = base58'A4q1mYKo11yuH9gmvDodeJoksagcyQzeFE9JtphMWddw' | |
9 | 9 | ||
44 | 44 | func StringToAsset (assetStr) = if ((assetStr == "WBET")) | |
45 | 45 | then WBET | |
46 | 46 | else if ((assetStr == "WAVES")) | |
47 | - | then | |
47 | + | then unit | |
48 | 48 | else if ((assetStr == "ROYALS")) | |
49 | 49 | then ROYALS | |
50 | 50 | else throw("Invalid asset") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4dAR6XbBDAS9hr/Ej3dJv6Ffc466x/mOGMWU3lrABs3qa8BHmuJGnkfbpEf2vAwYTOWPvvzfM10OBbfloSyq3c9MKvyTe1luBLGqW4vZUXIyvSgz1liyUVefIQy3dyF9jbeTZbC0bbcT/7O3DEL+01z6A+rDCacSZ0lGolSQ6AnhLxzIkVpOQJbrBmC+x+ZuZPCMWzJynd5aeOn7jaj/mkRVyxe6g/0OhWz4NiiZXeuMRB+8mKy0fWD/UlIlZWHsAS2ZmrkXKqjLq0/0wr8ILJkznjSqdnI5Ibjg3uQrj/4AN+i9r28aQ73/ZkPtY5Sbw0AOiABBu7gHmq9ayVxZQIDAQAB") | |
5 | 5 | ||
6 | - | let WAVES = base58'WAVES' | |
6 | + | let WAVES = assetInfo(base58'WAVES') | |
7 | 7 | ||
8 | 8 | let WBET = base58'A4q1mYKo11yuH9gmvDodeJoksagcyQzeFE9JtphMWddw' | |
9 | 9 | ||
10 | 10 | let ROYALS = base58'BSt87FHK4td7NvDuzKYeb2ETVersiZDr4QW6WMX1BaFU' | |
11 | 11 | ||
12 | 12 | let WALLETCOMMUNITY = Address(base58'3MtCy2PCFPyu8A9SRNL4qUo1V17SGLHftD8') | |
13 | 13 | ||
14 | 14 | let WALLETWAVESBET = Address(base58'3MxK12u62zsu9xh3hU7p5iJncCLANd3zhTZ') | |
15 | 15 | ||
16 | 16 | let WALLETMCAFEE = Address(base58'3MxK12u62zsu9xh3hU7p5iJncCLANd3zhTZ') | |
17 | 17 | ||
18 | 18 | let FEECOMMUNITY = 1 | |
19 | 19 | ||
20 | 20 | let FEEWAVESBET = 3 | |
21 | 21 | ||
22 | 22 | let FEEMCAFEE = 2 | |
23 | 23 | ||
24 | 24 | func ExtractString (id) = { | |
25 | 25 | let rawDataStr = match getString(this, id) { | |
26 | 26 | case str: String => | |
27 | 27 | str | |
28 | 28 | case _ => | |
29 | 29 | throw(("Couldn't find string by " + id)) | |
30 | 30 | } | |
31 | 31 | rawDataStr | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func AssetToString (payment) = if ((payment.assetId == WBET)) | |
36 | 36 | then "WBET" | |
37 | 37 | else if ((payment.assetId == WAVES)) | |
38 | 38 | then "WAVES" | |
39 | 39 | else if ((payment.assetId == ROYALS)) | |
40 | 40 | then "ROYALS" | |
41 | 41 | else throw("Payment should be in Wavesbet, Waves or Royals") | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func StringToAsset (assetStr) = if ((assetStr == "WBET")) | |
45 | 45 | then WBET | |
46 | 46 | else if ((assetStr == "WAVES")) | |
47 | - | then | |
47 | + | then unit | |
48 | 48 | else if ((assetStr == "ROYALS")) | |
49 | 49 | then ROYALS | |
50 | 50 | else throw("Invalid asset") | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | @Callable(i) | |
54 | 54 | func play (tableId) = { | |
55 | 55 | let payment = extract(i.payment) | |
56 | 56 | let feeAssetId = isDefined(i.feeAssetId) | |
57 | 57 | let gameId = toBase58String(i.transactionId) | |
58 | 58 | let gameIdUsed = isDefined(getString(this, gameId)) | |
59 | 59 | if (if (if ((payment.assetId != WBET)) | |
60 | 60 | then (payment.assetId != WAVES) | |
61 | 61 | else false) | |
62 | 62 | then (payment.assetId != ROYALS) | |
63 | 63 | else false) | |
64 | 64 | then throw("Payment should be in Wavesbet, Waves or Royals") | |
65 | 65 | else if (feeAssetId) | |
66 | 66 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
67 | 67 | else if (gameIdUsed) | |
68 | 68 | then throw("Passed GameId had been used before. Game aborted.") | |
69 | 69 | else { | |
70 | 70 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
71 | 71 | let gameDataStr = (((((((("SUBMITTED" + "_") + tableId) + "_") + playerPubKey58) + "_") + toString(payment.amount)) + "_") + AssetToString(payment)) | |
72 | 72 | ScriptResult(WriteSet([DataEntry(gameId, gameDataStr)]), TransferSet(nil)) | |
73 | 73 | } | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | ||
78 | 78 | @Callable(i) | |
79 | 79 | func withdraw (gameId,payment,rsaSign) = { | |
80 | 80 | let gameDataList = split(ExtractString(gameId), "_") | |
81 | 81 | let gameState = gameDataList[0] | |
82 | 82 | let tableId = gameDataList[1] | |
83 | 83 | let playerPubKey58 = gameDataList[2] | |
84 | 84 | let assetName = gameDataList[4] | |
85 | 85 | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
86 | 86 | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
87 | 87 | if ((gameState != "SUBMITTED")) | |
88 | 88 | then throw("Invalid game state for passed gameId. Game aborted.") | |
89 | 89 | else if (!(rsaSigValid)) | |
90 | 90 | then throw("Invalid RSA Verification") | |
91 | 91 | else { | |
92 | 92 | let newGameDataStr = ((((((("WON_" + tableId) + "_") + playerPubKey58) + "_") + payment) + "_") + assetName) | |
93 | 93 | let winAmt = parseIntValue(payment) | |
94 | 94 | let assetType = StringToAsset(assetName) | |
95 | 95 | ScriptResult(WriteSet([DataEntry(gameId, newGameDataStr)]), TransferSet([ScriptTransfer(playerAddress, fraction(winAmt, 94, 100), assetType), ScriptTransfer(WALLETCOMMUNITY, fraction(winAmt, FEECOMMUNITY, 100), assetType), ScriptTransfer(WALLETWAVESBET, fraction(winAmt, FEEWAVESBET, 100), assetType), ScriptTransfer(WALLETMCAFEE, fraction(winAmt, FEEMCAFEE, 100), assetType)])) | |
96 | 96 | } | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 |
github/deemru/w8io/169f3d6 23.93 ms ◑