tx · Ac6W2vMfD6FJUeYP86ZNzBo1VNXiRzqZZJzwJGML12Pi 3N778wrQUp2Fm75ZTwtZ2WM7L9R2hT1Pavb: -0.01400000 Waves 2020.03.17 19:58 [913544] smart account 3N778wrQUp2Fm75ZTwtZ2WM7L9R2hT1Pavb > SELF 0.00000000 Waves
{ "type": 13, "id": "Ac6W2vMfD6FJUeYP86ZNzBo1VNXiRzqZZJzwJGML12Pi", "fee": 1400000, "feeAssetId": null, "timestamp": 1584464257079, "version": 1, "sender": "3N778wrQUp2Fm75ZTwtZ2WM7L9R2hT1Pavb", "senderPublicKey": "GDLTHJjR9hamQRzEMe3M685bqZSbdGzjtEXWbQupogZQ", "proofs": [ "4JWXeYFZ8CizapU3tFijzw6KEYpxu7SJXcowtWLaDsrtj4fNSdePp3VToE4rus8j43x9Vd19M2q7tCaXMATB4yj6" ], "script": "base64:AAIDAAAAAAAAAA4IARIDCgEIEgUKAwgIAgAAAA0AAAAACVJTQVBVQkxJQwkAAlsAAAABAgAAAY9iYXNlNjQ6TUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUFnNGRBUjZYYkJEQVM5aHIvRWozZEp2NkZmYzQ2NngvbU9HTVdVM2xyQUJzM3FhOEJIbXVKR25rZmJwRWYydkF3WVRPV1B2dnpmTTEwT0JiZmxvU3lxM2M5TUt2eVRlMWx1QkxHcVc0dlpVWEl5dlNnejFsaXlVVmVmSVF5M2R5RjlqYmVUWmJDMGJiY1QvN08zREVMKzAxejZBK3JEQ2FjU1owbEdvbFNRNkFuaEx4eklrVnBPUUpickJtQyt4K1p1WlBDTVd6SnluZDVhZU9uN2phai9ta1JWeXhlNmcvME9oV3o0TmlpWlhldU1SQis4bUt5MGZXRC9VbElsWldIc0FTMlptcmtYS3FqTHEwLzB3cjhJTEprem5qU3Fkbkk1SWJqZzN1UXJqLzRBTitpOXIyOGFRNzMvWmtQdFk1U2J3MEFPaUFCQnU3Z0htcTlheVZ4W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ZXROYW1lBAAAAAZ3aW5BbXQJAQAAAA1wYXJzZUludFZhbHVlAAAAAQUAAAAHcGF5bWVudAQAAAAJYXNzZXRUeXBlCQEAAAANU3RyaW5nVG9Bc3NldAAAAAEFAAAACWFzc2V0TmFtZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABmdhbWVJZAUAAAAObmV3R2FtZURhdGFTdHIFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAA1wbGF5ZXJBZGRyZXNzBQAAAAZ3aW5BbXQFAAAACWFzc2V0VHlwZQUAAAADbmlsAAAAACdKxL0=", "chainId": 84, "height": 913544, "spentComplexity": 0 } View: original | compacted Prev: DcFGxUgQ9WHYogWJYfFmvDjPuJzGMb2w4r5dCYwXCgov Next: TuPHCiQEEJMxmd5v1RtF6Tn6FjzT3z9EpNC84q4kUP1 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let RSAPUBLIC = fromBase64String(" | |
4 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4dAR6XbBDAS9hr/Ej3dJv6Ffc466x/mOGMWU3lrABs3qa8BHmuJGnkfbpEf2vAwYTOWPvvzfM10OBbfloSyq3c9MKvyTe1luBLGqW4vZUXIyvSgz1liyUVefIQy3dyF9jbeTZbC0bbcT/7O3DEL+01z6A+rDCacSZ0lGolSQ6AnhLxzIkVpOQJbrBmC+x+ZuZPCMWzJynd5aeOn7jaj/mkRVyxe6g/0OhWz4NiiZXeuMRB+8mKy0fWD/UlIlZWHsAS2ZmrkXKqjLq0/0wr8ILJkznjSqdnI5Ibjg3uQrj/4AN+i9r28aQ73/ZkPtY5Sbw0AOiABBu7gHmq9ayVxZQIDAQAB") | |
5 | 5 | ||
6 | 6 | let WAVES = base58'WAVES' | |
7 | 7 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let RSAPUBLIC = fromBase64String(" | |
4 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4dAR6XbBDAS9hr/Ej3dJv6Ffc466x/mOGMWU3lrABs3qa8BHmuJGnkfbpEf2vAwYTOWPvvzfM10OBbfloSyq3c9MKvyTe1luBLGqW4vZUXIyvSgz1liyUVefIQy3dyF9jbeTZbC0bbcT/7O3DEL+01z6A+rDCacSZ0lGolSQ6AnhLxzIkVpOQJbrBmC+x+ZuZPCMWzJynd5aeOn7jaj/mkRVyxe6g/0OhWz4NiiZXeuMRB+8mKy0fWD/UlIlZWHsAS2ZmrkXKqjLq0/0wr8ILJkznjSqdnI5Ibjg3uQrj/4AN+i9r28aQ73/ZkPtY5Sbw0AOiABBu7gHmq9ayVxZQIDAQAB") | |
5 | 5 | ||
6 | 6 | let WAVES = 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 | 47 | then WAVES | |
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([ScriptTransfer(WALLETCOMMUNITY, fraction(payment.amount, FEECOMMUNITY, 100), payment.assetId), ScriptTransfer(WALLETWAVESBET, fraction(payment.amount, FEEWAVESBET, 100), payment.assetId), ScriptTransfer(WALLETMCAFEE, fraction(payment.amount, FEEMCAFEE, 100), payment.assetId)])) | |
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, winAmt, assetType)])) | |
96 | 96 | } | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 |
github/deemru/w8io/026f985 28.26 ms ◑