tx · FFfGvxM1taiRhZrVSyuWPdVmP3nuuBRmvBXsmBg6VZk2 3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb: -0.01000000 Waves 2022.05.12 12:01 [2048255] smart account 3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb > SELF 0.00000000 Waves
{ "type": 13, "id": "FFfGvxM1taiRhZrVSyuWPdVmP3nuuBRmvBXsmBg6VZk2", "fee": 1000000, "feeAssetId": null, "timestamp": 1652346134451, "version": 2, "chainId": 84, "sender": "3N8WDKbqGox5Eky326PHHT7rUyrby5MXdmb", "senderPublicKey": "FWSsBbeCwLVkekWhvNKtX6JkrZiruRybKKVuiS3F4bqN", "proofs": [ "5MWn8UwJfwvLcNYzuk6pqGP3ZSjD684zwHFsZA2QLJvzfVLq3dWZ6ywMRuwgxztiU7QRgLahU8sxQ5hCr3aaHZnY" ], "script": "base64:AAIFAAAAAAAAADkIAhIECgIICBIFCgMICAgSBAoCCAgSBAoCCAgSAwoBCBIECgIICBIECgIICBIFCgMICAESBAoCCAEAAAAbAAAAAApzaGlueXdnZ2lkAQAAACCJac8C/7a6udRxltd5uJl2JrB00Hd59HNuhvD0c58GJgAAAAAPdHJlYXN1cnlBZGRyZXNzAQAAABoBVGX48BYLBMBZQnAankiMl/9+3Bxi8t27/QAAAAAObmF0aW9uc0FkZHJlc3MBAAAAGgFUTYXo3vT4RGtZEDtwX8O3uWUOUfVERm2gAAAAABJtYXJrZXRwbGFjZUFkZHJlc3MBAAAAGgFUHSG5k/H8GMOnG0lxFkOWUXTrrFQuJbzvAAAAAAxhZG1pbkFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNNcE50aVBTUlNxNk5uYVFZazM4QmZXU3paY2dBWVR5clE5AAAAAAxCdWlsZFN0YXJ0ZWQCAAAADUJVSUxEX1NUQVJURUQAAAAADUJ1aWxkRmluaXNoZWQCAAAADkJVSUxEX0ZJTklTSEVEAAAAAAZBc3NldHMJAARMAAAAA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aGVja0Fzc2V0T3duZXIAAAACCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgUAAAAHYXNzZXRJZAkAAAIAAAABAgAAACNZb3UgYXJlIG5vdCB0aGUgb3duZXIgb2YgdGhpcyBhc3NldAQAAAAJYXNzZXRTaGVnCQEAAAANdHJ5R2V0SW50ZWdlcgAAAAEFAAAAB2Fzc2V0SWQEAAAAAnRyCQAD/AAAAAQJAQAAAAdBZGRyZXNzAAAAAQUAAAASbWFya2V0cGxhY2VBZGRyZXNzAgAAAAlwdXRPblNhbGUJAARMAAAAAgUAAAAHYXNzZXRJZAkABEwAAAACBQAAAAlhc3NldFNoZWcJAARMAAAAAgUAAAAJc2VsbHByaWNlBQAAAANuaWwFAAAAA25pbAQAAAAHJG1hdGNoMAUAAAACdHIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABdAUAAAAHJG1hdGNoMAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAWZ2V0QXNzZXRPd25lcktleVN0cmluZwAAAAEFAAAAB2Fzc2V0SWQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAAHYXNzZXRJZAUAAAADbmlsCQAAAgAAAAECAAAAKUVycm9yIHB1dHRpbmcgdGhlIGl0ZW0gb24gdGhlIG1hcmtldHBsYWNlAAAAACgSt74=", "height": 2048255, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8BLVNGb9tCwPSVzen7iYcEumv3AdciiG5kMJfCMwBQYG Next: 37Q5ohmsCNj5zC74uLjtP2xJMoKVkrazLY8zBidUcmoz Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ' | |
7 | 7 | ||
8 | 8 | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
9 | + | ||
10 | + | let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A' | |
9 | 11 | ||
10 | 12 | let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
11 | 13 | ||
61 | 63 | func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner") | |
62 | 64 | ||
63 | 65 | ||
66 | + | func getAssetOwnerKeyString (assetId) = (assetId + "_Owner") | |
67 | + | ||
68 | + | ||
64 | 69 | func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh") | |
65 | 70 | ||
66 | 71 | ||
70 | 75 | func getTreasuryKey (nationid) = (nationid + "_Treasury") | |
71 | 76 | ||
72 | 77 | ||
73 | - | func checkAdmin (caller) = if (if (if ((caller == adminAddress)) | |
78 | + | func checkAdmin (caller) = if (if (if (if ((caller == adminAddress)) | |
74 | 79 | then true | |
75 | 80 | else (caller == this)) | |
76 | 81 | then true | |
77 | 82 | else (caller.bytes == nationsAddress)) | |
78 | 83 | then true | |
79 | - | else (caller.bytes == treasuryAddress) | |
84 | + | else (caller.bytes == treasuryAddress)) | |
85 | + | then true | |
86 | + | else (caller.bytes == marketplaceAddress) | |
80 | 87 | ||
81 | 88 | ||
82 | 89 | func internalFinishBuild (caller,assetStr,assetKey,BuildingStatusKey,finishHeightKey) = { | |
112 | 119 | func isNationReservedAsset (strAssetType) = if ((strAssetType == "Settler")) | |
113 | 120 | then true | |
114 | 121 | else (strAssetType == "Explorer") | |
122 | + | ||
123 | + | ||
124 | + | func internalTrasnferOwnership (assetId,newOwner) = { | |
125 | + | let strAssetType = split(assetId, "_")[0] | |
126 | + | let oldOwner = tryGetString(getAssetOwnerKeyString(assetId)) | |
127 | + | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
128 | + | if ((assetPower > 0)) | |
129 | + | then { | |
130 | + | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
131 | + | let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil) | |
132 | + | if ((pw == pw)) | |
133 | + | then if ((pw != (currentPower - assetPower))) | |
134 | + | then throw("Incorrect invoke result") | |
135 | + | else { | |
136 | + | let newcurrentPower = nationsTryGetInteger((newOwner + "_Power")) | |
137 | + | let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil) | |
138 | + | if ((pw2 == pw2)) | |
139 | + | then match pw2 { | |
140 | + | case r: Int => | |
141 | + | [StringEntry(getAssetOwnerKeyString(assetId), newOwner)] | |
142 | + | case _ => | |
143 | + | throw("Incorrect invoke result") | |
144 | + | } | |
145 | + | else throw("Strict value is not equal to itself.") | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | else [StringEntry(getAssetOwnerKeyString(assetId), newOwner)] | |
150 | + | } | |
115 | 151 | ||
116 | 152 | ||
117 | 153 | @Callable(i) | |
196 | 232 | let strAssetType = split(assetId, "_")[0] | |
197 | 233 | if (!(checkAdmin(i.caller))) | |
198 | 234 | then throw("Only the admin can perform this operation") | |
199 | - | else { | |
200 | - | let oldOwner = tryGetString((assetId + "_Owner")) | |
201 | - | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
202 | - | if ((assetPower > 0)) | |
203 | - | then { | |
204 | - | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
205 | - | let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil) | |
206 | - | if ((pw == pw)) | |
207 | - | then if ((pw != (currentPower - assetPower))) | |
208 | - | then throw("Incorrect invoke result") | |
209 | - | else { | |
210 | - | let newcurrentPower = nationsTryGetInteger((newOwner + "_Power")) | |
211 | - | let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil) | |
212 | - | if ((pw2 == pw2)) | |
213 | - | then match pw2 { | |
214 | - | case r: Int => | |
215 | - | $Tuple2([StringEntry((assetId + "_Owner"), newOwner)], newOwner) | |
216 | - | case _ => | |
217 | - | throw("Incorrect invoke result") | |
218 | - | } | |
219 | - | else throw("Strict value is not equal to itself.") | |
220 | - | } | |
221 | - | else throw("Strict value is not equal to itself.") | |
222 | - | } | |
223 | - | else $Tuple2([StringEntry((assetId + "_Owner"), newOwner)], newOwner) | |
224 | - | } | |
235 | + | else $Tuple2(internalTrasnferOwnership(assetId, newOwner), newOwner) | |
225 | 236 | } | |
226 | 237 | ||
227 | 238 | ||
232 | 243 | if (!(checkAdmin(i.caller))) | |
233 | 244 | then throw("Only the admin can perform this operation") | |
234 | 245 | else { | |
235 | - | let oldOwner = tryGetString((assetId | |
246 | + | let oldOwner = tryGetString(getAssetOwnerKeyString(assetId)) | |
236 | 247 | let assetCoins = tryGetInteger(assetId) | |
237 | 248 | let refCall = invoke(Address(treasuryAddress), "arbitraryAddCoins", [toAddress, assetCoins], nil) | |
238 | 249 | if ((refCall == refCall)) | |
313 | 324 | let a = invoke(Address(treasuryAddress), "increaseNationWallet", [NationKey, amountIn], nil) | |
314 | 325 | match a { | |
315 | 326 | case b: Int => | |
316 | - | let p = invoke(this, "transferOwnership", [assetId, toString(i.caller)], nil) | |
317 | - | match p { | |
318 | - | case t: String => | |
319 | - | [ScriptTransfer(Address(treasuryAddress), amountIn, shinywggid)] | |
320 | - | case _ => | |
321 | - | throw("Error transferring Ownership") | |
322 | - | } | |
327 | + | (internalTrasnferOwnership(assetId, toString(i.caller)) :+ ScriptTransfer(Address(treasuryAddress), amountIn, shinywggid)) | |
323 | 328 | case _ => | |
324 | 329 | throw("Error transferring SHEG to nations wallet") | |
325 | 330 | } | |
328 | 333 | } | |
329 | 334 | ||
330 | 335 | ||
336 | + | ||
337 | + | @Callable(i) | |
338 | + | func AddAssetFromMarkeplace (assetId,oldOwner,assetSheg) = if (!(checkAdmin(i.caller))) | |
339 | + | then throw("You are not allowed to perform this operation") | |
340 | + | else $Tuple2([StringEntry(getAssetOwnerKeyString(assetId), oldOwner), IntegerEntry(assetId, assetSheg)], oldOwner) | |
341 | + | ||
342 | + | ||
343 | + | ||
344 | + | @Callable(i) | |
345 | + | func TransferAssetToMarketplace (assetId,sellprice) = if (!(checkAssetOwner(toString(i.caller), assetId))) | |
346 | + | then throw("You are not the owner of this asset") | |
347 | + | else { | |
348 | + | let assetSheg = tryGetInteger(assetId) | |
349 | + | let tr = invoke(Address(marketplaceAddress), "putOnSale", [assetId, assetSheg, sellprice], nil) | |
350 | + | match tr { | |
351 | + | case t: Int => | |
352 | + | [DeleteEntry(getAssetOwnerKeyString(assetId)), DeleteEntry(assetId)] | |
353 | + | case _ => | |
354 | + | throw("Error putting the item on the marketplace") | |
355 | + | } | |
356 | + | } | |
357 | + | ||
358 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | 5 | ||
6 | 6 | let treasuryAddress = base58'3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ' | |
7 | 7 | ||
8 | 8 | let nationsAddress = base58'3MvyzDtzWWV5MZ1GP8JfQhhQqiGU4Nbifdy' | |
9 | + | ||
10 | + | let marketplaceAddress = base58'3Mra7mjPipcQd5sJaRmXK8xgS4scb8gPF4A' | |
9 | 11 | ||
10 | 12 | let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
11 | 13 | ||
12 | 14 | let BuildStarted = "BUILD_STARTED" | |
13 | 15 | ||
14 | 16 | let BuildFinished = "BUILD_FINISHED" | |
15 | 17 | ||
16 | 18 | let Assets = ["Nation", "City", "Barrack", "Barn", "Warrior", "Settler", "Explorer"] | |
17 | 19 | ||
18 | 20 | let assetsCost = [0, 1000000000, 5000000000, 5000000000, 500000000, 10000000000, 100000000] | |
19 | 21 | ||
20 | 22 | let assetsSellPrice = [0, 0, 0, 0, 0, 10000000000, 100000000] | |
21 | 23 | ||
22 | 24 | let assetsDelay = [0, 4, 4, 4, 2, 2, 2] | |
23 | 25 | ||
24 | 26 | let assetsPower = [0, 1000, 500, 500, 0, 0, 0] | |
25 | 27 | ||
26 | 28 | func treasuryTryGetInteger (key) = match getInteger(Address(treasuryAddress), key) { | |
27 | 29 | case b: Int => | |
28 | 30 | b | |
29 | 31 | case _ => | |
30 | 32 | 0 | |
31 | 33 | } | |
32 | 34 | ||
33 | 35 | ||
34 | 36 | func nationsTryGetInteger (key) = match getInteger(Address(nationsAddress), key) { | |
35 | 37 | case b: Int => | |
36 | 38 | b | |
37 | 39 | case _ => | |
38 | 40 | 0 | |
39 | 41 | } | |
40 | 42 | ||
41 | 43 | ||
42 | 44 | func tryGetString (key) = match getString(this, key) { | |
43 | 45 | case b: String => | |
44 | 46 | b | |
45 | 47 | case _ => | |
46 | 48 | "" | |
47 | 49 | } | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | func tryGetInteger (key) = match getInteger(this, key) { | |
51 | 53 | case b: Int => | |
52 | 54 | b | |
53 | 55 | case _ => | |
54 | 56 | 0 | |
55 | 57 | } | |
56 | 58 | ||
57 | 59 | ||
58 | 60 | func getAssetIdKey (txId,assetType) = ((assetType + "_") + toBase58String(txId)) | |
59 | 61 | ||
60 | 62 | ||
61 | 63 | func getAssetOwnerKey (txId,assetType) = (getAssetIdKey(txId, assetType) + "_Owner") | |
62 | 64 | ||
63 | 65 | ||
66 | + | func getAssetOwnerKeyString (assetId) = (assetId + "_Owner") | |
67 | + | ||
68 | + | ||
64 | 69 | func getBuildingFinishHeightKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_fh") | |
65 | 70 | ||
66 | 71 | ||
67 | 72 | func getBuildingStatusKey (address,txId,assetType) = (((address + "_") + getAssetIdKey(txId, assetType)) + "_status") | |
68 | 73 | ||
69 | 74 | ||
70 | 75 | func getTreasuryKey (nationid) = (nationid + "_Treasury") | |
71 | 76 | ||
72 | 77 | ||
73 | - | func checkAdmin (caller) = if (if (if ((caller == adminAddress)) | |
78 | + | func checkAdmin (caller) = if (if (if (if ((caller == adminAddress)) | |
74 | 79 | then true | |
75 | 80 | else (caller == this)) | |
76 | 81 | then true | |
77 | 82 | else (caller.bytes == nationsAddress)) | |
78 | 83 | then true | |
79 | - | else (caller.bytes == treasuryAddress) | |
84 | + | else (caller.bytes == treasuryAddress)) | |
85 | + | then true | |
86 | + | else (caller.bytes == marketplaceAddress) | |
80 | 87 | ||
81 | 88 | ||
82 | 89 | func internalFinishBuild (caller,assetStr,assetKey,BuildingStatusKey,finishHeightKey) = { | |
83 | 90 | let buildingFinishHeight = getIntegerValue(this, finishHeightKey) | |
84 | 91 | if ((buildingFinishHeight > height)) | |
85 | 92 | then throw((((("Building is not finished yet " + toString((buildingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((buildingFinishHeight - height))) + " minutes")) | |
86 | 93 | else { | |
87 | 94 | let idx = value(indexOf(Assets, assetStr)) | |
88 | 95 | let assetPower = assetsPower[idx] | |
89 | 96 | let assetCoins = assetsCost[idx] | |
90 | 97 | let refCall = invoke(Address(treasuryAddress), "Pay", [caller, assetCoins], nil) | |
91 | 98 | if ((refCall == refCall)) | |
92 | 99 | then if ((assetPower > 0)) | |
93 | 100 | then { | |
94 | 101 | let currentPower = nationsTryGetInteger((caller + "_Power")) | |
95 | 102 | let pw = invoke(Address(nationsAddress), "setUserPower", [caller, (currentPower + assetPower)], nil) | |
96 | 103 | if ((pw == pw)) | |
97 | 104 | then [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)] | |
98 | 105 | else throw("Strict value is not equal to itself.") | |
99 | 106 | } | |
100 | 107 | else [IntegerEntry(assetKey, assetCoins), DeleteEntry(BuildingStatusKey), DeleteEntry(finishHeightKey)] | |
101 | 108 | else throw("Strict value is not equal to itself.") | |
102 | 109 | } | |
103 | 110 | } | |
104 | 111 | ||
105 | 112 | ||
106 | 113 | func checkAssetOwner (caller,assetKey) = { | |
107 | 114 | let assetOwner = tryGetString((assetKey + "_Owner")) | |
108 | 115 | (assetOwner == caller) | |
109 | 116 | } | |
110 | 117 | ||
111 | 118 | ||
112 | 119 | func isNationReservedAsset (strAssetType) = if ((strAssetType == "Settler")) | |
113 | 120 | then true | |
114 | 121 | else (strAssetType == "Explorer") | |
122 | + | ||
123 | + | ||
124 | + | func internalTrasnferOwnership (assetId,newOwner) = { | |
125 | + | let strAssetType = split(assetId, "_")[0] | |
126 | + | let oldOwner = tryGetString(getAssetOwnerKeyString(assetId)) | |
127 | + | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
128 | + | if ((assetPower > 0)) | |
129 | + | then { | |
130 | + | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
131 | + | let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil) | |
132 | + | if ((pw == pw)) | |
133 | + | then if ((pw != (currentPower - assetPower))) | |
134 | + | then throw("Incorrect invoke result") | |
135 | + | else { | |
136 | + | let newcurrentPower = nationsTryGetInteger((newOwner + "_Power")) | |
137 | + | let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil) | |
138 | + | if ((pw2 == pw2)) | |
139 | + | then match pw2 { | |
140 | + | case r: Int => | |
141 | + | [StringEntry(getAssetOwnerKeyString(assetId), newOwner)] | |
142 | + | case _ => | |
143 | + | throw("Incorrect invoke result") | |
144 | + | } | |
145 | + | else throw("Strict value is not equal to itself.") | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | else [StringEntry(getAssetOwnerKeyString(assetId), newOwner)] | |
150 | + | } | |
115 | 151 | ||
116 | 152 | ||
117 | 153 | @Callable(i) | |
118 | 154 | func StartBuild (strAssetType,NationKey) = if (!(containsElement(Assets, strAssetType))) | |
119 | 155 | then throw("This asset is not amanged by the system") | |
120 | 156 | else { | |
121 | 157 | let ind = value(indexOf(Assets, strAssetType)) | |
122 | 158 | let delayForBuilding = assetsDelay[ind] | |
123 | 159 | let assetBuildCost = assetsCost[ind] | |
124 | 160 | if (isNationReservedAsset(strAssetType)) | |
125 | 161 | then if (if (!(checkAssetOwner(toString(i.caller), NationKey))) | |
126 | 162 | then !(checkAdmin(i.caller)) | |
127 | 163 | else false) | |
128 | 164 | then throw("You are not authorized to perform this operation") | |
129 | 165 | else { | |
130 | 166 | let nationsheg = treasuryTryGetInteger(getTreasuryKey(NationKey)) | |
131 | 167 | if ((assetBuildCost > nationsheg)) | |
132 | 168 | then throw("The nation hasn't enough funds") | |
133 | 169 | else { | |
134 | 170 | let d = invoke(Address(treasuryAddress), "decreaseNationWallet", [NationKey, assetBuildCost], nil) | |
135 | 171 | match d { | |
136 | 172 | case r: Int => | |
137 | 173 | let pw = invoke(Address(treasuryAddress), "arbitraryAddCoins", [NationKey, assetBuildCost], nil) | |
138 | 174 | match pw { | |
139 | 175 | case b: Int => | |
140 | 176 | [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))] | |
141 | 177 | case _ => | |
142 | 178 | throw("Error Depositing nation funds") | |
143 | 179 | } | |
144 | 180 | case _ => | |
145 | 181 | throw("Error Depositing nation funds") | |
146 | 182 | } | |
147 | 183 | } | |
148 | 184 | } | |
149 | 185 | else { | |
150 | 186 | let amountIn = value(i.payments[0].amount) | |
151 | 187 | if ((assetBuildCost > amountIn)) | |
152 | 188 | then throw(("You provided less $heg than the needed cost for building this " + strAssetType)) | |
153 | 189 | else if ((i.payments[0].assetId != shinywggid)) | |
154 | 190 | then throw("Only $HEG payments allowed") | |
155 | 191 | else { | |
156 | 192 | let pw = invoke(Address(treasuryAddress), "Deposit", nil, i.payments) | |
157 | 193 | match pw { | |
158 | 194 | case r: Int => | |
159 | 195 | [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))] | |
160 | 196 | case _ => | |
161 | 197 | throw("Incorrect invoke result") | |
162 | 198 | } | |
163 | 199 | } | |
164 | 200 | } | |
165 | 201 | } | |
166 | 202 | ||
167 | 203 | ||
168 | 204 | ||
169 | 205 | @Callable(i) | |
170 | 206 | func FinishBuild (txIdStr,assetStr,NationKey) = { | |
171 | 207 | let txId = fromBase58String(txIdStr) | |
172 | 208 | let BuildingStatusKey = getBuildingStatusKey(toString(i.caller), txId, assetStr) | |
173 | 209 | let finishHeightKey = getBuildingFinishHeightKey(toString(i.caller), txId, assetStr) | |
174 | 210 | let assetKey = getAssetIdKey(txId, assetStr) | |
175 | 211 | let assetOwner = tryGetString(getAssetOwnerKey(txId, assetStr)) | |
176 | 212 | if (isNationReservedAsset(assetStr)) | |
177 | 213 | then if (if (!(checkAssetOwner(toString(i.caller), NationKey))) | |
178 | 214 | then !(checkAdmin(i.caller)) | |
179 | 215 | else false) | |
180 | 216 | then throw("You are not authorized to perform this operation") | |
181 | 217 | else internalFinishBuild(NationKey, assetStr, assetKey, BuildingStatusKey, finishHeightKey) | |
182 | 218 | else if ((assetOwner != toString(i.caller))) | |
183 | 219 | then throw(("You cannot claim other's players " + assetStr)) | |
184 | 220 | else { | |
185 | 221 | let buildingTxStatus = tryGetString(BuildingStatusKey) | |
186 | 222 | if ((buildingTxStatus == "")) | |
187 | 223 | then throw("No pending operations for this asset") | |
188 | 224 | else internalFinishBuild(toString(i.caller), assetStr, assetKey, BuildingStatusKey, finishHeightKey) | |
189 | 225 | } | |
190 | 226 | } | |
191 | 227 | ||
192 | 228 | ||
193 | 229 | ||
194 | 230 | @Callable(i) | |
195 | 231 | func transferOwnership (assetId,newOwner) = { | |
196 | 232 | let strAssetType = split(assetId, "_")[0] | |
197 | 233 | if (!(checkAdmin(i.caller))) | |
198 | 234 | then throw("Only the admin can perform this operation") | |
199 | - | else { | |
200 | - | let oldOwner = tryGetString((assetId + "_Owner")) | |
201 | - | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
202 | - | if ((assetPower > 0)) | |
203 | - | then { | |
204 | - | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
205 | - | let pw = invoke(Address(nationsAddress), "setUserPower", [oldOwner, (currentPower - assetPower)], nil) | |
206 | - | if ((pw == pw)) | |
207 | - | then if ((pw != (currentPower - assetPower))) | |
208 | - | then throw("Incorrect invoke result") | |
209 | - | else { | |
210 | - | let newcurrentPower = nationsTryGetInteger((newOwner + "_Power")) | |
211 | - | let pw2 = invoke(Address(nationsAddress), "setUserPower", [newOwner, (newcurrentPower + assetPower)], nil) | |
212 | - | if ((pw2 == pw2)) | |
213 | - | then match pw2 { | |
214 | - | case r: Int => | |
215 | - | $Tuple2([StringEntry((assetId + "_Owner"), newOwner)], newOwner) | |
216 | - | case _ => | |
217 | - | throw("Incorrect invoke result") | |
218 | - | } | |
219 | - | else throw("Strict value is not equal to itself.") | |
220 | - | } | |
221 | - | else throw("Strict value is not equal to itself.") | |
222 | - | } | |
223 | - | else $Tuple2([StringEntry((assetId + "_Owner"), newOwner)], newOwner) | |
224 | - | } | |
235 | + | else $Tuple2(internalTrasnferOwnership(assetId, newOwner), newOwner) | |
225 | 236 | } | |
226 | 237 | ||
227 | 238 | ||
228 | 239 | ||
229 | 240 | @Callable(i) | |
230 | 241 | func destroyAssetAndTransfer (assetId,toAddress) = { | |
231 | 242 | let strAssetType = split(assetId, "_")[0] | |
232 | 243 | if (!(checkAdmin(i.caller))) | |
233 | 244 | then throw("Only the admin can perform this operation") | |
234 | 245 | else { | |
235 | - | let oldOwner = tryGetString((assetId | |
246 | + | let oldOwner = tryGetString(getAssetOwnerKeyString(assetId)) | |
236 | 247 | let assetCoins = tryGetInteger(assetId) | |
237 | 248 | let refCall = invoke(Address(treasuryAddress), "arbitraryAddCoins", [toAddress, assetCoins], nil) | |
238 | 249 | if ((refCall == refCall)) | |
239 | 250 | then { | |
240 | 251 | let currentPower = nationsTryGetInteger((oldOwner + "_Power")) | |
241 | 252 | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
242 | 253 | let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil) | |
243 | 254 | if ((pw == pw)) | |
244 | 255 | then match pw { | |
245 | 256 | case r: Int => | |
246 | 257 | [DeleteEntry(assetId)] | |
247 | 258 | case _ => | |
248 | 259 | throw("Incorrect invoke result") | |
249 | 260 | } | |
250 | 261 | else throw("Strict value is not equal to itself.") | |
251 | 262 | } | |
252 | 263 | else throw("Strict value is not equal to itself.") | |
253 | 264 | } | |
254 | 265 | } | |
255 | 266 | ||
256 | 267 | ||
257 | 268 | ||
258 | 269 | @Callable(i) | |
259 | 270 | func destroyAssetFromUser (assetId) = { | |
260 | 271 | let strAssetType = split(assetId, "_")[0] | |
261 | 272 | if (!(checkAssetOwner(toString(i.caller), assetId))) | |
262 | 273 | then throw("You don't own this asset") | |
263 | 274 | else { | |
264 | 275 | let assetCoins = tryGetInteger(assetId) | |
265 | 276 | let currentPower = nationsTryGetInteger((toString(i.caller) + "_Power")) | |
266 | 277 | let assetPower = assetsPower[value(indexOf(Assets, strAssetType))] | |
267 | 278 | let pw = invoke(Address(nationsAddress), "setUserPower", [toString(i.caller), (currentPower - assetPower)], nil) | |
268 | 279 | if ((pw == pw)) | |
269 | 280 | then match pw { | |
270 | 281 | case r: Int => | |
271 | 282 | [DeleteEntry(assetId), ScriptTransfer(i.caller, assetCoins, shinywggid)] | |
272 | 283 | case _ => | |
273 | 284 | throw("Incorrect invoke result") | |
274 | 285 | } | |
275 | 286 | else throw("Strict value is not equal to itself.") | |
276 | 287 | } | |
277 | 288 | } | |
278 | 289 | ||
279 | 290 | ||
280 | 291 | ||
281 | 292 | @Callable(i) | |
282 | 293 | func setNationOwner (nationKey,newOwner) = if (checkAdmin(i.caller)) | |
283 | 294 | then $Tuple2([StringEntry((nationKey + "_Owner"), newOwner)], true) | |
284 | 295 | else { | |
285 | 296 | let currentOwner = tryGetString((nationKey + "_Owner")) | |
286 | 297 | if ((currentOwner != toString(i.caller))) | |
287 | 298 | then throw("You are not the nation owner") | |
288 | 299 | else [StringEntry((nationKey + "_Owner"), newOwner)] | |
289 | 300 | } | |
290 | 301 | ||
291 | 302 | ||
292 | 303 | ||
293 | 304 | @Callable(i) | |
294 | 305 | func buyNationItem (assetId,NationKey) = { | |
295 | 306 | let strAssetType = split(assetId, "_")[0] | |
296 | 307 | let n = nationsTryGetInteger(toString(i.caller)) | |
297 | 308 | let nid = nationsTryGetInteger(NationKey) | |
298 | 309 | if ((n != nid)) | |
299 | 310 | then throw("you can buy assets only from your nation") | |
300 | 311 | else if (!(checkAssetOwner(NationKey, assetId))) | |
301 | 312 | then throw("The asset does not belong to the nation") | |
302 | 313 | else if (!(isNationReservedAsset(strAssetType))) | |
303 | 314 | then throw("this asset cannot be sold by the nation") | |
304 | 315 | else { | |
305 | 316 | let ind = value(indexOf(Assets, strAssetType)) | |
306 | 317 | let assetPrice = assetsSellPrice[ind] | |
307 | 318 | let amountIn = value(i.payments[0].amount) | |
308 | 319 | if ((assetPrice > amountIn)) | |
309 | 320 | then throw(("You provided less $heg than the needed cost for buying this " + strAssetType)) | |
310 | 321 | else if ((i.payments[0].assetId != shinywggid)) | |
311 | 322 | then throw("Only $HEG payments allowed") | |
312 | 323 | else { | |
313 | 324 | let a = invoke(Address(treasuryAddress), "increaseNationWallet", [NationKey, amountIn], nil) | |
314 | 325 | match a { | |
315 | 326 | case b: Int => | |
316 | - | let p = invoke(this, "transferOwnership", [assetId, toString(i.caller)], nil) | |
317 | - | match p { | |
318 | - | case t: String => | |
319 | - | [ScriptTransfer(Address(treasuryAddress), amountIn, shinywggid)] | |
320 | - | case _ => | |
321 | - | throw("Error transferring Ownership") | |
322 | - | } | |
327 | + | (internalTrasnferOwnership(assetId, toString(i.caller)) :+ ScriptTransfer(Address(treasuryAddress), amountIn, shinywggid)) | |
323 | 328 | case _ => | |
324 | 329 | throw("Error transferring SHEG to nations wallet") | |
325 | 330 | } | |
326 | 331 | } | |
327 | 332 | } | |
328 | 333 | } | |
329 | 334 | ||
330 | 335 | ||
336 | + | ||
337 | + | @Callable(i) | |
338 | + | func AddAssetFromMarkeplace (assetId,oldOwner,assetSheg) = if (!(checkAdmin(i.caller))) | |
339 | + | then throw("You are not allowed to perform this operation") | |
340 | + | else $Tuple2([StringEntry(getAssetOwnerKeyString(assetId), oldOwner), IntegerEntry(assetId, assetSheg)], oldOwner) | |
341 | + | ||
342 | + | ||
343 | + | ||
344 | + | @Callable(i) | |
345 | + | func TransferAssetToMarketplace (assetId,sellprice) = if (!(checkAssetOwner(toString(i.caller), assetId))) | |
346 | + | then throw("You are not the owner of this asset") | |
347 | + | else { | |
348 | + | let assetSheg = tryGetInteger(assetId) | |
349 | + | let tr = invoke(Address(marketplaceAddress), "putOnSale", [assetId, assetSheg, sellprice], nil) | |
350 | + | match tr { | |
351 | + | case t: Int => | |
352 | + | [DeleteEntry(getAssetOwnerKeyString(assetId)), DeleteEntry(assetId)] | |
353 | + | case _ => | |
354 | + | throw("Error putting the item on the marketplace") | |
355 | + | } | |
356 | + | } | |
357 | + | ||
358 | + |
github/deemru/w8io/169f3d6 47.39 ms ◑