tx · D7j759sdyeFc1fHRd4DbhL386hUQ3xwpnLLrp1v5sdbq

3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb:  -0.02100000 Waves

2022.06.13 14:01 [2094512] smart account 3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb > SELF 0.00000000 Waves

{ "type": 13, "id": "D7j759sdyeFc1fHRd4DbhL386hUQ3xwpnLLrp1v5sdbq", "fee": 2100000, "feeAssetId": null, "timestamp": 1655118034183, "version": 2, "chainId": 84, "sender": "3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb", "senderPublicKey": "FWSsBbeCwLVkekWhvNKtX6JkrZiruRybKKVuiS3F4bqN", "proofs": [ "3ae6z3inzF2jkFPfgbeu6GTgNnQRA3o4QaJTVLBzPrjvGwrcSnGaJkz7eykgLaEwdKeZQ7jk9jP6pqn11APsJLjL" ], "script": "base64:AAIFAAAAAAAAADwIAhIGCgQIAQgIEgYKBAgIAQgSBAoCCAgSBAoCCAgSAwoBCBIECgIICBIECgIICBIFCgMICAESBAoCCAEAAAAmAAAAAApzaGlueXdnZ2lkAQAAACCJac8C/7a6udRxltd5uJl2JrB00Hd59HNuhvD0c58GJgAAAAAPdHJlYXN1cnlBZGRyZXNzAQAAABoBVGX48BYLBMBZQnAankiMl/9+3Bxi8t27/QAAAAANYXNzZXRzQWRkcmVzcwEAAAAaAVTL5rTBd9cdJy1rFhBLypFI6ymLChqVp5oAAAAAEm1hcmtldHBsYWNlQWRkcmVzcwEAAAAaAVQdIbmT8fwYw6cbSXEWQ5ZRdOusVC4lvO8AAAAAFGNvbmZpZ3VyYXRpb25BZGRyZXNzAQAAABoBVNsgy5eRVj9CDmynZTWCi2G/tXRyOLTQLgAAAAAObmF0aW9uc0FkZHJlc3MBAAAAGgFUTYXo3vT4RGtZEDtwX8O3uWUOUfVERm2gAAAAAAthZG1pbldhbGxldAkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM01wTnRpUFNSU3E2Tm5hUVlrMz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aWwFAAAAA25pbAQAAAAHJG1hdGNoMAUAAAACdHIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABdAUAAAAHJG1hdGNoMAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAWZ2V0QXNzZXRPd25lcktleVN0cmluZwAAAAEFAAAAB2Fzc2V0SWQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAAHYXNzZXRJZAUAAAADbmlsCQAAAgAAAAECAAAAKUVycm9yIHB1dHRpbmcgdGhlIGl0ZW0gb24gdGhlIG1hcmtldHBsYWNlAAAAAJwvMFY=", "height": 2094512, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: QAUsTuUi5YBhUwcK7NZCjVGxvaVBAy16uFne2hzxA5P Next: 5qoMJoDxaiEykem7rHiQQwFfCcLspyC1TJ9MukhtoEQ7 Diff:
OldNewDifferences
55
66 let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ'
77
8-let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy'
8+let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb'
99
1010 let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A'
11+
12+let configurationAddress = base58'3N9tj3b2djcaZozn97VkYchL9S1i6cdEbC1'
13+
14+let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy'
1115
1216 let adminWallet = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9")
1317
1519
1620 let dailyStakingRewardsWallet = addressFromStringValue("3Mv3mr3uNXdpgkVPApbGEJjMQXqau37DY5i")
1721
18-let BuildStarted = "BUILD_STARTED"
22+func checkAdmin (caller) = if (if (if (if ((caller == adminWallet))
23+ then true
24+ else (caller == this))
25+ then true
26+ else (caller.bytes == assetsAddress))
27+ then true
28+ else (caller.bytes == treasuryAddress))
29+ then true
30+ else (caller.bytes == marketplaceAddress)
1931
20-let BuildFinished = "BUILD_FINISHED"
2132
22-let Assets = ["Nation", "City", "Barrack", "Barn", "Warrior", "Settler", "Explorer"]
33+func tryGetInteger (key) = match getInteger(this, key) {
34+ case b: Int =>
35+ b
36+ case _ =>
37+ 0
38+}
2339
24-let assetsCost = [0, 0, 5000000000, 5000000000, 500000000, 10000000000, 100000000]
2540
26-let assetsSellPrice = [0, 0, 0, 0, 0, 10000000000, 100000000]
41+func tryGetBoolean (key) = match getBoolean(this, key) {
42+ case b: Boolean =>
43+ b
44+ case _ =>
45+ false
46+}
2747
28-let assetsDelay = [0, 4, 4, 4, 2, 2, 2]
2948
30-let assetsPower = [0, 1000, 50, 50, 1, 1, 1]
49+func tryGetString (key) = match getString(this, key) {
50+ case b: String =>
51+ b
52+ case _ =>
53+ ""
54+}
55+
56+
57+func getALKey (Name,Level) = ((Name + "_lvl") + toString(Level))
58+
59+
60+func confTryGetInteger (key) = match getInteger(Address(configurationAddress), key) {
61+ case b: Int =>
62+ b
63+ case _ =>
64+ 0
65+}
66+
67+
68+func confTryGetString (key) = match getString(Address(configurationAddress), key) {
69+ case b: String =>
70+ b
71+ case _ =>
72+ ""
73+}
74+
75+
76+func confTryGetBoolean (key) = match getBoolean(Address(configurationAddress), key) {
77+ case b: Boolean =>
78+ b
79+ case _ =>
80+ false
81+}
82+
83+
84+func getTreasuryKey (nationid) = (nationid + "_Treasury")
85+
3186
3287 func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) {
3388 case b: Int =>
45100 }
46101
47102
48-func tryGetString (key) = match getString(this, key) {
103+func nationsTryGetBoolean (key) = match getBoolean(Address(nationsAddress), key) {
104+ case b: Boolean =>
105+ b
106+ case _ =>
107+ false
108+}
109+
110+
111+func nationsTryGetString (key) = match getString(Address(nationsAddress), key) {
49112 case b: String =>
50113 b
51114 case _ =>
53116 }
54117
55118
56-func tryGetInteger (key) = match getInteger(this, key) {
57- case b: Int =>
58- b
59- case _ =>
60- 0
61-}
119+func getAssetOwnerKeyString (assetId) = (assetId + "_Owner")
62120
121+
122+let BuildStarted = "BUILD_STARTED"
123+
124+let BuildFinished = "BUILD_FINISHED"
63125
64126 func getAssetIdKey (txId,assetType) = ((assetType + "_") + toBase58String(txId))
65127
66128
67129 func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner")
68-
69-
70-func getAssetOwnerKeyString (assetId) = (assetId + "_Owner")
71130
72131
73132 func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh")
76135 func getBuildingStatusKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_status")
77136
78137
79-func getTreasuryKey (nationid) = (nationid + "_Treasury")
80-
81-
82-func checkAdmin (caller) = if (if (if (if ((caller == adminWallet))
83- then true
84- else (caller == this))
85- then true
86- else (caller.bytes == nationsAddress))
87- then true
88- else (caller.bytes == treasuryAddress))
89- then true
90- else (caller.bytes == marketplaceAddress)
138+func getAssetTypeLevel (assetStr) = {
139+ let chunks = split(assetStr, "_")
140+ let strAssetType = chunks[0]
141+ let level = parseIntValue(drop(chunks[1], 3))
142+ $Tuple2(strAssetType, level)
143+ }
91144
92145
93146 func internalFinishBuild (caller,assetStr,assetKey,BuildingStatusKey,finishHeightKey) = {
147+ let chunks = getAssetTypeLevel(assetStr)
148+ let strAssetType = chunks._1
149+ let level = chunks._2
150+ let k = getALKey(strAssetType, level)
94151 let buildingFinishHeight = getIntegerValue(this, finishHeightKey)
95152 if ((buildingFinishHeight > height))
96153 then throw((((("Building is not finished yet " + toString((buildingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((buildingFinishHeight - height))) + " minutes"))
97- else {
98- let idx = value(indexOf(Assets, assetStr))
99- let assetPower = assetsPower[idx]
100- let assetCoins = ((assetsCost[idx] * 20) / 100)
101- let refCall = invoke(Address(treasuryAddress), "Pay", [caller, assetCoins], nil)
102- if ((refCall == refCall))
103- then if ((assetPower > 0))
104- then {
105- let currentPower = nationsTryGetInteger((caller + "_Power"))
106- let pw = invoke(Address(nationsAddress), "setUserPower", [caller, (currentPower + assetPower)], nil)
107- if ((pw == pw))
108- then [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
109- else throw("Strict value is not equal to itself.")
110- }
111- else [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
112- else throw("Strict value is not equal to itself.")
113- }
154+ else if ((take(strAssetType, 4) == "TECH"))
155+ then {
156+ let discovered = invoke(Address(nationsAddress), "setTecnhnologyDiscovered", [caller, k], nil)
157+ if ((discovered == true))
158+ then [DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
159+ else throw("error discovering technology")
160+ }
161+ else {
162+ let assetPower = confTryGetInteger((k + "_Power"))
163+ let assetCoins = ((confTryGetInteger((k + "_Cost")) * 20) / 100)
164+ let refCall = invoke(Address(treasuryAddress), "Pay", [caller, assetCoins], nil)
165+ if ((refCall == refCall))
166+ then if ((assetPower > 0))
167+ then {
168+ let currentPower = nationsTryGetInteger((caller + "_Power"))
169+ let pw = invoke(Address(nationsAddress), "setUserPower", [caller, (currentPower + assetPower)], nil)
170+ if ((pw == pw))
171+ then [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
172+ else throw("Strict value is not equal to itself.")
173+ }
174+ else [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
175+ else throw("Strict value is not equal to itself.")
176+ }
114177 }
115178
116179
117180 func checkAssetOwner (caller,assetKey) = {
118- let assetOwner = tryGetString((assetKey + "_Owner"))
181+ let assetOwner = tryGetString(getAssetOwnerKeyString(assetKey))
119182 (assetOwner == caller)
120183 }
121184
122185
123-func isNationReservedAsset (strAssetType) = if ((strAssetType == "Settler"))
124- then true
125- else (strAssetType == "Explorer")
186+func isNationReservedAsset (Name,Level) = {
187+ let k = getALKey(Name, Level)
188+ confTryGetBoolean((k + "_NationReserved"))
189+ }
126190
127191
128192 func internalTrasnferOwnership (assetId,newOwner) = {
129- let strAssetType = split(assetId, "_")[0]
193+ let chunks = getAssetTypeLevel(assetId)
194+ let strAssetType = chunks._1
195+ let level = chunks._2
196+ let k = getALKey(strAssetType, level)
130197 let oldOwner = tryGetString(getAssetOwnerKeyString(assetId))
131- let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
198+ let assetPower = confTryGetInteger((k + "_Power"))
132199 if ((assetPower > 0))
133200 then {
134201 let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
154221 }
155222
156223
224+func CheckAssetBuildableSacrifice (ALKey,caller,SacrificeKey) = {
225+ let assetSac = confTryGetString((ALKey + "_SacrificeAsset"))
226+ let assetSaclvl = confTryGetInteger((ALKey + "_SacrificeAssetLevel"))
227+ if ((assetSac == ""))
228+ then true
229+ else if (!(checkAssetOwner(caller, SacrificeKey)))
230+ then throw("you are not the owner of the asset")
231+ else {
232+ let chunks = getAssetTypeLevel(SacrificeKey)
233+ if (if ((assetSac != chunks._1))
234+ then true
235+ else (assetSaclvl != chunks._2))
236+ then throw("the sacrificeAsset has the wrong type or level")
237+ else true
238+ }
239+ }
240+
241+
242+func CheckAssetBuildableNation (Name,Level,NationKey,SacrificeKey) = {
243+ let cnfgKey = getALKey(Name, Level)
244+ let tec = confTryGetString((cnfgKey + "_Tecnhology_discovered"))
245+ if ((tec != ""))
246+ then if (nationsTryGetBoolean(((NationKey + "_") + tec)))
247+ then CheckAssetBuildableSacrifice(cnfgKey, NationKey, SacrificeKey)
248+ else false
249+ else CheckAssetBuildableSacrifice(cnfgKey, NationKey, SacrificeKey)
250+ }
251+
252+
253+func CheckAssetBuildableUser (Name,Level,caller,SacrificeKey) = {
254+ let cnfKey = getALKey(Name, Level)
255+ let nationId = nationsTryGetInteger(caller)
256+ if ((nationId == 0))
257+ then false
258+ else {
259+ let tec = confTryGetString((cnfKey + "_Tecnhology_discovered"))
260+ if ((tec != ""))
261+ then {
262+ let NationKey = nationsTryGetString(toString(nationId))
263+ if (nationsTryGetBoolean(((NationKey + "_") + tec)))
264+ then CheckAssetBuildableSacrifice(cnfKey, caller, SacrificeKey)
265+ else false
266+ }
267+ else CheckAssetBuildableSacrifice(cnfKey, caller, SacrificeKey)
268+ }
269+ }
270+
271+
272+func CheckAssetBuildable (Name,Level,Caller,NationKey,SacrificeKey) = if ((NationKey == ""))
273+ then CheckAssetBuildableNation(Name, Level, NationKey, SacrificeKey)
274+ else CheckAssetBuildableUser(Name, Level, Caller, SacrificeKey)
275+
276+
157277 @Callable(i)
158-func StartBuild (strAssetType,NationKey,SettlerKey) = if (!(containsElement(Assets, strAssetType)))
159- then throw("This asset is not managed by the system")
278+func StartBuild (strAssetType,Level,NationKey,SacrificeKey) = if (!(CheckAssetBuildable(strAssetType, Level, toString(i.caller), NationKey, SacrificeKey)))
279+ then throw("You cannot build this Item")
160280 else {
161- let ind = value(indexOf(Assets, strAssetType))
162- let delayForBuilding = assetsDelay[ind]
163- let assetBuildCost = assetsCost[ind]
281+ let cnfgKey = getALKey(strAssetType, Level)
282+ let delayForBuilding = confTryGetInteger((cnfgKey + "_BuildTime"))
283+ let assetBuildCost = confTryGetInteger((cnfgKey + "_Cost"))
164284 let ToAdminWallet = ((assetBuildCost * 5) / 100)
165285 let ToGameRewardsWallet = ((assetBuildCost * 10) / 100)
166286 let ToStakingRewardsWallet = ((assetBuildCost * 65) / 100)
167287 let UnitStakeSheg = (((assetBuildCost - ToAdminWallet) - ToGameRewardsWallet) - ToStakingRewardsWallet)
168- if (isNationReservedAsset(strAssetType))
288+ if (isNationReservedAsset(strAssetType, Level))
169289 then if (if (!(checkAssetOwner(toString(i.caller), NationKey)))
170290 then !(checkAdmin(i.caller))
171291 else false)
172- then throw("You are not authorized to perform this operation")
292+ then throw("You are not the owner of the nation")
173293 else {
174294 let nationsheg = treasuryTryGetInteger(getTreasuryKey(NationKey))
175295 if ((assetBuildCost > nationsheg))
196316 }
197317 }
198318 }
199- else if ((strAssetType == "City"))
200- then if (!(checkAssetOwner(toString(i.caller), SettlerKey)))
201- then throw("You don't own the settler or has been destroyed")
202- else {
203- let settlerSheg = tryGetInteger(SettlerKey)
319+ else {
320+ let assetSac = confTryGetString((cnfgKey + "_SacrificeAsset"))
321+ if ((assetSac != ""))
322+ then {
204323 let pw = invoke(Address(treasuryAddress), "NoPaymentDeposit", [toString(i.caller), UnitStakeSheg], nil)
205324 match pw {
206325 case r: Int =>
207326 let transfer = invoke(Address(treasuryAddress), "distributeNationPayRewards", [assetBuildCost], nil)
208327 match transfer {
209328 case t: Int =>
210-[DeleteEntry(SettlerKey), 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))]
329+[DeleteEntry(SacrificeKey), 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))]
211330 case _ =>
212331 throw("Error Distributing asset rewards")
213332 }
215334 throw("Error adding deposit")
216335 }
217336 }
218- else {
219- let amountIn = value(i.payments[0].amount)
220- if ((assetBuildCost > amountIn))
221- then throw(("You provided less $heg than the needed cost for building this " + strAssetType))
222- else if ((i.payments[0].assetId != shinywggid))
223- then throw("Only $HEG payments allowed")
224- else {
225- let pw = invoke(Address(treasuryAddress), "Deposit", nil, [AttachedPayment(shinywggid, UnitStakeSheg)])
226- match pw {
227- case r: Int =>
337+ else {
338+ let amountIn = value(i.payments[0].amount)
339+ if ((assetBuildCost > amountIn))
340+ then throw(("You provided less $heg than the needed cost for building this " + strAssetType))
341+ else if ((i.payments[0].assetId != shinywggid))
342+ then throw("Only $HEG payments allowed")
343+ else {
344+ let pw = invoke(Address(treasuryAddress), "Deposit", nil, [AttachedPayment(shinywggid, UnitStakeSheg)])
345+ match pw {
346+ case r: Int =>
228347 [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)), ScriptTransfer(adminWallet, ToAdminWallet, shinywggid), ScriptTransfer(dailyGameRewardsWallet, ToGameRewardsWallet, shinywggid), ScriptTransfer(dailyStakingRewardsWallet, ToStakingRewardsWallet, shinywggid)]
229- case _ =>
230- throw("Incorrect invoke result")
231- }
232- }
233- }
348+ case _ =>
349+ throw("Incorrect invoke result")
350+ }
351+ }
352+ }
353+ }
234354 }
235355
236356
237357
238358 @Callable(i)
239-func FinishBuild (txIdStr,assetStr,NationKey) = {
359+func FinishBuild (txIdStr,assetStr,Level,NationKey) = {
240360 let txId = fromBase58String(txIdStr)
241361 let BuildingStatusKey = getBuildingStatusKey(toString(i.caller), txId, assetStr)
242362 let finishHeightKey = getBuildingFinishHeightKey(toString(i.caller), txId, assetStr)
243363 let assetKey = getAssetIdKey(txId, assetStr)
244364 let assetOwner = tryGetString(getAssetOwnerKey(txId, assetStr))
245- if (isNationReservedAsset(assetStr))
365+ if (isNationReservedAsset(assetStr, Level))
246366 then if (if (!(checkAssetOwner(toString(i.caller), NationKey)))
247367 then !(checkAdmin(i.caller))
248368 else false)
272392
273393 @Callable(i)
274394 func destroyAssetAndTransfer (assetId,toAddress) = {
275- let strAssetType = split(assetId, "_")[0]
395+ let chunks = getAssetTypeLevel(assetId)
396+ let strAssetType = chunks._1
397+ let level = chunks._2
398+ let k = getALKey(strAssetType, level)
276399 if (!(checkAdmin(i.caller)))
277400 then throw("Only the admin can perform this operation")
278401 else {
282405 if ((refCall == refCall))
283406 then {
284407 let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
285- let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
408+ let assetPower = confTryGetInteger((k + "_Power"))
286409 let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil)
287410 if ((pw == pw))
288411 then match pw {
301424
302425 @Callable(i)
303426 func destroyAssetFromUser (assetId) = {
304- let strAssetType = split(assetId, "_")[0]
427+ let chunks = getAssetTypeLevel(assetId)
428+ let strAssetType = chunks._1
429+ let level = chunks._2
430+ let k = getALKey(strAssetType, level)
305431 if (!(checkAssetOwner(toString(i.caller), assetId)))
306432 then throw("You don't own this asset")
307433 else {
308434 let assetCoins = tryGetInteger(assetId)
309435 let currentPower = nationsTryGetInteger((toString(i.caller) + "_Power"))
310- let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
436+ let assetPower = confTryGetInteger((k + "_Power"))
311437 let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil)
312438 if ((pw == pw))
313439 then match pw {
342468
343469 @Callable(i)
344470 func buyNationItem (assetId,NationKey) = {
345- let strAssetType = split(assetId, "_")[0]
471+ let chunks = getAssetTypeLevel(assetId)
472+ let strAssetType = chunks._1
473+ let level = chunks._2
474+ let k = getALKey(strAssetType, level)
346475 let n = nationsTryGetInteger(toString(i.caller))
347476 let nid = nationsTryGetInteger(NationKey)
348477 if ((n != nid))
349478 then throw("you can buy assets only from your nation")
350479 else if (!(checkAssetOwner(NationKey, assetId)))
351480 then throw("The asset does not belong to the nation")
352- else if (!(isNationReservedAsset(strAssetType)))
481+ else if (!(isNationReservedAsset(strAssetType, level)))
353482 then throw("this asset cannot be sold by the nation")
354483 else {
355- let ind = value(indexOf(Assets, strAssetType))
356- let assetPrice = assetsSellPrice[ind]
484+ let assetPrice = confTryGetInteger((getALKey(strAssetType, level) + "_SellPrice"))
357485 let amountIn = value(i.payments[0].amount)
358486 if ((assetPrice > amountIn))
359487 then throw(("You provided less $heg than the needed cost for buying this " + strAssetType))
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
8-let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy'
8+let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb'
99
1010 let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A'
11+
12+let configurationAddress = base58'3N9tj3b2djcaZozn97VkYchL9S1i6cdEbC1'
13+
14+let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy'
1115
1216 let adminWallet = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9")
1317
1418 let dailyGameRewardsWallet = addressFromStringValue("3MuSrXTTiwo9bdoD6FeaBpMUYMiU5saDv2U")
1519
1620 let dailyStakingRewardsWallet = addressFromStringValue("3Mv3mr3uNXdpgkVPApbGEJjMQXqau37DY5i")
1721
18-let BuildStarted = "BUILD_STARTED"
22+func checkAdmin (caller) = if (if (if (if ((caller == adminWallet))
23+ then true
24+ else (caller == this))
25+ then true
26+ else (caller.bytes == assetsAddress))
27+ then true
28+ else (caller.bytes == treasuryAddress))
29+ then true
30+ else (caller.bytes == marketplaceAddress)
1931
20-let BuildFinished = "BUILD_FINISHED"
2132
22-let Assets = ["Nation", "City", "Barrack", "Barn", "Warrior", "Settler", "Explorer"]
33+func tryGetInteger (key) = match getInteger(this, key) {
34+ case b: Int =>
35+ b
36+ case _ =>
37+ 0
38+}
2339
24-let assetsCost = [0, 0, 5000000000, 5000000000, 500000000, 10000000000, 100000000]
2540
26-let assetsSellPrice = [0, 0, 0, 0, 0, 10000000000, 100000000]
41+func tryGetBoolean (key) = match getBoolean(this, key) {
42+ case b: Boolean =>
43+ b
44+ case _ =>
45+ false
46+}
2747
28-let assetsDelay = [0, 4, 4, 4, 2, 2, 2]
2948
30-let assetsPower = [0, 1000, 50, 50, 1, 1, 1]
49+func tryGetString (key) = match getString(this, key) {
50+ case b: String =>
51+ b
52+ case _ =>
53+ ""
54+}
55+
56+
57+func getALKey (Name,Level) = ((Name + "_lvl") + toString(Level))
58+
59+
60+func confTryGetInteger (key) = match getInteger(Address(configurationAddress), key) {
61+ case b: Int =>
62+ b
63+ case _ =>
64+ 0
65+}
66+
67+
68+func confTryGetString (key) = match getString(Address(configurationAddress), key) {
69+ case b: String =>
70+ b
71+ case _ =>
72+ ""
73+}
74+
75+
76+func confTryGetBoolean (key) = match getBoolean(Address(configurationAddress), key) {
77+ case b: Boolean =>
78+ b
79+ case _ =>
80+ false
81+}
82+
83+
84+func getTreasuryKey (nationid) = (nationid + "_Treasury")
85+
3186
3287 func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) {
3388 case b: Int =>
3489 b
3590 case _ =>
3691 0
3792 }
3893
3994
4095 func nationsTryGetInteger (key) = match getInteger(Address(nationsAddress), key) {
4196 case b: Int =>
4297 b
4398 case _ =>
4499 0
45100 }
46101
47102
48-func tryGetString (key) = match getString(this, key) {
103+func nationsTryGetBoolean (key) = match getBoolean(Address(nationsAddress), key) {
104+ case b: Boolean =>
105+ b
106+ case _ =>
107+ false
108+}
109+
110+
111+func nationsTryGetString (key) = match getString(Address(nationsAddress), key) {
49112 case b: String =>
50113 b
51114 case _ =>
52115 ""
53116 }
54117
55118
56-func tryGetInteger (key) = match getInteger(this, key) {
57- case b: Int =>
58- b
59- case _ =>
60- 0
61-}
119+func getAssetOwnerKeyString (assetId) = (assetId + "_Owner")
62120
121+
122+let BuildStarted = "BUILD_STARTED"
123+
124+let BuildFinished = "BUILD_FINISHED"
63125
64126 func getAssetIdKey (txId,assetType) = ((assetType + "_") + toBase58String(txId))
65127
66128
67129 func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner")
68-
69-
70-func getAssetOwnerKeyString (assetId) = (assetId + "_Owner")
71130
72131
73132 func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh")
74133
75134
76135 func getBuildingStatusKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_status")
77136
78137
79-func getTreasuryKey (nationid) = (nationid + "_Treasury")
80-
81-
82-func checkAdmin (caller) = if (if (if (if ((caller == adminWallet))
83- then true
84- else (caller == this))
85- then true
86- else (caller.bytes == nationsAddress))
87- then true
88- else (caller.bytes == treasuryAddress))
89- then true
90- else (caller.bytes == marketplaceAddress)
138+func getAssetTypeLevel (assetStr) = {
139+ let chunks = split(assetStr, "_")
140+ let strAssetType = chunks[0]
141+ let level = parseIntValue(drop(chunks[1], 3))
142+ $Tuple2(strAssetType, level)
143+ }
91144
92145
93146 func internalFinishBuild (caller,assetStr,assetKey,BuildingStatusKey,finishHeightKey) = {
147+ let chunks = getAssetTypeLevel(assetStr)
148+ let strAssetType = chunks._1
149+ let level = chunks._2
150+ let k = getALKey(strAssetType, level)
94151 let buildingFinishHeight = getIntegerValue(this, finishHeightKey)
95152 if ((buildingFinishHeight > height))
96153 then throw((((("Building is not finished yet " + toString((buildingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((buildingFinishHeight - height))) + " minutes"))
97- else {
98- let idx = value(indexOf(Assets, assetStr))
99- let assetPower = assetsPower[idx]
100- let assetCoins = ((assetsCost[idx] * 20) / 100)
101- let refCall = invoke(Address(treasuryAddress), "Pay", [caller, assetCoins], nil)
102- if ((refCall == refCall))
103- then if ((assetPower > 0))
104- then {
105- let currentPower = nationsTryGetInteger((caller + "_Power"))
106- let pw = invoke(Address(nationsAddress), "setUserPower", [caller, (currentPower + assetPower)], nil)
107- if ((pw == pw))
108- then [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
109- else throw("Strict value is not equal to itself.")
110- }
111- else [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
112- else throw("Strict value is not equal to itself.")
113- }
154+ else if ((take(strAssetType, 4) == "TECH"))
155+ then {
156+ let discovered = invoke(Address(nationsAddress), "setTecnhnologyDiscovered", [caller, k], nil)
157+ if ((discovered == true))
158+ then [DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
159+ else throw("error discovering technology")
160+ }
161+ else {
162+ let assetPower = confTryGetInteger((k + "_Power"))
163+ let assetCoins = ((confTryGetInteger((k + "_Cost")) * 20) / 100)
164+ let refCall = invoke(Address(treasuryAddress), "Pay", [caller, assetCoins], nil)
165+ if ((refCall == refCall))
166+ then if ((assetPower > 0))
167+ then {
168+ let currentPower = nationsTryGetInteger((caller + "_Power"))
169+ let pw = invoke(Address(nationsAddress), "setUserPower", [caller, (currentPower + assetPower)], nil)
170+ if ((pw == pw))
171+ then [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
172+ else throw("Strict value is not equal to itself.")
173+ }
174+ else [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)]
175+ else throw("Strict value is not equal to itself.")
176+ }
114177 }
115178
116179
117180 func checkAssetOwner (caller,assetKey) = {
118- let assetOwner = tryGetString((assetKey + "_Owner"))
181+ let assetOwner = tryGetString(getAssetOwnerKeyString(assetKey))
119182 (assetOwner == caller)
120183 }
121184
122185
123-func isNationReservedAsset (strAssetType) = if ((strAssetType == "Settler"))
124- then true
125- else (strAssetType == "Explorer")
186+func isNationReservedAsset (Name,Level) = {
187+ let k = getALKey(Name, Level)
188+ confTryGetBoolean((k + "_NationReserved"))
189+ }
126190
127191
128192 func internalTrasnferOwnership (assetId,newOwner) = {
129- let strAssetType = split(assetId, "_")[0]
193+ let chunks = getAssetTypeLevel(assetId)
194+ let strAssetType = chunks._1
195+ let level = chunks._2
196+ let k = getALKey(strAssetType, level)
130197 let oldOwner = tryGetString(getAssetOwnerKeyString(assetId))
131- let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
198+ let assetPower = confTryGetInteger((k + "_Power"))
132199 if ((assetPower > 0))
133200 then {
134201 let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
135202 let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil)
136203 if ((pw == pw))
137204 then if ((pw != (currentPower - assetPower)))
138205 then throw("Incorrect invoke result")
139206 else {
140207 let newcurrentPower = nationsTryGetInteger((newOwner + "_Power"))
141208 let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil)
142209 if ((pw2 == pw2))
143210 then match pw2 {
144211 case r: Int =>
145212 [StringEntry(getAssetOwnerKeyString(assetId), newOwner)]
146213 case _ =>
147214 throw("Incorrect invoke result")
148215 }
149216 else throw("Strict value is not equal to itself.")
150217 }
151218 else throw("Strict value is not equal to itself.")
152219 }
153220 else [StringEntry(getAssetOwnerKeyString(assetId), newOwner)]
154221 }
155222
156223
224+func CheckAssetBuildableSacrifice (ALKey,caller,SacrificeKey) = {
225+ let assetSac = confTryGetString((ALKey + "_SacrificeAsset"))
226+ let assetSaclvl = confTryGetInteger((ALKey + "_SacrificeAssetLevel"))
227+ if ((assetSac == ""))
228+ then true
229+ else if (!(checkAssetOwner(caller, SacrificeKey)))
230+ then throw("you are not the owner of the asset")
231+ else {
232+ let chunks = getAssetTypeLevel(SacrificeKey)
233+ if (if ((assetSac != chunks._1))
234+ then true
235+ else (assetSaclvl != chunks._2))
236+ then throw("the sacrificeAsset has the wrong type or level")
237+ else true
238+ }
239+ }
240+
241+
242+func CheckAssetBuildableNation (Name,Level,NationKey,SacrificeKey) = {
243+ let cnfgKey = getALKey(Name, Level)
244+ let tec = confTryGetString((cnfgKey + "_Tecnhology_discovered"))
245+ if ((tec != ""))
246+ then if (nationsTryGetBoolean(((NationKey + "_") + tec)))
247+ then CheckAssetBuildableSacrifice(cnfgKey, NationKey, SacrificeKey)
248+ else false
249+ else CheckAssetBuildableSacrifice(cnfgKey, NationKey, SacrificeKey)
250+ }
251+
252+
253+func CheckAssetBuildableUser (Name,Level,caller,SacrificeKey) = {
254+ let cnfKey = getALKey(Name, Level)
255+ let nationId = nationsTryGetInteger(caller)
256+ if ((nationId == 0))
257+ then false
258+ else {
259+ let tec = confTryGetString((cnfKey + "_Tecnhology_discovered"))
260+ if ((tec != ""))
261+ then {
262+ let NationKey = nationsTryGetString(toString(nationId))
263+ if (nationsTryGetBoolean(((NationKey + "_") + tec)))
264+ then CheckAssetBuildableSacrifice(cnfKey, caller, SacrificeKey)
265+ else false
266+ }
267+ else CheckAssetBuildableSacrifice(cnfKey, caller, SacrificeKey)
268+ }
269+ }
270+
271+
272+func CheckAssetBuildable (Name,Level,Caller,NationKey,SacrificeKey) = if ((NationKey == ""))
273+ then CheckAssetBuildableNation(Name, Level, NationKey, SacrificeKey)
274+ else CheckAssetBuildableUser(Name, Level, Caller, SacrificeKey)
275+
276+
157277 @Callable(i)
158-func StartBuild (strAssetType,NationKey,SettlerKey) = if (!(containsElement(Assets, strAssetType)))
159- then throw("This asset is not managed by the system")
278+func StartBuild (strAssetType,Level,NationKey,SacrificeKey) = if (!(CheckAssetBuildable(strAssetType, Level, toString(i.caller), NationKey, SacrificeKey)))
279+ then throw("You cannot build this Item")
160280 else {
161- let ind = value(indexOf(Assets, strAssetType))
162- let delayForBuilding = assetsDelay[ind]
163- let assetBuildCost = assetsCost[ind]
281+ let cnfgKey = getALKey(strAssetType, Level)
282+ let delayForBuilding = confTryGetInteger((cnfgKey + "_BuildTime"))
283+ let assetBuildCost = confTryGetInteger((cnfgKey + "_Cost"))
164284 let ToAdminWallet = ((assetBuildCost * 5) / 100)
165285 let ToGameRewardsWallet = ((assetBuildCost * 10) / 100)
166286 let ToStakingRewardsWallet = ((assetBuildCost * 65) / 100)
167287 let UnitStakeSheg = (((assetBuildCost - ToAdminWallet) - ToGameRewardsWallet) - ToStakingRewardsWallet)
168- if (isNationReservedAsset(strAssetType))
288+ if (isNationReservedAsset(strAssetType, Level))
169289 then if (if (!(checkAssetOwner(toString(i.caller), NationKey)))
170290 then !(checkAdmin(i.caller))
171291 else false)
172- then throw("You are not authorized to perform this operation")
292+ then throw("You are not the owner of the nation")
173293 else {
174294 let nationsheg = treasuryTryGetInteger(getTreasuryKey(NationKey))
175295 if ((assetBuildCost > nationsheg))
176296 then throw("The nation hasn't enough funds")
177297 else {
178298 let d = invoke(Address(treasuryAddress), "decreaseNationWallet", [NationKey, assetBuildCost], nil)
179299 match d {
180300 case r: Int =>
181301 let pw = invoke(Address(treasuryAddress), "arbitraryAddCoins", [NationKey, UnitStakeSheg], nil)
182302 match pw {
183303 case b: Int =>
184304 let transfer = invoke(Address(treasuryAddress), "distributeNationPayRewards", [assetBuildCost], nil)
185305 match transfer {
186306 case t: Int =>
187307 [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))]
188308 case _ =>
189309 throw("Error Distributing asset rewards")
190310 }
191311 case _ =>
192312 throw("Error Depositing nation funds")
193313 }
194314 case _ =>
195315 throw("Error Depositing nation funds")
196316 }
197317 }
198318 }
199- else if ((strAssetType == "City"))
200- then if (!(checkAssetOwner(toString(i.caller), SettlerKey)))
201- then throw("You don't own the settler or has been destroyed")
202- else {
203- let settlerSheg = tryGetInteger(SettlerKey)
319+ else {
320+ let assetSac = confTryGetString((cnfgKey + "_SacrificeAsset"))
321+ if ((assetSac != ""))
322+ then {
204323 let pw = invoke(Address(treasuryAddress), "NoPaymentDeposit", [toString(i.caller), UnitStakeSheg], nil)
205324 match pw {
206325 case r: Int =>
207326 let transfer = invoke(Address(treasuryAddress), "distributeNationPayRewards", [assetBuildCost], nil)
208327 match transfer {
209328 case t: Int =>
210-[DeleteEntry(SettlerKey), 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))]
329+[DeleteEntry(SacrificeKey), 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))]
211330 case _ =>
212331 throw("Error Distributing asset rewards")
213332 }
214333 case _ =>
215334 throw("Error adding deposit")
216335 }
217336 }
218- else {
219- let amountIn = value(i.payments[0].amount)
220- if ((assetBuildCost > amountIn))
221- then throw(("You provided less $heg than the needed cost for building this " + strAssetType))
222- else if ((i.payments[0].assetId != shinywggid))
223- then throw("Only $HEG payments allowed")
224- else {
225- let pw = invoke(Address(treasuryAddress), "Deposit", nil, [AttachedPayment(shinywggid, UnitStakeSheg)])
226- match pw {
227- case r: Int =>
337+ else {
338+ let amountIn = value(i.payments[0].amount)
339+ if ((assetBuildCost > amountIn))
340+ then throw(("You provided less $heg than the needed cost for building this " + strAssetType))
341+ else if ((i.payments[0].assetId != shinywggid))
342+ then throw("Only $HEG payments allowed")
343+ else {
344+ let pw = invoke(Address(treasuryAddress), "Deposit", nil, [AttachedPayment(shinywggid, UnitStakeSheg)])
345+ match pw {
346+ case r: Int =>
228347 [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)), ScriptTransfer(adminWallet, ToAdminWallet, shinywggid), ScriptTransfer(dailyGameRewardsWallet, ToGameRewardsWallet, shinywggid), ScriptTransfer(dailyStakingRewardsWallet, ToStakingRewardsWallet, shinywggid)]
229- case _ =>
230- throw("Incorrect invoke result")
231- }
232- }
233- }
348+ case _ =>
349+ throw("Incorrect invoke result")
350+ }
351+ }
352+ }
353+ }
234354 }
235355
236356
237357
238358 @Callable(i)
239-func FinishBuild (txIdStr,assetStr,NationKey) = {
359+func FinishBuild (txIdStr,assetStr,Level,NationKey) = {
240360 let txId = fromBase58String(txIdStr)
241361 let BuildingStatusKey = getBuildingStatusKey(toString(i.caller), txId, assetStr)
242362 let finishHeightKey = getBuildingFinishHeightKey(toString(i.caller), txId, assetStr)
243363 let assetKey = getAssetIdKey(txId, assetStr)
244364 let assetOwner = tryGetString(getAssetOwnerKey(txId, assetStr))
245- if (isNationReservedAsset(assetStr))
365+ if (isNationReservedAsset(assetStr, Level))
246366 then if (if (!(checkAssetOwner(toString(i.caller), NationKey)))
247367 then !(checkAdmin(i.caller))
248368 else false)
249369 then throw("You are not authorized to perform this operation")
250370 else internalFinishBuild(NationKey, assetStr, assetKey, BuildingStatusKey, finishHeightKey)
251371 else if ((assetOwner != toString(i.caller)))
252372 then throw(("You cannot claim other's players " + assetStr))
253373 else {
254374 let buildingTxStatus = tryGetString(BuildingStatusKey)
255375 if ((buildingTxStatus == ""))
256376 then throw("No pending operations for this asset")
257377 else internalFinishBuild(toString(i.caller), assetStr, assetKey, BuildingStatusKey, finishHeightKey)
258378 }
259379 }
260380
261381
262382
263383 @Callable(i)
264384 func transferOwnership (assetId,newOwner) = {
265385 let strAssetType = split(assetId, "_")[0]
266386 if (!(checkAdmin(i.caller)))
267387 then throw("Only the admin can perform this operation")
268388 else $Tuple2(internalTrasnferOwnership(assetId, newOwner), newOwner)
269389 }
270390
271391
272392
273393 @Callable(i)
274394 func destroyAssetAndTransfer (assetId,toAddress) = {
275- let strAssetType = split(assetId, "_")[0]
395+ let chunks = getAssetTypeLevel(assetId)
396+ let strAssetType = chunks._1
397+ let level = chunks._2
398+ let k = getALKey(strAssetType, level)
276399 if (!(checkAdmin(i.caller)))
277400 then throw("Only the admin can perform this operation")
278401 else {
279402 let oldOwner = tryGetString(getAssetOwnerKeyString(assetId))
280403 let assetCoins = tryGetInteger(assetId)
281404 let refCall = invoke(Address(treasuryAddress), "adminTransfer", [addressFromStringValue(toAddress), assetCoins], nil)
282405 if ((refCall == refCall))
283406 then {
284407 let currentPower = nationsTryGetInteger((oldOwner + "_Power"))
285- let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
408+ let assetPower = confTryGetInteger((k + "_Power"))
286409 let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil)
287410 if ((pw == pw))
288411 then match pw {
289412 case r: Int =>
290413 [DeleteEntry(assetId)]
291414 case _ =>
292415 throw("Error setting user power")
293416 }
294417 else throw("Strict value is not equal to itself.")
295418 }
296419 else throw("Strict value is not equal to itself.")
297420 }
298421 }
299422
300423
301424
302425 @Callable(i)
303426 func destroyAssetFromUser (assetId) = {
304- let strAssetType = split(assetId, "_")[0]
427+ let chunks = getAssetTypeLevel(assetId)
428+ let strAssetType = chunks._1
429+ let level = chunks._2
430+ let k = getALKey(strAssetType, level)
305431 if (!(checkAssetOwner(toString(i.caller), assetId)))
306432 then throw("You don't own this asset")
307433 else {
308434 let assetCoins = tryGetInteger(assetId)
309435 let currentPower = nationsTryGetInteger((toString(i.caller) + "_Power"))
310- let assetPower = assetsPower[value(indexOf(Assets, strAssetType))]
436+ let assetPower = confTryGetInteger((k + "_Power"))
311437 let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil)
312438 if ((pw == pw))
313439 then match pw {
314440 case r: Int =>
315441 let tr = invoke(Address(treasuryAddress), "adminTransfer", [toString(i.caller), assetCoins], nil)
316442 match tr {
317443 case t: Int =>
318444 [DeleteEntry(assetId)]
319445 case _ =>
320446 throw("Error transferring coins")
321447 }
322448 case _ =>
323449 throw("Error setting user power")
324450 }
325451 else throw("Strict value is not equal to itself.")
326452 }
327453 }
328454
329455
330456
331457 @Callable(i)
332458 func setNationOwner (nationKey,newOwner) = if (checkAdmin(i.caller))
333459 then $Tuple2([StringEntry((nationKey + "_Owner"), newOwner)], true)
334460 else {
335461 let currentOwner = tryGetString((nationKey + "_Owner"))
336462 if ((currentOwner != toString(i.caller)))
337463 then throw("You are not the nation owner")
338464 else [StringEntry((nationKey + "_Owner"), newOwner)]
339465 }
340466
341467
342468
343469 @Callable(i)
344470 func buyNationItem (assetId,NationKey) = {
345- let strAssetType = split(assetId, "_")[0]
471+ let chunks = getAssetTypeLevel(assetId)
472+ let strAssetType = chunks._1
473+ let level = chunks._2
474+ let k = getALKey(strAssetType, level)
346475 let n = nationsTryGetInteger(toString(i.caller))
347476 let nid = nationsTryGetInteger(NationKey)
348477 if ((n != nid))
349478 then throw("you can buy assets only from your nation")
350479 else if (!(checkAssetOwner(NationKey, assetId)))
351480 then throw("The asset does not belong to the nation")
352- else if (!(isNationReservedAsset(strAssetType)))
481+ else if (!(isNationReservedAsset(strAssetType, level)))
353482 then throw("this asset cannot be sold by the nation")
354483 else {
355- let ind = value(indexOf(Assets, strAssetType))
356- let assetPrice = assetsSellPrice[ind]
484+ let assetPrice = confTryGetInteger((getALKey(strAssetType, level) + "_SellPrice"))
357485 let amountIn = value(i.payments[0].amount)
358486 if ((assetPrice > amountIn))
359487 then throw(("You provided less $heg than the needed cost for buying this " + strAssetType))
360488 else if ((i.payments[0].assetId != shinywggid))
361489 then throw("Only $HEG payments allowed")
362490 else {
363491 let a = invoke(Address(treasuryAddress), "increaseNationWallet", [NationKey, amountIn], nil)
364492 match a {
365493 case b: Int =>
366494 (internalTrasnferOwnership(assetId, toString(i.caller)) :+ ScriptTransfer(Address(treasuryAddress), amountIn, shinywggid))
367495 case _ =>
368496 throw("Error transferring SHEG to nations wallet")
369497 }
370498 }
371499 }
372500 }
373501
374502
375503
376504 @Callable(i)
377505 func AddAssetFromMarkeplace (assetId,oldOwner,assetSheg) = if (!(checkAdmin(i.caller)))
378506 then throw("You are not allowed to perform this operation")
379507 else $Tuple2([StringEntry(getAssetOwnerKeyString(assetId), oldOwner), IntegerEntry(assetId, assetSheg)], oldOwner)
380508
381509
382510
383511 @Callable(i)
384512 func TransferAssetToMarketplace (assetId,sellprice) = if (!(checkAssetOwner(toString(i.caller), assetId)))
385513 then throw("You are not the owner of this asset")
386514 else {
387515 let assetSheg = tryGetInteger(assetId)
388516 let tr = invoke(Address(marketplaceAddress), "putOnSale", [assetId, assetSheg, sellprice], nil)
389517 match tr {
390518 case t: Int =>
391519 [DeleteEntry(getAssetOwnerKeyString(assetId)), DeleteEntry(assetId)]
392520 case _ =>
393521 throw("Error putting the item on the marketplace")
394522 }
395523 }
396524
397525

github/deemru/w8io/169f3d6 
67.16 ms