tx · 8BLVNGb9tCwPSVzen7iYcEumv3AdciiG5kMJfCMwBQYG

3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb:  -0.01000000 Waves

2022.05.11 17:24 [2047119] smart account 3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb > SELF 0.00000000 Waves

{ "type": 13, "id": "8BLVNGb9tCwPSVzen7iYcEumv3AdciiG5kMJfCMwBQYG", "fee": 1000000, "feeAssetId": null, "timestamp": 1652279080239, "version": 2, "chainId": 84, "sender": "3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb", "senderPublicKey": "FWSsBbeCwLVkekWhvNKtX6JkrZiruRybKKVuiS3F4bqN", "proofs": [ "2LqExWzyd4d33LBfhuq7Atz59t2MYvsZaFjMbcWcbWLXLdDkCnb28kCL2pbrdSRUu53aBXY6Sn9XdqBfXe8BtHCP" ], "script": "base64:AAIFAAAAAAAAACwIAhIECgIICBIFCgMICAgSBAoCCAgSBAoCCAgSAwoBCBIECgIICBIECgIICAAAABgAAAAACnNoaW55d2dnaWQBAAAAIIlpzwL/trq51HGW13m4mXYmsHTQd3n0c26G8PRznwYmAAAAAA90cmVhc3VyeUFkZHJlc3MBAAAAGgFUZfjwFgsEwFlCcBqeSIyX/37cHGLy3bv9AAAAAA5uYXRpb25zQWRkcmVzcwEAAAAaAVRNheje9PhEa1kQO3Bfw7e5ZQ5R9URGbaAAAAAADGFkbWluQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM01wTnRpUFNSU3E2Tm5hUVlrMzhCZldTelpjZ0FZVHlyUTkAAAAADEJ1aWxkU3RhcnRlZAIAAAANQlVJTERfU1RBUlRFRAAAAAANQnVpbGRGaW5pc2hlZAIAAAAOQlVJTERfRklOSVNIRUQAAAAABkFzc2V0cwkABEwAAAACAgAAAAZOYXRpb24JAARMAAAAAgIAAAAEQ2l0eQkABEwAAAACAgAAAAdCYXJyYWNrCQAETAAAAAICAAAABEJhcm4JAARMAAAAAgI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HJlYXN1cnlBZGRyZXNzBQAAAAhhbW91bnRJbgUAAAAKc2hpbnl3Z2dpZAUAAAADbmlsCQAAAgAAAAECAAAAHEVycm9yIHRyYW5zZmVycmluZyBPd25lcnNoaXAJAAACAAAAAQIAAAApRXJyb3IgdHJhbnNmZXJyaW5nIFNIRUcgdG8gbmF0aW9ucyB3YWxsZXQAAAAAosz4uA==", "height": 2047119, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BBHrZLFur5Q2ufDu1G6bTecDmkt2XRdzT4qrsgwhv1Qp Next: FFfGvxM1taiRhZrVSyuWPdVmP3nuuBRmvBXsmBg6VZk2 Diff:
OldNewDifferences
198198 then throw("Only the admin can perform this operation")
199199 else {
200200 let oldOwner = tryGetString((assetId + "_Owner"))
201- let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
202201 let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
203- let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil)
204- if ((pw == pw))
205- then if ((pw != (currentPower - assetPower)))
206- then throw("Incorrect invoke result")
207- else {
208- let newcurrentPower = nationsTryGetInteger((newOwner + "_Power"))
209- let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil)
210- if ((pw2 == pw2))
211- then match pw2 {
212- case r: Int =>
213-[StringEntry((assetId + "_Owner"), newOwner)]
214- case _ =>
215- throw("Incorrect invoke result")
216- }
217- else throw("Strict value is not equal to itself.")
218- }
219- else throw("Strict value is not equal to itself.")
202+ if ((assetPower > 0))
203+ then {
204+ let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
205+ let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil)
206+ if ((pw == pw))
207+ then if ((pw != (currentPower - assetPower)))
208+ then throw("Incorrect invoke result")
209+ else {
210+ let newcurrentPower = nationsTryGetInteger((newOwner + "_Power"))
211+ let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil)
212+ if ((pw2 == pw2))
213+ then match pw2 {
214+ case r: Int =>
215+ $Tuple2([StringEntry((assetId + "_Owner"), newOwner)], newOwner)
216+ case _ =>
217+ throw("Incorrect invoke result")
218+ }
219+ else throw("Strict value is not equal to itself.")
220+ }
221+ else throw("Strict value is not equal to itself.")
222+ }
223+ else $Tuple2([StringEntry((assetId + "_Owner"), newOwner)], newOwner)
220224 }
221225 }
222226
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf'
55
66 let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ'
77
88 let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy'
99
1010 let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9")
1111
1212 let BuildStarted = "BUILD_STARTED"
1313
1414 let BuildFinished = "BUILD_FINISHED"
1515
1616 let Assets = ["Nation", "City", "Barrack", "Barn", "Warrior", "Settler", "Explorer"]
1717
1818 let assetsCost = [0, 1000000000, 5000000000, 5000000000, 500000000, 10000000000, 100000000]
1919
2020 let assetsSellPrice = [0, 0, 0, 0, 0, 10000000000, 100000000]
2121
2222 let assetsDelay = [0, 4, 4, 4, 2, 2, 2]
2323
2424 let assetsPower = [0, 1000, 500, 500, 0, 0, 0]
2525
2626 func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) {
2727 case b: Int =>
2828 b
2929 case _ =>
3030 0
3131 }
3232
3333
3434 func nationsTryGetInteger (key) = match getInteger(Address(nationsAddress), key) {
3535 case b: Int =>
3636 b
3737 case _ =>
3838 0
3939 }
4040
4141
4242 func tryGetString (key) = match getString(this, key) {
4343 case b: String =>
4444 b
4545 case _ =>
4646 ""
4747 }
4848
4949
5050 func tryGetInteger (key) = match getInteger(this, key) {
5151 case b: Int =>
5252 b
5353 case _ =>
5454 0
5555 }
5656
5757
5858 func getAssetIdKey (txId,assetType) = ((assetType + "_") + toBase58String(txId))
5959
6060
6161 func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner")
6262
6363
6464 func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh")
6565
6666
6767 func getBuildingStatusKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_status")
6868
6969
7070 func getTreasuryKey (nationid) = (nationid + "_Treasury")
7171
7272
7373 func checkAdmin (caller) = if (if (if ((caller == adminAddress))
7474 then true
7575 else (caller == this))
7676 then true
7777 else (caller.bytes == nationsAddress))
7878 then true
7979 else (caller.bytes == treasuryAddress)
8080
8181
8282 func internalFinishBuild (caller,assetStr,assetKey,BuildingStatusKey,finishHeightKey) = {
8383 let buildingFinishHeight = getIntegerValue(this, finishHeightKey)
8484 if ((buildingFinishHeight > height))
8585 then throw((((("Building is not finished yet " + toString((buildingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((buildingFinishHeight - height))) + " minutes"))
8686 else {
8787 let idx = value(indexOf(Assets, assetStr))
8888 let assetPower = assetsPower[idx]
8989 let assetCoins = assetsCost[idx]
9090 let refCall = invoke(Address(treasuryAddress), "Pay", [caller, assetCoins], nil)
9191 if ((refCall == refCall))
9292 then if ((assetPower > 0))
9393 then {
9494 let currentPower = nationsTryGetInteger((caller + "_Power"))
9595 let pw = invoke(Address(nationsAddress), "setUserPower", [caller, (currentPower + assetPower)], nil)
9696 if ((pw == pw))
9797 then [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
9898 else throw("Strict value is not equal to itself.")
9999 }
100100 else [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
101101 else throw("Strict value is not equal to itself.")
102102 }
103103 }
104104
105105
106106 func checkAssetOwner (caller,assetKey) = {
107107 let assetOwner = tryGetString((assetKey + "_Owner"))
108108 (assetOwner == caller)
109109 }
110110
111111
112112 func isNationReservedAsset (strAssetType) = if ((strAssetType == "Settler"))
113113 then true
114114 else (strAssetType == "Explorer")
115115
116116
117117 @Callable(i)
118118 func StartBuild (strAssetType,NationKey) = if (!(containsElement(Assets, strAssetType)))
119119 then throw("This asset is not amanged by the system")
120120 else {
121121 let ind = value(indexOf(Assets, strAssetType))
122122 let delayForBuilding = assetsDelay[ind]
123123 let assetBuildCost = assetsCost[ind]
124124 if (isNationReservedAsset(strAssetType))
125125 then if (if (!(checkAssetOwner(toString(i.caller), NationKey)))
126126 then !(checkAdmin(i.caller))
127127 else false)
128128 then throw("You are not authorized to perform this operation")
129129 else {
130130 let nationsheg = treasuryTryGetInteger(getTreasuryKey(NationKey))
131131 if ((assetBuildCost > nationsheg))
132132 then throw("The nation hasn't enough funds")
133133 else {
134134 let d = invoke(Address(treasuryAddress), "decreaseNationWallet", [NationKey, assetBuildCost], nil)
135135 match d {
136136 case r: Int =>
137137 let pw = invoke(Address(treasuryAddress), "arbitraryAddCoins", [NationKey, assetBuildCost], nil)
138138 match pw {
139139 case b: Int =>
140140 [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))]
141141 case _ =>
142142 throw("Error Depositing nation funds")
143143 }
144144 case _ =>
145145 throw("Error Depositing nation funds")
146146 }
147147 }
148148 }
149149 else {
150150 let amountIn = value(i.payments[0].amount)
151151 if ((assetBuildCost > amountIn))
152152 then throw(("You provided less $heg than the needed cost for building this " + strAssetType))
153153 else if ((i.payments[0].assetId != shinywggid))
154154 then throw("Only $HEG payments allowed")
155155 else {
156156 let pw = invoke(Address(treasuryAddress), "Deposit", nil, i.payments)
157157 match pw {
158158 case r: Int =>
159159 [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))]
160160 case _ =>
161161 throw("Incorrect invoke result")
162162 }
163163 }
164164 }
165165 }
166166
167167
168168
169169 @Callable(i)
170170 func FinishBuild (txIdStr,assetStr,NationKey) = {
171171 let txId = fromBase58String(txIdStr)
172172 let BuildingStatusKey = getBuildingStatusKey(toString(i.caller), txId, assetStr)
173173 let finishHeightKey = getBuildingFinishHeightKey(toString(i.caller), txId, assetStr)
174174 let assetKey = getAssetIdKey(txId, assetStr)
175175 let assetOwner = tryGetString(getAssetOwnerKey(txId, assetStr))
176176 if (isNationReservedAsset(assetStr))
177177 then if (if (!(checkAssetOwner(toString(i.caller), NationKey)))
178178 then !(checkAdmin(i.caller))
179179 else false)
180180 then throw("You are not authorized to perform this operation")
181181 else internalFinishBuild(NationKey, assetStr, assetKey, BuildingStatusKey, finishHeightKey)
182182 else if ((assetOwner != toString(i.caller)))
183183 then throw(("You cannot claim other's players " + assetStr))
184184 else {
185185 let buildingTxStatus = tryGetString(BuildingStatusKey)
186186 if ((buildingTxStatus == ""))
187187 then throw("No pending operations for this asset")
188188 else internalFinishBuild(toString(i.caller), assetStr, assetKey, BuildingStatusKey, finishHeightKey)
189189 }
190190 }
191191
192192
193193
194194 @Callable(i)
195195 func transferOwnership (assetId,newOwner) = {
196196 let strAssetType = split(assetId, "_")[0]
197197 if (!(checkAdmin(i.caller)))
198198 then throw("Only the admin can perform this operation")
199199 else {
200200 let oldOwner = tryGetString((assetId + "_Owner"))
201- let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
202201 let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
203- let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil)
204- if ((pw == pw))
205- then if ((pw != (currentPower - assetPower)))
206- then throw("Incorrect invoke result")
207- else {
208- let newcurrentPower = nationsTryGetInteger((newOwner + "_Power"))
209- let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil)
210- if ((pw2 == pw2))
211- then match pw2 {
212- case r: Int =>
213-[StringEntry((assetId + "_Owner"), newOwner)]
214- case _ =>
215- throw("Incorrect invoke result")
216- }
217- else throw("Strict value is not equal to itself.")
218- }
219- else throw("Strict value is not equal to itself.")
202+ if ((assetPower > 0))
203+ then {
204+ let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
205+ let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil)
206+ if ((pw == pw))
207+ then if ((pw != (currentPower - assetPower)))
208+ then throw("Incorrect invoke result")
209+ else {
210+ let newcurrentPower = nationsTryGetInteger((newOwner + "_Power"))
211+ let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil)
212+ if ((pw2 == pw2))
213+ then match pw2 {
214+ case r: Int =>
215+ $Tuple2([StringEntry((assetId + "_Owner"), newOwner)], newOwner)
216+ case _ =>
217+ throw("Incorrect invoke result")
218+ }
219+ else throw("Strict value is not equal to itself.")
220+ }
221+ else throw("Strict value is not equal to itself.")
222+ }
223+ else $Tuple2([StringEntry((assetId + "_Owner"), newOwner)], newOwner)
220224 }
221225 }
222226
223227
224228
225229 @Callable(i)
226230 func destroyAssetAndTransfer (assetId,toAddress) = {
227231 let strAssetType = split(assetId, "_")[0]
228232 if (!(checkAdmin(i.caller)))
229233 then throw("Only the admin can perform this operation")
230234 else {
231235 let oldOwner = tryGetString((assetId + "_Owner"))
232236 let assetCoins = tryGetInteger(assetId)
233237 let refCall = invoke(Address(treasuryAddress), "arbitraryAddCoins", [toAddress, assetCoins], nil)
234238 if ((refCall == refCall))
235239 then {
236240 let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
237241 let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
238242 let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil)
239243 if ((pw == pw))
240244 then match pw {
241245 case r: Int =>
242246 [DeleteEntry(assetId)]
243247 case _ =>
244248 throw("Incorrect invoke result")
245249 }
246250 else throw("Strict value is not equal to itself.")
247251 }
248252 else throw("Strict value is not equal to itself.")
249253 }
250254 }
251255
252256
253257
254258 @Callable(i)
255259 func destroyAssetFromUser (assetId) = {
256260 let strAssetType = split(assetId, "_")[0]
257261 if (!(checkAssetOwner(toString(i.caller), assetId)))
258262 then throw("You don't own this asset")
259263 else {
260264 let assetCoins = tryGetInteger(assetId)
261265 let currentPower = nationsTryGetInteger((toString(i.caller) + "_Power"))
262266 let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
263267 let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil)
264268 if ((pw == pw))
265269 then match pw {
266270 case r: Int =>
267271 [DeleteEntry(assetId), ScriptTransfer(i.caller, assetCoins, shinywggid)]
268272 case _ =>
269273 throw("Incorrect invoke result")
270274 }
271275 else throw("Strict value is not equal to itself.")
272276 }
273277 }
274278
275279
276280
277281 @Callable(i)
278282 func setNationOwner (nationKey,newOwner) = if (checkAdmin(i.caller))
279283 then $Tuple2([StringEntry((nationKey + "_Owner"), newOwner)], true)
280284 else {
281285 let currentOwner = tryGetString((nationKey + "_Owner"))
282286 if ((currentOwner != toString(i.caller)))
283287 then throw("You are not the nation owner")
284288 else [StringEntry((nationKey + "_Owner"), newOwner)]
285289 }
286290
287291
288292
289293 @Callable(i)
290294 func buyNationItem (assetId,NationKey) = {
291295 let strAssetType = split(assetId, "_")[0]
292296 let n = nationsTryGetInteger(toString(i.caller))
293297 let nid = nationsTryGetInteger(NationKey)
294298 if ((n != nid))
295299 then throw("you can buy assets only from your nation")
296300 else if (!(checkAssetOwner(NationKey, assetId)))
297301 then throw("The asset does not belong to the nation")
298302 else if (!(isNationReservedAsset(strAssetType)))
299303 then throw("this asset cannot be sold by the nation")
300304 else {
301305 let ind = value(indexOf(Assets, strAssetType))
302306 let assetPrice = assetsSellPrice[ind]
303307 let amountIn = value(i.payments[0].amount)
304308 if ((assetPrice > amountIn))
305309 then throw(("You provided less $heg than the needed cost for buying this " + strAssetType))
306310 else if ((i.payments[0].assetId != shinywggid))
307311 then throw("Only $HEG payments allowed")
308312 else {
309313 let a = invoke(Address(treasuryAddress), "increaseNationWallet", [NationKey, amountIn], nil)
310314 match a {
311315 case b: Int =>
312316 let p = invoke(this, "transferOwnership", [assetId, toString(i.caller)], nil)
313317 match p {
314318 case t: String =>
315319 [ScriptTransfer(Address(treasuryAddress), amountIn, shinywggid)]
316320 case _ =>
317321 throw("Error transferring Ownership")
318322 }
319323 case _ =>
320324 throw("Error transferring SHEG to nations wallet")
321325 }
322326 }
323327 }
324328 }
325329
326330

github/deemru/w8io/169f3d6 
44.94 ms