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