tx · 3zJ8tF4jBAdb2LNvTeHCVKf8LsKqArhbtpGzoXRiGUwq 3N3A5ytTFmeT6yY7uHBR1x4RaURVqd2vFih: -0.01100000 Waves 2024.10.03 11:53 [3310455] smart account 3N3A5ytTFmeT6yY7uHBR1x4RaURVqd2vFih > SELF 0.00000000 Waves
{ "type": 13, "id": "3zJ8tF4jBAdb2LNvTeHCVKf8LsKqArhbtpGzoXRiGUwq", "fee": 1100000, "feeAssetId": null, "timestamp": 1727945625570, "version": 2, "chainId": 84, "sender": "3N3A5ytTFmeT6yY7uHBR1x4RaURVqd2vFih", "senderPublicKey": "FCkc6XaNdqHBY98YHzkNmomKLXrs8QG3w1zKAuACmZgF", "proofs": [ "35gk4SMqCg6aBRHTAMyTF9tjziZskapXJoFKHFBnmg6tt2sUnhb2HB94D7Fu5RjJ5rNJNM8PV3AhL7B5PFYRnSK3" ], "script": "base64:BgIRCAISAwoBCBIAEgQKAgQIEgAVARdzdGF0aWNLZXlfb3JhY2xlQWRkcmVzcwACFHN0YXRpY19vcmFjbGVBZGRyZXNzARhzdGF0aWNLZXlfYnJlZWRlckFkZHJlc3MAAhVzdGF0aWNfYnJlZWRlckFkZHJlc3MBFnN0YXRpY0tleV9pdGVtc0FkZHJlc3MAAhNzdGF0aWNfaXRlbXNBZGRyZXNzARJzdGF0aWNLZXlfZXh0cmFGZWUAAg9zdGF0aWNfZXh0cmFGZWUBGHN0YXRpY0tleV9leHRyYUZlZVJlbW92ZQACFXN0YXRpY19leHRyYUZlZVJlbW92ZQEXc3RhdGljS2V5X2ZlZUFnZ3JlZ2F0b3IAAhRzdGF0aWNfZmVlQWdncmVnYXRvcgAJd2VhcmFibGVzCQDMCAICCEFSVC1DQVBFCQDMCAICB0FSVC1IQVQJAMwIAgIKQVJULVhTQ0FSRgkAzAgCAgxBUlQtWFNXRUFURVIFA25pbAEPa2V5QXJ0ZWZhY3REdWNrAgZkdWNrSWQId2VhcmFibGUJAKwCAgkArAICBQZkdWNrSWQCAV8FCH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jaGlsZHJlbgkBBWFzSW50AQkA/AcECQERZ2V0QnJlZWRlckFkZHJlc3MAAhZ2YWxpZGF0ZUFuZEdldENoaWxkcmVuCQDMCAIFBmR1Y2tJZAUDbmlsBQNuaWwDCQAAAgUIY2hpbGRyZW4FCGNoaWxkcmVuCQDOCAIFA2FjYwkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIAAQgFB3BheW1lbnQHYXNzZXRJZAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQDOCAIFA2FjYwkBCHdlYXJJdGVtAgkA2AQBCQEFdmFsdWUBCAUHcGF5bWVudAdhc3NldElkCQDYBAEJAQV2YWx1ZQEICQCRAwIIBQFpCHBheW1lbnRzAAEHYXNzZXRJZAkAzggCCgACJGwIBQFpCHBheW1lbnRzCgACJHMJAJADAQUCJGwKAAUkYWNjMAUDbmlsCgEFJGYwXzECAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAQpoYW5kbGVJdGVtAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhNMaXN0IHNpemUgZXhjZWVkcyA2CQEFJGYwXzICCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECBQUkYWNjMAAAAAEAAgADAAQABQAGBQx2YWxpZFBheW1lbnQAFCB/fA==", "height": 3310455, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: EEH7mHzDZDfAJyfVpbEE38xn5Kx4Rx31buFB6qkv8Mqn Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func staticKey_oracleAddress () = "static_oracleAddress" | |
5 | + | ||
6 | + | ||
7 | + | func staticKey_breederAddress () = "static_breederAddress" | |
8 | + | ||
9 | + | ||
10 | + | func staticKey_itemsAddress () = "static_itemsAddress" | |
11 | + | ||
12 | + | ||
13 | + | func staticKey_extraFee () = "static_extraFee" | |
14 | + | ||
15 | + | ||
16 | + | func staticKey_extraFeeRemove () = "static_extraFeeRemove" | |
17 | + | ||
18 | + | ||
19 | + | func staticKey_feeAggregator () = "static_feeAggregator" | |
20 | + | ||
21 | + | ||
22 | + | let wearables = ["ART-CAPE", "ART-HAT", "ART-XSCARF", "ART-XSWEATER"] | |
23 | + | ||
24 | + | func keyArtefactDuck (duckId,wearable) = ((duckId + "_") + wearable) | |
25 | + | ||
26 | + | ||
27 | + | func keyTypesDuck (duckId,type) = ((duckId + "_") + type) | |
28 | + | ||
29 | + | ||
30 | + | func tryGetStringExternal (address,key) = match getString(address, key) { | |
31 | + | case a: String => | |
32 | + | a | |
33 | + | case _ => | |
34 | + | "" | |
35 | + | } | |
36 | + | ||
37 | + | ||
38 | + | func tryGetString (key) = tryGetStringExternal(this, key) | |
39 | + | ||
40 | + | ||
41 | + | func asInt (value) = match value { | |
42 | + | case int: Int => | |
43 | + | int | |
44 | + | case _ => | |
45 | + | throw("wrong type, expected: Int") | |
46 | + | } | |
47 | + | ||
48 | + | ||
49 | + | func asString (value) = match value { | |
50 | + | case string: String => | |
51 | + | string | |
52 | + | case _ => | |
53 | + | throw("wrong type, expected: String") | |
54 | + | } | |
55 | + | ||
56 | + | ||
57 | + | func getOracle () = Address(fromBase58String(tryGetString(staticKey_oracleAddress()))) | |
58 | + | ||
59 | + | ||
60 | + | func getBreederAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_breederAddress()))) | |
61 | + | ||
62 | + | ||
63 | + | func getItemsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_itemsAddress()))) | |
64 | + | ||
65 | + | ||
66 | + | func getFeeAggregator () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_feeAggregator()))) | |
67 | + | ||
68 | + | ||
69 | + | func checkAdditionalPayment (payment,amountOverride) = if (isDefined(payment.assetId)) | |
70 | + | then throw("WCAP: Please attach waves") | |
71 | + | else { | |
72 | + | let feeAmount = if ((amountOverride != 0)) | |
73 | + | then amountOverride | |
74 | + | else getIntegerValue(getOracle(), staticKey_extraFee()) | |
75 | + | if ((payment.amount != feeAmount)) | |
76 | + | then throw((("WCAP: Please attach exactly " + toString(feeAmount)) + " amount of wavelets")) | |
77 | + | else [ScriptTransfer(getFeeAggregator(), feeAmount, unit)] | |
78 | + | } | |
79 | + | ||
80 | + | ||
81 | + | func tryGetCosmeticItem (item) = { | |
82 | + | let key = ("direct_cosmetic_" + item) | |
83 | + | match getInteger(getItemsAddress(), key) { | |
84 | + | case a: Int => | |
85 | + | a | |
86 | + | case _ => | |
87 | + | unit | |
88 | + | } | |
89 | + | } | |
90 | + | ||
91 | + | ||
92 | + | func tryGetType (wearable) = tryGetStringExternal(getItemsAddress(), ("type_cosmetic_" + wearable)) | |
93 | + | ||
94 | + | ||
95 | + | func wearItem (assetIdWearAble,duckId) = { | |
96 | + | let artefactName = asString(invoke(getItemsAddress(), "checkArtefactDetails", [assetIdWearAble], nil)) | |
97 | + | if ((artefactName == artefactName)) | |
98 | + | then if (if (!(containsElement(wearables, artefactName))) | |
99 | + | then !(isDefined(tryGetCosmeticItem(artefactName))) | |
100 | + | else false) | |
101 | + | then throw("WRITD: Unsupported wearable") | |
102 | + | else { | |
103 | + | let artefactId = tryGetString(keyArtefactDuck(duckId, artefactName)) | |
104 | + | let boostDuck = if ((artefactName == "ART-XSCARF")) | |
105 | + | then invoke(getItemsAddress(), "manipulateBoost", [69, duckId], nil) | |
106 | + | else nil | |
107 | + | if ((boostDuck == boostDuck)) | |
108 | + | then if ((artefactId != "")) | |
109 | + | then throw(("Duck is already wearing a " + artefactName)) | |
110 | + | else { | |
111 | + | let type = tryGetType(artefactName) | |
112 | + | let typeOnDuck = if ((type != "")) | |
113 | + | then (tryGetString(keyTypesDuck(duckId, type)) != "") | |
114 | + | else throw(("Type undefined, please contact admins " + artefactName)) | |
115 | + | if (typeOnDuck) | |
116 | + | then throw("You can only attach 1 from each type to your duck!") | |
117 | + | else { | |
118 | + | let typeResult = if ((type != "")) | |
119 | + | then [StringEntry(keyTypesDuck(duckId, type), assetIdWearAble)] | |
120 | + | else nil | |
121 | + | ([StringEntry(keyArtefactDuck(duckId, artefactName), assetIdWearAble)] ++ typeResult) | |
122 | + | } | |
123 | + | } | |
124 | + | else throw("Strict value is not equal to itself.") | |
125 | + | } | |
126 | + | else throw("Strict value is not equal to itself.") | |
127 | + | } | |
128 | + | ||
129 | + | ||
130 | + | @Callable(i) | |
131 | + | func configureOracle (oracle) = if ((i.caller != this)) | |
132 | + | then throw("admin only") | |
133 | + | else [StringEntry(staticKey_oracleAddress(), oracle)] | |
134 | + | ||
135 | + | ||
136 | + | ||
137 | + | @Callable(i) | |
138 | + | func wearItemToDuck () = { | |
139 | + | let firstPayment = value(i.payments[0]) | |
140 | + | let secondPayment = value(i.payments[1]) | |
141 | + | let validPayment = checkAdditionalPayment(i.payments[2], 0) | |
142 | + | let duckId = toBase58String(value(firstPayment.assetId)) | |
143 | + | let secondAssetId = toBase58String(value(secondPayment.assetId)) | |
144 | + | if (if ((firstPayment.amount != 1)) | |
145 | + | then true | |
146 | + | else (secondPayment.amount != 1)) | |
147 | + | then throw("WRITD: NFT is not attached") | |
148 | + | else { | |
149 | + | let children = asInt(invoke(getBreederAddress(), "validateAndGetChildren", [duckId], nil)) | |
150 | + | if ((children == children)) | |
151 | + | then ((wearItem(secondAssetId, duckId) ++ [ScriptTransfer(i.caller, 1, firstPayment.assetId)]) ++ validPayment) | |
152 | + | else throw("Strict value is not equal to itself.") | |
153 | + | } | |
154 | + | } | |
155 | + | ||
156 | + | ||
157 | + | ||
158 | + | @Callable(i) | |
159 | + | func removeItemFromDuck (burnItem,artefactName) = { | |
160 | + | let wavesFee = if (burnItem) | |
161 | + | then 0 | |
162 | + | else getIntegerValue(getOracle(), staticKey_extraFeeRemove()) | |
163 | + | let duckPayment = value(i.payments[0]) | |
164 | + | let roboDuckPayment = value(i.payments[1]) | |
165 | + | let validPayment = checkAdditionalPayment(i.payments[2], wavesFee) | |
166 | + | let duckId = toBase58String(value(duckPayment.assetId)) | |
167 | + | let roboDuckId = toBase58String(value(roboDuckPayment.assetId)) | |
168 | + | if (if ((duckPayment.amount != 1)) | |
169 | + | then true | |
170 | + | else (roboDuckPayment.amount != 1)) | |
171 | + | then throw("WRITD: NFT is not attached") | |
172 | + | else { | |
173 | + | let children = asInt(invoke(getBreederAddress(), "validateAndGetChildren", [duckId], nil)) | |
174 | + | if ((children == children)) | |
175 | + | then { | |
176 | + | let artefactNameRoboduck = asString(invoke(getItemsAddress(), "checkArtefactDetails", [roboDuckId], nil)) | |
177 | + | if ((artefactNameRoboduck == artefactNameRoboduck)) | |
178 | + | then if ((artefactNameRoboduck != "ART-ROBODUCK")) | |
179 | + | then throw("Only rododuck can remove items!") | |
180 | + | else if (if (!(containsElement(wearables, artefactName))) | |
181 | + | then !(isDefined(tryGetCosmeticItem(artefactName))) | |
182 | + | else false) | |
183 | + | then throw("WRITD: Unsupported wearable") | |
184 | + | else { | |
185 | + | let artefactId = tryGetString(keyArtefactDuck(duckId, artefactName)) | |
186 | + | let boostDuck = if ((artefactName == "ART-XSCARF")) | |
187 | + | then invoke(getItemsAddress(), "manipulateBoost", [69, duckId], nil) | |
188 | + | else nil | |
189 | + | if ((boostDuck == boostDuck)) | |
190 | + | then if ((artefactId == "")) | |
191 | + | then throw(("Duck not wearing a " + artefactName)) | |
192 | + | else { | |
193 | + | let type = tryGetType(artefactName) | |
194 | + | let typeResult = if ((type != "")) | |
195 | + | then [DeleteEntry(keyTypesDuck(duckId, type))] | |
196 | + | else nil | |
197 | + | let burn = if (burnItem) | |
198 | + | then [Burn(fromBase58String(artefactId), 1)] | |
199 | + | else [ScriptTransfer(i.caller, 1, fromBase58String(artefactId))] | |
200 | + | ((([DeleteEntry(keyArtefactDuck(duckId, artefactName)), ScriptTransfer(i.caller, 1, duckPayment.assetId), Burn(fromBase58String(roboDuckId), 1)] ++ burn) ++ validPayment) ++ typeResult) | |
201 | + | } | |
202 | + | else throw("Strict value is not equal to itself.") | |
203 | + | } | |
204 | + | else throw("Strict value is not equal to itself.") | |
205 | + | } | |
206 | + | else throw("Strict value is not equal to itself.") | |
207 | + | } | |
208 | + | } | |
209 | + | ||
210 | + | ||
211 | + | ||
212 | + | @Callable(i) | |
213 | + | func wearXItemsToDuck () = { | |
214 | + | let validPayment = checkAdditionalPayment(i.payments[1], 0) | |
215 | + | if ((3 > size(i.payments))) | |
216 | + | then throw("WWXITD: Please attach at least 1 item and 1 duck!") | |
217 | + | else if ((size(i.payments) > 7)) | |
218 | + | then throw("WWXITD: You can only attach 5 items and one duck!") | |
219 | + | else { | |
220 | + | func handleItem (acc,payment) = { | |
221 | + | let index = indexOf(i.payments, payment) | |
222 | + | if ((index == 0)) | |
223 | + | then { | |
224 | + | let duckId = toBase58String(value(payment.assetId)) | |
225 | + | if ((payment.amount != 1)) | |
226 | + | then throw("WRITD: Duck is not attached") | |
227 | + | else { | |
228 | + | let children = asInt(invoke(getBreederAddress(), "validateAndGetChildren", [duckId], nil)) | |
229 | + | if ((children == children)) | |
230 | + | then (acc ++ [ScriptTransfer(i.caller, 1, payment.assetId)]) | |
231 | + | else throw("Strict value is not equal to itself.") | |
232 | + | } | |
233 | + | } | |
234 | + | else (acc ++ wearItem(toBase58String(value(payment.assetId)), toBase58String(value(i.payments[1].assetId)))) | |
235 | + | } | |
236 | + | ||
237 | + | ({ | |
238 | + | let $l = i.payments | |
239 | + | let $s = size($l) | |
240 | + | let $acc0 = nil | |
241 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
242 | + | then $a | |
243 | + | else handleItem($a, $l[$i]) | |
244 | + | ||
245 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
246 | + | then $a | |
247 | + | else throw("List size exceeds 6") | |
248 | + | ||
249 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
250 | + | } ++ validPayment) | |
251 | + | } | |
252 | + | } | |
253 | + | ||
254 | + |
github/deemru/w8io/026f985 18.82 ms ◑