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/tXRyOLTQLgAAAAAObmF0aW9uc0FkZHJlc3MBAAAAGgFUTYXo3vT4RGtZEDtwX8O3uWUOUfVERm2gAAAAAAthZG1pbldhbGxldAkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQIAAAAjM01wTnRpUFNSU3E2Tm5hUVlrMzh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WwFAAAAA25pbAQAAAAHJG1hdGNoMAUAAAACdHIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABdAUAAAAHJG1hdGNoMAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAWZ2V0QXNzZXRPd25lcktleVN0cmluZwAAAAEFAAAAB2Fzc2V0SWQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAAHYXNzZXRJZAUAAAADbmlsCQAAAgAAAAECAAAAKUVycm9yIHB1dHRpbmcgdGhlIGl0ZW0gb24gdGhlIG1hcmtldHBsYWNlAAAAAJwvMFY=", "height": 2094512, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: QAUsTuUi5YBhUwcK7NZCjVGxvaVBAy16uFne2hzxA5P Next: 5qoMJoDxaiEykem7rHiQQwFfCcLspyC1TJ9MukhtoEQ7 Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ' | |
7 | 7 | ||
8 | - | let | |
8 | + | let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb' | |
9 | 9 | ||
10 | 10 | let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A' | |
11 | + | ||
12 | + | let configurationAddress = base58'3N9tj3b2djcaZozn97VkYchL9S1i6cdEbC1' | |
13 | + | ||
14 | + | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
11 | 15 | ||
12 | 16 | let adminWallet = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
13 | 17 | ||
15 | 19 | ||
16 | 20 | let dailyStakingRewardsWallet = addressFromStringValue("3Mv3mr3uNXdpgkVPApbGEJjMQXqau37DY5i") | |
17 | 21 | ||
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) | |
19 | 31 | ||
20 | - | let BuildFinished = "BUILD_FINISHED" | |
21 | 32 | ||
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 | + | } | |
23 | 39 | ||
24 | - | let assetsCost = [0, 0, 5000000000, 5000000000, 500000000, 10000000000, 100000000] | |
25 | 40 | ||
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 | + | } | |
27 | 47 | ||
28 | - | let assetsDelay = [0, 4, 4, 4, 2, 2, 2] | |
29 | 48 | ||
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 | + | ||
31 | 86 | ||
32 | 87 | func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) { | |
33 | 88 | case b: Int => | |
45 | 100 | } | |
46 | 101 | ||
47 | 102 | ||
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) { | |
49 | 112 | case b: String => | |
50 | 113 | b | |
51 | 114 | case _ => | |
53 | 116 | } | |
54 | 117 | ||
55 | 118 | ||
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") | |
62 | 120 | ||
121 | + | ||
122 | + | let BuildStarted = "BUILD_STARTED" | |
123 | + | ||
124 | + | let BuildFinished = "BUILD_FINISHED" | |
63 | 125 | ||
64 | 126 | func getAssetIdKey (txId,assetType) = ((assetType + "_") + toBase58String(txId)) | |
65 | 127 | ||
66 | 128 | ||
67 | 129 | func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner") | |
68 | - | ||
69 | - | ||
70 | - | func getAssetOwnerKeyString (assetId) = (assetId + "_Owner") | |
71 | 130 | ||
72 | 131 | ||
73 | 132 | func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh") | |
76 | 135 | func getBuildingStatusKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_status") | |
77 | 136 | ||
78 | 137 | ||
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 | + | } | |
91 | 144 | ||
92 | 145 | ||
93 | 146 | 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) | |
94 | 151 | let buildingFinishHeight = getIntegerValue(this, finishHeightKey) | |
95 | 152 | if ((buildingFinishHeight > height)) | |
96 | 153 | 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 | + | } | |
114 | 177 | } | |
115 | 178 | ||
116 | 179 | ||
117 | 180 | func checkAssetOwner (caller,assetKey) = { | |
118 | - | let assetOwner = tryGetString((assetKey | |
181 | + | let assetOwner = tryGetString(getAssetOwnerKeyString(assetKey)) | |
119 | 182 | (assetOwner == caller) | |
120 | 183 | } | |
121 | 184 | ||
122 | 185 | ||
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 | + | } | |
126 | 190 | ||
127 | 191 | ||
128 | 192 | 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) | |
130 | 197 | let oldOwner = tryGetString(getAssetOwnerKeyString(assetId)) | |
131 | - | let assetPower = | |
198 | + | let assetPower = confTryGetInteger((k + "_Power")) | |
132 | 199 | if ((assetPower > 0)) | |
133 | 200 | then { | |
134 | 201 | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
154 | 221 | } | |
155 | 222 | ||
156 | 223 | ||
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 | + | ||
157 | 277 | @Callable(i) | |
158 | - | func StartBuild (strAssetType,NationKey, | |
159 | - | then throw(" | |
278 | + | func StartBuild (strAssetType,Level,NationKey,SacrificeKey) = if (!(CheckAssetBuildable(strAssetType, Level, toString(i.caller), NationKey, SacrificeKey))) | |
279 | + | then throw("You cannot build this Item") | |
160 | 280 | else { | |
161 | - | let | |
162 | - | let delayForBuilding = | |
163 | - | let assetBuildCost = | |
281 | + | let cnfgKey = getALKey(strAssetType, Level) | |
282 | + | let delayForBuilding = confTryGetInteger((cnfgKey + "_BuildTime")) | |
283 | + | let assetBuildCost = confTryGetInteger((cnfgKey + "_Cost")) | |
164 | 284 | let ToAdminWallet = ((assetBuildCost * 5) / 100) | |
165 | 285 | let ToGameRewardsWallet = ((assetBuildCost * 10) / 100) | |
166 | 286 | let ToStakingRewardsWallet = ((assetBuildCost * 65) / 100) | |
167 | 287 | let UnitStakeSheg = (((assetBuildCost - ToAdminWallet) - ToGameRewardsWallet) - ToStakingRewardsWallet) | |
168 | - | if (isNationReservedAsset(strAssetType)) | |
288 | + | if (isNationReservedAsset(strAssetType, Level)) | |
169 | 289 | then if (if (!(checkAssetOwner(toString(i.caller), NationKey))) | |
170 | 290 | then !(checkAdmin(i.caller)) | |
171 | 291 | else false) | |
172 | - | then throw("You are not | |
292 | + | then throw("You are not the owner of the nation") | |
173 | 293 | else { | |
174 | 294 | let nationsheg = treasuryTryGetInteger(getTreasuryKey(NationKey)) | |
175 | 295 | if ((assetBuildCost > nationsheg)) | |
196 | 316 | } | |
197 | 317 | } | |
198 | 318 | } | |
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 { | |
204 | 323 | let pw = invoke(Address(treasuryAddress), "NoPaymentDeposit", [toString(i.caller), UnitStakeSheg], nil) | |
205 | 324 | match pw { | |
206 | 325 | case r: Int => | |
207 | 326 | let transfer = invoke(Address(treasuryAddress), "distributeNationPayRewards", [assetBuildCost], nil) | |
208 | 327 | match transfer { | |
209 | 328 | case t: Int => | |
210 | - | [DeleteEntry( | |
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))] | |
211 | 330 | case _ => | |
212 | 331 | throw("Error Distributing asset rewards") | |
213 | 332 | } | |
215 | 334 | throw("Error adding deposit") | |
216 | 335 | } | |
217 | 336 | } | |
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 => | |
228 | 347 | [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 | + | } | |
234 | 354 | } | |
235 | 355 | ||
236 | 356 | ||
237 | 357 | ||
238 | 358 | @Callable(i) | |
239 | - | func FinishBuild (txIdStr,assetStr,NationKey) = { | |
359 | + | func FinishBuild (txIdStr,assetStr,Level,NationKey) = { | |
240 | 360 | let txId = fromBase58String(txIdStr) | |
241 | 361 | let BuildingStatusKey = getBuildingStatusKey(toString(i.caller), txId, assetStr) | |
242 | 362 | let finishHeightKey = getBuildingFinishHeightKey(toString(i.caller), txId, assetStr) | |
243 | 363 | let assetKey = getAssetIdKey(txId, assetStr) | |
244 | 364 | let assetOwner = tryGetString(getAssetOwnerKey(txId, assetStr)) | |
245 | - | if (isNationReservedAsset(assetStr)) | |
365 | + | if (isNationReservedAsset(assetStr, Level)) | |
246 | 366 | then if (if (!(checkAssetOwner(toString(i.caller), NationKey))) | |
247 | 367 | then !(checkAdmin(i.caller)) | |
248 | 368 | else false) | |
272 | 392 | ||
273 | 393 | @Callable(i) | |
274 | 394 | 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) | |
276 | 399 | if (!(checkAdmin(i.caller))) | |
277 | 400 | then throw("Only the admin can perform this operation") | |
278 | 401 | else { | |
282 | 405 | if ((refCall == refCall)) | |
283 | 406 | then { | |
284 | 407 | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
285 | - | let assetPower = | |
408 | + | let assetPower = confTryGetInteger((k + "_Power")) | |
286 | 409 | let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil) | |
287 | 410 | if ((pw == pw)) | |
288 | 411 | then match pw { | |
301 | 424 | ||
302 | 425 | @Callable(i) | |
303 | 426 | 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) | |
305 | 431 | if (!(checkAssetOwner(toString(i.caller), assetId))) | |
306 | 432 | then throw("You don't own this asset") | |
307 | 433 | else { | |
308 | 434 | let assetCoins = tryGetInteger(assetId) | |
309 | 435 | let currentPower = nationsTryGetInteger((toString(i.caller) + "_Power")) | |
310 | - | let assetPower = | |
436 | + | let assetPower = confTryGetInteger((k + "_Power")) | |
311 | 437 | let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil) | |
312 | 438 | if ((pw == pw)) | |
313 | 439 | then match pw { | |
342 | 468 | ||
343 | 469 | @Callable(i) | |
344 | 470 | 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) | |
346 | 475 | let n = nationsTryGetInteger(toString(i.caller)) | |
347 | 476 | let nid = nationsTryGetInteger(NationKey) | |
348 | 477 | if ((n != nid)) | |
349 | 478 | then throw("you can buy assets only from your nation") | |
350 | 479 | else if (!(checkAssetOwner(NationKey, assetId))) | |
351 | 480 | then throw("The asset does not belong to the nation") | |
352 | - | else if (!(isNationReservedAsset(strAssetType))) | |
481 | + | else if (!(isNationReservedAsset(strAssetType, level))) | |
353 | 482 | then throw("this asset cannot be sold by the nation") | |
354 | 483 | else { | |
355 | - | let ind = value(indexOf(Assets, strAssetType)) | |
356 | - | let assetPrice = assetsSellPrice[ind] | |
484 | + | let assetPrice = confTryGetInteger((getALKey(strAssetType, level) + "_SellPrice")) | |
357 | 485 | let amountIn = value(i.payments[0].amount) | |
358 | 486 | if ((assetPrice > amountIn)) | |
359 | 487 | then throw(("You provided less $heg than the needed cost for buying this " + strAssetType)) |
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 | - | let | |
8 | + | let assetsAddress = base58'3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb' | |
9 | 9 | ||
10 | 10 | let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A' | |
11 | + | ||
12 | + | let configurationAddress = base58'3N9tj3b2djcaZozn97VkYchL9S1i6cdEbC1' | |
13 | + | ||
14 | + | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
11 | 15 | ||
12 | 16 | let adminWallet = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
13 | 17 | ||
14 | 18 | let dailyGameRewardsWallet = addressFromStringValue("3MuSrXTTiwo9bdoD6FeaBpMUYMiU5saDv2U") | |
15 | 19 | ||
16 | 20 | let dailyStakingRewardsWallet = addressFromStringValue("3Mv3mr3uNXdpgkVPApbGEJjMQXqau37DY5i") | |
17 | 21 | ||
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) | |
19 | 31 | ||
20 | - | let BuildFinished = "BUILD_FINISHED" | |
21 | 32 | ||
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 | + | } | |
23 | 39 | ||
24 | - | let assetsCost = [0, 0, 5000000000, 5000000000, 500000000, 10000000000, 100000000] | |
25 | 40 | ||
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 | + | } | |
27 | 47 | ||
28 | - | let assetsDelay = [0, 4, 4, 4, 2, 2, 2] | |
29 | 48 | ||
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 | + | ||
31 | 86 | ||
32 | 87 | func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) { | |
33 | 88 | case b: Int => | |
34 | 89 | b | |
35 | 90 | case _ => | |
36 | 91 | 0 | |
37 | 92 | } | |
38 | 93 | ||
39 | 94 | ||
40 | 95 | func nationsTryGetInteger (key) = match getInteger(Address(nationsAddress), key) { | |
41 | 96 | case b: Int => | |
42 | 97 | b | |
43 | 98 | case _ => | |
44 | 99 | 0 | |
45 | 100 | } | |
46 | 101 | ||
47 | 102 | ||
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) { | |
49 | 112 | case b: String => | |
50 | 113 | b | |
51 | 114 | case _ => | |
52 | 115 | "" | |
53 | 116 | } | |
54 | 117 | ||
55 | 118 | ||
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") | |
62 | 120 | ||
121 | + | ||
122 | + | let BuildStarted = "BUILD_STARTED" | |
123 | + | ||
124 | + | let BuildFinished = "BUILD_FINISHED" | |
63 | 125 | ||
64 | 126 | func getAssetIdKey (txId,assetType) = ((assetType + "_") + toBase58String(txId)) | |
65 | 127 | ||
66 | 128 | ||
67 | 129 | func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner") | |
68 | - | ||
69 | - | ||
70 | - | func getAssetOwnerKeyString (assetId) = (assetId + "_Owner") | |
71 | 130 | ||
72 | 131 | ||
73 | 132 | func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh") | |
74 | 133 | ||
75 | 134 | ||
76 | 135 | func getBuildingStatusKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_status") | |
77 | 136 | ||
78 | 137 | ||
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 | + | } | |
91 | 144 | ||
92 | 145 | ||
93 | 146 | 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) | |
94 | 151 | let buildingFinishHeight = getIntegerValue(this, finishHeightKey) | |
95 | 152 | if ((buildingFinishHeight > height)) | |
96 | 153 | 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 | + | } | |
114 | 177 | } | |
115 | 178 | ||
116 | 179 | ||
117 | 180 | func checkAssetOwner (caller,assetKey) = { | |
118 | - | let assetOwner = tryGetString((assetKey | |
181 | + | let assetOwner = tryGetString(getAssetOwnerKeyString(assetKey)) | |
119 | 182 | (assetOwner == caller) | |
120 | 183 | } | |
121 | 184 | ||
122 | 185 | ||
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 | + | } | |
126 | 190 | ||
127 | 191 | ||
128 | 192 | 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) | |
130 | 197 | let oldOwner = tryGetString(getAssetOwnerKeyString(assetId)) | |
131 | - | let assetPower = | |
198 | + | let assetPower = confTryGetInteger((k + "_Power")) | |
132 | 199 | if ((assetPower > 0)) | |
133 | 200 | then { | |
134 | 201 | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
135 | 202 | let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil) | |
136 | 203 | if ((pw == pw)) | |
137 | 204 | then if ((pw != (currentPower - assetPower))) | |
138 | 205 | then throw("Incorrect invoke result") | |
139 | 206 | else { | |
140 | 207 | let newcurrentPower = nationsTryGetInteger((newOwner + "_Power")) | |
141 | 208 | let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil) | |
142 | 209 | if ((pw2 == pw2)) | |
143 | 210 | then match pw2 { | |
144 | 211 | case r: Int => | |
145 | 212 | [StringEntry(getAssetOwnerKeyString(assetId), newOwner)] | |
146 | 213 | case _ => | |
147 | 214 | throw("Incorrect invoke result") | |
148 | 215 | } | |
149 | 216 | else throw("Strict value is not equal to itself.") | |
150 | 217 | } | |
151 | 218 | else throw("Strict value is not equal to itself.") | |
152 | 219 | } | |
153 | 220 | else [StringEntry(getAssetOwnerKeyString(assetId), newOwner)] | |
154 | 221 | } | |
155 | 222 | ||
156 | 223 | ||
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 | + | ||
157 | 277 | @Callable(i) | |
158 | - | func StartBuild (strAssetType,NationKey, | |
159 | - | then throw(" | |
278 | + | func StartBuild (strAssetType,Level,NationKey,SacrificeKey) = if (!(CheckAssetBuildable(strAssetType, Level, toString(i.caller), NationKey, SacrificeKey))) | |
279 | + | then throw("You cannot build this Item") | |
160 | 280 | else { | |
161 | - | let | |
162 | - | let delayForBuilding = | |
163 | - | let assetBuildCost = | |
281 | + | let cnfgKey = getALKey(strAssetType, Level) | |
282 | + | let delayForBuilding = confTryGetInteger((cnfgKey + "_BuildTime")) | |
283 | + | let assetBuildCost = confTryGetInteger((cnfgKey + "_Cost")) | |
164 | 284 | let ToAdminWallet = ((assetBuildCost * 5) / 100) | |
165 | 285 | let ToGameRewardsWallet = ((assetBuildCost * 10) / 100) | |
166 | 286 | let ToStakingRewardsWallet = ((assetBuildCost * 65) / 100) | |
167 | 287 | let UnitStakeSheg = (((assetBuildCost - ToAdminWallet) - ToGameRewardsWallet) - ToStakingRewardsWallet) | |
168 | - | if (isNationReservedAsset(strAssetType)) | |
288 | + | if (isNationReservedAsset(strAssetType, Level)) | |
169 | 289 | then if (if (!(checkAssetOwner(toString(i.caller), NationKey))) | |
170 | 290 | then !(checkAdmin(i.caller)) | |
171 | 291 | else false) | |
172 | - | then throw("You are not | |
292 | + | then throw("You are not the owner of the nation") | |
173 | 293 | else { | |
174 | 294 | let nationsheg = treasuryTryGetInteger(getTreasuryKey(NationKey)) | |
175 | 295 | if ((assetBuildCost > nationsheg)) | |
176 | 296 | then throw("The nation hasn't enough funds") | |
177 | 297 | else { | |
178 | 298 | let d = invoke(Address(treasuryAddress), "decreaseNationWallet", [NationKey, assetBuildCost], nil) | |
179 | 299 | match d { | |
180 | 300 | case r: Int => | |
181 | 301 | let pw = invoke(Address(treasuryAddress), "arbitraryAddCoins", [NationKey, UnitStakeSheg], nil) | |
182 | 302 | match pw { | |
183 | 303 | case b: Int => | |
184 | 304 | let transfer = invoke(Address(treasuryAddress), "distributeNationPayRewards", [assetBuildCost], nil) | |
185 | 305 | match transfer { | |
186 | 306 | case t: Int => | |
187 | 307 | [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))] | |
188 | 308 | case _ => | |
189 | 309 | throw("Error Distributing asset rewards") | |
190 | 310 | } | |
191 | 311 | case _ => | |
192 | 312 | throw("Error Depositing nation funds") | |
193 | 313 | } | |
194 | 314 | case _ => | |
195 | 315 | throw("Error Depositing nation funds") | |
196 | 316 | } | |
197 | 317 | } | |
198 | 318 | } | |
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 { | |
204 | 323 | let pw = invoke(Address(treasuryAddress), "NoPaymentDeposit", [toString(i.caller), UnitStakeSheg], nil) | |
205 | 324 | match pw { | |
206 | 325 | case r: Int => | |
207 | 326 | let transfer = invoke(Address(treasuryAddress), "distributeNationPayRewards", [assetBuildCost], nil) | |
208 | 327 | match transfer { | |
209 | 328 | case t: Int => | |
210 | - | [DeleteEntry( | |
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))] | |
211 | 330 | case _ => | |
212 | 331 | throw("Error Distributing asset rewards") | |
213 | 332 | } | |
214 | 333 | case _ => | |
215 | 334 | throw("Error adding deposit") | |
216 | 335 | } | |
217 | 336 | } | |
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 => | |
228 | 347 | [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 | + | } | |
234 | 354 | } | |
235 | 355 | ||
236 | 356 | ||
237 | 357 | ||
238 | 358 | @Callable(i) | |
239 | - | func FinishBuild (txIdStr,assetStr,NationKey) = { | |
359 | + | func FinishBuild (txIdStr,assetStr,Level,NationKey) = { | |
240 | 360 | let txId = fromBase58String(txIdStr) | |
241 | 361 | let BuildingStatusKey = getBuildingStatusKey(toString(i.caller), txId, assetStr) | |
242 | 362 | let finishHeightKey = getBuildingFinishHeightKey(toString(i.caller), txId, assetStr) | |
243 | 363 | let assetKey = getAssetIdKey(txId, assetStr) | |
244 | 364 | let assetOwner = tryGetString(getAssetOwnerKey(txId, assetStr)) | |
245 | - | if (isNationReservedAsset(assetStr)) | |
365 | + | if (isNationReservedAsset(assetStr, Level)) | |
246 | 366 | then if (if (!(checkAssetOwner(toString(i.caller), NationKey))) | |
247 | 367 | then !(checkAdmin(i.caller)) | |
248 | 368 | else false) | |
249 | 369 | then throw("You are not authorized to perform this operation") | |
250 | 370 | else internalFinishBuild(NationKey, assetStr, assetKey, BuildingStatusKey, finishHeightKey) | |
251 | 371 | else if ((assetOwner != toString(i.caller))) | |
252 | 372 | then throw(("You cannot claim other's players " + assetStr)) | |
253 | 373 | else { | |
254 | 374 | let buildingTxStatus = tryGetString(BuildingStatusKey) | |
255 | 375 | if ((buildingTxStatus == "")) | |
256 | 376 | then throw("No pending operations for this asset") | |
257 | 377 | else internalFinishBuild(toString(i.caller), assetStr, assetKey, BuildingStatusKey, finishHeightKey) | |
258 | 378 | } | |
259 | 379 | } | |
260 | 380 | ||
261 | 381 | ||
262 | 382 | ||
263 | 383 | @Callable(i) | |
264 | 384 | func transferOwnership (assetId,newOwner) = { | |
265 | 385 | let strAssetType = split(assetId, "_")[0] | |
266 | 386 | if (!(checkAdmin(i.caller))) | |
267 | 387 | then throw("Only the admin can perform this operation") | |
268 | 388 | else $Tuple2(internalTrasnferOwnership(assetId, newOwner), newOwner) | |
269 | 389 | } | |
270 | 390 | ||
271 | 391 | ||
272 | 392 | ||
273 | 393 | @Callable(i) | |
274 | 394 | 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) | |
276 | 399 | if (!(checkAdmin(i.caller))) | |
277 | 400 | then throw("Only the admin can perform this operation") | |
278 | 401 | else { | |
279 | 402 | let oldOwner = tryGetString(getAssetOwnerKeyString(assetId)) | |
280 | 403 | let assetCoins = tryGetInteger(assetId) | |
281 | 404 | let refCall = invoke(Address(treasuryAddress), "adminTransfer", [addressFromStringValue(toAddress), assetCoins], nil) | |
282 | 405 | if ((refCall == refCall)) | |
283 | 406 | then { | |
284 | 407 | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
285 | - | let assetPower = | |
408 | + | let assetPower = confTryGetInteger((k + "_Power")) | |
286 | 409 | let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil) | |
287 | 410 | if ((pw == pw)) | |
288 | 411 | then match pw { | |
289 | 412 | case r: Int => | |
290 | 413 | [DeleteEntry(assetId)] | |
291 | 414 | case _ => | |
292 | 415 | throw("Error setting user power") | |
293 | 416 | } | |
294 | 417 | else throw("Strict value is not equal to itself.") | |
295 | 418 | } | |
296 | 419 | else throw("Strict value is not equal to itself.") | |
297 | 420 | } | |
298 | 421 | } | |
299 | 422 | ||
300 | 423 | ||
301 | 424 | ||
302 | 425 | @Callable(i) | |
303 | 426 | 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) | |
305 | 431 | if (!(checkAssetOwner(toString(i.caller), assetId))) | |
306 | 432 | then throw("You don't own this asset") | |
307 | 433 | else { | |
308 | 434 | let assetCoins = tryGetInteger(assetId) | |
309 | 435 | let currentPower = nationsTryGetInteger((toString(i.caller) + "_Power")) | |
310 | - | let assetPower = | |
436 | + | let assetPower = confTryGetInteger((k + "_Power")) | |
311 | 437 | let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil) | |
312 | 438 | if ((pw == pw)) | |
313 | 439 | then match pw { | |
314 | 440 | case r: Int => | |
315 | 441 | let tr = invoke(Address(treasuryAddress), "adminTransfer", [toString(i.caller), assetCoins], nil) | |
316 | 442 | match tr { | |
317 | 443 | case t: Int => | |
318 | 444 | [DeleteEntry(assetId)] | |
319 | 445 | case _ => | |
320 | 446 | throw("Error transferring coins") | |
321 | 447 | } | |
322 | 448 | case _ => | |
323 | 449 | throw("Error setting user power") | |
324 | 450 | } | |
325 | 451 | else throw("Strict value is not equal to itself.") | |
326 | 452 | } | |
327 | 453 | } | |
328 | 454 | ||
329 | 455 | ||
330 | 456 | ||
331 | 457 | @Callable(i) | |
332 | 458 | func setNationOwner (nationKey,newOwner) = if (checkAdmin(i.caller)) | |
333 | 459 | then $Tuple2([StringEntry((nationKey + "_Owner"), newOwner)], true) | |
334 | 460 | else { | |
335 | 461 | let currentOwner = tryGetString((nationKey + "_Owner")) | |
336 | 462 | if ((currentOwner != toString(i.caller))) | |
337 | 463 | then throw("You are not the nation owner") | |
338 | 464 | else [StringEntry((nationKey + "_Owner"), newOwner)] | |
339 | 465 | } | |
340 | 466 | ||
341 | 467 | ||
342 | 468 | ||
343 | 469 | @Callable(i) | |
344 | 470 | 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) | |
346 | 475 | let n = nationsTryGetInteger(toString(i.caller)) | |
347 | 476 | let nid = nationsTryGetInteger(NationKey) | |
348 | 477 | if ((n != nid)) | |
349 | 478 | then throw("you can buy assets only from your nation") | |
350 | 479 | else if (!(checkAssetOwner(NationKey, assetId))) | |
351 | 480 | then throw("The asset does not belong to the nation") | |
352 | - | else if (!(isNationReservedAsset(strAssetType))) | |
481 | + | else if (!(isNationReservedAsset(strAssetType, level))) | |
353 | 482 | then throw("this asset cannot be sold by the nation") | |
354 | 483 | else { | |
355 | - | let ind = value(indexOf(Assets, strAssetType)) | |
356 | - | let assetPrice = assetsSellPrice[ind] | |
484 | + | let assetPrice = confTryGetInteger((getALKey(strAssetType, level) + "_SellPrice")) | |
357 | 485 | let amountIn = value(i.payments[0].amount) | |
358 | 486 | if ((assetPrice > amountIn)) | |
359 | 487 | then throw(("You provided less $heg than the needed cost for buying this " + strAssetType)) | |
360 | 488 | else if ((i.payments[0].assetId != shinywggid)) | |
361 | 489 | then throw("Only $HEG payments allowed") | |
362 | 490 | else { | |
363 | 491 | let a = invoke(Address(treasuryAddress), "increaseNationWallet", [NationKey, amountIn], nil) | |
364 | 492 | match a { | |
365 | 493 | case b: Int => | |
366 | 494 | (internalTrasnferOwnership(assetId, toString(i.caller)) :+ ScriptTransfer(Address(treasuryAddress), amountIn, shinywggid)) | |
367 | 495 | case _ => | |
368 | 496 | throw("Error transferring SHEG to nations wallet") | |
369 | 497 | } | |
370 | 498 | } | |
371 | 499 | } | |
372 | 500 | } | |
373 | 501 | ||
374 | 502 | ||
375 | 503 | ||
376 | 504 | @Callable(i) | |
377 | 505 | func AddAssetFromMarkeplace (assetId,oldOwner,assetSheg) = if (!(checkAdmin(i.caller))) | |
378 | 506 | then throw("You are not allowed to perform this operation") | |
379 | 507 | else $Tuple2([StringEntry(getAssetOwnerKeyString(assetId), oldOwner), IntegerEntry(assetId, assetSheg)], oldOwner) | |
380 | 508 | ||
381 | 509 | ||
382 | 510 | ||
383 | 511 | @Callable(i) | |
384 | 512 | func TransferAssetToMarketplace (assetId,sellprice) = if (!(checkAssetOwner(toString(i.caller), assetId))) | |
385 | 513 | then throw("You are not the owner of this asset") | |
386 | 514 | else { | |
387 | 515 | let assetSheg = tryGetInteger(assetId) | |
388 | 516 | let tr = invoke(Address(marketplaceAddress), "putOnSale", [assetId, assetSheg, sellprice], nil) | |
389 | 517 | match tr { | |
390 | 518 | case t: Int => | |
391 | 519 | [DeleteEntry(getAssetOwnerKeyString(assetId)), DeleteEntry(assetId)] | |
392 | 520 | case _ => | |
393 | 521 | throw("Error putting the item on the marketplace") | |
394 | 522 | } | |
395 | 523 | } | |
396 | 524 | ||
397 | 525 |
github/deemru/w8io/169f3d6 67.16 ms ◑