tx · 7gBhkZkMAsTDKCE6Z8rkRCqo7TFruS5BqVzJmLhcaxde 3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX: -0.05000000 Waves 2019.10.29 06:55 [740918] smart account 3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX > SELF 0.00000000 Waves
{ "type": 13, "id": "7gBhkZkMAsTDKCE6Z8rkRCqo7TFruS5BqVzJmLhcaxde", "fee": 5000000, "feeAssetId": null, "timestamp": 1572321326922, "version": 1, "sender": "3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX", "senderPublicKey": "ACfUG5PwG2GssMuyEwVEhkYAbbbP1geSHR8XoNxLyu6V", "proofs": [ "3GMk3p6gLHFQDVk3BAEfoKNRD2izKw2yciKN5k4Le911vQx9FSZbBNGs8K6aa9mHJRjCJ8NKZPkkngRDsheKqHVs" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAAHQAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQWc0ZEFSNlhiQkRBUzloci9FajNkSnY2RmZjNDY2eC9tT0dNV1UzbHJBQnMzcWE4QkhtdUpHbmtmYnBFZjJ2QXdZVE9XUHZ2emZNMTBPQmJmbG9TeXEzYzlNS3Z5VGUxbHVCTEdxVzR2WlVYSXl2U2d6MWxpeVVWZWZJUXkzZHlGOWpiZVRaYkMwYmJjVC83TzNERUwrMDF6NkErckRDYWNTWjBsR29sU1E2QW5oTHh6SWtWcE9RSmJyQm1DK3grWnVaUENNV3pKeW5kNWFlT243amFqL21rUlZ5eGU2Zy8wT2hXejROaWlaWGV1TVJCKzhtS3kwZldEL1VsSWxaV0hzQVMyWm1ya1hLcWpMcTAvMHdyOElMSmt6bmpTcWRuSTVJYmpnM3VRcmovNEFOK2k5cjI4YVE3My9aa1B0WTVTYncwQU9pQUJCdTdnSG1xOWF5VnhaUUlEQVFBQgAAAAA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VCZXRBbmREZWZpbmVXaW5BbXQAAAADCAUAAAAHcGF5bWVudAAAAAZhbW91bnQFAAAABnBhQ29pbgUAAAAHcGF5VHlwZQQAAAALZ2FtZURhdGFTdHIJAQAAABFGb3JtYXRHYW1lRGF0YVN0cgAAAAgFAAAADlNUQVRFU1VCTUlUVEVEBQAAAAZwYUNvaW4FAAAAD3BsYXllckFQdWJLZXk1OAUAAAAHcGF5VHlwZQgFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAAZ3aW5BbXQCAAAAAAIAAAAACQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAPR0FNRVNDT1VOVEVSS0VZBQAAAApuZXdHYW1lTnVtCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAZnYW1lSWQFAAAAC2dhbWVEYXRhU3RyBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAB0/mVu", "chainId": 84, "height": 740918, "spentComplexity": 0 } View: original | compacted Prev: FwfpqDPfs3EvW1znFgeaBgWkz9oSo2YyLTkwEc4xbs2w Next: EoCkuPVCpYaq7u2F9FbKvidjBrVPjqH74RpZeTT313mA Diff:
Old | New | Differences | |
---|---|---|---|
95 | 95 | func FormatGameDataStr (gameState,playerACoin,playerAPubKey58,payType,payAmount,winAmt,playerBCoin,playerBPubKey58) = { | |
96 | 96 | let fullStateStr = ((((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerACoin)) + "_") + FormatGameDataParam(playerAPubKey58)) + "_") + FormatGameDataParam(payType)) + "_") + FormatGameDataParam(toString(payAmount))) + "_") + FormatGameDataParam(toString(winAmt))) | |
97 | 97 | if (if ((playerBCoin == "")) | |
98 | - | then | |
99 | - | else | |
98 | + | then true | |
99 | + | else (playerBPubKey58 == "")) | |
100 | 100 | then fullStateStr | |
101 | 101 | else ((((fullStateStr + "_") + FormatGameDataParam(playerBCoin)) + "_") + FormatGameDataParam(playerBPubKey58)) | |
102 | 102 | } |
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 | 6 | let GAMESCOUNTERKEY = "$GAME_NUM" | |
7 | 7 | ||
8 | 8 | let WBET = base58'23vgV9p9pD83A7CFbsDEc4zjanep7UeFo4ZRS6oGorhv' | |
9 | 9 | ||
10 | 10 | let FEEWAVESBET = 4 | |
11 | 11 | ||
12 | 12 | let FEEMCAFEE = 2 | |
13 | 13 | ||
14 | 14 | let WAVELET = 100000000 | |
15 | 15 | ||
16 | 16 | let STATESUBMITTED = "SUBMITTED" | |
17 | 17 | ||
18 | 18 | let STATEACCEPTED = "ACCEPTED" | |
19 | 19 | ||
20 | 20 | let STATEFINISHED = "FINISHED" | |
21 | 21 | ||
22 | 22 | let STATECANCELED = "CANCELED" | |
23 | 23 | ||
24 | 24 | let COINRED = "RED" | |
25 | 25 | ||
26 | 26 | let COINBLUE = "BLUE" | |
27 | 27 | ||
28 | 28 | let BETMINWAVES = ((1 * WAVELET) / 2) | |
29 | 29 | ||
30 | 30 | let BETMINWBET = (100 * WAVELET) | |
31 | 31 | ||
32 | 32 | let IdxGameState = 0 | |
33 | 33 | ||
34 | 34 | let IdxPlayerACoin = 1 | |
35 | 35 | ||
36 | 36 | let IdxPlayerAPubKey58 = 2 | |
37 | 37 | ||
38 | 38 | let IdxPayType = 3 | |
39 | 39 | ||
40 | 40 | let IdxPayAmt = 4 | |
41 | 41 | ||
42 | 42 | let IdxWinAmt = 5 | |
43 | 43 | ||
44 | 44 | let IdxPlayerBCoin = 6 | |
45 | 45 | ||
46 | 46 | let IdxPlayerBPubKey58 = 7 | |
47 | 47 | ||
48 | 48 | func IncrementGameNum () = { | |
49 | 49 | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
50 | 50 | case num: Int => | |
51 | 51 | num | |
52 | 52 | case _ => | |
53 | 53 | 0 | |
54 | 54 | } | |
55 | 55 | (gameNum + 1) | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func generateNumber (inv,max,min) = { | |
60 | 60 | let lastPlay = match getBinary(this, "lastPlay") { | |
61 | 61 | case s: ByteVector => | |
62 | 62 | s | |
63 | 63 | case a: Unit => | |
64 | 64 | base58'2ee4oFDYriWJ9EMeR' | |
65 | 65 | case _ => | |
66 | 66 | throw() | |
67 | 67 | } | |
68 | 68 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
69 | 69 | (((toInt(sha256(rand)) % 1000) % ((max - min) + 1)) + 1) | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func paymentType (payment) = if ((payment.assetId == WBET)) | |
74 | 74 | then "WBET" | |
75 | 75 | else "WAVES" | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func tokenType (token) = if ((token == "WBET")) | |
79 | 79 | then WBET | |
80 | 80 | else unit | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func FormatGameDataParam (p) = { | |
84 | 84 | let s = size(p) | |
85 | 85 | if ((s == 0)) | |
86 | 86 | then throw("Parameter size must be greater then 0") | |
87 | 87 | else if ((s > 99)) | |
88 | 88 | then throw("Parameter size must be less then 100") | |
89 | 89 | else if ((10 > s)) | |
90 | 90 | then (("0" + toString(s)) + p) | |
91 | 91 | else (toString(s) + p) | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func FormatGameDataStr (gameState,playerACoin,playerAPubKey58,payType,payAmount,winAmt,playerBCoin,playerBPubKey58) = { | |
96 | 96 | let fullStateStr = ((((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerACoin)) + "_") + FormatGameDataParam(playerAPubKey58)) + "_") + FormatGameDataParam(payType)) + "_") + FormatGameDataParam(toString(payAmount))) + "_") + FormatGameDataParam(toString(winAmt))) | |
97 | 97 | if (if ((playerBCoin == "")) | |
98 | - | then | |
99 | - | else | |
98 | + | then true | |
99 | + | else (playerBPubKey58 == "")) | |
100 | 100 | then fullStateStr | |
101 | 101 | else ((((fullStateStr + "_") + FormatGameDataParam(playerBCoin)) + "_") + FormatGameDataParam(playerBPubKey58)) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func ValidateBetAndDefineWinAmt (amount,playerCoin,paymentType) = if (if ((playerCoin != COINRED)) | |
106 | 106 | then (playerCoin != COINBLUE) | |
107 | 107 | else false) | |
108 | 108 | then throw("Invalid play, change your bet to RED or BLUE coin. Game aborted.") | |
109 | 109 | else if (if ((paymentType == "WBET")) | |
110 | 110 | then (BETMINWBET > amount) | |
111 | 111 | else false) | |
112 | 112 | then throw(("The minimum bet on Wbet is " + toString((BETMINWBET / WAVELET)))) | |
113 | 113 | else if (if ((paymentType == "WAVES")) | |
114 | 114 | then (BETMINWAVES > amount) | |
115 | 115 | else false) | |
116 | 116 | then throw(("The minimum bet on Waves is " + toString((BETMINWAVES / WAVELET)))) | |
117 | 117 | else (((amount * 2) * WAVELET) * ((100 - (FEEWAVESBET + FEEMCAFEE)) / 100)) | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | @Callable(i) | |
121 | 121 | func playCoin (paCoin) = { | |
122 | 122 | let gameId = toBase58String(i.transactionId) | |
123 | 123 | let gameIdUsed = isDefined(getString(this, gameId)) | |
124 | 124 | let payment = extract(i.payment) | |
125 | 125 | let feeAssetId = isDefined(i.feeAssetId) | |
126 | 126 | if (if ((payment.assetId != assetInfo(base58'WAVES'))) | |
127 | 127 | then (payment.assetId != WBET) | |
128 | 128 | else false) | |
129 | 129 | then throw("Payment should be in Wbet or Waves. Game aborted.") | |
130 | 130 | else if (feeAssetId) | |
131 | 131 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
132 | 132 | else if (gameIdUsed) | |
133 | 133 | then throw("Passed gameId had been used before. Game aborted.") | |
134 | 134 | else { | |
135 | 135 | let newGameNum = IncrementGameNum() | |
136 | 136 | let playerAPubKey58 = toBase58String(i.callerPublicKey) | |
137 | 137 | let payType = paymentType(payment) | |
138 | 138 | let winAmt = ValidateBetAndDefineWinAmt(payment.amount, paCoin, payType) | |
139 | 139 | let gameDataStr = FormatGameDataStr(STATESUBMITTED, paCoin, playerAPubKey58, payType, payment.amount, winAmt, "", "") | |
140 | 140 | ScriptResult(WriteSet([DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet(nil)) | |
141 | 141 | } | |
142 | 142 | } | |
143 | 143 | ||
144 | 144 |
github/deemru/w8io/169f3d6 55.07 ms ◑