tx · B7mXXdprvczmQyEEm9yfKnx7vkRgJ4bhhteTWCSVCCpD 3MtrXLq2YFHNLqTBXr488vaQVQpsHdmbg7C: -0.01900000 Waves 2024.11.01 19:39 [3352711] smart account 3MtrXLq2YFHNLqTBXr488vaQVQpsHdmbg7C > SELF 0.00000000 Waves
{ "type": 13, "id": "B7mXXdprvczmQyEEm9yfKnx7vkRgJ4bhhteTWCSVCCpD", "fee": 1900000, "feeAssetId": null, "timestamp": 1730479187009, "version": 2, "chainId": 84, "sender": "3MtrXLq2YFHNLqTBXr488vaQVQpsHdmbg7C", "senderPublicKey": "ESRi59hjHAnDxmeFyTaaXNvzeEW323BvzYJYyKjpEsC1", "proofs": [ "4qorX7cgtgke8sVpwfSWnHacpMUJkhZwgfboRRQo8AhB2wtJGQaDXVeNnqgc8dfgyitutuaqkfoCvGkXZSzaAydk" ], "script": "base64:AAIFAAAAAAAAAC8IAhIECgIICBIECgIICBIDCgEIEgUKAwgICBIECgIICBIDCgEBEgMKAQgSAwoBCAAAACIBAAAAB2dldEJvb2wAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIHAQAAAAlpc1Rlc3RFbnYAAAAACQEAAAAHZ2V0Qm9vbAAAAAECAAAAB1RFU1RFTlYBAAAAFHRyeUdldFN0cmluZ0V4dGVybmFsAAAAAgAAAAdhZGRyZXNzAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQkBAAAAFHRyeUdldFN0cmluZ0V4dGVybmFsAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAABd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UAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAACBQAAAAl0aGlyZFVzZXIAAAAAAAAAAAEAAAAAAAAAAAAEAAAAD3NpZ25hdHVyZXNDb3VudAkAAGQAAAACCQAAZAAAAAIFAAAAD2ZpcnN0VXNlclNpZ25lZAUAAAAQc2Vjb25kVXNlclNpZ25lZAUAAAAPdGhpcmRVc2VyU2lnbmVkBAAAAAckbWF0Y2gwBQAAAAJ0eAkAAGcAAAACBQAAAA9zaWduYXR1cmVzQ291bnQAAAAAAAAAAALTPnfz", "height": 3352711, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BBxGEaZ5BaLv1FKrLM3bXDQziSuNRAcKYURP7nAc11Tz Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getBool (key) = match getBoolean(this, key) { | |
5 | + | case b: Boolean => | |
6 | + | b | |
7 | + | case _ => | |
8 | + | false | |
9 | + | } | |
10 | + | ||
11 | + | ||
12 | + | func isTestEnv () = getBool("TESTENV") | |
13 | + | ||
14 | + | ||
4 | 15 | func tryGetStringExternal (address,key) = match getString(address, key) { | |
5 | 16 | case a: String => | |
6 | 17 | a | |
9 | 20 | } | |
10 | 21 | ||
11 | 22 | ||
12 | - | func tryGetInteger (key) = match getInteger(this, key) { | |
13 | - | case b: Int => | |
14 | - | b | |
15 | - | case _ => | |
16 | - | 0 | |
17 | - | } | |
18 | - | ||
19 | - | ||
20 | 23 | func tryGetString (key) = tryGetStringExternal(this, key) | |
21 | - | ||
22 | - | ||
23 | - | func asInt (value) = match value { | |
24 | - | case int: Int => | |
25 | - | int | |
26 | - | case string: String => | |
27 | - | throw(("RAI: wrong type, expected: Int, but got: " + string)) | |
28 | - | case _ => | |
29 | - | throw("RAI: wrong type, expected: Int") | |
30 | - | } | |
31 | - | ||
32 | - | ||
33 | - | func asBoolean (value) = match value { | |
34 | - | case boolean: Boolean => | |
35 | - | boolean | |
36 | - | case _ => | |
37 | - | throw("FAB: wrong type, expected: Boolean") | |
38 | - | } | |
39 | - | ||
40 | - | ||
41 | - | func asString (value) = match value { | |
42 | - | case s: String => | |
43 | - | s | |
44 | - | case s: Int => | |
45 | - | throw("wrong type, expected: String, got: Int") | |
46 | - | case s: Unit => | |
47 | - | throw("wrong type, expected: String, got: Unit") | |
48 | - | case _ => | |
49 | - | throw("wrong type, expected: String") | |
50 | - | } | |
51 | 24 | ||
52 | 25 | ||
53 | 26 | func staticKey_oracleAddress () = "static_oracleAddress" | |
59 | 32 | func staticKey_feeAggregator () = "static_feeAggregator" | |
60 | 33 | ||
61 | 34 | ||
62 | - | func staticKey_ | |
35 | + | func staticKey_refContractAddress () = "static_refContractAddress" | |
63 | 36 | ||
64 | 37 | ||
65 | - | func staticKey_ | |
38 | + | func staticKey_caniRebirthAddress () = "static_canineRebirthAddress" | |
66 | 39 | ||
67 | 40 | ||
68 | - | func staticKey_couponsAddress () = "static_couponsAddress" | |
69 | - | ||
70 | - | ||
71 | - | func staticKey_canineStakingAddress () = "static_canineStakingAddress" | |
72 | - | ||
73 | - | ||
74 | - | func staticKey_duckStakingAddress () = "static_farmingAddressNew" | |
75 | - | ||
76 | - | ||
77 | - | func staticKey_duckIncubatorAddress () = "static_incubatorAddress" | |
78 | - | ||
79 | - | ||
80 | - | func staticKey_itemsAddress () = "static_itemsAddress" | |
81 | - | ||
82 | - | ||
83 | - | func staticKey_canineWavesRebirthPrice () = "static_canineWavesRebirthPrice" | |
84 | - | ||
85 | - | ||
86 | - | func staticKey_turtleIncubatorAddress () = "static_turtleIncubatorAddress" | |
87 | - | ||
88 | - | ||
89 | - | func staticKey_babyDuckAddress () = "static_babyDuckAddress" | |
41 | + | func staticKey_caniFarmingAddress () = "static_canineStakingAddress" | |
90 | 42 | ||
91 | 43 | ||
92 | 44 | func getOracle () = Address(fromBase58String(tryGetString(staticKey_oracleAddress()))) | |
95 | 47 | func getFeeAggregator () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_feeAggregator()))) | |
96 | 48 | ||
97 | 49 | ||
98 | - | func | |
50 | + | func getMintAssetId () = unit | |
99 | 51 | ||
100 | 52 | ||
101 | - | func | |
53 | + | func getBurnAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_burnAddress"))) | |
102 | 54 | ||
103 | 55 | ||
104 | - | func | |
56 | + | func getRefContractAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_refContractAddress()))) | |
105 | 57 | ||
106 | 58 | ||
107 | - | func | |
59 | + | func getCaniRebirthAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_caniRebirthAddress()))) | |
108 | 60 | ||
109 | 61 | ||
110 | - | func getDuckStakingAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_duckStakingAddress()))) | |
111 | - | ||
112 | - | ||
113 | - | func getDuckIncubatorAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_duckIncubatorAddress()))) | |
114 | - | ||
115 | - | ||
116 | - | func getItemsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_itemsAddress()))) | |
117 | - | ||
118 | - | ||
119 | - | func getTurtleIncubatorAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_turtleIncubatorAddress()))) | |
120 | - | ||
121 | - | ||
122 | - | func getBabyDuckAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_babyDuckAddress()))) | |
123 | - | ||
124 | - | ||
125 | - | func tryGetIntegerExternal (address,key) = match getInteger(address, key) { | |
126 | - | case b: Int => | |
127 | - | b | |
128 | - | case _ => | |
129 | - | throw("TR: Value not found in sc!") | |
130 | - | } | |
131 | - | ||
132 | - | ||
133 | - | let wavesAmount = tryGetIntegerExternal(getOracle(), staticKey_canineWavesRebirthPrice()) | |
134 | - | ||
135 | - | let delayForHatching = 2 | |
136 | - | ||
137 | - | func checkReal (assetId) = if (if ((value(assetInfo(assetId)).issuer == getCanineBreederAddress())) | |
138 | - | then true | |
139 | - | else (value(assetInfo(assetId)).issuer == getCanineIncubatorAddress())) | |
140 | - | then value(assetInfo(assetId)).issuer | |
141 | - | else throw("not valid NFT") | |
62 | + | func getCaniFarmingAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_caniFarmingAddress()))) | |
142 | 63 | ||
143 | 64 | ||
144 | 65 | func checkAdditionalPayment (payment) = if (isDefined(payment.assetId)) | |
145 | - | then throw(" | |
66 | + | then throw("BDCAP: Please attach waves") | |
146 | 67 | else { | |
147 | 68 | let feeAmount = getIntegerValue(getOracle(), staticKey_extraFee()) | |
148 | 69 | if ((payment.amount != feeAmount)) | |
149 | - | then throw(((" | |
70 | + | then throw((("BDCAP: Please attach exactly " + toString(feeAmount)) + " amount of wavelets")) | |
150 | 71 | else [ScriptTransfer(getFeeAggregator(), feeAmount, unit)] | |
151 | 72 | } | |
152 | 73 | ||
153 | 74 | ||
154 | - | func getRandomNumber (options,txId,hatchingFinishHeight,offset) = { | |
155 | - | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
156 | - | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
157 | - | (toInt(randomHash, (offset * 8)) % options) | |
75 | + | let delayForHatching = 2 | |
76 | + | ||
77 | + | let HatchingStarted = "HATCHING_STARTED" | |
78 | + | ||
79 | + | let HatchingFinished = "HATCHING_FINISHED" | |
80 | + | ||
81 | + | func isLocked () = { | |
82 | + | let masterAddress = Address(base58'3PEPftf2kWZDmAaWBjs6BUJa9957kiA2PkU') | |
83 | + | match getInteger(masterAddress, "egglock") { | |
84 | + | case b: Int => | |
85 | + | b | |
86 | + | case _ => | |
87 | + | 0 | |
88 | + | } | |
158 | 89 | } | |
159 | 90 | ||
160 | 91 | ||
161 | - | func tryGetBoolean (key) = match getBoolean(key) { | |
162 | - | case b: Boolean => | |
163 | - | b | |
92 | + | func getHatchingStatusKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_status") | |
93 | + | ||
94 | + | ||
95 | + | func getHatchingFinishHeightKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_fh") | |
96 | + | ||
97 | + | ||
98 | + | func getCANIIdKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_di") | |
99 | + | ||
100 | + | ||
101 | + | func getCANIStatsKey (genString) = (("stats_" + genString) + "_amount") | |
102 | + | ||
103 | + | ||
104 | + | func tryGetInteger (key) = { | |
105 | + | let val = match getInteger(this, key) { | |
106 | + | case b: Int => | |
107 | + | b | |
108 | + | case _ => | |
109 | + | 0 | |
110 | + | } | |
111 | + | val | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | let discountCoefficient = tryGetInteger("discountCoefficient") | |
116 | + | ||
117 | + | func getRandomNumber (variants,txId,hatchingFinishHeight,offset) = { | |
118 | + | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
119 | + | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
120 | + | (toInt(randomHash, (offset * 8)) % variants) | |
121 | + | } | |
122 | + | ||
123 | + | ||
124 | + | func select (color) = { | |
125 | + | let oldGenes = [$Tuple2(("CANI-AAAAAAAA-G" + color), "8A-G")] | |
126 | + | let newGenes = [$Tuple2(("CANI-BBBBBBBB-G" + color), "8B-G"), $Tuple2(("CANI-CCCCCCCC-G" + color), "8C-G"), $Tuple2(("CANI-DDDDDDDD-G" + color), "8D-G"), $Tuple2(("CANI-EEEEEEEE-G" + color), "8E-G")] | |
127 | + | $Tuple2((oldGenes ++ newGenes), newGenes) | |
128 | + | } | |
129 | + | ||
130 | + | ||
131 | + | func getRandomName (txId,hatchingFinishHeight,all) = { | |
132 | + | let colorRandom = getRandomNumber(4, txId, hatchingFinishHeight, 1) | |
133 | + | let color = ["A", "B", "C", "D"][colorRandom] | |
134 | + | let colorSelect = select(color) | |
135 | + | let toPickFrom = if (all) | |
136 | + | then colorSelect._1 | |
137 | + | else colorSelect._2 | |
138 | + | let typeRandom = getRandomNumber(size(toPickFrom), txId, hatchingFinishHeight, 0) | |
139 | + | toPickFrom[typeRandom] | |
140 | + | } | |
141 | + | ||
142 | + | ||
143 | + | let typesAmount = (size(select("R")._2) - 1) | |
144 | + | ||
145 | + | func countEggsNeededAmount (totalCANIsAmount) = { | |
146 | + | let n = totalCANIsAmount | |
147 | + | let g = discountCoefficient | |
148 | + | let t = typesAmount | |
149 | + | let price = (pow((100 + ((n * g) / (10 * t))), 2, 5, 1, 2, DOWN) + 55) | |
150 | + | (price * 1500000) | |
151 | + | } | |
152 | + | ||
153 | + | ||
154 | + | func asBoolean (value) = match value { | |
155 | + | case boolean: Boolean => | |
156 | + | boolean | |
164 | 157 | case _ => | |
165 | - | | |
158 | + | throw("TI: wrong type, expected: Boolean") | |
166 | 159 | } | |
167 | 160 | ||
168 | 161 | ||
169 | - | func getRandomWin (tx,finishHeight,blacklistCode) = { | |
170 | - | let jackpotRandom = getRandomNumber(10, tx, finishHeight, 1) | |
171 | - | if ((jackpotRandom == 1)) | |
172 | - | then $Tuple2(jackpotRandom, "jackpot") | |
162 | + | @Callable(i) | |
163 | + | func reduceRarity (assetId,fGen) = { | |
164 | + | let asset = fromBase58String(assetId) | |
165 | + | if (if ((i.caller != getCaniRebirthAddress())) | |
166 | + | then (i.caller != this) | |
167 | + | else false) | |
168 | + | then throw("IRR: admin or rebirth only") | |
173 | 169 | else { | |
174 | - | let n = getRandomNumber(1000, tx, finishHeight, 0) | |
175 | - | let result = if (if ((100 > n)) | |
176 | - | then (blacklistCode != "docking_A") | |
177 | - | else false) | |
178 | - | then "docking_A" | |
179 | - | else if (if ((200 > n)) | |
180 | - | then (blacklistCode != "docking_B") | |
181 | - | else false) | |
182 | - | then "docking_B" | |
183 | - | else if (if ((300 > n)) | |
184 | - | then (blacklistCode != "docking_C") | |
185 | - | else false) | |
186 | - | then "docking_C" | |
187 | - | else if (if ((400 > n)) | |
188 | - | then (blacklistCode != "docking_D") | |
189 | - | else false) | |
190 | - | then "docking_D" | |
191 | - | else if (if ((450 > n)) | |
192 | - | then (blacklistCode != "incubator") | |
193 | - | else false) | |
194 | - | then "incubator" | |
195 | - | else if (if ((490 > n)) | |
196 | - | then (blacklistCode != "duckling_40") | |
197 | - | else false) | |
198 | - | then "duckling_40" | |
199 | - | else if (if ((540 > n)) | |
200 | - | then (blacklistCode != "duckling_20") | |
201 | - | else false) | |
202 | - | then "duckling_20" | |
203 | - | else if (if ((640 > n)) | |
204 | - | then (blacklistCode != "item!ART-FEED5") | |
205 | - | else false) | |
206 | - | then "item!ART-FEED5" | |
207 | - | else if (if ((710 > n)) | |
208 | - | then (blacklistCode != "item!ART-FEED10") | |
209 | - | else false) | |
210 | - | then "item!ART-FEED10" | |
211 | - | else if (if ((740 > n)) | |
212 | - | then (blacklistCode != "item!ART-FEED15") | |
213 | - | else false) | |
214 | - | then "item!ART-FEED15" | |
215 | - | else if (if ((770 > n)) | |
216 | - | then (blacklistCode != "item!ART-FEED20") | |
217 | - | else false) | |
218 | - | then "item!ART-FEED20" | |
219 | - | else if (if ((790 > n)) | |
220 | - | then (blacklistCode != "item!ART-FEED25") | |
221 | - | else false) | |
222 | - | then "item!ART-FEED25" | |
223 | - | else if (if ((810 > n)) | |
224 | - | then (blacklistCode != "item!ART-FEED50") | |
225 | - | else false) | |
226 | - | then "item!ART-FEED50" | |
227 | - | else if (if ((830 > n)) | |
228 | - | then (blacklistCode != "item!ART-FEED100") | |
229 | - | else false) | |
230 | - | then "item!ART-FEED100" | |
231 | - | else if (if ((860 > n)) | |
232 | - | then (blacklistCode != "item!ART-MUTARIUM-G") | |
233 | - | else false) | |
234 | - | then "item!ART-MUTARIUM-G" | |
235 | - | else if (if ((890 > n)) | |
236 | - | then (blacklistCode != "item!ART-MUTARIUM-D") | |
237 | - | else false) | |
238 | - | then "item!ART-MUTARIUM-D" | |
239 | - | else if (if ((910 > n)) | |
240 | - | then (blacklistCode != "item!ART-FREEGENE") | |
241 | - | else false) | |
242 | - | then "item!ART-FREEGENE" | |
243 | - | else if (if ((930 > n)) | |
244 | - | then (blacklistCode != "item!ART-FIXGENE") | |
245 | - | else false) | |
246 | - | then "item!ART-FIXGENE" | |
247 | - | else if (if ((980 > n)) | |
248 | - | then (blacklistCode != "trtl_incubator") | |
249 | - | else false) | |
250 | - | then "trtl_incubator" | |
251 | - | else "item!ART-POTION" | |
252 | - | $Tuple2(n, result) | |
170 | + | let duckGen = value(assetInfo(asset)).name | |
171 | + | let letter = takeRight(take(duckGen, 6), 1) | |
172 | + | let farmGen = (("8" + letter) + "-G") | |
173 | + | [IntegerEntry(getCANIStatsKey(duckGen), (tryGetInteger(getCANIStatsKey(duckGen)) - 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) - 1))] | |
253 | 174 | } | |
254 | 175 | } | |
255 | 176 | ||
256 | 177 | ||
257 | - | func getRandomReturn (tx,finishHeight) = { | |
258 | - | let n = getRandomNumber(2, tx, finishHeight, 1) | |
259 | - | if ((n == 0)) | |
260 | - | then true | |
261 | - | else false | |
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func increaseRarity (assetId,fGen) = { | |
181 | + | let asset = fromBase58String(assetId) | |
182 | + | if (if ((i.caller != getCaniRebirthAddress())) | |
183 | + | then (i.caller != this) | |
184 | + | else false) | |
185 | + | then throw("IRR: admin or rebirth only") | |
186 | + | else { | |
187 | + | let duckGen = value(assetInfo(asset)).name | |
188 | + | let letter = takeRight(take(duckGen, 6), 1) | |
189 | + | let farmGen = (("8" + letter) + "-G") | |
190 | + | [IntegerEntry(getCANIStatsKey(duckGen), (tryGetInteger(getCANIStatsKey(duckGen)) + 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1))] | |
191 | + | } | |
262 | 192 | } | |
263 | 193 | ||
264 | - | ||
265 | - | func finishRebirthInternal (initTx,address,additionalPayment,double,blacklistCode,rescue) = { | |
266 | - | let finishBlock = tryGetInteger((((("address_" + address) + "_initTx_") + initTx) + "_finishBlock")) | |
267 | - | let status = tryGetString((((("address_" + address) + "_initTx_") + initTx) + "_status")) | |
268 | - | let validPayment = checkAdditionalPayment(additionalPayment) | |
269 | - | if ((validPayment == validPayment)) | |
270 | - | then if ((status != "open")) | |
271 | - | then throw("rebirth is finished or not open") | |
272 | - | else if ((finishBlock > height)) | |
273 | - | then throw("you cannot finish rebirth, yet") | |
274 | - | else { | |
275 | - | let output = getRandomWin(fromBase58String(initTx), finishBlock, blacklistCode) | |
276 | - | let win = output._2 | |
277 | - | let random = output._1 | |
278 | - | let txId = initTx | |
279 | - | let result = if ((indexOf(win, "docking") != unit)) | |
280 | - | then { | |
281 | - | let color = takeRight(win, 1) | |
282 | - | let call = if (!(double)) | |
283 | - | then { | |
284 | - | let first = invoke(getCanineStakingAddress(), "addFreePerch", [address, color, 1], nil) | |
285 | - | if ((first == first)) | |
286 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
287 | - | else throw("Strict value is not equal to itself.") | |
288 | - | } | |
289 | - | else { | |
290 | - | let first = invoke(getCanineStakingAddress(), "addFreePerch", [address, color, 2], nil) | |
291 | - | if ((first == first)) | |
292 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), win)] | |
293 | - | else throw("Strict value is not equal to itself.") | |
294 | - | } | |
295 | - | if ((call == call)) | |
296 | - | then call | |
297 | - | else throw("Strict value is not equal to itself.") | |
298 | - | } | |
299 | - | else if ((win == "jackpot")) | |
300 | - | then { | |
301 | - | let call = invoke(getCanineIncubatorAddress(), "issueJackpot", [address, txId, "WWWWHWTF"], nil) | |
302 | - | if ((call == call)) | |
303 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
304 | - | else throw("Strict value is not equal to itself.") | |
305 | - | } | |
306 | - | else if ((win == "incubator")) | |
307 | - | then { | |
308 | - | let call = if (!(double)) | |
309 | - | then { | |
310 | - | let first = invoke(getCanineIncubatorAddress(), "issueFree", [address, txId], nil) | |
311 | - | if ((first == first)) | |
312 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
313 | - | else throw("Strict value is not equal to itself.") | |
314 | - | } | |
315 | - | else { | |
316 | - | let first = invoke(getCanineIncubatorAddress(), "issueFree", [address, txId], nil) | |
317 | - | if ((first == first)) | |
318 | - | then { | |
319 | - | let second = invoke(getTurtleIncubatorAddress(), "issueFreeTurtle", [address, txId], nil) | |
320 | - | if ((second == second)) | |
321 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), "incubator")] | |
322 | - | else throw("Strict value is not equal to itself.") | |
323 | - | } | |
324 | - | else throw("Strict value is not equal to itself.") | |
325 | - | } | |
326 | - | if ((call == call)) | |
327 | - | then call | |
328 | - | else throw("Strict value is not equal to itself.") | |
329 | - | } | |
330 | - | else if ((indexOf(win, "duckling") != unit)) | |
331 | - | then { | |
332 | - | let level = parseIntValue(split(win, "_")[1]) | |
333 | - | let levelFinal = if (double) | |
334 | - | then (2 * level) | |
335 | - | else level | |
336 | - | let call = invoke(getBabyDuckAddress(), "issueFreeDuckling", [address, txId, levelFinal], nil) | |
337 | - | if ((call == call)) | |
338 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
339 | - | else throw("Strict value is not equal to itself.") | |
340 | - | } | |
341 | - | else if ((win == "trtl_incubator")) | |
342 | - | then { | |
343 | - | let call = if (!(double)) | |
344 | - | then { | |
345 | - | let first = invoke(getTurtleIncubatorAddress(), "issueFreeTurtle", [address, txId], nil) | |
346 | - | if ((first == first)) | |
347 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
348 | - | else throw("Strict value is not equal to itself.") | |
349 | - | } | |
350 | - | else { | |
351 | - | let first = invoke(getTurtleIncubatorAddress(), "issueFreeTurtle", [address, txId], nil) | |
352 | - | if ((first == first)) | |
353 | - | then { | |
354 | - | let second = invoke(getCanineIncubatorAddress(), "issueFree", [address, txId], nil) | |
355 | - | if ((second == second)) | |
356 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), "trtl_incubator")] | |
357 | - | else throw("Strict value is not equal to itself.") | |
358 | - | } | |
359 | - | else throw("Strict value is not equal to itself.") | |
360 | - | } | |
361 | - | if ((call == call)) | |
362 | - | then call | |
363 | - | else throw("Strict value is not equal to itself.") | |
364 | - | } | |
365 | - | else if ((indexOf(win, "item") != unit)) | |
366 | - | then { | |
367 | - | let itemName = split(win, "!")[1] | |
368 | - | let call = if (!(double)) | |
369 | - | then { | |
370 | - | let first = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 0], nil) | |
371 | - | if ((first == first)) | |
372 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
373 | - | else throw("Strict value is not equal to itself.") | |
374 | - | } | |
375 | - | else { | |
376 | - | let first = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 0], nil) | |
377 | - | if ((first == first)) | |
378 | - | then { | |
379 | - | let second = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 1], nil) | |
380 | - | if ((second == second)) | |
381 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), win)] | |
382 | - | else throw("Strict value is not equal to itself.") | |
383 | - | } | |
384 | - | else throw("Strict value is not equal to itself.") | |
385 | - | } | |
386 | - | if ((call == call)) | |
387 | - | then call | |
388 | - | else throw("Strict value is not equal to itself.") | |
389 | - | } | |
390 | - | else throw(("RFB: Some error occured, please contact the admins! " + win)) | |
391 | - | if ((result == result)) | |
392 | - | then { | |
393 | - | let returnToSender = if (rescue) | |
394 | - | then getRandomReturn(fromBase58String(initTx), finishBlock) | |
395 | - | else false | |
396 | - | let returnPayload = if (returnToSender) | |
397 | - | then { | |
398 | - | let assetId = fromBase58String(getStringValue((((("address_" + address) + "_initTx_") + initTx) + "_assetId"))) | |
399 | - | let issuer = checkReal(assetId) | |
400 | - | let gen = asString(invoke(getCanineBreederAddress(), "getGenFromName", [value(assetInfo(assetId)).name], nil)) | |
401 | - | if ((gen == gen)) | |
402 | - | then { | |
403 | - | let call = invoke(issuer, "increaseRarity", [toBase58String(assetId), gen], nil) | |
404 | - | if ((call == call)) | |
405 | - | then [ScriptTransfer(addressFromStringValue(address), 1, assetId)] | |
406 | - | else throw("Strict value is not equal to itself.") | |
407 | - | } | |
408 | - | else throw("Strict value is not equal to itself.") | |
409 | - | } | |
410 | - | else nil | |
411 | - | (((result ++ [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win"), win), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_status"), "finish"), IntegerEntry((((("address_" + address) + "_initTx_") + initTx) + "_random"), random)]) ++ validPayment) ++ returnPayload) | |
412 | - | } | |
413 | - | else throw("Strict value is not equal to itself.") | |
414 | - | } | |
415 | - | else throw("Strict value is not equal to itself.") | |
416 | - | } | |
417 | 194 | ||
418 | 195 | ||
419 | 196 | @Callable(i) | |
420 | 197 | func configureOracle (oracle) = if ((i.caller != this)) | |
421 | - | then throw(" | |
198 | + | then throw("ICU: admin only") | |
422 | 199 | else [StringEntry("static_oracleAddress", oracle)] | |
423 | 200 | ||
424 | 201 | ||
425 | 202 | ||
426 | 203 | @Callable(i) | |
427 | - | func initRebirth () = { | |
428 | - | let pmtCanine = i.payments[0] | |
429 | - | let pmtWaves = i.payments[1] | |
430 | - | let assetId = value(pmtCanine.assetId) | |
431 | - | let initTx = toBase58String(i.transactionId) | |
432 | - | let address = toString(i.caller) | |
433 | - | if ((pmtCanine.amount != 1)) | |
434 | - | then throw("NFT is not attached") | |
435 | - | else if (if ((pmtWaves.amount != wavesAmount)) | |
436 | - | then true | |
437 | - | else (pmtWaves.assetId != unit)) | |
438 | - | then throw("Wavespayment is not attached or wrong!") | |
204 | + | func issueJackpot (address,txIdStr,gen) = if (if ((i.caller != getCaniRebirthAddress())) | |
205 | + | then (i.caller != this) | |
206 | + | else false) | |
207 | + | then throw("ISJ: admin or rebirth only") | |
208 | + | else { | |
209 | + | let txId = fromBase58String(txIdStr) | |
210 | + | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
211 | + | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
212 | + | let totalDucksAmount = tryGetInteger("cani_amount") | |
213 | + | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
214 | + | let $t065546606 = $Tuple2((("CANI-" + gen) + "-JU"), "8W-J") | |
215 | + | let duckGen = $t065546606._1 | |
216 | + | let farmGen = $t065546606._2 | |
217 | + | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
218 | + | let asset = Issue(duckGen, description, 1, 0, false, unit, height) | |
219 | + | let assetId = calculateAssetId(asset) | |
220 | + | let duckIdKey = getCANIIdKey(address, txId) | |
221 | + | let valueDuckIdKeyExits = tryGetString(duckIdKey) | |
222 | + | if ((valueDuckIdKeyExits != "")) | |
223 | + | then throw((("ISJ: You will override following duckId :" + duckIdKey) + " make sure that your txId is unique!")) | |
224 | + | else $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("cani_amount", (totalDucksAmount + 1)), IntegerEntry("cani_last_price", (eggsNeeded / 1500000)), StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getCANIStatsKey(duckGen), (tryGetInteger(getCANIStatsKey(duckGen)) + 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
225 | + | } | |
226 | + | ||
227 | + | ||
228 | + | ||
229 | + | @Callable(i) | |
230 | + | func issueFree (address,txIdStr) = if ((i.caller != getCaniRebirthAddress())) | |
231 | + | then throw("CIF: rebirth only") | |
232 | + | else { | |
233 | + | let txId = fromBase58String(txIdStr) | |
234 | + | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
235 | + | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
236 | + | let totalDucksAmount = tryGetInteger("cani_amount") | |
237 | + | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
238 | + | let $t081888336 = getRandomName(txId, (valueOrErrorMessage(transactionHeightById(txId), ((txIdStr + " not found ") + toBase58String(txId))) + 1), true) | |
239 | + | let CANIGen = $t081888336._1 | |
240 | + | let farmGen = $t081888336._2 | |
241 | + | let description = (("{\"genotype\": \"" + CANIGen) + "\", \"crossbreeding\": true}") | |
242 | + | let asset = Issue(CANIGen, description, 1, 0, false, unit, height) | |
243 | + | let assetId = calculateAssetId(asset) | |
244 | + | let amount = (tryGetInteger(getCANIStatsKey(CANIGen)) + 1) | |
245 | + | let duckIdKey = getCANIIdKey(address, txId) | |
246 | + | $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("cani_amount", (totalDucksAmount + 1)), IntegerEntry("cani_last_price", (eggsNeeded / 1500000)), StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getCANIStatsKey(CANIGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
247 | + | } | |
248 | + | ||
249 | + | ||
250 | + | ||
251 | + | @Callable(i) | |
252 | + | func setDiscount (val) = if ((i.caller != this)) | |
253 | + | then throw("admin_only") | |
254 | + | else [IntegerEntry("discountCoefficient", val)] | |
255 | + | ||
256 | + | ||
257 | + | ||
258 | + | @Callable(i) | |
259 | + | func startHatching (refererAddress) = { | |
260 | + | let feeValidate = checkAdditionalPayment(i.payments[0]) | |
261 | + | if ((feeValidate == feeValidate)) | |
262 | + | then if ((isLocked() > 0)) | |
263 | + | then throw("EGG operations are temporarily locked") | |
439 | 264 | else { | |
440 | - | let sendToAggreGator = (pmtWaves.amount / 4) | |
441 | - | let topup = (pmtWaves.amount - sendToAggreGator) | |
442 | - | let addMore = invoke(getCanineStakingAddress(), "addWavesAndStakeMore", nil, [AttachedPayment(unit, topup)]) | |
443 | - | if ((addMore == addMore)) | |
444 | - | then { | |
445 | - | let issuer = checkReal(assetId) | |
446 | - | let gen = asString(invoke(getCanineBreederAddress(), "getGenFromName", [value(assetInfo(assetId)).name], nil)) | |
447 | - | if ((gen == gen)) | |
448 | - | then { | |
449 | - | let call = invoke(issuer, "reduceRarity", [toBase58String(assetId), gen], nil) | |
450 | - | if ((call == call)) | |
451 | - | then [IntegerEntry((((("address_" + address) + "_initTx_") + initTx) + "_finishBlock"), (height + delayForHatching)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_status"), "open"), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_assetId"), toBase58String(assetId)), ScriptTransfer(getFeeAggregator(), sendToAggreGator, unit)] | |
452 | - | else throw("Strict value is not equal to itself.") | |
453 | - | } | |
454 | - | else throw("Strict value is not equal to itself.") | |
455 | - | } | |
456 | - | else throw("Strict value is not equal to itself.") | |
265 | + | let totalCaniAmount = tryGetInteger("cani_amount") | |
266 | + | let eggsNeeded = countEggsNeededAmount(totalCaniAmount) | |
267 | + | let results = [StringEntry(getHatchingStatusKey(toString(i.originCaller), i.transactionId), HatchingStarted), IntegerEntry(getHatchingFinishHeightKey(toString(i.originCaller), i.transactionId), (height + delayForHatching)), IntegerEntry("cani_amount", (totalCaniAmount + 1)), IntegerEntry("cani_last_price", (eggsNeeded / 1500000))] | |
268 | + | let leftToPay = eggsNeeded | |
269 | + | let firstPayment = value(i.payments[1]) | |
270 | + | if ((firstPayment.assetId != getMintAssetId())) | |
271 | + | then throw("TB: You can attach only WAVES") | |
272 | + | else if ((leftToPay > firstPayment.amount)) | |
273 | + | then throw(((("TB: To breed a Canine you following amount of WAVES: " + toString(leftToPay)) + " ") + toString(i.caller))) | |
274 | + | else { | |
275 | + | let addMore = invoke(getCaniFarmingAddress(), "addWavesAndStakeMore", nil, [AttachedPayment(unit, leftToPay)]) | |
276 | + | if ((addMore == addMore)) | |
277 | + | then { | |
278 | + | let refund = if ((size(i.payments) == 2)) | |
279 | + | then [ScriptTransfer(i.caller, (i.payments[1].amount - leftToPay), getMintAssetId())] | |
280 | + | else nil | |
281 | + | ((results ++ refund) ++ feeValidate) | |
282 | + | } | |
283 | + | else throw("Strict value is not equal to itself.") | |
284 | + | } | |
457 | 285 | } | |
286 | + | else throw("Strict value is not equal to itself.") | |
458 | 287 | } | |
459 | 288 | ||
460 | 289 | ||
461 | 290 | ||
462 | 291 | @Callable(i) | |
463 | - | func finishRebirth (initTx) = finishRebirthInternal(initTx, toString(i.caller), i.payments[0], false, "", false) | |
292 | + | func finishHatching (txIdStr) = { | |
293 | + | let feeValidate = checkAdditionalPayment(i.payments[0]) | |
294 | + | if ((feeValidate == feeValidate)) | |
295 | + | then { | |
296 | + | let txId = fromBase58String(txIdStr) | |
297 | + | let hatchingStatusKey = getHatchingStatusKey(toString(i.caller), txId) | |
298 | + | let finishHeightKey = getHatchingFinishHeightKey(toString(i.caller), txId) | |
299 | + | let CANIIdKey = getCANIIdKey(toString(i.caller), txId) | |
300 | + | let hatchingTxStatus = getStringValue(this, hatchingStatusKey) | |
301 | + | let hatchingFinishHeight = getIntegerValue(this, finishHeightKey) | |
302 | + | if ((hatchingTxStatus == HatchingFinished)) | |
303 | + | then { | |
304 | + | let CANIId = getStringValue(this, getCANIIdKey(toString(i.caller), txId)) | |
305 | + | throw(("The Cani was hatched and claimed already, here is the folowing: " + CANIId)) | |
306 | + | } | |
307 | + | else if ((hatchingFinishHeight > height)) | |
308 | + | then throw((((("Hatching is not finished yet " + toString((hatchingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((hatchingFinishHeight - height))) + " minutes")) | |
309 | + | else { | |
310 | + | let $t01189311966 = getRandomName(txId, hatchingFinishHeight, false) | |
311 | + | let CANIGen = $t01189311966._1 | |
312 | + | let farmGen = $t01189311966._2 | |
313 | + | let description = (("{\"genotype\": \"" + CANIGen) + "\", \"crossbreeding\": true}") | |
314 | + | let asset = Issue(CANIGen, description, 1, 0, false, unit, hatchingFinishHeight) | |
315 | + | let assetId = calculateAssetId(asset) | |
316 | + | let amount = (tryGetInteger(getCANIStatsKey(CANIGen)) + 1) | |
317 | + | ([StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(CANIIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), CANIIdKey), IntegerEntry(getCANIStatsKey(CANIGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(i.caller, 1, assetId)] ++ feeValidate) | |
318 | + | } | |
319 | + | } | |
320 | + | else throw("Strict value is not equal to itself.") | |
321 | + | } | |
464 | 322 | ||
465 | 323 | ||
466 | - | ||
467 | - | @Callable(i) | |
468 | - | func finishRebirthDouble (initTx) = if (!(if ((size(i.payments) == 2)) | |
469 | - | then (i.payments[0].amount == 1) | |
470 | - | else false)) | |
471 | - | then throw("Invalid payment") | |
324 | + | @Verifier(tx) | |
325 | + | func verify () = if (isTestEnv()) | |
326 | + | then sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
472 | 327 | else { | |
473 | - | let assetId = value(i.payments[0].assetId) | |
474 | - | let boosterType = asString(invoke(getItemsAddress(), "checkArtefactDetails", [toBase58String(assetId)], nil)) | |
475 | - | if ((boosterType == boosterType)) | |
476 | - | then if ((boosterType == "ART-GIFT_DOUBL")) | |
477 | - | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], true, "", false)) | |
478 | - | else throw("Error! Wrong item attached to double rewards!") | |
479 | - | else throw("Strict value is not equal to itself.") | |
328 | + | let firstUser = base58'6TdaXEfhnjYquvPf3yV7MFxt2CbgFmaqsvGwkKfXtKi4' | |
329 | + | let secondUser = base58'7DsP2WaMLocbHuUxux7pbXRjTrrZ1TFQPsi5QumS3gr8' | |
330 | + | let thirdUser = base58'BpFWP3p3JgYrrP45xfrKzeMcWMEXoinj4FVPPkUiA8D3' | |
331 | + | let firstUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], firstUser)) | |
332 | + | then 1 | |
333 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], firstUser)) | |
334 | + | then 1 | |
335 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], firstUser)) | |
336 | + | then 1 | |
337 | + | else 0 | |
338 | + | let secondUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], secondUser)) | |
339 | + | then 1 | |
340 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], secondUser)) | |
341 | + | then 1 | |
342 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], secondUser)) | |
343 | + | then 1 | |
344 | + | else 0 | |
345 | + | let thirdUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], thirdUser)) | |
346 | + | then 1 | |
347 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], thirdUser)) | |
348 | + | then 1 | |
349 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], thirdUser)) | |
350 | + | then 1 | |
351 | + | else 0 | |
352 | + | let signaturesCount = ((firstUserSigned + secondUserSigned) + thirdUserSigned) | |
353 | + | match tx { | |
354 | + | case _ => | |
355 | + | (signaturesCount >= 2) | |
480 | 356 | } | |
481 | - | ||
482 | - | ||
483 | - | ||
484 | - | @Callable(i) | |
485 | - | func finishRebirthItem (initTx,itemCode) = if (if ((size(i.payments) == 2)) | |
486 | - | then (i.payments[0].amount == 1) | |
487 | - | else false) | |
488 | - | then { | |
489 | - | let assetId = value(i.payments[0].assetId) | |
490 | - | let boosterType = asString(invoke(getItemsAddress(), "checkArtefactDetails", [toBase58String(assetId)], nil)) | |
491 | - | if ((boosterType == boosterType)) | |
492 | - | then if ((boosterType == "ART-HWERASE")) | |
493 | - | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], false, itemCode, false)) | |
494 | - | else if ((boosterType == "ART-HWRESCUE")) | |
495 | - | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], false, "", true)) | |
496 | - | else if ((boosterType == "ART-GIFT_DOUBL")) | |
497 | - | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], true, "", false)) | |
498 | - | else throw("Error! Wrong item attached ") | |
499 | - | else throw("Strict value is not equal to itself.") | |
500 | 357 | } | |
501 | - | else if ((size(i.payments) == 1)) | |
502 | - | then finishRebirthInternal(initTx, toString(i.caller), i.payments[0], false, "", false) | |
503 | - | else throw("Invalid payments") | |
504 | - | ||
505 | 358 |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getBool (key) = match getBoolean(this, key) { | |
5 | + | case b: Boolean => | |
6 | + | b | |
7 | + | case _ => | |
8 | + | false | |
9 | + | } | |
10 | + | ||
11 | + | ||
12 | + | func isTestEnv () = getBool("TESTENV") | |
13 | + | ||
14 | + | ||
4 | 15 | func tryGetStringExternal (address,key) = match getString(address, key) { | |
5 | 16 | case a: String => | |
6 | 17 | a | |
7 | 18 | case _ => | |
8 | 19 | "" | |
9 | 20 | } | |
10 | 21 | ||
11 | 22 | ||
12 | - | func tryGetInteger (key) = match getInteger(this, key) { | |
13 | - | case b: Int => | |
14 | - | b | |
15 | - | case _ => | |
16 | - | 0 | |
17 | - | } | |
18 | - | ||
19 | - | ||
20 | 23 | func tryGetString (key) = tryGetStringExternal(this, key) | |
21 | - | ||
22 | - | ||
23 | - | func asInt (value) = match value { | |
24 | - | case int: Int => | |
25 | - | int | |
26 | - | case string: String => | |
27 | - | throw(("RAI: wrong type, expected: Int, but got: " + string)) | |
28 | - | case _ => | |
29 | - | throw("RAI: wrong type, expected: Int") | |
30 | - | } | |
31 | - | ||
32 | - | ||
33 | - | func asBoolean (value) = match value { | |
34 | - | case boolean: Boolean => | |
35 | - | boolean | |
36 | - | case _ => | |
37 | - | throw("FAB: wrong type, expected: Boolean") | |
38 | - | } | |
39 | - | ||
40 | - | ||
41 | - | func asString (value) = match value { | |
42 | - | case s: String => | |
43 | - | s | |
44 | - | case s: Int => | |
45 | - | throw("wrong type, expected: String, got: Int") | |
46 | - | case s: Unit => | |
47 | - | throw("wrong type, expected: String, got: Unit") | |
48 | - | case _ => | |
49 | - | throw("wrong type, expected: String") | |
50 | - | } | |
51 | 24 | ||
52 | 25 | ||
53 | 26 | func staticKey_oracleAddress () = "static_oracleAddress" | |
54 | 27 | ||
55 | 28 | ||
56 | 29 | func staticKey_extraFee () = "static_extraFee" | |
57 | 30 | ||
58 | 31 | ||
59 | 32 | func staticKey_feeAggregator () = "static_feeAggregator" | |
60 | 33 | ||
61 | 34 | ||
62 | - | func staticKey_ | |
35 | + | func staticKey_refContractAddress () = "static_refContractAddress" | |
63 | 36 | ||
64 | 37 | ||
65 | - | func staticKey_ | |
38 | + | func staticKey_caniRebirthAddress () = "static_canineRebirthAddress" | |
66 | 39 | ||
67 | 40 | ||
68 | - | func staticKey_couponsAddress () = "static_couponsAddress" | |
69 | - | ||
70 | - | ||
71 | - | func staticKey_canineStakingAddress () = "static_canineStakingAddress" | |
72 | - | ||
73 | - | ||
74 | - | func staticKey_duckStakingAddress () = "static_farmingAddressNew" | |
75 | - | ||
76 | - | ||
77 | - | func staticKey_duckIncubatorAddress () = "static_incubatorAddress" | |
78 | - | ||
79 | - | ||
80 | - | func staticKey_itemsAddress () = "static_itemsAddress" | |
81 | - | ||
82 | - | ||
83 | - | func staticKey_canineWavesRebirthPrice () = "static_canineWavesRebirthPrice" | |
84 | - | ||
85 | - | ||
86 | - | func staticKey_turtleIncubatorAddress () = "static_turtleIncubatorAddress" | |
87 | - | ||
88 | - | ||
89 | - | func staticKey_babyDuckAddress () = "static_babyDuckAddress" | |
41 | + | func staticKey_caniFarmingAddress () = "static_canineStakingAddress" | |
90 | 42 | ||
91 | 43 | ||
92 | 44 | func getOracle () = Address(fromBase58String(tryGetString(staticKey_oracleAddress()))) | |
93 | 45 | ||
94 | 46 | ||
95 | 47 | func getFeeAggregator () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_feeAggregator()))) | |
96 | 48 | ||
97 | 49 | ||
98 | - | func | |
50 | + | func getMintAssetId () = unit | |
99 | 51 | ||
100 | 52 | ||
101 | - | func | |
53 | + | func getBurnAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_burnAddress"))) | |
102 | 54 | ||
103 | 55 | ||
104 | - | func | |
56 | + | func getRefContractAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_refContractAddress()))) | |
105 | 57 | ||
106 | 58 | ||
107 | - | func | |
59 | + | func getCaniRebirthAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_caniRebirthAddress()))) | |
108 | 60 | ||
109 | 61 | ||
110 | - | func getDuckStakingAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_duckStakingAddress()))) | |
111 | - | ||
112 | - | ||
113 | - | func getDuckIncubatorAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_duckIncubatorAddress()))) | |
114 | - | ||
115 | - | ||
116 | - | func getItemsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_itemsAddress()))) | |
117 | - | ||
118 | - | ||
119 | - | func getTurtleIncubatorAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_turtleIncubatorAddress()))) | |
120 | - | ||
121 | - | ||
122 | - | func getBabyDuckAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_babyDuckAddress()))) | |
123 | - | ||
124 | - | ||
125 | - | func tryGetIntegerExternal (address,key) = match getInteger(address, key) { | |
126 | - | case b: Int => | |
127 | - | b | |
128 | - | case _ => | |
129 | - | throw("TR: Value not found in sc!") | |
130 | - | } | |
131 | - | ||
132 | - | ||
133 | - | let wavesAmount = tryGetIntegerExternal(getOracle(), staticKey_canineWavesRebirthPrice()) | |
134 | - | ||
135 | - | let delayForHatching = 2 | |
136 | - | ||
137 | - | func checkReal (assetId) = if (if ((value(assetInfo(assetId)).issuer == getCanineBreederAddress())) | |
138 | - | then true | |
139 | - | else (value(assetInfo(assetId)).issuer == getCanineIncubatorAddress())) | |
140 | - | then value(assetInfo(assetId)).issuer | |
141 | - | else throw("not valid NFT") | |
62 | + | func getCaniFarmingAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_caniFarmingAddress()))) | |
142 | 63 | ||
143 | 64 | ||
144 | 65 | func checkAdditionalPayment (payment) = if (isDefined(payment.assetId)) | |
145 | - | then throw(" | |
66 | + | then throw("BDCAP: Please attach waves") | |
146 | 67 | else { | |
147 | 68 | let feeAmount = getIntegerValue(getOracle(), staticKey_extraFee()) | |
148 | 69 | if ((payment.amount != feeAmount)) | |
149 | - | then throw(((" | |
70 | + | then throw((("BDCAP: Please attach exactly " + toString(feeAmount)) + " amount of wavelets")) | |
150 | 71 | else [ScriptTransfer(getFeeAggregator(), feeAmount, unit)] | |
151 | 72 | } | |
152 | 73 | ||
153 | 74 | ||
154 | - | func getRandomNumber (options,txId,hatchingFinishHeight,offset) = { | |
155 | - | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
156 | - | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
157 | - | (toInt(randomHash, (offset * 8)) % options) | |
75 | + | let delayForHatching = 2 | |
76 | + | ||
77 | + | let HatchingStarted = "HATCHING_STARTED" | |
78 | + | ||
79 | + | let HatchingFinished = "HATCHING_FINISHED" | |
80 | + | ||
81 | + | func isLocked () = { | |
82 | + | let masterAddress = Address(base58'3PEPftf2kWZDmAaWBjs6BUJa9957kiA2PkU') | |
83 | + | match getInteger(masterAddress, "egglock") { | |
84 | + | case b: Int => | |
85 | + | b | |
86 | + | case _ => | |
87 | + | 0 | |
88 | + | } | |
158 | 89 | } | |
159 | 90 | ||
160 | 91 | ||
161 | - | func tryGetBoolean (key) = match getBoolean(key) { | |
162 | - | case b: Boolean => | |
163 | - | b | |
92 | + | func getHatchingStatusKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_status") | |
93 | + | ||
94 | + | ||
95 | + | func getHatchingFinishHeightKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_fh") | |
96 | + | ||
97 | + | ||
98 | + | func getCANIIdKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_di") | |
99 | + | ||
100 | + | ||
101 | + | func getCANIStatsKey (genString) = (("stats_" + genString) + "_amount") | |
102 | + | ||
103 | + | ||
104 | + | func tryGetInteger (key) = { | |
105 | + | let val = match getInteger(this, key) { | |
106 | + | case b: Int => | |
107 | + | b | |
108 | + | case _ => | |
109 | + | 0 | |
110 | + | } | |
111 | + | val | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | let discountCoefficient = tryGetInteger("discountCoefficient") | |
116 | + | ||
117 | + | func getRandomNumber (variants,txId,hatchingFinishHeight,offset) = { | |
118 | + | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
119 | + | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
120 | + | (toInt(randomHash, (offset * 8)) % variants) | |
121 | + | } | |
122 | + | ||
123 | + | ||
124 | + | func select (color) = { | |
125 | + | let oldGenes = [$Tuple2(("CANI-AAAAAAAA-G" + color), "8A-G")] | |
126 | + | let newGenes = [$Tuple2(("CANI-BBBBBBBB-G" + color), "8B-G"), $Tuple2(("CANI-CCCCCCCC-G" + color), "8C-G"), $Tuple2(("CANI-DDDDDDDD-G" + color), "8D-G"), $Tuple2(("CANI-EEEEEEEE-G" + color), "8E-G")] | |
127 | + | $Tuple2((oldGenes ++ newGenes), newGenes) | |
128 | + | } | |
129 | + | ||
130 | + | ||
131 | + | func getRandomName (txId,hatchingFinishHeight,all) = { | |
132 | + | let colorRandom = getRandomNumber(4, txId, hatchingFinishHeight, 1) | |
133 | + | let color = ["A", "B", "C", "D"][colorRandom] | |
134 | + | let colorSelect = select(color) | |
135 | + | let toPickFrom = if (all) | |
136 | + | then colorSelect._1 | |
137 | + | else colorSelect._2 | |
138 | + | let typeRandom = getRandomNumber(size(toPickFrom), txId, hatchingFinishHeight, 0) | |
139 | + | toPickFrom[typeRandom] | |
140 | + | } | |
141 | + | ||
142 | + | ||
143 | + | let typesAmount = (size(select("R")._2) - 1) | |
144 | + | ||
145 | + | func countEggsNeededAmount (totalCANIsAmount) = { | |
146 | + | let n = totalCANIsAmount | |
147 | + | let g = discountCoefficient | |
148 | + | let t = typesAmount | |
149 | + | let price = (pow((100 + ((n * g) / (10 * t))), 2, 5, 1, 2, DOWN) + 55) | |
150 | + | (price * 1500000) | |
151 | + | } | |
152 | + | ||
153 | + | ||
154 | + | func asBoolean (value) = match value { | |
155 | + | case boolean: Boolean => | |
156 | + | boolean | |
164 | 157 | case _ => | |
165 | - | | |
158 | + | throw("TI: wrong type, expected: Boolean") | |
166 | 159 | } | |
167 | 160 | ||
168 | 161 | ||
169 | - | func getRandomWin (tx,finishHeight,blacklistCode) = { | |
170 | - | let jackpotRandom = getRandomNumber(10, tx, finishHeight, 1) | |
171 | - | if ((jackpotRandom == 1)) | |
172 | - | then $Tuple2(jackpotRandom, "jackpot") | |
162 | + | @Callable(i) | |
163 | + | func reduceRarity (assetId,fGen) = { | |
164 | + | let asset = fromBase58String(assetId) | |
165 | + | if (if ((i.caller != getCaniRebirthAddress())) | |
166 | + | then (i.caller != this) | |
167 | + | else false) | |
168 | + | then throw("IRR: admin or rebirth only") | |
173 | 169 | else { | |
174 | - | let n = getRandomNumber(1000, tx, finishHeight, 0) | |
175 | - | let result = if (if ((100 > n)) | |
176 | - | then (blacklistCode != "docking_A") | |
177 | - | else false) | |
178 | - | then "docking_A" | |
179 | - | else if (if ((200 > n)) | |
180 | - | then (blacklistCode != "docking_B") | |
181 | - | else false) | |
182 | - | then "docking_B" | |
183 | - | else if (if ((300 > n)) | |
184 | - | then (blacklistCode != "docking_C") | |
185 | - | else false) | |
186 | - | then "docking_C" | |
187 | - | else if (if ((400 > n)) | |
188 | - | then (blacklistCode != "docking_D") | |
189 | - | else false) | |
190 | - | then "docking_D" | |
191 | - | else if (if ((450 > n)) | |
192 | - | then (blacklistCode != "incubator") | |
193 | - | else false) | |
194 | - | then "incubator" | |
195 | - | else if (if ((490 > n)) | |
196 | - | then (blacklistCode != "duckling_40") | |
197 | - | else false) | |
198 | - | then "duckling_40" | |
199 | - | else if (if ((540 > n)) | |
200 | - | then (blacklistCode != "duckling_20") | |
201 | - | else false) | |
202 | - | then "duckling_20" | |
203 | - | else if (if ((640 > n)) | |
204 | - | then (blacklistCode != "item!ART-FEED5") | |
205 | - | else false) | |
206 | - | then "item!ART-FEED5" | |
207 | - | else if (if ((710 > n)) | |
208 | - | then (blacklistCode != "item!ART-FEED10") | |
209 | - | else false) | |
210 | - | then "item!ART-FEED10" | |
211 | - | else if (if ((740 > n)) | |
212 | - | then (blacklistCode != "item!ART-FEED15") | |
213 | - | else false) | |
214 | - | then "item!ART-FEED15" | |
215 | - | else if (if ((770 > n)) | |
216 | - | then (blacklistCode != "item!ART-FEED20") | |
217 | - | else false) | |
218 | - | then "item!ART-FEED20" | |
219 | - | else if (if ((790 > n)) | |
220 | - | then (blacklistCode != "item!ART-FEED25") | |
221 | - | else false) | |
222 | - | then "item!ART-FEED25" | |
223 | - | else if (if ((810 > n)) | |
224 | - | then (blacklistCode != "item!ART-FEED50") | |
225 | - | else false) | |
226 | - | then "item!ART-FEED50" | |
227 | - | else if (if ((830 > n)) | |
228 | - | then (blacklistCode != "item!ART-FEED100") | |
229 | - | else false) | |
230 | - | then "item!ART-FEED100" | |
231 | - | else if (if ((860 > n)) | |
232 | - | then (blacklistCode != "item!ART-MUTARIUM-G") | |
233 | - | else false) | |
234 | - | then "item!ART-MUTARIUM-G" | |
235 | - | else if (if ((890 > n)) | |
236 | - | then (blacklistCode != "item!ART-MUTARIUM-D") | |
237 | - | else false) | |
238 | - | then "item!ART-MUTARIUM-D" | |
239 | - | else if (if ((910 > n)) | |
240 | - | then (blacklistCode != "item!ART-FREEGENE") | |
241 | - | else false) | |
242 | - | then "item!ART-FREEGENE" | |
243 | - | else if (if ((930 > n)) | |
244 | - | then (blacklistCode != "item!ART-FIXGENE") | |
245 | - | else false) | |
246 | - | then "item!ART-FIXGENE" | |
247 | - | else if (if ((980 > n)) | |
248 | - | then (blacklistCode != "trtl_incubator") | |
249 | - | else false) | |
250 | - | then "trtl_incubator" | |
251 | - | else "item!ART-POTION" | |
252 | - | $Tuple2(n, result) | |
170 | + | let duckGen = value(assetInfo(asset)).name | |
171 | + | let letter = takeRight(take(duckGen, 6), 1) | |
172 | + | let farmGen = (("8" + letter) + "-G") | |
173 | + | [IntegerEntry(getCANIStatsKey(duckGen), (tryGetInteger(getCANIStatsKey(duckGen)) - 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) - 1))] | |
253 | 174 | } | |
254 | 175 | } | |
255 | 176 | ||
256 | 177 | ||
257 | - | func getRandomReturn (tx,finishHeight) = { | |
258 | - | let n = getRandomNumber(2, tx, finishHeight, 1) | |
259 | - | if ((n == 0)) | |
260 | - | then true | |
261 | - | else false | |
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func increaseRarity (assetId,fGen) = { | |
181 | + | let asset = fromBase58String(assetId) | |
182 | + | if (if ((i.caller != getCaniRebirthAddress())) | |
183 | + | then (i.caller != this) | |
184 | + | else false) | |
185 | + | then throw("IRR: admin or rebirth only") | |
186 | + | else { | |
187 | + | let duckGen = value(assetInfo(asset)).name | |
188 | + | let letter = takeRight(take(duckGen, 6), 1) | |
189 | + | let farmGen = (("8" + letter) + "-G") | |
190 | + | [IntegerEntry(getCANIStatsKey(duckGen), (tryGetInteger(getCANIStatsKey(duckGen)) + 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1))] | |
191 | + | } | |
262 | 192 | } | |
263 | 193 | ||
264 | - | ||
265 | - | func finishRebirthInternal (initTx,address,additionalPayment,double,blacklistCode,rescue) = { | |
266 | - | let finishBlock = tryGetInteger((((("address_" + address) + "_initTx_") + initTx) + "_finishBlock")) | |
267 | - | let status = tryGetString((((("address_" + address) + "_initTx_") + initTx) + "_status")) | |
268 | - | let validPayment = checkAdditionalPayment(additionalPayment) | |
269 | - | if ((validPayment == validPayment)) | |
270 | - | then if ((status != "open")) | |
271 | - | then throw("rebirth is finished or not open") | |
272 | - | else if ((finishBlock > height)) | |
273 | - | then throw("you cannot finish rebirth, yet") | |
274 | - | else { | |
275 | - | let output = getRandomWin(fromBase58String(initTx), finishBlock, blacklistCode) | |
276 | - | let win = output._2 | |
277 | - | let random = output._1 | |
278 | - | let txId = initTx | |
279 | - | let result = if ((indexOf(win, "docking") != unit)) | |
280 | - | then { | |
281 | - | let color = takeRight(win, 1) | |
282 | - | let call = if (!(double)) | |
283 | - | then { | |
284 | - | let first = invoke(getCanineStakingAddress(), "addFreePerch", [address, color, 1], nil) | |
285 | - | if ((first == first)) | |
286 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
287 | - | else throw("Strict value is not equal to itself.") | |
288 | - | } | |
289 | - | else { | |
290 | - | let first = invoke(getCanineStakingAddress(), "addFreePerch", [address, color, 2], nil) | |
291 | - | if ((first == first)) | |
292 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), win)] | |
293 | - | else throw("Strict value is not equal to itself.") | |
294 | - | } | |
295 | - | if ((call == call)) | |
296 | - | then call | |
297 | - | else throw("Strict value is not equal to itself.") | |
298 | - | } | |
299 | - | else if ((win == "jackpot")) | |
300 | - | then { | |
301 | - | let call = invoke(getCanineIncubatorAddress(), "issueJackpot", [address, txId, "WWWWHWTF"], nil) | |
302 | - | if ((call == call)) | |
303 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
304 | - | else throw("Strict value is not equal to itself.") | |
305 | - | } | |
306 | - | else if ((win == "incubator")) | |
307 | - | then { | |
308 | - | let call = if (!(double)) | |
309 | - | then { | |
310 | - | let first = invoke(getCanineIncubatorAddress(), "issueFree", [address, txId], nil) | |
311 | - | if ((first == first)) | |
312 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
313 | - | else throw("Strict value is not equal to itself.") | |
314 | - | } | |
315 | - | else { | |
316 | - | let first = invoke(getCanineIncubatorAddress(), "issueFree", [address, txId], nil) | |
317 | - | if ((first == first)) | |
318 | - | then { | |
319 | - | let second = invoke(getTurtleIncubatorAddress(), "issueFreeTurtle", [address, txId], nil) | |
320 | - | if ((second == second)) | |
321 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), "incubator")] | |
322 | - | else throw("Strict value is not equal to itself.") | |
323 | - | } | |
324 | - | else throw("Strict value is not equal to itself.") | |
325 | - | } | |
326 | - | if ((call == call)) | |
327 | - | then call | |
328 | - | else throw("Strict value is not equal to itself.") | |
329 | - | } | |
330 | - | else if ((indexOf(win, "duckling") != unit)) | |
331 | - | then { | |
332 | - | let level = parseIntValue(split(win, "_")[1]) | |
333 | - | let levelFinal = if (double) | |
334 | - | then (2 * level) | |
335 | - | else level | |
336 | - | let call = invoke(getBabyDuckAddress(), "issueFreeDuckling", [address, txId, levelFinal], nil) | |
337 | - | if ((call == call)) | |
338 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
339 | - | else throw("Strict value is not equal to itself.") | |
340 | - | } | |
341 | - | else if ((win == "trtl_incubator")) | |
342 | - | then { | |
343 | - | let call = if (!(double)) | |
344 | - | then { | |
345 | - | let first = invoke(getTurtleIncubatorAddress(), "issueFreeTurtle", [address, txId], nil) | |
346 | - | if ((first == first)) | |
347 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
348 | - | else throw("Strict value is not equal to itself.") | |
349 | - | } | |
350 | - | else { | |
351 | - | let first = invoke(getTurtleIncubatorAddress(), "issueFreeTurtle", [address, txId], nil) | |
352 | - | if ((first == first)) | |
353 | - | then { | |
354 | - | let second = invoke(getCanineIncubatorAddress(), "issueFree", [address, txId], nil) | |
355 | - | if ((second == second)) | |
356 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), "trtl_incubator")] | |
357 | - | else throw("Strict value is not equal to itself.") | |
358 | - | } | |
359 | - | else throw("Strict value is not equal to itself.") | |
360 | - | } | |
361 | - | if ((call == call)) | |
362 | - | then call | |
363 | - | else throw("Strict value is not equal to itself.") | |
364 | - | } | |
365 | - | else if ((indexOf(win, "item") != unit)) | |
366 | - | then { | |
367 | - | let itemName = split(win, "!")[1] | |
368 | - | let call = if (!(double)) | |
369 | - | then { | |
370 | - | let first = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 0], nil) | |
371 | - | if ((first == first)) | |
372 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
373 | - | else throw("Strict value is not equal to itself.") | |
374 | - | } | |
375 | - | else { | |
376 | - | let first = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 0], nil) | |
377 | - | if ((first == first)) | |
378 | - | then { | |
379 | - | let second = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 1], nil) | |
380 | - | if ((second == second)) | |
381 | - | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), win)] | |
382 | - | else throw("Strict value is not equal to itself.") | |
383 | - | } | |
384 | - | else throw("Strict value is not equal to itself.") | |
385 | - | } | |
386 | - | if ((call == call)) | |
387 | - | then call | |
388 | - | else throw("Strict value is not equal to itself.") | |
389 | - | } | |
390 | - | else throw(("RFB: Some error occured, please contact the admins! " + win)) | |
391 | - | if ((result == result)) | |
392 | - | then { | |
393 | - | let returnToSender = if (rescue) | |
394 | - | then getRandomReturn(fromBase58String(initTx), finishBlock) | |
395 | - | else false | |
396 | - | let returnPayload = if (returnToSender) | |
397 | - | then { | |
398 | - | let assetId = fromBase58String(getStringValue((((("address_" + address) + "_initTx_") + initTx) + "_assetId"))) | |
399 | - | let issuer = checkReal(assetId) | |
400 | - | let gen = asString(invoke(getCanineBreederAddress(), "getGenFromName", [value(assetInfo(assetId)).name], nil)) | |
401 | - | if ((gen == gen)) | |
402 | - | then { | |
403 | - | let call = invoke(issuer, "increaseRarity", [toBase58String(assetId), gen], nil) | |
404 | - | if ((call == call)) | |
405 | - | then [ScriptTransfer(addressFromStringValue(address), 1, assetId)] | |
406 | - | else throw("Strict value is not equal to itself.") | |
407 | - | } | |
408 | - | else throw("Strict value is not equal to itself.") | |
409 | - | } | |
410 | - | else nil | |
411 | - | (((result ++ [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win"), win), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_status"), "finish"), IntegerEntry((((("address_" + address) + "_initTx_") + initTx) + "_random"), random)]) ++ validPayment) ++ returnPayload) | |
412 | - | } | |
413 | - | else throw("Strict value is not equal to itself.") | |
414 | - | } | |
415 | - | else throw("Strict value is not equal to itself.") | |
416 | - | } | |
417 | 194 | ||
418 | 195 | ||
419 | 196 | @Callable(i) | |
420 | 197 | func configureOracle (oracle) = if ((i.caller != this)) | |
421 | - | then throw(" | |
198 | + | then throw("ICU: admin only") | |
422 | 199 | else [StringEntry("static_oracleAddress", oracle)] | |
423 | 200 | ||
424 | 201 | ||
425 | 202 | ||
426 | 203 | @Callable(i) | |
427 | - | func initRebirth () = { | |
428 | - | let pmtCanine = i.payments[0] | |
429 | - | let pmtWaves = i.payments[1] | |
430 | - | let assetId = value(pmtCanine.assetId) | |
431 | - | let initTx = toBase58String(i.transactionId) | |
432 | - | let address = toString(i.caller) | |
433 | - | if ((pmtCanine.amount != 1)) | |
434 | - | then throw("NFT is not attached") | |
435 | - | else if (if ((pmtWaves.amount != wavesAmount)) | |
436 | - | then true | |
437 | - | else (pmtWaves.assetId != unit)) | |
438 | - | then throw("Wavespayment is not attached or wrong!") | |
204 | + | func issueJackpot (address,txIdStr,gen) = if (if ((i.caller != getCaniRebirthAddress())) | |
205 | + | then (i.caller != this) | |
206 | + | else false) | |
207 | + | then throw("ISJ: admin or rebirth only") | |
208 | + | else { | |
209 | + | let txId = fromBase58String(txIdStr) | |
210 | + | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
211 | + | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
212 | + | let totalDucksAmount = tryGetInteger("cani_amount") | |
213 | + | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
214 | + | let $t065546606 = $Tuple2((("CANI-" + gen) + "-JU"), "8W-J") | |
215 | + | let duckGen = $t065546606._1 | |
216 | + | let farmGen = $t065546606._2 | |
217 | + | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
218 | + | let asset = Issue(duckGen, description, 1, 0, false, unit, height) | |
219 | + | let assetId = calculateAssetId(asset) | |
220 | + | let duckIdKey = getCANIIdKey(address, txId) | |
221 | + | let valueDuckIdKeyExits = tryGetString(duckIdKey) | |
222 | + | if ((valueDuckIdKeyExits != "")) | |
223 | + | then throw((("ISJ: You will override following duckId :" + duckIdKey) + " make sure that your txId is unique!")) | |
224 | + | else $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("cani_amount", (totalDucksAmount + 1)), IntegerEntry("cani_last_price", (eggsNeeded / 1500000)), StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getCANIStatsKey(duckGen), (tryGetInteger(getCANIStatsKey(duckGen)) + 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
225 | + | } | |
226 | + | ||
227 | + | ||
228 | + | ||
229 | + | @Callable(i) | |
230 | + | func issueFree (address,txIdStr) = if ((i.caller != getCaniRebirthAddress())) | |
231 | + | then throw("CIF: rebirth only") | |
232 | + | else { | |
233 | + | let txId = fromBase58String(txIdStr) | |
234 | + | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
235 | + | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
236 | + | let totalDucksAmount = tryGetInteger("cani_amount") | |
237 | + | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
238 | + | let $t081888336 = getRandomName(txId, (valueOrErrorMessage(transactionHeightById(txId), ((txIdStr + " not found ") + toBase58String(txId))) + 1), true) | |
239 | + | let CANIGen = $t081888336._1 | |
240 | + | let farmGen = $t081888336._2 | |
241 | + | let description = (("{\"genotype\": \"" + CANIGen) + "\", \"crossbreeding\": true}") | |
242 | + | let asset = Issue(CANIGen, description, 1, 0, false, unit, height) | |
243 | + | let assetId = calculateAssetId(asset) | |
244 | + | let amount = (tryGetInteger(getCANIStatsKey(CANIGen)) + 1) | |
245 | + | let duckIdKey = getCANIIdKey(address, txId) | |
246 | + | $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("cani_amount", (totalDucksAmount + 1)), IntegerEntry("cani_last_price", (eggsNeeded / 1500000)), StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getCANIStatsKey(CANIGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
247 | + | } | |
248 | + | ||
249 | + | ||
250 | + | ||
251 | + | @Callable(i) | |
252 | + | func setDiscount (val) = if ((i.caller != this)) | |
253 | + | then throw("admin_only") | |
254 | + | else [IntegerEntry("discountCoefficient", val)] | |
255 | + | ||
256 | + | ||
257 | + | ||
258 | + | @Callable(i) | |
259 | + | func startHatching (refererAddress) = { | |
260 | + | let feeValidate = checkAdditionalPayment(i.payments[0]) | |
261 | + | if ((feeValidate == feeValidate)) | |
262 | + | then if ((isLocked() > 0)) | |
263 | + | then throw("EGG operations are temporarily locked") | |
439 | 264 | else { | |
440 | - | let sendToAggreGator = (pmtWaves.amount / 4) | |
441 | - | let topup = (pmtWaves.amount - sendToAggreGator) | |
442 | - | let addMore = invoke(getCanineStakingAddress(), "addWavesAndStakeMore", nil, [AttachedPayment(unit, topup)]) | |
443 | - | if ((addMore == addMore)) | |
444 | - | then { | |
445 | - | let issuer = checkReal(assetId) | |
446 | - | let gen = asString(invoke(getCanineBreederAddress(), "getGenFromName", [value(assetInfo(assetId)).name], nil)) | |
447 | - | if ((gen == gen)) | |
448 | - | then { | |
449 | - | let call = invoke(issuer, "reduceRarity", [toBase58String(assetId), gen], nil) | |
450 | - | if ((call == call)) | |
451 | - | then [IntegerEntry((((("address_" + address) + "_initTx_") + initTx) + "_finishBlock"), (height + delayForHatching)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_status"), "open"), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_assetId"), toBase58String(assetId)), ScriptTransfer(getFeeAggregator(), sendToAggreGator, unit)] | |
452 | - | else throw("Strict value is not equal to itself.") | |
453 | - | } | |
454 | - | else throw("Strict value is not equal to itself.") | |
455 | - | } | |
456 | - | else throw("Strict value is not equal to itself.") | |
265 | + | let totalCaniAmount = tryGetInteger("cani_amount") | |
266 | + | let eggsNeeded = countEggsNeededAmount(totalCaniAmount) | |
267 | + | let results = [StringEntry(getHatchingStatusKey(toString(i.originCaller), i.transactionId), HatchingStarted), IntegerEntry(getHatchingFinishHeightKey(toString(i.originCaller), i.transactionId), (height + delayForHatching)), IntegerEntry("cani_amount", (totalCaniAmount + 1)), IntegerEntry("cani_last_price", (eggsNeeded / 1500000))] | |
268 | + | let leftToPay = eggsNeeded | |
269 | + | let firstPayment = value(i.payments[1]) | |
270 | + | if ((firstPayment.assetId != getMintAssetId())) | |
271 | + | then throw("TB: You can attach only WAVES") | |
272 | + | else if ((leftToPay > firstPayment.amount)) | |
273 | + | then throw(((("TB: To breed a Canine you following amount of WAVES: " + toString(leftToPay)) + " ") + toString(i.caller))) | |
274 | + | else { | |
275 | + | let addMore = invoke(getCaniFarmingAddress(), "addWavesAndStakeMore", nil, [AttachedPayment(unit, leftToPay)]) | |
276 | + | if ((addMore == addMore)) | |
277 | + | then { | |
278 | + | let refund = if ((size(i.payments) == 2)) | |
279 | + | then [ScriptTransfer(i.caller, (i.payments[1].amount - leftToPay), getMintAssetId())] | |
280 | + | else nil | |
281 | + | ((results ++ refund) ++ feeValidate) | |
282 | + | } | |
283 | + | else throw("Strict value is not equal to itself.") | |
284 | + | } | |
457 | 285 | } | |
286 | + | else throw("Strict value is not equal to itself.") | |
458 | 287 | } | |
459 | 288 | ||
460 | 289 | ||
461 | 290 | ||
462 | 291 | @Callable(i) | |
463 | - | func finishRebirth (initTx) = finishRebirthInternal(initTx, toString(i.caller), i.payments[0], false, "", false) | |
292 | + | func finishHatching (txIdStr) = { | |
293 | + | let feeValidate = checkAdditionalPayment(i.payments[0]) | |
294 | + | if ((feeValidate == feeValidate)) | |
295 | + | then { | |
296 | + | let txId = fromBase58String(txIdStr) | |
297 | + | let hatchingStatusKey = getHatchingStatusKey(toString(i.caller), txId) | |
298 | + | let finishHeightKey = getHatchingFinishHeightKey(toString(i.caller), txId) | |
299 | + | let CANIIdKey = getCANIIdKey(toString(i.caller), txId) | |
300 | + | let hatchingTxStatus = getStringValue(this, hatchingStatusKey) | |
301 | + | let hatchingFinishHeight = getIntegerValue(this, finishHeightKey) | |
302 | + | if ((hatchingTxStatus == HatchingFinished)) | |
303 | + | then { | |
304 | + | let CANIId = getStringValue(this, getCANIIdKey(toString(i.caller), txId)) | |
305 | + | throw(("The Cani was hatched and claimed already, here is the folowing: " + CANIId)) | |
306 | + | } | |
307 | + | else if ((hatchingFinishHeight > height)) | |
308 | + | then throw((((("Hatching is not finished yet " + toString((hatchingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((hatchingFinishHeight - height))) + " minutes")) | |
309 | + | else { | |
310 | + | let $t01189311966 = getRandomName(txId, hatchingFinishHeight, false) | |
311 | + | let CANIGen = $t01189311966._1 | |
312 | + | let farmGen = $t01189311966._2 | |
313 | + | let description = (("{\"genotype\": \"" + CANIGen) + "\", \"crossbreeding\": true}") | |
314 | + | let asset = Issue(CANIGen, description, 1, 0, false, unit, hatchingFinishHeight) | |
315 | + | let assetId = calculateAssetId(asset) | |
316 | + | let amount = (tryGetInteger(getCANIStatsKey(CANIGen)) + 1) | |
317 | + | ([StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(CANIIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), CANIIdKey), IntegerEntry(getCANIStatsKey(CANIGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(i.caller, 1, assetId)] ++ feeValidate) | |
318 | + | } | |
319 | + | } | |
320 | + | else throw("Strict value is not equal to itself.") | |
321 | + | } | |
464 | 322 | ||
465 | 323 | ||
466 | - | ||
467 | - | @Callable(i) | |
468 | - | func finishRebirthDouble (initTx) = if (!(if ((size(i.payments) == 2)) | |
469 | - | then (i.payments[0].amount == 1) | |
470 | - | else false)) | |
471 | - | then throw("Invalid payment") | |
324 | + | @Verifier(tx) | |
325 | + | func verify () = if (isTestEnv()) | |
326 | + | then sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
472 | 327 | else { | |
473 | - | let assetId = value(i.payments[0].assetId) | |
474 | - | let boosterType = asString(invoke(getItemsAddress(), "checkArtefactDetails", [toBase58String(assetId)], nil)) | |
475 | - | if ((boosterType == boosterType)) | |
476 | - | then if ((boosterType == "ART-GIFT_DOUBL")) | |
477 | - | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], true, "", false)) | |
478 | - | else throw("Error! Wrong item attached to double rewards!") | |
479 | - | else throw("Strict value is not equal to itself.") | |
328 | + | let firstUser = base58'6TdaXEfhnjYquvPf3yV7MFxt2CbgFmaqsvGwkKfXtKi4' | |
329 | + | let secondUser = base58'7DsP2WaMLocbHuUxux7pbXRjTrrZ1TFQPsi5QumS3gr8' | |
330 | + | let thirdUser = base58'BpFWP3p3JgYrrP45xfrKzeMcWMEXoinj4FVPPkUiA8D3' | |
331 | + | let firstUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], firstUser)) | |
332 | + | then 1 | |
333 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], firstUser)) | |
334 | + | then 1 | |
335 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], firstUser)) | |
336 | + | then 1 | |
337 | + | else 0 | |
338 | + | let secondUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], secondUser)) | |
339 | + | then 1 | |
340 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], secondUser)) | |
341 | + | then 1 | |
342 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], secondUser)) | |
343 | + | then 1 | |
344 | + | else 0 | |
345 | + | let thirdUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], thirdUser)) | |
346 | + | then 1 | |
347 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[1], thirdUser)) | |
348 | + | then 1 | |
349 | + | else if (sigVerify(tx.bodyBytes, tx.proofs[2], thirdUser)) | |
350 | + | then 1 | |
351 | + | else 0 | |
352 | + | let signaturesCount = ((firstUserSigned + secondUserSigned) + thirdUserSigned) | |
353 | + | match tx { | |
354 | + | case _ => | |
355 | + | (signaturesCount >= 2) | |
480 | 356 | } | |
481 | - | ||
482 | - | ||
483 | - | ||
484 | - | @Callable(i) | |
485 | - | func finishRebirthItem (initTx,itemCode) = if (if ((size(i.payments) == 2)) | |
486 | - | then (i.payments[0].amount == 1) | |
487 | - | else false) | |
488 | - | then { | |
489 | - | let assetId = value(i.payments[0].assetId) | |
490 | - | let boosterType = asString(invoke(getItemsAddress(), "checkArtefactDetails", [toBase58String(assetId)], nil)) | |
491 | - | if ((boosterType == boosterType)) | |
492 | - | then if ((boosterType == "ART-HWERASE")) | |
493 | - | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], false, itemCode, false)) | |
494 | - | else if ((boosterType == "ART-HWRESCUE")) | |
495 | - | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], false, "", true)) | |
496 | - | else if ((boosterType == "ART-GIFT_DOUBL")) | |
497 | - | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], true, "", false)) | |
498 | - | else throw("Error! Wrong item attached ") | |
499 | - | else throw("Strict value is not equal to itself.") | |
500 | 357 | } | |
501 | - | else if ((size(i.payments) == 1)) | |
502 | - | then finishRebirthInternal(initTx, toString(i.caller), i.payments[0], false, "", false) | |
503 | - | else throw("Invalid payments") | |
504 | - | ||
505 | 358 |
github/deemru/w8io/026f985 55.50 ms ◑