tx · GMbyUuT3t2XNz7iihoCAfS8Bn2FPTcwWdVogHtmryUWb 3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb: -0.01000000 Waves 2022.05.11 14:16 [2046927] smart account 3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb > SELF 0.00000000 Waves
{ "type": 13, "id": "GMbyUuT3t2XNz7iihoCAfS8Bn2FPTcwWdVogHtmryUWb", "fee": 1000000, "feeAssetId": null, "timestamp": 1652267785346, "version": 2, "chainId": 84, "sender": "3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb", "senderPublicKey": "FWSsBbeCwLVkekWhvNKtX6JkrZiruRybKKVuiS3F4bqN", "proofs": [ "64M9QXYd269Sa5LU74ZJrzwpSqAX8SuFniV6E2oQfz9vsANjHKEbxuyQUnshQP2ViBfGApt7W6TCJW33w87CPgT8" ], "script": "base64:AAIFAAAAAAAAACkIAhIECgIICBIFCgMICAgSBQoDCAgIEgUKAwgICBIECgIICBIECgIICAAAABgAAAAACnNoaW55d2dnaWQBAAAAIIlpzwL/trq51HGW13m4mXYmsHTQd3n0c26G8PRznwYmAAAAAA90cmVhc3VyeUFkZHJlc3MBAAAAGgFUZfjwFgsEwFlCcBqeSIyX/37cHGLy3bv9AAAAAA5uYXRpb25zQWRkcmVzcwEAAAAaAVRNheje9PhEa1kQO3Bfw7e5ZQ5R9URGbaAAAAAADGFkbWluQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM01wTnRpUFNSU3E2Tm5hUVlrMzhCZldTelpjZ0FZVHlyUTkAAAAADEJ1aWxkU3RhcnRlZAIAAAANQlVJTERfU1RBUlRFRAAAAAANQnVpbGRGaW5pc2hlZAIAAAAOQlVJTERfRklOSVNIRUQAAAAABkFzc2V0cwkABEwAAAACAgAAAAZOYXRpb24JAARMAAAAAgIAAAAEQ2l0eQkABEwAAAACAgAAAAdCYXJyYWNrCQAETAAAAAICAAAABEJhcm4JAARMAAAAAgIAAAAHV2Fyc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aXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAACmFzc2V0Q29pbnMFAAAACnNoaW55d2dnaWQFAAAAA25pbAkAAAIAAAABAgAAABdJbmNvcnJlY3QgaW52b2tlIHJlc3VsdAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABaQEAAAAOc2V0TmF0aW9uT3duZXIAAAACAAAACW5hdGlvbktleQAAAAhuZXdPd25lcgMJAQAAAApjaGVja0FkbWluAAAAAQgFAAAAAWkAAAAGY2FsbGVyCQAFFAAAAAIJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACBQAAAAluYXRpb25LZXkCAAAABl9Pd25lcgUAAAAIbmV3T3duZXIFAAAAA25pbAYEAAAADGN1cnJlbnRPd25lcgkBAAAADHRyeUdldFN0cmluZwAAAAEJAAEsAAAAAgUAAAAJbmF0aW9uS2V5AgAAAAZfT3duZXIDCQEAAAACIT0AAAACBQAAAAxjdXJyZW50T3duZXIJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyCQAAAgAAAAECAAAAHFlvdSBhcmUgbm90IHRoZSBuYXRpb24gb3duZXIJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACBQAAAAluYXRpb25LZXkCAAAABl9Pd25lcgUAAAAIbmV3T3duZXIFAAAAA25pbAAAAAAS7TBM", "height": 2046927, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: A8et2oNQnuJ8XYKd38qhzmUTW7pcdoJgqVS15ceCie8p Next: 4W3xtbVdcV5UVKjcPwGATnA8SsBry968uSD5VTTVDc8a Diff:
Old | New | Differences | |
---|---|---|---|
265 | 265 | ||
266 | 266 | ||
267 | 267 | @Callable(i) | |
268 | - | func setNationOwner (nationKey,newOwner) = if ( | |
268 | + | func setNationOwner (nationKey,newOwner) = if (checkAdmin(i.caller)) | |
269 | 269 | then $Tuple2([StringEntry((nationKey + "_Owner"), newOwner)], true) | |
270 | 270 | else { | |
271 | 271 | let currentOwner = tryGetString((nationKey + "_Owner")) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | 5 | ||
6 | 6 | let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ' | |
7 | 7 | ||
8 | 8 | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
9 | 9 | ||
10 | 10 | let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
11 | 11 | ||
12 | 12 | let BuildStarted = "BUILD_STARTED" | |
13 | 13 | ||
14 | 14 | let BuildFinished = "BUILD_FINISHED" | |
15 | 15 | ||
16 | 16 | let Assets = ["Nation", "City", "Barrack", "Barn", "Warrior", "Settler", "Explorer"] | |
17 | 17 | ||
18 | 18 | let assetsCost = [0, 1000000000, 5000000000, 5000000000, 500000000, 10000000000, 100000000] | |
19 | 19 | ||
20 | 20 | let assetsDelay = [0, 4, 4, 4, 2, 2, 2] | |
21 | 21 | ||
22 | 22 | let assetsPower = [0, 1000, 500, 500, 0, 0, 0] | |
23 | 23 | ||
24 | 24 | func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) { | |
25 | 25 | case b: Int => | |
26 | 26 | b | |
27 | 27 | case _ => | |
28 | 28 | 0 | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func nationsTryGetInteger (key) = match getInteger(Address(nationsAddress), key) { | |
33 | 33 | case b: Int => | |
34 | 34 | b | |
35 | 35 | case _ => | |
36 | 36 | 0 | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func tryGetString (key) = match getString(this, key) { | |
41 | 41 | case b: String => | |
42 | 42 | b | |
43 | 43 | case _ => | |
44 | 44 | "" | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func tryGetInteger (key) = match getInteger(this, key) { | |
49 | 49 | case b: Int => | |
50 | 50 | b | |
51 | 51 | case _ => | |
52 | 52 | 0 | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func getAssetIdKey (txId,assetType) = ((assetType + "_") + toBase58String(txId)) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner") | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh") | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func getBuildingStatusKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_status") | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func getTreasuryKey (nationid) = (nationid + "_Treasury") | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func checkAdmin (caller) = if (if (if ((caller == adminAddress)) | |
72 | 72 | then true | |
73 | 73 | else (caller == this)) | |
74 | 74 | then true | |
75 | 75 | else (caller.bytes == nationsAddress)) | |
76 | 76 | then true | |
77 | 77 | else (caller.bytes == treasuryAddress) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func internalFinishBuild (caller,assetStr,assetKey,BuildingStatusKey,finishHeightKey) = { | |
81 | 81 | let buildingFinishHeight = getIntegerValue(this, finishHeightKey) | |
82 | 82 | if ((buildingFinishHeight > height)) | |
83 | 83 | then throw((((("Building is not finished yet " + toString((buildingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((buildingFinishHeight - height))) + " minutes")) | |
84 | 84 | else { | |
85 | 85 | let idx = value(indexOf(Assets, assetStr)) | |
86 | 86 | let assetPower = assetsPower[idx] | |
87 | 87 | let assetCoins = assetsCost[idx] | |
88 | 88 | let refCall = invoke(Address(treasuryAddress), "Pay", [caller, assetCoins], nil) | |
89 | 89 | if ((refCall == refCall)) | |
90 | 90 | then if ((assetPower > 0)) | |
91 | 91 | then { | |
92 | 92 | let currentPower = nationsTryGetInteger((caller + "_Power")) | |
93 | 93 | let pw = invoke(Address(nationsAddress), "setUserPower", [caller, (currentPower + assetPower)], nil) | |
94 | 94 | if ((pw == pw)) | |
95 | 95 | then [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)] | |
96 | 96 | else throw("Strict value is not equal to itself.") | |
97 | 97 | } | |
98 | 98 | else [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)] | |
99 | 99 | else throw("Strict value is not equal to itself.") | |
100 | 100 | } | |
101 | 101 | } | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func checkNationOwner (caller,NationKey) = { | |
105 | 105 | let nationOwner = tryGetString((NationKey + "_Owner")) | |
106 | 106 | (nationOwner == toString(caller)) | |
107 | 107 | } | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func checkAssetOwner (caller,assetKey) = { | |
111 | 111 | let assetOwner = tryGetString((assetKey + "_Owner")) | |
112 | 112 | (assetOwner == toString(caller)) | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func isNationReservedAsset (strAssetType) = if ((strAssetType == "Settler")) | |
117 | 117 | then true | |
118 | 118 | else (strAssetType == "Explorer") | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | @Callable(i) | |
122 | 122 | func StartBuild (strAssetType,NationKey) = if (!(containsElement(Assets, strAssetType))) | |
123 | 123 | then throw("This asset is not amanged by the system") | |
124 | 124 | else { | |
125 | 125 | let ind = value(indexOf(Assets, strAssetType)) | |
126 | 126 | let delayForBuilding = assetsDelay[ind] | |
127 | 127 | let assetBuildCost = assetsCost[ind] | |
128 | 128 | if (isNationReservedAsset(strAssetType)) | |
129 | 129 | then if (if (!(checkNationOwner(i.caller, NationKey))) | |
130 | 130 | then !(checkAdmin(i.caller)) | |
131 | 131 | else false) | |
132 | 132 | then throw("You are not authorized to perform this operation") | |
133 | 133 | else { | |
134 | 134 | let nationsheg = treasuryTryGetInteger(getTreasuryKey(NationKey)) | |
135 | 135 | if ((assetBuildCost > nationsheg)) | |
136 | 136 | then throw("The nation hasn't enough funds") | |
137 | 137 | else { | |
138 | 138 | let d = invoke(Address(treasuryAddress), "decreaseNationWallet", [NationKey, assetBuildCost], nil) | |
139 | 139 | let pw = invoke(Address(treasuryAddress), "arbitraryAddCoins", [NationKey, assetBuildCost], nil) | |
140 | 140 | match pw { | |
141 | 141 | case r: Int => | |
142 | 142 | [StringEntry(getBuildingStatusKey(toString(i.originCaller), i.transactionId, strAssetType), BuildStarted), StringEntry(getAssetOwnerKey(i.transactionId, strAssetType), NationKey), IntegerEntry(getBuildingFinishHeightKey(toString(i.originCaller), i.transactionId, strAssetType), (height + delayForBuilding))] | |
143 | 143 | case _ => | |
144 | 144 | throw("Incorrect invoke result") | |
145 | 145 | } | |
146 | 146 | } | |
147 | 147 | } | |
148 | 148 | else { | |
149 | 149 | let amountIn = value(i.payments[0].amount) | |
150 | 150 | if ((assetBuildCost > amountIn)) | |
151 | 151 | then throw(("You provided less $heg than the needed cost for building this " + strAssetType)) | |
152 | 152 | else if ((i.payments[0].assetId != shinywggid)) | |
153 | 153 | then throw("Only $HEG payments allowed") | |
154 | 154 | else { | |
155 | 155 | let pw = invoke(Address(treasuryAddress), "Deposit", nil, i.payments) | |
156 | 156 | match pw { | |
157 | 157 | case r: Int => | |
158 | 158 | [StringEntry(getBuildingStatusKey(toString(i.originCaller), i.transactionId, strAssetType), BuildStarted), StringEntry(getAssetOwnerKey(i.transactionId, strAssetType), toString(i.originCaller)), IntegerEntry(getBuildingFinishHeightKey(toString(i.originCaller), i.transactionId, strAssetType), (height + delayForBuilding))] | |
159 | 159 | case _ => | |
160 | 160 | throw("Incorrect invoke result") | |
161 | 161 | } | |
162 | 162 | } | |
163 | 163 | } | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | ||
168 | 168 | @Callable(i) | |
169 | 169 | func FinishBuild (txIdStr,assetStr,NationKey) = { | |
170 | 170 | let txId = fromBase58String(txIdStr) | |
171 | 171 | let BuildingStatusKey = getBuildingStatusKey(toString(i.caller), txId, assetStr) | |
172 | 172 | let finishHeightKey = getBuildingFinishHeightKey(toString(i.caller), txId, assetStr) | |
173 | 173 | let assetKey = getAssetIdKey(txId, assetStr) | |
174 | 174 | let assetOwner = tryGetString(getAssetOwnerKey(txId, assetStr)) | |
175 | 175 | if (isNationReservedAsset(assetStr)) | |
176 | 176 | then if (if (!(checkNationOwner(i.caller, NationKey))) | |
177 | 177 | then !(checkAdmin(i.caller)) | |
178 | 178 | else false) | |
179 | 179 | then throw("You are not authorized to perform this operation") | |
180 | 180 | else internalFinishBuild(NationKey, assetStr, assetKey, BuildingStatusKey, finishHeightKey) | |
181 | 181 | else if ((assetOwner != toString(i.caller))) | |
182 | 182 | then throw(("You cannot claim other's players " + assetStr)) | |
183 | 183 | else { | |
184 | 184 | let buildingTxStatus = tryGetString(BuildingStatusKey) | |
185 | 185 | if ((buildingTxStatus == "")) | |
186 | 186 | then throw("No pending operations for this asset") | |
187 | 187 | else internalFinishBuild(toString(i.caller), assetStr, assetKey, BuildingStatusKey, finishHeightKey) | |
188 | 188 | } | |
189 | 189 | } | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | ||
193 | 193 | @Callable(i) | |
194 | 194 | func transferOwnership (assetId,newOwner,strAssetType) = if (!(checkAdmin(i.caller))) | |
195 | 195 | then throw("Only the admin can perform this operation") | |
196 | 196 | else { | |
197 | 197 | let oldOwner = tryGetString((assetId + "_Owner")) | |
198 | 198 | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
199 | 199 | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
200 | 200 | let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil) | |
201 | 201 | if ((pw == pw)) | |
202 | 202 | then if ((pw != (currentPower - assetPower))) | |
203 | 203 | then throw("Incorrect invoke result") | |
204 | 204 | else { | |
205 | 205 | let newcurrentPower = nationsTryGetInteger((newOwner + "_Power")) | |
206 | 206 | let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil) | |
207 | 207 | if ((pw2 == pw2)) | |
208 | 208 | then match pw2 { | |
209 | 209 | case r: Int => | |
210 | 210 | [StringEntry((assetId + "_Owner"), newOwner)] | |
211 | 211 | case _ => | |
212 | 212 | throw("Incorrect invoke result") | |
213 | 213 | } | |
214 | 214 | else throw("Strict value is not equal to itself.") | |
215 | 215 | } | |
216 | 216 | else throw("Strict value is not equal to itself.") | |
217 | 217 | } | |
218 | 218 | ||
219 | 219 | ||
220 | 220 | ||
221 | 221 | @Callable(i) | |
222 | 222 | func destroyAssetAndTransfer (assetId,toAddress,strAssetType) = if (!(checkAdmin(i.caller))) | |
223 | 223 | then throw("Only the admin can perform this operation") | |
224 | 224 | else { | |
225 | 225 | let oldOwner = tryGetString((assetId + "_Owner")) | |
226 | 226 | let assetCoins = tryGetInteger(assetId) | |
227 | 227 | let refCall = invoke(Address(treasuryAddress), "arbitraryAddCoins", [toAddress, assetCoins], nil) | |
228 | 228 | if ((refCall == refCall)) | |
229 | 229 | then { | |
230 | 230 | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
231 | 231 | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
232 | 232 | let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil) | |
233 | 233 | if ((pw == pw)) | |
234 | 234 | then match pw { | |
235 | 235 | case r: Int => | |
236 | 236 | [DeleteEntry(assetId)] | |
237 | 237 | case _ => | |
238 | 238 | throw("Incorrect invoke result") | |
239 | 239 | } | |
240 | 240 | else throw("Strict value is not equal to itself.") | |
241 | 241 | } | |
242 | 242 | else throw("Strict value is not equal to itself.") | |
243 | 243 | } | |
244 | 244 | ||
245 | 245 | ||
246 | 246 | ||
247 | 247 | @Callable(i) | |
248 | 248 | func destroyAssetFromUser (assetId,strAssetType) = if (!(checkAssetOwner(i.caller, assetId))) | |
249 | 249 | then throw("You don't own this asset") | |
250 | 250 | else { | |
251 | 251 | let assetCoins = tryGetInteger(assetId) | |
252 | 252 | let currentPower = nationsTryGetInteger((toString(i.caller) + "_Power")) | |
253 | 253 | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
254 | 254 | let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil) | |
255 | 255 | if ((pw == pw)) | |
256 | 256 | then match pw { | |
257 | 257 | case r: Int => | |
258 | 258 | [DeleteEntry(assetId), ScriptTransfer(i.caller, assetCoins, shinywggid)] | |
259 | 259 | case _ => | |
260 | 260 | throw("Incorrect invoke result") | |
261 | 261 | } | |
262 | 262 | else throw("Strict value is not equal to itself.") | |
263 | 263 | } | |
264 | 264 | ||
265 | 265 | ||
266 | 266 | ||
267 | 267 | @Callable(i) | |
268 | - | func setNationOwner (nationKey,newOwner) = if ( | |
268 | + | func setNationOwner (nationKey,newOwner) = if (checkAdmin(i.caller)) | |
269 | 269 | then $Tuple2([StringEntry((nationKey + "_Owner"), newOwner)], true) | |
270 | 270 | else { | |
271 | 271 | let currentOwner = tryGetString((nationKey + "_Owner")) | |
272 | 272 | if ((currentOwner != toString(i.caller))) | |
273 | 273 | then throw("You are not the nation owner") | |
274 | 274 | else [StringEntry((nationKey + "_Owner"), newOwner)] | |
275 | 275 | } | |
276 | 276 | ||
277 | 277 |
github/deemru/w8io/026f985 147.92 ms ◑