tx · F8RX5Zpt8cunT3oTunQW2BRu4FP5HzAYaNHdYHfa1MU4 3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw: -0.00700000 Waves 2023.03.22 19:45 [2501477] smart account 3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw > SELF 0.00000000 Waves
{ "type": 13, "id": "F8RX5Zpt8cunT3oTunQW2BRu4FP5HzAYaNHdYHfa1MU4", "fee": 700000, "feeAssetId": null, "timestamp": 1679503567822, "version": 2, "chainId": 84, "sender": "3N2iycpXC7Fomf1vYLmz9uUWwLR2ZvxRCyw", "senderPublicKey": "3TJ91ZMX9cHrPAcqCiYodSdxYs8AiLNHyvRJNK1PDc6i", "proofs": [ "3sfontfmrzLddg8HD2VovkTD6gLUrtLiGT6Hh9RSCzXWG6GfycazBo2hTtZZnNp7YFEfNQ5Frsx9eg8GxPCkPSsk" ], "script": "base64:BgIcCAISABIDCgEIEgUKAwEBCBIDCgEBEgASAwoBCAUABkF1cnVlcwEgOYDtDd1mVUaSfSlX4MdFqsCgGC27Z5CEtJGKkGOZYFwBCW9ubHlPd25lcgEBaQMJAAACCAUEdGhpcwVieXRlcwgIBQFpBmNhbGxlcgVieXRlcwUEdW5pdAkAAgECKU9ubHkgZGFwcCBhY2NvdW50IGNhbiBjYWxsIHRoaXMgZnVuY3Rpb24hARBnZXRBdXJ1ZXNQYXltZW50AQFpAwkAAAIJAJADAQgFAWkIcGF5bWVudHMAAAkAAgECFFBheW1lbnQgbm90IGF0dGFjaGVkBAFwCQCRAwIIBQFpCHBheW1lbnRzAAAEByRtYXRjaDAIBQFwB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQHYXNzZXRJZAUHJG1hdGNoMAMJAAACBQdhc3NldElkBQZBdXJ1ZXMIBQFwBmFtb3VudAkAAgECIE9ubHkgYXVydWVzIGFjY2VwdGVkIGFzIHBheW1lbnQhCQACAQIgT25seSBhdXJ1ZXMgYWNjZXB0ZWQgYXM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DbnQAAQUDbmlsBQR1bml0CQACAQIcQXNzZXQgYWxyZWFkeSBhZGRlZCB0byBnYW1lIQkAAgECD1dyb25nIE5GVCBzZW50IQkAAgECEENhbid0IGZpbmQgYXNzZXQJAAIBAhtOb3QgYWJsZSB0byBmaW5kIGFzc2V0IGlkISEBaQELcmVtb3ZlQXNzZXQBB2Fzc2V0SWQEBW93bmVyCQERQGV4dHJOYXRpdmUoMTA1MykCBQR0aGlzBQdhc3NldElkAwkAAAIJANkEAQUFb3duZXIICAUBaQZjYWxsZXIFYnl0ZXMEByRtYXRjaDAJAOwHAQkA2QQBBQdhc3NldElkAwkAAQIFByRtYXRjaDACBUFzc2V0BAVhc3NldAUHJG1hdGNoMAQDa2V5CQELZ2V0QXNzZXRLZXkBCAUFYXNzZXQEbmFtZQQHYWRkcmVzcwkA2AQBCAgFAWkGY2FsbGVyBWJ5dGVzBAhhc3NldENudAkBEUBleHRyTmF0aXZlKDEwNTApAgUEdGhpcwkArAICBQdhZGRyZXNzBQNrZXkDCQBmAgUIYXNzZXRDbnQAAAkAlAoCCQDMCAIJAQtEZWxldGVFbnRyeQEFB2Fzc2V0SWQJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgUHYWRkcmVzcwUDa2V5CQBlAgUIYXNzZXRDbnQAAQUDbmlsBQR1bml0CQACAQkArAICCQCsAgICBEFsbCAIBQVhc3NldARuYW1lAhUgYXJlIGxvY2sgaW5zaWRlIGdhbWUJAAIBAhBDYW4ndCBmaW5kIGFzc2V0CQACAQIgWW91IGFyZSBub3Qgb3duZXIgb2YgdGhpcyBhc3NldCEAAdaxNA==", "height": 2501477, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 85chFtf9RwJkFyWCunzsnnEP61TNpVh2WHyMGstNDoto Next: CJxBMuAL2KQRwrwrGw3W9AA6PpppM6jmtUv6GeUp1iwa Diff:
Old | New | Differences | |
---|---|---|---|
133 | 133 | let J = getIntegerValue(this, (k + I)) | |
134 | 134 | let K = Issue(j, G, 1, 0, false) | |
135 | 135 | let L = toBase58String(calculateAssetId(K)) | |
136 | - | $Tuple2([K, ScriptTransfer(c.caller, 1, | |
136 | + | $Tuple2([K, ScriptTransfer(c.caller, 1, calculateAssetId(K)), Burn(a, E), IntegerEntry((k + I), (J + 1)), StringEntry(L, k)], unit) | |
137 | 137 | } | |
138 | 138 | else throw(("Not enough payment to buy " + j)) | |
139 | 139 | } | |
174 | 174 | @Callable(c) | |
175 | 175 | func removeAsset (g) = { | |
176 | 176 | let Q = getStringValue(this, g) | |
177 | - | if (( | |
177 | + | if ((fromBase58String(Q) == c.caller.bytes)) | |
178 | 178 | then { | |
179 | 179 | let f = assetInfo(fromBase58String(g)) | |
180 | 180 | if ($isInstanceOf(f, "Asset")) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'4sUGAwEDLVm6Z3sNbLapWXtEtMkhRU8fypam9dLT4UjM' | |
5 | 5 | ||
6 | 6 | func b (c) = if ((this.bytes == c.caller.bytes)) | |
7 | 7 | then unit | |
8 | 8 | else throw("Only dapp account can call this function!") | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func d (c) = if ((size(c.payments) == 0)) | |
12 | 12 | then throw("Payment not attached") | |
13 | 13 | else { | |
14 | 14 | let e = c.payments[0] | |
15 | 15 | let f = e.assetId | |
16 | 16 | if ($isInstanceOf(f, "ByteVector")) | |
17 | 17 | then { | |
18 | 18 | let g = f | |
19 | 19 | if ((g == a)) | |
20 | 20 | then e.amount | |
21 | 21 | else throw("Only aurues accepted as payment!") | |
22 | 22 | } | |
23 | 23 | else throw("Only aurues accepted as payment!") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func h (g) = if ((g == 0)) | |
28 | 28 | then $Tuple4("Miner", "Utility building that helps you to mine aurues at certain blovk height.", 30000, "__miner") | |
29 | 29 | else if ((g == 1)) | |
30 | 30 | then $Tuple4("Canon", "Utility building that helps you to mine aurues at certain blovk height.", 25000, "_canon") | |
31 | 31 | else if ((g == 2)) | |
32 | 32 | then $Tuple4("Xbow", "Utility building that helps you to mine aurues at certain blovk height.", 15000, "_xbow") | |
33 | 33 | else if ((g == 3)) | |
34 | 34 | then $Tuple4("Tesla", "Utility building that helps you to mine aurues at certain blovk height.", 20000, "_tesla") | |
35 | 35 | else if ((g == 4)) | |
36 | 36 | then throw("You can't buy townhall!") | |
37 | 37 | else if ((g == 5)) | |
38 | 38 | then $Tuple4("Archer", "Utility building that helps you to mine aurues at certain blovk height.", 4500, "_archer") | |
39 | 39 | else if ((g == 6)) | |
40 | 40 | then $Tuple4("Robot", "Utility building that helps you to mine aurues at certain blovk height.", 5500, "_robo") | |
41 | 41 | else if ((g == 7)) | |
42 | 42 | then $Tuple4("Valkyriee", "Utility building that helps you to mine aurues at certain blovk height.", 6000, "_valkyriee") | |
43 | 43 | else throw("Unkown assetId!") | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func i (j) = if ((j == "Miner")) | |
47 | 47 | then "__miner" | |
48 | 48 | else if ((j == "Canon")) | |
49 | 49 | then "_canon" | |
50 | 50 | else if ((j == "Xbow")) | |
51 | 51 | then "_xbow" | |
52 | 52 | else if ((j == "Tesla")) | |
53 | 53 | then "_tesla" | |
54 | 54 | else if ((j == "Townhall")) | |
55 | 55 | then throw("You can't add or remove townhall!") | |
56 | 56 | else if ((j == "Archer")) | |
57 | 57 | then "_archer" | |
58 | 58 | else if ((j == "Robot")) | |
59 | 59 | then "_robo" | |
60 | 60 | else if ((j == "Valkyriee")) | |
61 | 61 | then "_valkyriee" | |
62 | 62 | else throw("Unkown Asset!") | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | @Callable(c) | |
66 | 66 | func startGame () = { | |
67 | 67 | let k = toBase58String(c.caller.bytes) | |
68 | 68 | let l = (k + "_isStrted") | |
69 | 69 | if ((getBoolean(this, l) == unit)) | |
70 | 70 | then { | |
71 | 71 | let m = { | |
72 | 72 | let f = getInteger(this, "userId") | |
73 | 73 | if ($isInstanceOf(f, "Int")) | |
74 | 74 | then { | |
75 | 75 | let n = f | |
76 | 76 | (n + 1) | |
77 | 77 | } | |
78 | 78 | else 0 | |
79 | 79 | } | |
80 | 80 | let o = Issue("Townhall", "HQ of your empire", 1, 0, false) | |
81 | 81 | let p = toBase58String(calculateAssetId(o)) | |
82 | 82 | $Tuple2([BooleanEntry(l, true), Reissue(a, 100000, true), ScriptTransfer(c.caller, 100000, a), o, StringEntry(p, k), IntegerEntry("userId", m), StringEntry(toString(m), k), IntegerEntry((k + "_townhall"), 1), IntegerEntry((k + "_townhall_placed"), 0), IntegerEntry((k + "_miner"), 0), IntegerEntry((k + "_miner_placed"), 0), IntegerEntry((k + "_canon"), 0), IntegerEntry((k + "_canon_placed"), 0), IntegerEntry((k + "_xbow"), 0), IntegerEntry((k + "_xbow_placed"), 0), IntegerEntry((k + "_tesla"), 0), IntegerEntry((k + "_tesla_placed"), 0), IntegerEntry((k + "_archer"), 0), IntegerEntry((k + "_robo"), 0), IntegerEntry((k + "_valkyriee"), 0)], unit) | |
83 | 83 | } | |
84 | 84 | else throw("Game already started!") | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(c) | |
90 | 90 | func saveGame (q) = { | |
91 | 91 | let r = (size(split_51C(q, "buildingIndex':4")) - 1) | |
92 | 92 | let s = (size(split_51C(q, "buildingIndex':0")) - 1) | |
93 | 93 | let t = (size(split_51C(q, "buildingIndex':1")) - 1) | |
94 | 94 | let u = (size(split_51C(q, "buildingIndex':2")) - 1) | |
95 | 95 | let v = (size(split_51C(q, "buildingIndex':3")) - 1) | |
96 | 96 | let k = toBase58String(c.caller.bytes) | |
97 | 97 | let w = (getIntegerValue(this, (k + "_townhall")) + getIntegerValue(this, (k + "_townhall_placed"))) | |
98 | 98 | let x = (getIntegerValue(this, (k + "_miner")) + getIntegerValue(this, (k + "_miner_placed"))) | |
99 | 99 | let y = (getIntegerValue(this, (k + "_canon")) + getIntegerValue(this, (k + "_canon_placed"))) | |
100 | 100 | let z = (getIntegerValue(this, (k + "_xbow")) + getIntegerValue(this, (k + "_xbow_placed"))) | |
101 | 101 | let A = (getIntegerValue(this, (k + "_tesla")) + getIntegerValue(this, (k + "_tesla_placed"))) | |
102 | 102 | if (if (if (if (if ((w >= r)) | |
103 | 103 | then (x >= s) | |
104 | 104 | else false) | |
105 | 105 | then (y >= t) | |
106 | 106 | else false) | |
107 | 107 | then (z >= u) | |
108 | 108 | else false) | |
109 | 109 | then (A >= v) | |
110 | 110 | else false) | |
111 | 111 | then $Tuple2([StringEntry((k + "_data"), q), IntegerEntry((k + "_townhall"), (w - r)), IntegerEntry((k + "_townhall_placed"), r), IntegerEntry((k + "_miner"), (x - s)), IntegerEntry((k + "_miner_placed"), s), IntegerEntry((k + "_canon"), (y - t)), IntegerEntry((k + "_canon_placed"), t), IntegerEntry((k + "_xbow"), (z - u)), IntegerEntry((k + "_xbow_placed"), u), IntegerEntry((k + "_tesla"), (A - v)), IntegerEntry((k + "_tesla_placed"), v)], unit) | |
112 | 112 | else throw("Placed more building then you owned!") | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | ||
117 | 117 | @Callable(c) | |
118 | 118 | func rewardWar (B,C,D) = $Tuple2([Reissue(a, ((B * 5000) + (C * 2000)), true), ScriptTransfer(c.caller, (B * 5000), a), ScriptTransfer(Address(fromBase58String(D)), (C * 2000), a)], unit) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | @Callable(c) | |
123 | 123 | func buy (g) = { | |
124 | 124 | let k = toBase58String(c.caller.bytes) | |
125 | 125 | let E = d(c) | |
126 | 126 | let F = h(g) | |
127 | 127 | let j = F._1 | |
128 | 128 | let G = F._2 | |
129 | 129 | let H = F._3 | |
130 | 130 | let I = F._4 | |
131 | 131 | if ((E >= H)) | |
132 | 132 | then { | |
133 | 133 | let J = getIntegerValue(this, (k + I)) | |
134 | 134 | let K = Issue(j, G, 1, 0, false) | |
135 | 135 | let L = toBase58String(calculateAssetId(K)) | |
136 | - | $Tuple2([K, ScriptTransfer(c.caller, 1, | |
136 | + | $Tuple2([K, ScriptTransfer(c.caller, 1, calculateAssetId(K)), Burn(a, E), IntegerEntry((k + I), (J + 1)), StringEntry(L, k)], unit) | |
137 | 137 | } | |
138 | 138 | else throw(("Not enough payment to buy " + j)) | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | ||
143 | 143 | @Callable(c) | |
144 | 144 | func addAsset () = if ((size(c.payments) == 0)) | |
145 | 145 | then throw("No NFT attached to this call!") | |
146 | 146 | else { | |
147 | 147 | let M = c.payments[0] | |
148 | 148 | let f = M.assetId | |
149 | 149 | if ($isInstanceOf(f, "ByteVector")) | |
150 | 150 | then { | |
151 | 151 | let g = f | |
152 | 152 | let N = assetInfo(g) | |
153 | 153 | if ($isInstanceOf(N, "Asset")) | |
154 | 154 | then { | |
155 | 155 | let O = N | |
156 | 156 | if ((O.issuer == this)) | |
157 | 157 | then if ((getString(this, toBase58String(g)) == unit)) | |
158 | 158 | then { | |
159 | 159 | let k = toBase58String(c.caller.bytes) | |
160 | 160 | let I = i(O.name) | |
161 | 161 | let P = getIntegerValue(this, (k + I)) | |
162 | 162 | $Tuple2([ScriptTransfer(Address(c.caller.bytes), 1, g), StringEntry(toBase58String(g), k), IntegerEntry((k + I), (P + 1))], unit) | |
163 | 163 | } | |
164 | 164 | else throw("Asset already added to game!") | |
165 | 165 | else throw("Wrong NFT sent!") | |
166 | 166 | } | |
167 | 167 | else throw("Can't find asset") | |
168 | 168 | } | |
169 | 169 | else throw("Not able to find asset id!!") | |
170 | 170 | } | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | 174 | @Callable(c) | |
175 | 175 | func removeAsset (g) = { | |
176 | 176 | let Q = getStringValue(this, g) | |
177 | - | if (( | |
177 | + | if ((fromBase58String(Q) == c.caller.bytes)) | |
178 | 178 | then { | |
179 | 179 | let f = assetInfo(fromBase58String(g)) | |
180 | 180 | if ($isInstanceOf(f, "Asset")) | |
181 | 181 | then { | |
182 | 182 | let O = f | |
183 | 183 | let I = i(O.name) | |
184 | 184 | let k = toBase58String(c.caller.bytes) | |
185 | 185 | let P = getIntegerValue(this, (k + I)) | |
186 | 186 | if ((P > 0)) | |
187 | 187 | then $Tuple2([DeleteEntry(g), IntegerEntry((k + I), (P - 1))], unit) | |
188 | 188 | else throw((("All " + O.name) + " are lock inside game")) | |
189 | 189 | } | |
190 | 190 | else throw("Can't find asset") | |
191 | 191 | } | |
192 | 192 | else throw("You are not owner of this asset!") | |
193 | 193 | } | |
194 | 194 | ||
195 | 195 |
github/deemru/w8io/026f985 38.88 ms ◑