tx · 6Rf2qELLRJHNH5KGNitsMPy6ifr71Qmk1XZKoBEtZQVC 3N6oB7VbceD3NoguGkfGnBMF4hcHZVbK8io: -0.01900000 Waves 2024.11.01 19:23 [3352696] smart account 3N6oB7VbceD3NoguGkfGnBMF4hcHZVbK8io > SELF 0.00000000 Waves
{ "type": 13, "id": "6Rf2qELLRJHNH5KGNitsMPy6ifr71Qmk1XZKoBEtZQVC", "fee": 1900000, "feeAssetId": null, "timestamp": 1730478189674, "version": 2, "chainId": 84, "sender": "3N6oB7VbceD3NoguGkfGnBMF4hcHZVbK8io", "senderPublicKey": "2cUCdub81Us7Le3h97BRsS5HupDXo5sErj1dwyNHKNU2", "proofs": [ "3o5uWjYxbwbjw6dYM65M9N1prYwj8zwi18Lod5Df8AxR74Rq6x7sGEfz1JszaT1cRpSfi36Mr8kGWyvW6h8N9jUM" ], "script": "base64:BgIWCAISAwoBCBIDCgEIEgMKAQgSAwoBCDABFHRyeUdldFN0cmluZ0V4dGVybmFsAgdhZGRyZXNzA2tleQQHJG1hdGNoMAkAnQgCBQdhZGRyZXNzBQNrZXkDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFhBQckbWF0Y2gwBQFhAgABEXRyeUdldEludEV4dGVybmFsAgdhZGRyZXNzA2tleQQHJG1hdGNoMAkAmggCBQdhZGRyZXNzBQNrZXkDCQABAgUHJG1hdGNoMAIDSW50BAFhBQckbWF0Y2gwBQFhCQACAQIbUlRHSUU6IFNvbWV0aGluZyB3ZW50IHdyb25nAQlhc0Jvb2xlYW4BBXZhbHVlBAckbWF0Y2gwBQV2YWx1ZQMJAAECBQckbWF0Y2gwAgdCb29sZWFuBAdib29sZWFuBQckbWF0Y2gwBQdib29sZWFuCQACAQIiRkFCOiB3cm9uZyB0eXBlLCBleHBlY3RlZDogQm9vbGVhbgEMdHJ5R2V0U3RyaW5nAQNrZXkJARR0cnlHZXRTdHJpbmdFeHRlcm5hbAIFBHRoaXMFA2tleQAQZGVsYXlGb3JIYXRjaGlu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lcwkAkQMCCAUCdHgGcHJvb2ZzAAIFCWZpcnN0VXNlcgABAAAEEHNlY29uZFVzZXJTaWduZWQDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQpzZWNvbmRVc2VyAAEDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwABBQpzZWNvbmRVc2VyAAEDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwACBQpzZWNvbmRVc2VyAAEAAAQPdGhpcmRVc2VyU2lnbmVkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUJdGhpcmRVc2VyAAEDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwABBQl0aGlyZFVzZXIAAQMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAIFCXRoaXJkVXNlcgABAAAED3NpZ25hdHVyZXNDb3VudAkAZAIJAGQCBQ9maXJzdFVzZXJTaWduZWQFEHNlY29uZFVzZXJTaWduZWQFD3RoaXJkVXNlclNpZ25lZAQHJG1hdGNoMAUCdHgJAGcCBQ9zaWduYXR1cmVzQ291bnQAAo677bE=", "height": 3352696, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FYzWysancM3KwKfrn7Gp8EmyJVrLUhuooM2SJNsNaXKH Next: GKU2UhMYuSVNJUSFZV9jmYQBspiC5UjYpYxHwtxZGxbb Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | - | func tryGetString (key) = tryGetStringExternal(this, key) | |
12 | + | func tryGetIntExternal (address,key) = match getInteger(address, key) { | |
13 | + | case a: Int => | |
14 | + | a | |
15 | + | case _ => | |
16 | + | throw("RTGIE: Something went wrong") | |
17 | + | } | |
13 | 18 | ||
14 | 19 | ||
15 | - | func staticKey_turtleRebirthAddress () = "static_turtleRebirthAddress" | |
20 | + | func asBoolean (value) = match value { | |
21 | + | case boolean: Boolean => | |
22 | + | boolean | |
23 | + | case _ => | |
24 | + | throw("FAB: wrong type, expected: Boolean") | |
25 | + | } | |
16 | 26 | ||
17 | 27 | ||
18 | - | func getOracle () = Address(fromBase58String(tryGetString("static_oracleAddress"))) | |
19 | - | ||
20 | - | ||
21 | - | func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), "static_eggAssetId")) | |
22 | - | ||
23 | - | ||
24 | - | func getRebirthAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_rebirthAddress"))) | |
25 | - | ||
26 | - | ||
27 | - | func getBabyDuckAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_babyDuckAddress"))) | |
28 | - | ||
29 | - | ||
30 | - | func getRefContractAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_refContractAddress"))) | |
31 | - | ||
32 | - | ||
33 | - | func getCouponsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_couponsAddress"))) | |
34 | - | ||
35 | - | ||
36 | - | func getBurnAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_burnAddress"))) | |
37 | - | ||
38 | - | ||
39 | - | func getTurtleRebirthAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_turtleRebirthAddress()))) | |
28 | + | func tryGetString (key) = tryGetStringExternal(this, key) | |
40 | 29 | ||
41 | 30 | ||
42 | 31 | let delayForHatching = 2 | |
43 | 32 | ||
44 | - | ||
33 | + | func staticKey_oracleAddress () = "static_oracleAddress" | |
45 | 34 | ||
46 | - | let RefererReward = 5 | |
47 | 35 | ||
48 | - | ||
36 | + | func staticKey_eggAssetId () = "static_eggAssetId" | |
49 | 37 | ||
50 | - | let HatchingFinished = "HATCHING_FINISHED" | |
51 | 38 | ||
52 | - | func isLocked () = { | |
53 | - | let masterAddress = Address(base58'3PEPftf2kWZDmAaWBjs6BUJa9957kiA2PkU') | |
54 | - | match getInteger(masterAddress, "egglock") { | |
55 | - | case b: Int => | |
56 | - | b | |
57 | - | case _ => | |
58 | - | 0 | |
59 | - | } | |
39 | + | func staticKey_incubatorAddress () = "static_incubatorAddress" | |
40 | + | ||
41 | + | ||
42 | + | func staticKey_breederAddress () = "static_breederAddress" | |
43 | + | ||
44 | + | ||
45 | + | func staticKey_farmingAddress () = "static_farmingAddressNew" | |
46 | + | ||
47 | + | ||
48 | + | func staticKey_babyDuckAddress () = "static_babyDuckAddress" | |
49 | + | ||
50 | + | ||
51 | + | func staticKey_gameDappAddress () = "static_gameDappAddress" | |
52 | + | ||
53 | + | ||
54 | + | func staticKey_itemsAddress () = "static_itemsAddress" | |
55 | + | ||
56 | + | ||
57 | + | func staticKey_couponsAddress () = "static_couponsAddress" | |
58 | + | ||
59 | + | ||
60 | + | func staticKey_huntAddress () = "static_huntAddress" | |
61 | + | ||
62 | + | ||
63 | + | func staticKey_burnAddress () = "static_burnAddress" | |
64 | + | ||
65 | + | ||
66 | + | func staticKey_refContractAddress () = "static_refContractAddress" | |
67 | + | ||
68 | + | ||
69 | + | func staticKey_extraFee () = "static_extraFee" | |
70 | + | ||
71 | + | ||
72 | + | func staticKey_feeAggregator () = "static_feeAggregator" | |
73 | + | ||
74 | + | ||
75 | + | func getOracle () = Address(fromBase58String(tryGetString(staticKey_oracleAddress()))) | |
76 | + | ||
77 | + | ||
78 | + | func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), staticKey_eggAssetId())) | |
79 | + | ||
80 | + | ||
81 | + | func getIncubatorAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_incubatorAddress()))) | |
82 | + | ||
83 | + | ||
84 | + | func getBreederAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_breederAddress()))) | |
85 | + | ||
86 | + | ||
87 | + | func getFarmingAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_farmingAddress()))) | |
88 | + | ||
89 | + | ||
90 | + | func getBabyDuckAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_babyDuckAddress()))) | |
91 | + | ||
92 | + | ||
93 | + | func getGameDappAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_gameDappAddress()))) | |
94 | + | ||
95 | + | ||
96 | + | func getItemsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_itemsAddress()))) | |
97 | + | ||
98 | + | ||
99 | + | func getCouponsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_couponsAddress()))) | |
100 | + | ||
101 | + | ||
102 | + | func getHuntAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_huntAddress()))) | |
103 | + | ||
104 | + | ||
105 | + | func getBurnAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_burnAddress()))) | |
106 | + | ||
107 | + | ||
108 | + | func getRefContractAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_refContractAddress()))) | |
109 | + | ||
110 | + | ||
111 | + | func getFeeAggregator () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_feeAggregator()))) | |
112 | + | ||
113 | + | ||
114 | + | func checkAdditionalPayment (payment) = if (isDefined(payment.assetId)) | |
115 | + | then throw("RCAP: Please attach waves") | |
116 | + | else { | |
117 | + | let feeAmount = getIntegerValue(getOracle(), staticKey_extraFee()) | |
118 | + | if ((payment.amount != feeAmount)) | |
119 | + | then throw((("RCAP: Please attach exactly " + toString(feeAmount)) + " amount of wavelets")) | |
120 | + | else [ScriptTransfer(getFeeAggregator(), feeAmount, unit)] | |
121 | + | } | |
122 | + | ||
123 | + | ||
124 | + | let PHOENIXBASEOPTIONS = 1000 | |
125 | + | ||
126 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
127 | + | case b: Int => | |
128 | + | b | |
129 | + | case _ => | |
130 | + | 0 | |
131 | + | } | |
132 | + | ||
133 | + | ||
134 | + | func asString (value) = match value { | |
135 | + | case s: String => | |
136 | + | s | |
137 | + | case s: Int => | |
138 | + | throw("wrong type, expected: String, got: Int") | |
139 | + | case s: Unit => | |
140 | + | throw("wrong type, expected: String, got: Unit") | |
141 | + | case _ => | |
142 | + | throw("wrong type, expected: String") | |
143 | + | } | |
144 | + | ||
145 | + | ||
146 | + | let feeAmount = tryGetInteger("currentPrice") | |
147 | + | ||
148 | + | func getAmountOrClear (amount) = if (contains(amount, "0")) | |
149 | + | then "" | |
150 | + | else amount | |
151 | + | ||
152 | + | ||
153 | + | func getAssetOrigin (generation) = if ((generation == "G")) | |
154 | + | then getIncubatorAddress() | |
155 | + | else getBreederAddress() | |
156 | + | ||
157 | + | ||
158 | + | func getAssetRarity (genotype,generation) = { | |
159 | + | let quantity = getIntegerValue(getAssetOrigin(generation), (("stats_" + genotype) + "_quantity")) | |
160 | + | let power = pow((10000 / quantity), 4, 5, 1, 2, FLOOR) | |
161 | + | if ((power > 0)) | |
162 | + | then power | |
163 | + | else 2 | |
60 | 164 | } | |
61 | 165 | ||
62 | 166 | ||
63 | - | func getHatchingStatusKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_status") | |
167 | + | func getAssetFarmingPower (assetId) = if (if ((value(assetInfo(assetId)).issuer == getBreederAddress())) | |
168 | + | then true | |
169 | + | else (value(assetInfo(assetId)).issuer == getIncubatorAddress())) | |
170 | + | then { | |
171 | + | let assetName = value(assetInfo(assetId)).name | |
172 | + | let generation = take(takeRight(assetName, 2), 1) | |
173 | + | let farmGen = asString(invoke(getBreederAddress(), "getGenFromName", [assetName], nil)) | |
174 | + | if ((farmGen == farmGen)) | |
175 | + | then $Tuple2(farmGen, getAssetRarity(farmGen, generation)) | |
176 | + | else throw("Strict value is not equal to itself.") | |
177 | + | } | |
178 | + | else throw("not valid NFT") | |
64 | 179 | ||
65 | 180 | ||
66 | - | func getHatchingFinishHeightKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_fh") | |
67 | - | ||
68 | - | ||
69 | - | func getDuckIdKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_di") | |
70 | - | ||
71 | - | ||
72 | - | func getDuckStatsKey (genString) = (("stats_" + genString) + "_amount") | |
73 | - | ||
74 | - | ||
75 | - | func tryGetInteger (key) = { | |
76 | - | let val = match getInteger(this, key) { | |
77 | - | case b: Int => | |
78 | - | b | |
79 | - | case _ => | |
80 | - | 0 | |
81 | - | } | |
82 | - | val | |
181 | + | func getRandomNumber (options,txId,hatchingFinishHeight,offset) = { | |
182 | + | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
183 | + | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
184 | + | (toInt(randomHash, (offset * 8)) % options) | |
83 | 185 | } | |
84 | 186 | ||
85 | 187 | ||
86 | - | let discountCoefficient = tryGetInteger("discountCoefficient") | |
87 | - | ||
88 | - | let saleCoefficient = tryGetInteger("saleCoefficient") | |
89 | - | ||
90 | - | func getRandomNumber (variants,txId,hatchingFinishHeight,offset) = { | |
91 | - | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
92 | - | let randomHash = sha256(((base58'incubator' + txId) + value(randomSeedBlock.vrf))) | |
93 | - | (toInt(randomHash, offset) % variants) | |
188 | + | func getRandomWin (tx,finishHeight,assetRarity) = { | |
189 | + | let jackpotRandom = getRandomNumber(10, tx, finishHeight, 1) | |
190 | + | if ((jackpotRandom == 1)) | |
191 | + | then "phoenix" | |
192 | + | else { | |
193 | + | let n = getRandomNumber(1000, tx, finishHeight, 0) | |
194 | + | if ((10 > n)) | |
195 | + | then "item!ART-FREEGENE" | |
196 | + | else if ((126 > n)) | |
197 | + | then "ar" | |
198 | + | else if ((186 > n)) | |
199 | + | then "item!ART-FIRE_ARMOUR" | |
200 | + | else if ((206 > n)) | |
201 | + | then "item!ART-FEED5" | |
202 | + | else if ((226 > n)) | |
203 | + | then "item!ART-FEED10" | |
204 | + | else if ((246 > n)) | |
205 | + | then "item!ART-FEED15" | |
206 | + | else if ((266 > n)) | |
207 | + | then "item!ART-FEED20" | |
208 | + | else if ((286 > n)) | |
209 | + | then "item!ART-FEED25" | |
210 | + | else if ((296 > n)) | |
211 | + | then "item!ART-FEED50" | |
212 | + | else if ((300 > n)) | |
213 | + | then "item!ART-FEED100" | |
214 | + | else if ((310 > n)) | |
215 | + | then "item!ART-CROWN" | |
216 | + | else if ((350 > n)) | |
217 | + | then "incubator" | |
218 | + | else if ((460 > n)) | |
219 | + | then if ((50 > assetRarity)) | |
220 | + | then "item!ART-BUILTBODY" | |
221 | + | else "item!ART-MUTARIUM-D" | |
222 | + | else if ((480 > n)) | |
223 | + | then "item!ART-SNAKE" | |
224 | + | else if ((510 > n)) | |
225 | + | then "item!ART-ROBODUCK" | |
226 | + | else if ((600 > n)) | |
227 | + | then "item!ART-KATANA" | |
228 | + | else if ((650 > n)) | |
229 | + | then if ((50 > assetRarity)) | |
230 | + | then "item!ART-SCEPTER" | |
231 | + | else "item!ART-MUTARIUM-D" | |
232 | + | else if ((710 > n)) | |
233 | + | then "item!ART-MUTARIUM-D" | |
234 | + | else if ((720 > n)) | |
235 | + | then "item!ART-MUTARIUM-G" | |
236 | + | else if ((890 > n)) | |
237 | + | then "duckling_10" | |
238 | + | else if ((960 > n)) | |
239 | + | then "duckling_20" | |
240 | + | else "duckling_40" | |
241 | + | } | |
94 | 242 | } | |
95 | 243 | ||
96 | 244 | ||
97 | - | func wasUniqueBorn (gen) = tryGetInteger(getDuckStatsKey(gen)) | |
98 | - | ||
99 | - | ||
100 | - | func getRandomName (txId,hatchingFinishHeight) = { | |
101 | - | let jackpotRandom = getRandomNumber(200, txId, hatchingFinishHeight, 4) | |
102 | - | let entry = IntegerEntry("last_jackpot_random", jackpotRandom) | |
103 | - | let typeRandom = getRandomNumber(4, txId, hatchingFinishHeight, 5) | |
104 | - | let colorRandom = getRandomNumber(4, txId, hatchingFinishHeight, 6) | |
105 | - | let color = if ((colorRandom == 0)) | |
106 | - | then "Y" | |
107 | - | else if ((colorRandom == 1)) | |
108 | - | then "G" | |
109 | - | else if ((colorRandom == 2)) | |
110 | - | then "B" | |
111 | - | else "R" | |
112 | - | if ((typeRandom == 0)) | |
113 | - | then $Tuple3(("DUCK-MMMMMMMM-G" + color), "8M-G", entry) | |
114 | - | else if ((typeRandom == 1)) | |
115 | - | then $Tuple3(("DUCK-NNNNNNNN-G" + color), "8N-G", entry) | |
116 | - | else if ((typeRandom == 2)) | |
117 | - | then $Tuple3(("DUCK-OOOOOOOO-G" + color), "8O-G", entry) | |
118 | - | else $Tuple3(("DUCK-PPPPPPPP-G" + color), "8P-G", entry) | |
119 | - | } | |
120 | - | ||
121 | - | ||
122 | - | func countEggsNeededAmount (totalDucksAmount) = { | |
123 | - | let n = totalDucksAmount | |
124 | - | let g = discountCoefficient | |
125 | - | let s = saleCoefficient | |
126 | - | let t = typesAmount | |
127 | - | let price = pow((100 + ((n * g) / (10 * t))), 2, 5, 1, 2, DOWN) | |
128 | - | if ((saleCoefficient == 0)) | |
129 | - | then (price * 1000000) | |
130 | - | else (((price * 1000000) / 100) * (100 - saleCoefficient)) | |
245 | + | func getOrigin (assetId) = { | |
246 | + | let assetName = value(assetInfo(assetId)).name | |
247 | + | let generation = take(takeRight(assetName, 2), 1) | |
248 | + | if (if ((generation == "G")) | |
249 | + | then true | |
250 | + | else (generation == "J")) | |
251 | + | then getIncubatorAddress() | |
252 | + | else getBreederAddress() | |
131 | 253 | } | |
132 | 254 | ||
133 | 255 | ||
134 | 256 | func asInt (value) = match value { | |
135 | 257 | case int: Int => | |
136 | 258 | int | |
259 | + | case string: String => | |
260 | + | throw(("RAI: wrong type, expected: Int, but got: " + string)) | |
137 | 261 | case _ => | |
138 | - | throw(" | |
262 | + | throw("RAI: wrong type, expected: Int") | |
139 | 263 | } | |
140 | - | ||
141 | - | ||
142 | - | func finishHatchingInternal (txIdStr,owner) = { | |
143 | - | let txId = fromBase58String(txIdStr) | |
144 | - | let hatchingStatusKey = getHatchingStatusKey(owner, txId) | |
145 | - | let finishHeightKey = getHatchingFinishHeightKey(owner, txId) | |
146 | - | let duckIdKey = getDuckIdKey(owner, txId) | |
147 | - | let duckFromBaby = match getBoolean((("hatching_" + txIdStr) + "_babyDuck")) { | |
148 | - | case t: Boolean => | |
149 | - | t | |
150 | - | case _ => | |
151 | - | false | |
152 | - | } | |
153 | - | let hatchingTxStatus = getStringValue(this, hatchingStatusKey) | |
154 | - | let hatchingFinishHeight = getIntegerValue(this, finishHeightKey) | |
155 | - | if ((hatchingTxStatus == HatchingFinished)) | |
156 | - | then { | |
157 | - | let duckId = getStringValue(this, getDuckIdKey(owner, txId)) | |
158 | - | throw(("IFDH: The duck was hatched and claimed already, here is the folowing: " + duckId)) | |
159 | - | } | |
160 | - | else if ((hatchingFinishHeight > height)) | |
161 | - | then throw((((("Hatching is not finished yet " + toString((hatchingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((hatchingFinishHeight - height))) + " minutes")) | |
162 | - | else { | |
163 | - | let $t055055591 = getRandomName(txId, hatchingFinishHeight) | |
164 | - | let duckGen = $t055055591._1 | |
165 | - | let farmGen = $t055055591._2 | |
166 | - | let jackpotRandomEntry = $t055055591._3 | |
167 | - | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
168 | - | let asset = Issue(duckGen, description, 1, 0, false, unit, hatchingFinishHeight) | |
169 | - | let assetId = calculateAssetId(asset) | |
170 | - | let amount = (tryGetInteger(getDuckStatsKey(duckGen)) + 1) | |
171 | - | [StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), BooleanEntry((("duck_" + toBase58String(assetId)) + "_grown"), duckFromBaby), IntegerEntry(getDuckStatsKey(duckGen), amount), jackpotRandomEntry, IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(Address(fromBase58String(owner)), 1, assetId)] | |
172 | - | } | |
173 | - | } | |
174 | 264 | ||
175 | 265 | ||
176 | 266 | func getBool (key) = match getBoolean(this, key) { | |
184 | 274 | func isTestEnv () = getBool("TESTENV") | |
185 | 275 | ||
186 | 276 | ||
277 | + | func finishRebirthInternal (initTx,address,payment,double) = { | |
278 | + | let finishBlock = tryGetInteger((((("address_" + address) + "_initTx_") + initTx) + "_finishBlock")) | |
279 | + | let assetRarity = tryGetInteger((((("address_" + address) + "_initTx_") + initTx) + "_assetRarity")) | |
280 | + | let status = tryGetString((((("address_" + address) + "_initTx_") + initTx) + "_status")) | |
281 | + | let validPayment = checkAdditionalPayment(payment) | |
282 | + | if ((validPayment == validPayment)) | |
283 | + | then { | |
284 | + | let recordAction = invoke(getCouponsAddress(), "recordAction", ["REBIRTH"], nil) | |
285 | + | if ((recordAction == recordAction)) | |
286 | + | then { | |
287 | + | func getAccessItemAssetId (address) = fromBase58String(tryGetStringExternal(address, "static_accessItemAssetId")) | |
288 | + | ||
289 | + | func getAccessItemPrice (address) = tryGetIntExternal(address, "static_accessItemPrice") | |
290 | + | ||
291 | + | if ((status != "open")) | |
292 | + | then throw("rebirth is finished or not open") | |
293 | + | else if ((finishBlock > height)) | |
294 | + | then throw("you cannot finish rebirth, yet") | |
295 | + | else { | |
296 | + | let win = getRandomWin(fromBase58String(initTx), finishBlock, assetRarity) | |
297 | + | let txId = initTx | |
298 | + | let result = if ((indexOf(win, "perch") != unit)) | |
299 | + | then { | |
300 | + | let color = takeRight(win, 1) | |
301 | + | let result = if (!(double)) | |
302 | + | then { | |
303 | + | let first = invoke(getFarmingAddress(), "addFreePerch", [address, color, 1], nil) | |
304 | + | if ((first == first)) | |
305 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
306 | + | else throw("Strict value is not equal to itself.") | |
307 | + | } | |
308 | + | else { | |
309 | + | let first = invoke(getFarmingAddress(), "addFreePerch", [address, color, 2], nil) | |
310 | + | if ((first == first)) | |
311 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), win)] | |
312 | + | else throw("Strict value is not equal to itself.") | |
313 | + | } | |
314 | + | if ((result == result)) | |
315 | + | then result | |
316 | + | else throw("Strict value is not equal to itself.") | |
317 | + | } | |
318 | + | else if ((win == "incubator")) | |
319 | + | then { | |
320 | + | let result = if (!(double)) | |
321 | + | then { | |
322 | + | let first = invoke(getIncubatorAddress(), "issueFreeDuck", [address, txId], nil) | |
323 | + | if ((first == first)) | |
324 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
325 | + | else throw("Strict value is not equal to itself.") | |
326 | + | } | |
327 | + | else { | |
328 | + | let first = invoke(getIncubatorAddress(), "issueFreeDuck", [address, txId], nil) | |
329 | + | if ((first == first)) | |
330 | + | then { | |
331 | + | let second = invoke(getBabyDuckAddress(), "issueFreeDuckling", [address, txId, 100], nil) | |
332 | + | if ((second == second)) | |
333 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), "duckling_100")] | |
334 | + | else throw("Strict value is not equal to itself.") | |
335 | + | } | |
336 | + | else throw("Strict value is not equal to itself.") | |
337 | + | } | |
338 | + | if ((result == result)) | |
339 | + | then result | |
340 | + | else throw("Strict value is not equal to itself.") | |
341 | + | } | |
342 | + | else if ((win == "ar")) | |
343 | + | then { | |
344 | + | let assetId = getAccessItemAssetId(getHuntAddress()) | |
345 | + | let price = getAccessItemPrice(getHuntAddress()) | |
346 | + | let call = invoke(getHuntAddress(), "buyAccessItemOther", [address], [AttachedPayment(assetId, price)]) | |
347 | + | if ((call == call)) | |
348 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
349 | + | else throw("Strict value is not equal to itself.") | |
350 | + | } | |
351 | + | else if ((win == "phoenix")) | |
352 | + | then { | |
353 | + | let call = invoke(getIncubatorAddress(), "issueJackpot", [address, txId, "WWWWHWTF"], nil) | |
354 | + | if ((call == call)) | |
355 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
356 | + | else throw("Strict value is not equal to itself.") | |
357 | + | } | |
358 | + | else if ((indexOf(win, "duckling") != unit)) | |
359 | + | then { | |
360 | + | let level = parseIntValue(split(win, "_")[1]) | |
361 | + | let levelFinal = if (double) | |
362 | + | then (2 * level) | |
363 | + | else level | |
364 | + | let call = invoke(getBabyDuckAddress(), "issueFreeDuckling", [address, txId, levelFinal], nil) | |
365 | + | if ((call == call)) | |
366 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
367 | + | else throw("Strict value is not equal to itself.") | |
368 | + | } | |
369 | + | else if ((indexOf(win, "item") != unit)) | |
370 | + | then { | |
371 | + | let itemName = split(win, "!")[1] | |
372 | + | let result = if (!(double)) | |
373 | + | then { | |
374 | + | let first = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 0], nil) | |
375 | + | if ((first == first)) | |
376 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
377 | + | else throw("Strict value is not equal to itself.") | |
378 | + | } | |
379 | + | else { | |
380 | + | let first = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 0], nil) | |
381 | + | if ((first == first)) | |
382 | + | then { | |
383 | + | let second = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 1], nil) | |
384 | + | if ((second == second)) | |
385 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), win)] | |
386 | + | else throw("Strict value is not equal to itself.") | |
387 | + | } | |
388 | + | else throw("Strict value is not equal to itself.") | |
389 | + | } | |
390 | + | if ((result == result)) | |
391 | + | then result | |
392 | + | else throw("Strict value is not equal to itself.") | |
393 | + | } | |
394 | + | else throw("RFB: Some error occured, please contact the admins!") | |
395 | + | ((result ++ [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win"), win), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_status"), "finish")]) ++ validPayment) | |
396 | + | } | |
397 | + | } | |
398 | + | else throw("Strict value is not equal to itself.") | |
399 | + | } | |
400 | + | else throw("Strict value is not equal to itself.") | |
401 | + | } | |
402 | + | ||
403 | + | ||
187 | 404 | @Callable(i) | |
188 | 405 | func configureOracle (oracle) = if ((i.caller != this)) | |
189 | - | then throw(" | |
406 | + | then throw("RCU: admin only") | |
190 | 407 | else [StringEntry("static_oracleAddress", oracle)] | |
191 | 408 | ||
192 | 409 | ||
193 | 410 | ||
194 | 411 | @Callable(i) | |
195 | - | func setDiscount (val) = if ((i.caller != this)) | |
196 | - | then throw("ISD: admin_only") | |
197 | - | else [IntegerEntry("discountCoefficient", val)] | |
198 | - | ||
199 | - | ||
200 | - | ||
201 | - | @Callable(i) | |
202 | - | func setSale (val) = if ((i.caller != this)) | |
203 | - | then throw("ISS: admin_only") | |
204 | - | else [IntegerEntry("saleCoefficient", val)] | |
205 | - | ||
206 | - | ||
207 | - | ||
208 | - | @Callable(i) | |
209 | - | func startDuckHatching (refererAddress) = if ((getBabyDuckAddress() != i.caller)) | |
210 | - | then throw("ISDHFA: From now on this is only possible through ducklings!") | |
211 | - | else if ((isLocked() > 0)) | |
212 | - | then throw("ISDH: EGG operations are temporarily locked") | |
412 | + | func initRebirth (refererAddress) = { | |
413 | + | let pmt = i.payments[0] | |
414 | + | let assetId = value(pmt.assetId) | |
415 | + | let initTx = toBase58String(i.transactionId) | |
416 | + | let address = toString(i.caller) | |
417 | + | if ((pmt.amount != 1)) | |
418 | + | then throw("NFT is not attached") | |
213 | 419 | else { | |
214 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
215 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
216 | - | [StringEntry(getHatchingStatusKey(toString(i.originCaller), i.transactionId), HatchingStarted), IntegerEntry(getHatchingFinishHeightKey(toString(i.originCaller), i.transactionId), (height + delayForHatching)), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), BooleanEntry((("hatching_" + toBase58String(i.transactionId)) + "_babyDuck"), true)] | |
217 | - | } | |
218 | - | ||
219 | - | ||
220 | - | ||
221 | - | @Callable(i) | |
222 | - | func startDuckHatchingForAddress (address) = if ((isLocked() > 0)) | |
223 | - | then throw("ISDHFA: EGG operations are temporarily locked") | |
224 | - | else if ((i.caller != this)) | |
225 | - | then throw("ISDHFA: Permission denied") | |
226 | - | else { | |
227 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
228 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
229 | - | [StringEntry(getHatchingStatusKey(address, i.transactionId), HatchingStarted), IntegerEntry(getHatchingFinishHeightKey(address, i.transactionId), (height + delayForHatching)), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), BooleanEntry((("hatching_" + toBase58String(i.transactionId)) + "_promo"), true)] | |
230 | - | } | |
231 | - | ||
232 | - | ||
233 | - | ||
234 | - | @Callable(i) | |
235 | - | func finishDuckHatching (txIdStr) = { | |
236 | - | let owner = toString(i.originCaller) | |
237 | - | finishHatchingInternal(txIdStr, owner) | |
238 | - | } | |
239 | - | ||
240 | - | ||
241 | - | ||
242 | - | @Callable(i) | |
243 | - | func issueFreeDuck (address,txIdStr) = if ((i.caller != getRebirthAddress())) | |
244 | - | then throw("ISFD: rebirth only") | |
245 | - | else { | |
246 | - | let txId = fromBase58String(txIdStr) | |
247 | - | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
248 | - | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
249 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
250 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
251 | - | let $t093379499 = getRandomName(txId, (valueOrErrorMessage(transactionHeightById(txId), ((txIdStr + " not found ") + toBase58String(txId))) + 1)) | |
252 | - | let duckGen = $t093379499._1 | |
253 | - | let farmGen = $t093379499._2 | |
254 | - | let jackpotRandomEntry = $t093379499._3 | |
255 | - | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
256 | - | let asset = Issue(duckGen, description, 1, 0, false, unit, height) | |
257 | - | let assetId = calculateAssetId(asset) | |
258 | - | let amount = (tryGetInteger(getDuckStatsKey(duckGen)) + 1) | |
259 | - | let duckIdKey = getDuckIdKey(address, txId) | |
260 | - | $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), jackpotRandomEntry, StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getDuckStatsKey(duckGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
261 | - | } | |
262 | - | ||
263 | - | ||
264 | - | ||
265 | - | @Callable(i) | |
266 | - | func issueFreeDuckDefinedGenes (address,txIdStr,genes) = if (if ((i.caller != this)) | |
267 | - | then (i.caller != getTurtleRebirthAddress()) | |
268 | - | else false) | |
269 | - | then throw("IIFDDG: Admin only!") | |
270 | - | else { | |
271 | - | let txId = fromBase58String(txIdStr) | |
272 | - | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
273 | - | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
274 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
275 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
276 | - | let colorRandom = getRandomNumber(4, txId, height, 6) | |
277 | - | let color = if ((colorRandom == 0)) | |
278 | - | then "Y" | |
279 | - | else if ((colorRandom == 1)) | |
280 | - | then "G" | |
281 | - | else if ((colorRandom == 2)) | |
282 | - | then "B" | |
283 | - | else "R" | |
284 | - | let $t01119611273 = $Tuple2(((("DUCK-" + genes) + "-G") + color), (("8" + take(genes, 1)) + "-G")) | |
285 | - | let duckGen = $t01119611273._1 | |
286 | - | let farmGen = $t01119611273._2 | |
287 | - | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
288 | - | let asset = Issue(duckGen, description, 1, 0, false, unit, height) | |
289 | - | let assetId = calculateAssetId(asset) | |
290 | - | let amount = (tryGetInteger(getDuckStatsKey(duckGen)) + 1) | |
291 | - | let duckIdKey = getDuckIdKey(address, txId) | |
292 | - | $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getDuckStatsKey(duckGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
293 | - | } | |
294 | - | ||
295 | - | ||
296 | - | ||
297 | - | @Callable(i) | |
298 | - | func issueJackpot (address,txIdStr,gen) = if (if ((i.caller != getRebirthAddress())) | |
299 | - | then (i.caller != this) | |
300 | - | else false) | |
301 | - | then throw("ISJ: admin or rebirth only") | |
302 | - | else { | |
303 | - | let txId = fromBase58String(txIdStr) | |
304 | - | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
305 | - | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
306 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
307 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
308 | - | let $t01272212774 = $Tuple2((("DUCK-" + gen) + "-JU"), "8W-J") | |
309 | - | let duckGen = $t01272212774._1 | |
310 | - | let farmGen = $t01272212774._2 | |
311 | - | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
312 | - | let asset = Issue(duckGen, description, 1, 0, false, unit, height) | |
313 | - | let assetId = calculateAssetId(asset) | |
314 | - | let duckIdKey = getDuckIdKey(address, txId) | |
315 | - | let valueDuckIdKeyExits = tryGetString(duckIdKey) | |
316 | - | if ((valueDuckIdKeyExits != "")) | |
317 | - | then throw((("ISJ: You will override following duckId :" + duckIdKey) + " make sure that your txId is unique!")) | |
318 | - | else $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getDuckStatsKey(duckGen), (tryGetInteger(getDuckStatsKey(duckGen)) + 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
319 | - | } | |
320 | - | ||
321 | - | ||
322 | - | ||
323 | - | @Callable(i) | |
324 | - | func reduceRarity (assetId,fGen) = { | |
325 | - | let asset = fromBase58String(assetId) | |
326 | - | if (if ((i.caller != getRebirthAddress())) | |
327 | - | then (i.caller != this) | |
328 | - | else false) | |
329 | - | then throw("IRR: admin or rebirth only") | |
330 | - | else { | |
331 | - | let duckGen = value(assetInfo(asset)).name | |
332 | - | let letter = takeRight(take(duckGen, 6), 1) | |
333 | - | let farmGen = (("8" + letter) + "-G") | |
334 | - | [IntegerEntry(getDuckStatsKey(duckGen), (tryGetInteger(getDuckStatsKey(duckGen)) - 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) - 1))] | |
420 | + | let amountPaidByCoupons = asInt(invoke(getCouponsAddress(), "useCoupons", [feeAmount], nil)) | |
421 | + | if ((amountPaidByCoupons == amountPaidByCoupons)) | |
422 | + | then { | |
423 | + | let leftToPay = (feeAmount - amountPaidByCoupons) | |
424 | + | let validPayment = checkAdditionalPayment(i.payments[1]) | |
425 | + | if ((validPayment == validPayment)) | |
426 | + | then { | |
427 | + | let payment = if ((leftToPay != 0)) | |
428 | + | then { | |
429 | + | let feePayment = value(i.payments[2]) | |
430 | + | if ((feePayment.assetId != getEggAssetId())) | |
431 | + | then throw("You need to attach EGG tokens as fee") | |
432 | + | else if ((leftToPay > feePayment.amount)) | |
433 | + | then throw(("You need to attach the following amount of EGG tokens as fee: 0." + toString(leftToPay))) | |
434 | + | else { | |
435 | + | let refererRewardForPerch = fraction(leftToPay, 5, 100) | |
436 | + | let refCall = asBoolean(invoke(getRefContractAddress(), "refPayment", [refererAddress], [AttachedPayment(getEggAssetId(), refererRewardForPerch)])) | |
437 | + | if ((refCall == refCall)) | |
438 | + | then { | |
439 | + | let toBurn = if (refCall) | |
440 | + | then (leftToPay - refererRewardForPerch) | |
441 | + | else leftToPay | |
442 | + | let burnCall = invoke(getBurnAddress(), "burnAttachedPayments", nil, [AttachedPayment(getEggAssetId(), toBurn)]) | |
443 | + | if ((burnCall == burnCall)) | |
444 | + | then leftToPay | |
445 | + | else throw("Strict value is not equal to itself.") | |
446 | + | } | |
447 | + | else throw("Strict value is not equal to itself.") | |
448 | + | } | |
449 | + | } | |
450 | + | else 0 | |
451 | + | if ((payment == payment)) | |
452 | + | then { | |
453 | + | let $t01380913858 = getAssetFarmingPower(assetId) | |
454 | + | let gen = $t01380913858._1 | |
455 | + | let rarity = $t01380913858._2 | |
456 | + | let call = invoke(getOrigin(assetId), "reduceRarity", [toBase58String(assetId), gen], nil) | |
457 | + | if ((call == call)) | |
458 | + | then ([IntegerEntry((((("address_" + address) + "_initTx_") + initTx) + "_finishBlock"), (height + delayForHatching)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_status"), "open"), IntegerEntry((((("address_" + address) + "_initTx_") + initTx) + "_assetRarity"), rarity), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_assetId"), toBase58String(assetId))] ++ validPayment) | |
459 | + | else throw("Strict value is not equal to itself.") | |
460 | + | } | |
461 | + | else throw("Strict value is not equal to itself.") | |
462 | + | } | |
463 | + | else throw("Strict value is not equal to itself.") | |
464 | + | } | |
465 | + | else throw("Strict value is not equal to itself.") | |
335 | 466 | } | |
336 | 467 | } | |
337 | 468 | ||
338 | 469 | ||
339 | 470 | ||
340 | 471 | @Callable(i) | |
341 | - | func finishDuckHatchingAdmin (txIdStr,owner) = if ((i.caller != this)) | |
342 | - | then throw("IFDHA: Only admins can run this!") | |
343 | - | else finishHatchingInternal(txIdStr, owner) | |
472 | + | func finishRebirth (initTx) = finishRebirthInternal(initTx, toString(i.caller), i.payments[0], false) | |
473 | + | ||
474 | + | ||
475 | + | ||
476 | + | @Callable(i) | |
477 | + | func finishRebirthDouble (initTx) = if (!(if ((size(i.payments) == 2)) | |
478 | + | then (i.payments[0].amount == 1) | |
479 | + | else false)) | |
480 | + | then throw("Invalid payment") | |
481 | + | else { | |
482 | + | let assetId = value(i.payments[0].assetId) | |
483 | + | let boosterType = asString(invoke(getItemsAddress(), "checkArtefactDetails", [toBase58String(assetId)], nil)) | |
484 | + | if ((boosterType == boosterType)) | |
485 | + | then if ((boosterType == "ART-GIFT_DOUBL")) | |
486 | + | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], true)) | |
487 | + | else throw("Error! Wrong item attached to double rewards!") | |
488 | + | else throw("Strict value is not equal to itself.") | |
489 | + | } | |
344 | 490 | ||
345 | 491 | ||
346 | 492 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func tryGetStringExternal (address,key) = match getString(address, key) { | |
5 | 5 | case a: String => | |
6 | 6 | a | |
7 | 7 | case _ => | |
8 | 8 | "" | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | - | func tryGetString (key) = tryGetStringExternal(this, key) | |
12 | + | func tryGetIntExternal (address,key) = match getInteger(address, key) { | |
13 | + | case a: Int => | |
14 | + | a | |
15 | + | case _ => | |
16 | + | throw("RTGIE: Something went wrong") | |
17 | + | } | |
13 | 18 | ||
14 | 19 | ||
15 | - | func staticKey_turtleRebirthAddress () = "static_turtleRebirthAddress" | |
20 | + | func asBoolean (value) = match value { | |
21 | + | case boolean: Boolean => | |
22 | + | boolean | |
23 | + | case _ => | |
24 | + | throw("FAB: wrong type, expected: Boolean") | |
25 | + | } | |
16 | 26 | ||
17 | 27 | ||
18 | - | func getOracle () = Address(fromBase58String(tryGetString("static_oracleAddress"))) | |
19 | - | ||
20 | - | ||
21 | - | func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), "static_eggAssetId")) | |
22 | - | ||
23 | - | ||
24 | - | func getRebirthAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_rebirthAddress"))) | |
25 | - | ||
26 | - | ||
27 | - | func getBabyDuckAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_babyDuckAddress"))) | |
28 | - | ||
29 | - | ||
30 | - | func getRefContractAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_refContractAddress"))) | |
31 | - | ||
32 | - | ||
33 | - | func getCouponsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_couponsAddress"))) | |
34 | - | ||
35 | - | ||
36 | - | func getBurnAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), "static_burnAddress"))) | |
37 | - | ||
38 | - | ||
39 | - | func getTurtleRebirthAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_turtleRebirthAddress()))) | |
28 | + | func tryGetString (key) = tryGetStringExternal(this, key) | |
40 | 29 | ||
41 | 30 | ||
42 | 31 | let delayForHatching = 2 | |
43 | 32 | ||
44 | - | ||
33 | + | func staticKey_oracleAddress () = "static_oracleAddress" | |
45 | 34 | ||
46 | - | let RefererReward = 5 | |
47 | 35 | ||
48 | - | ||
36 | + | func staticKey_eggAssetId () = "static_eggAssetId" | |
49 | 37 | ||
50 | - | let HatchingFinished = "HATCHING_FINISHED" | |
51 | 38 | ||
52 | - | func isLocked () = { | |
53 | - | let masterAddress = Address(base58'3PEPftf2kWZDmAaWBjs6BUJa9957kiA2PkU') | |
54 | - | match getInteger(masterAddress, "egglock") { | |
55 | - | case b: Int => | |
56 | - | b | |
57 | - | case _ => | |
58 | - | 0 | |
59 | - | } | |
39 | + | func staticKey_incubatorAddress () = "static_incubatorAddress" | |
40 | + | ||
41 | + | ||
42 | + | func staticKey_breederAddress () = "static_breederAddress" | |
43 | + | ||
44 | + | ||
45 | + | func staticKey_farmingAddress () = "static_farmingAddressNew" | |
46 | + | ||
47 | + | ||
48 | + | func staticKey_babyDuckAddress () = "static_babyDuckAddress" | |
49 | + | ||
50 | + | ||
51 | + | func staticKey_gameDappAddress () = "static_gameDappAddress" | |
52 | + | ||
53 | + | ||
54 | + | func staticKey_itemsAddress () = "static_itemsAddress" | |
55 | + | ||
56 | + | ||
57 | + | func staticKey_couponsAddress () = "static_couponsAddress" | |
58 | + | ||
59 | + | ||
60 | + | func staticKey_huntAddress () = "static_huntAddress" | |
61 | + | ||
62 | + | ||
63 | + | func staticKey_burnAddress () = "static_burnAddress" | |
64 | + | ||
65 | + | ||
66 | + | func staticKey_refContractAddress () = "static_refContractAddress" | |
67 | + | ||
68 | + | ||
69 | + | func staticKey_extraFee () = "static_extraFee" | |
70 | + | ||
71 | + | ||
72 | + | func staticKey_feeAggregator () = "static_feeAggregator" | |
73 | + | ||
74 | + | ||
75 | + | func getOracle () = Address(fromBase58String(tryGetString(staticKey_oracleAddress()))) | |
76 | + | ||
77 | + | ||
78 | + | func getEggAssetId () = fromBase58String(tryGetStringExternal(getOracle(), staticKey_eggAssetId())) | |
79 | + | ||
80 | + | ||
81 | + | func getIncubatorAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_incubatorAddress()))) | |
82 | + | ||
83 | + | ||
84 | + | func getBreederAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_breederAddress()))) | |
85 | + | ||
86 | + | ||
87 | + | func getFarmingAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_farmingAddress()))) | |
88 | + | ||
89 | + | ||
90 | + | func getBabyDuckAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_babyDuckAddress()))) | |
91 | + | ||
92 | + | ||
93 | + | func getGameDappAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_gameDappAddress()))) | |
94 | + | ||
95 | + | ||
96 | + | func getItemsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_itemsAddress()))) | |
97 | + | ||
98 | + | ||
99 | + | func getCouponsAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_couponsAddress()))) | |
100 | + | ||
101 | + | ||
102 | + | func getHuntAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_huntAddress()))) | |
103 | + | ||
104 | + | ||
105 | + | func getBurnAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_burnAddress()))) | |
106 | + | ||
107 | + | ||
108 | + | func getRefContractAddress () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_refContractAddress()))) | |
109 | + | ||
110 | + | ||
111 | + | func getFeeAggregator () = Address(fromBase58String(tryGetStringExternal(getOracle(), staticKey_feeAggregator()))) | |
112 | + | ||
113 | + | ||
114 | + | func checkAdditionalPayment (payment) = if (isDefined(payment.assetId)) | |
115 | + | then throw("RCAP: Please attach waves") | |
116 | + | else { | |
117 | + | let feeAmount = getIntegerValue(getOracle(), staticKey_extraFee()) | |
118 | + | if ((payment.amount != feeAmount)) | |
119 | + | then throw((("RCAP: Please attach exactly " + toString(feeAmount)) + " amount of wavelets")) | |
120 | + | else [ScriptTransfer(getFeeAggregator(), feeAmount, unit)] | |
121 | + | } | |
122 | + | ||
123 | + | ||
124 | + | let PHOENIXBASEOPTIONS = 1000 | |
125 | + | ||
126 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
127 | + | case b: Int => | |
128 | + | b | |
129 | + | case _ => | |
130 | + | 0 | |
131 | + | } | |
132 | + | ||
133 | + | ||
134 | + | func asString (value) = match value { | |
135 | + | case s: String => | |
136 | + | s | |
137 | + | case s: Int => | |
138 | + | throw("wrong type, expected: String, got: Int") | |
139 | + | case s: Unit => | |
140 | + | throw("wrong type, expected: String, got: Unit") | |
141 | + | case _ => | |
142 | + | throw("wrong type, expected: String") | |
143 | + | } | |
144 | + | ||
145 | + | ||
146 | + | let feeAmount = tryGetInteger("currentPrice") | |
147 | + | ||
148 | + | func getAmountOrClear (amount) = if (contains(amount, "0")) | |
149 | + | then "" | |
150 | + | else amount | |
151 | + | ||
152 | + | ||
153 | + | func getAssetOrigin (generation) = if ((generation == "G")) | |
154 | + | then getIncubatorAddress() | |
155 | + | else getBreederAddress() | |
156 | + | ||
157 | + | ||
158 | + | func getAssetRarity (genotype,generation) = { | |
159 | + | let quantity = getIntegerValue(getAssetOrigin(generation), (("stats_" + genotype) + "_quantity")) | |
160 | + | let power = pow((10000 / quantity), 4, 5, 1, 2, FLOOR) | |
161 | + | if ((power > 0)) | |
162 | + | then power | |
163 | + | else 2 | |
60 | 164 | } | |
61 | 165 | ||
62 | 166 | ||
63 | - | func getHatchingStatusKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_status") | |
167 | + | func getAssetFarmingPower (assetId) = if (if ((value(assetInfo(assetId)).issuer == getBreederAddress())) | |
168 | + | then true | |
169 | + | else (value(assetInfo(assetId)).issuer == getIncubatorAddress())) | |
170 | + | then { | |
171 | + | let assetName = value(assetInfo(assetId)).name | |
172 | + | let generation = take(takeRight(assetName, 2), 1) | |
173 | + | let farmGen = asString(invoke(getBreederAddress(), "getGenFromName", [assetName], nil)) | |
174 | + | if ((farmGen == farmGen)) | |
175 | + | then $Tuple2(farmGen, getAssetRarity(farmGen, generation)) | |
176 | + | else throw("Strict value is not equal to itself.") | |
177 | + | } | |
178 | + | else throw("not valid NFT") | |
64 | 179 | ||
65 | 180 | ||
66 | - | func getHatchingFinishHeightKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_fh") | |
67 | - | ||
68 | - | ||
69 | - | func getDuckIdKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_di") | |
70 | - | ||
71 | - | ||
72 | - | func getDuckStatsKey (genString) = (("stats_" + genString) + "_amount") | |
73 | - | ||
74 | - | ||
75 | - | func tryGetInteger (key) = { | |
76 | - | let val = match getInteger(this, key) { | |
77 | - | case b: Int => | |
78 | - | b | |
79 | - | case _ => | |
80 | - | 0 | |
81 | - | } | |
82 | - | val | |
181 | + | func getRandomNumber (options,txId,hatchingFinishHeight,offset) = { | |
182 | + | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
183 | + | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
184 | + | (toInt(randomHash, (offset * 8)) % options) | |
83 | 185 | } | |
84 | 186 | ||
85 | 187 | ||
86 | - | let discountCoefficient = tryGetInteger("discountCoefficient") | |
87 | - | ||
88 | - | let saleCoefficient = tryGetInteger("saleCoefficient") | |
89 | - | ||
90 | - | func getRandomNumber (variants,txId,hatchingFinishHeight,offset) = { | |
91 | - | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
92 | - | let randomHash = sha256(((base58'incubator' + txId) + value(randomSeedBlock.vrf))) | |
93 | - | (toInt(randomHash, offset) % variants) | |
188 | + | func getRandomWin (tx,finishHeight,assetRarity) = { | |
189 | + | let jackpotRandom = getRandomNumber(10, tx, finishHeight, 1) | |
190 | + | if ((jackpotRandom == 1)) | |
191 | + | then "phoenix" | |
192 | + | else { | |
193 | + | let n = getRandomNumber(1000, tx, finishHeight, 0) | |
194 | + | if ((10 > n)) | |
195 | + | then "item!ART-FREEGENE" | |
196 | + | else if ((126 > n)) | |
197 | + | then "ar" | |
198 | + | else if ((186 > n)) | |
199 | + | then "item!ART-FIRE_ARMOUR" | |
200 | + | else if ((206 > n)) | |
201 | + | then "item!ART-FEED5" | |
202 | + | else if ((226 > n)) | |
203 | + | then "item!ART-FEED10" | |
204 | + | else if ((246 > n)) | |
205 | + | then "item!ART-FEED15" | |
206 | + | else if ((266 > n)) | |
207 | + | then "item!ART-FEED20" | |
208 | + | else if ((286 > n)) | |
209 | + | then "item!ART-FEED25" | |
210 | + | else if ((296 > n)) | |
211 | + | then "item!ART-FEED50" | |
212 | + | else if ((300 > n)) | |
213 | + | then "item!ART-FEED100" | |
214 | + | else if ((310 > n)) | |
215 | + | then "item!ART-CROWN" | |
216 | + | else if ((350 > n)) | |
217 | + | then "incubator" | |
218 | + | else if ((460 > n)) | |
219 | + | then if ((50 > assetRarity)) | |
220 | + | then "item!ART-BUILTBODY" | |
221 | + | else "item!ART-MUTARIUM-D" | |
222 | + | else if ((480 > n)) | |
223 | + | then "item!ART-SNAKE" | |
224 | + | else if ((510 > n)) | |
225 | + | then "item!ART-ROBODUCK" | |
226 | + | else if ((600 > n)) | |
227 | + | then "item!ART-KATANA" | |
228 | + | else if ((650 > n)) | |
229 | + | then if ((50 > assetRarity)) | |
230 | + | then "item!ART-SCEPTER" | |
231 | + | else "item!ART-MUTARIUM-D" | |
232 | + | else if ((710 > n)) | |
233 | + | then "item!ART-MUTARIUM-D" | |
234 | + | else if ((720 > n)) | |
235 | + | then "item!ART-MUTARIUM-G" | |
236 | + | else if ((890 > n)) | |
237 | + | then "duckling_10" | |
238 | + | else if ((960 > n)) | |
239 | + | then "duckling_20" | |
240 | + | else "duckling_40" | |
241 | + | } | |
94 | 242 | } | |
95 | 243 | ||
96 | 244 | ||
97 | - | func wasUniqueBorn (gen) = tryGetInteger(getDuckStatsKey(gen)) | |
98 | - | ||
99 | - | ||
100 | - | func getRandomName (txId,hatchingFinishHeight) = { | |
101 | - | let jackpotRandom = getRandomNumber(200, txId, hatchingFinishHeight, 4) | |
102 | - | let entry = IntegerEntry("last_jackpot_random", jackpotRandom) | |
103 | - | let typeRandom = getRandomNumber(4, txId, hatchingFinishHeight, 5) | |
104 | - | let colorRandom = getRandomNumber(4, txId, hatchingFinishHeight, 6) | |
105 | - | let color = if ((colorRandom == 0)) | |
106 | - | then "Y" | |
107 | - | else if ((colorRandom == 1)) | |
108 | - | then "G" | |
109 | - | else if ((colorRandom == 2)) | |
110 | - | then "B" | |
111 | - | else "R" | |
112 | - | if ((typeRandom == 0)) | |
113 | - | then $Tuple3(("DUCK-MMMMMMMM-G" + color), "8M-G", entry) | |
114 | - | else if ((typeRandom == 1)) | |
115 | - | then $Tuple3(("DUCK-NNNNNNNN-G" + color), "8N-G", entry) | |
116 | - | else if ((typeRandom == 2)) | |
117 | - | then $Tuple3(("DUCK-OOOOOOOO-G" + color), "8O-G", entry) | |
118 | - | else $Tuple3(("DUCK-PPPPPPPP-G" + color), "8P-G", entry) | |
119 | - | } | |
120 | - | ||
121 | - | ||
122 | - | func countEggsNeededAmount (totalDucksAmount) = { | |
123 | - | let n = totalDucksAmount | |
124 | - | let g = discountCoefficient | |
125 | - | let s = saleCoefficient | |
126 | - | let t = typesAmount | |
127 | - | let price = pow((100 + ((n * g) / (10 * t))), 2, 5, 1, 2, DOWN) | |
128 | - | if ((saleCoefficient == 0)) | |
129 | - | then (price * 1000000) | |
130 | - | else (((price * 1000000) / 100) * (100 - saleCoefficient)) | |
245 | + | func getOrigin (assetId) = { | |
246 | + | let assetName = value(assetInfo(assetId)).name | |
247 | + | let generation = take(takeRight(assetName, 2), 1) | |
248 | + | if (if ((generation == "G")) | |
249 | + | then true | |
250 | + | else (generation == "J")) | |
251 | + | then getIncubatorAddress() | |
252 | + | else getBreederAddress() | |
131 | 253 | } | |
132 | 254 | ||
133 | 255 | ||
134 | 256 | func asInt (value) = match value { | |
135 | 257 | case int: Int => | |
136 | 258 | int | |
259 | + | case string: String => | |
260 | + | throw(("RAI: wrong type, expected: Int, but got: " + string)) | |
137 | 261 | case _ => | |
138 | - | throw(" | |
262 | + | throw("RAI: wrong type, expected: Int") | |
139 | 263 | } | |
140 | - | ||
141 | - | ||
142 | - | func finishHatchingInternal (txIdStr,owner) = { | |
143 | - | let txId = fromBase58String(txIdStr) | |
144 | - | let hatchingStatusKey = getHatchingStatusKey(owner, txId) | |
145 | - | let finishHeightKey = getHatchingFinishHeightKey(owner, txId) | |
146 | - | let duckIdKey = getDuckIdKey(owner, txId) | |
147 | - | let duckFromBaby = match getBoolean((("hatching_" + txIdStr) + "_babyDuck")) { | |
148 | - | case t: Boolean => | |
149 | - | t | |
150 | - | case _ => | |
151 | - | false | |
152 | - | } | |
153 | - | let hatchingTxStatus = getStringValue(this, hatchingStatusKey) | |
154 | - | let hatchingFinishHeight = getIntegerValue(this, finishHeightKey) | |
155 | - | if ((hatchingTxStatus == HatchingFinished)) | |
156 | - | then { | |
157 | - | let duckId = getStringValue(this, getDuckIdKey(owner, txId)) | |
158 | - | throw(("IFDH: The duck was hatched and claimed already, here is the folowing: " + duckId)) | |
159 | - | } | |
160 | - | else if ((hatchingFinishHeight > height)) | |
161 | - | then throw((((("Hatching is not finished yet " + toString((hatchingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((hatchingFinishHeight - height))) + " minutes")) | |
162 | - | else { | |
163 | - | let $t055055591 = getRandomName(txId, hatchingFinishHeight) | |
164 | - | let duckGen = $t055055591._1 | |
165 | - | let farmGen = $t055055591._2 | |
166 | - | let jackpotRandomEntry = $t055055591._3 | |
167 | - | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
168 | - | let asset = Issue(duckGen, description, 1, 0, false, unit, hatchingFinishHeight) | |
169 | - | let assetId = calculateAssetId(asset) | |
170 | - | let amount = (tryGetInteger(getDuckStatsKey(duckGen)) + 1) | |
171 | - | [StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), BooleanEntry((("duck_" + toBase58String(assetId)) + "_grown"), duckFromBaby), IntegerEntry(getDuckStatsKey(duckGen), amount), jackpotRandomEntry, IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(Address(fromBase58String(owner)), 1, assetId)] | |
172 | - | } | |
173 | - | } | |
174 | 264 | ||
175 | 265 | ||
176 | 266 | func getBool (key) = match getBoolean(this, key) { | |
177 | 267 | case b: Boolean => | |
178 | 268 | b | |
179 | 269 | case _ => | |
180 | 270 | false | |
181 | 271 | } | |
182 | 272 | ||
183 | 273 | ||
184 | 274 | func isTestEnv () = getBool("TESTENV") | |
185 | 275 | ||
186 | 276 | ||
277 | + | func finishRebirthInternal (initTx,address,payment,double) = { | |
278 | + | let finishBlock = tryGetInteger((((("address_" + address) + "_initTx_") + initTx) + "_finishBlock")) | |
279 | + | let assetRarity = tryGetInteger((((("address_" + address) + "_initTx_") + initTx) + "_assetRarity")) | |
280 | + | let status = tryGetString((((("address_" + address) + "_initTx_") + initTx) + "_status")) | |
281 | + | let validPayment = checkAdditionalPayment(payment) | |
282 | + | if ((validPayment == validPayment)) | |
283 | + | then { | |
284 | + | let recordAction = invoke(getCouponsAddress(), "recordAction", ["REBIRTH"], nil) | |
285 | + | if ((recordAction == recordAction)) | |
286 | + | then { | |
287 | + | func getAccessItemAssetId (address) = fromBase58String(tryGetStringExternal(address, "static_accessItemAssetId")) | |
288 | + | ||
289 | + | func getAccessItemPrice (address) = tryGetIntExternal(address, "static_accessItemPrice") | |
290 | + | ||
291 | + | if ((status != "open")) | |
292 | + | then throw("rebirth is finished or not open") | |
293 | + | else if ((finishBlock > height)) | |
294 | + | then throw("you cannot finish rebirth, yet") | |
295 | + | else { | |
296 | + | let win = getRandomWin(fromBase58String(initTx), finishBlock, assetRarity) | |
297 | + | let txId = initTx | |
298 | + | let result = if ((indexOf(win, "perch") != unit)) | |
299 | + | then { | |
300 | + | let color = takeRight(win, 1) | |
301 | + | let result = if (!(double)) | |
302 | + | then { | |
303 | + | let first = invoke(getFarmingAddress(), "addFreePerch", [address, color, 1], nil) | |
304 | + | if ((first == first)) | |
305 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
306 | + | else throw("Strict value is not equal to itself.") | |
307 | + | } | |
308 | + | else { | |
309 | + | let first = invoke(getFarmingAddress(), "addFreePerch", [address, color, 2], nil) | |
310 | + | if ((first == first)) | |
311 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), win)] | |
312 | + | else throw("Strict value is not equal to itself.") | |
313 | + | } | |
314 | + | if ((result == result)) | |
315 | + | then result | |
316 | + | else throw("Strict value is not equal to itself.") | |
317 | + | } | |
318 | + | else if ((win == "incubator")) | |
319 | + | then { | |
320 | + | let result = if (!(double)) | |
321 | + | then { | |
322 | + | let first = invoke(getIncubatorAddress(), "issueFreeDuck", [address, txId], nil) | |
323 | + | if ((first == first)) | |
324 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
325 | + | else throw("Strict value is not equal to itself.") | |
326 | + | } | |
327 | + | else { | |
328 | + | let first = invoke(getIncubatorAddress(), "issueFreeDuck", [address, txId], nil) | |
329 | + | if ((first == first)) | |
330 | + | then { | |
331 | + | let second = invoke(getBabyDuckAddress(), "issueFreeDuckling", [address, txId, 100], nil) | |
332 | + | if ((second == second)) | |
333 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result1"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), "duckling_100")] | |
334 | + | else throw("Strict value is not equal to itself.") | |
335 | + | } | |
336 | + | else throw("Strict value is not equal to itself.") | |
337 | + | } | |
338 | + | if ((result == result)) | |
339 | + | then result | |
340 | + | else throw("Strict value is not equal to itself.") | |
341 | + | } | |
342 | + | else if ((win == "ar")) | |
343 | + | then { | |
344 | + | let assetId = getAccessItemAssetId(getHuntAddress()) | |
345 | + | let price = getAccessItemPrice(getHuntAddress()) | |
346 | + | let call = invoke(getHuntAddress(), "buyAccessItemOther", [address], [AttachedPayment(assetId, price)]) | |
347 | + | if ((call == call)) | |
348 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
349 | + | else throw("Strict value is not equal to itself.") | |
350 | + | } | |
351 | + | else if ((win == "phoenix")) | |
352 | + | then { | |
353 | + | let call = invoke(getIncubatorAddress(), "issueJackpot", [address, txId, "WWWWHWTF"], nil) | |
354 | + | if ((call == call)) | |
355 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
356 | + | else throw("Strict value is not equal to itself.") | |
357 | + | } | |
358 | + | else if ((indexOf(win, "duckling") != unit)) | |
359 | + | then { | |
360 | + | let level = parseIntValue(split(win, "_")[1]) | |
361 | + | let levelFinal = if (double) | |
362 | + | then (2 * level) | |
363 | + | else level | |
364 | + | let call = invoke(getBabyDuckAddress(), "issueFreeDuckling", [address, txId, levelFinal], nil) | |
365 | + | if ((call == call)) | |
366 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(call))] | |
367 | + | else throw("Strict value is not equal to itself.") | |
368 | + | } | |
369 | + | else if ((indexOf(win, "item") != unit)) | |
370 | + | then { | |
371 | + | let itemName = split(win, "!")[1] | |
372 | + | let result = if (!(double)) | |
373 | + | then { | |
374 | + | let first = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 0], nil) | |
375 | + | if ((first == first)) | |
376 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first))] | |
377 | + | else throw("Strict value is not equal to itself.") | |
378 | + | } | |
379 | + | else { | |
380 | + | let first = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 0], nil) | |
381 | + | if ((first == first)) | |
382 | + | then { | |
383 | + | let second = invoke(getItemsAddress(), "issueArtefactIndex", [itemName, address, 1], nil) | |
384 | + | if ((second == second)) | |
385 | + | then [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(first)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_result"), asString(second)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win1"), win)] | |
386 | + | else throw("Strict value is not equal to itself.") | |
387 | + | } | |
388 | + | else throw("Strict value is not equal to itself.") | |
389 | + | } | |
390 | + | if ((result == result)) | |
391 | + | then result | |
392 | + | else throw("Strict value is not equal to itself.") | |
393 | + | } | |
394 | + | else throw("RFB: Some error occured, please contact the admins!") | |
395 | + | ((result ++ [StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_win"), win), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_status"), "finish")]) ++ validPayment) | |
396 | + | } | |
397 | + | } | |
398 | + | else throw("Strict value is not equal to itself.") | |
399 | + | } | |
400 | + | else throw("Strict value is not equal to itself.") | |
401 | + | } | |
402 | + | ||
403 | + | ||
187 | 404 | @Callable(i) | |
188 | 405 | func configureOracle (oracle) = if ((i.caller != this)) | |
189 | - | then throw(" | |
406 | + | then throw("RCU: admin only") | |
190 | 407 | else [StringEntry("static_oracleAddress", oracle)] | |
191 | 408 | ||
192 | 409 | ||
193 | 410 | ||
194 | 411 | @Callable(i) | |
195 | - | func setDiscount (val) = if ((i.caller != this)) | |
196 | - | then throw("ISD: admin_only") | |
197 | - | else [IntegerEntry("discountCoefficient", val)] | |
198 | - | ||
199 | - | ||
200 | - | ||
201 | - | @Callable(i) | |
202 | - | func setSale (val) = if ((i.caller != this)) | |
203 | - | then throw("ISS: admin_only") | |
204 | - | else [IntegerEntry("saleCoefficient", val)] | |
205 | - | ||
206 | - | ||
207 | - | ||
208 | - | @Callable(i) | |
209 | - | func startDuckHatching (refererAddress) = if ((getBabyDuckAddress() != i.caller)) | |
210 | - | then throw("ISDHFA: From now on this is only possible through ducklings!") | |
211 | - | else if ((isLocked() > 0)) | |
212 | - | then throw("ISDH: EGG operations are temporarily locked") | |
412 | + | func initRebirth (refererAddress) = { | |
413 | + | let pmt = i.payments[0] | |
414 | + | let assetId = value(pmt.assetId) | |
415 | + | let initTx = toBase58String(i.transactionId) | |
416 | + | let address = toString(i.caller) | |
417 | + | if ((pmt.amount != 1)) | |
418 | + | then throw("NFT is not attached") | |
213 | 419 | else { | |
214 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
215 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
216 | - | [StringEntry(getHatchingStatusKey(toString(i.originCaller), i.transactionId), HatchingStarted), IntegerEntry(getHatchingFinishHeightKey(toString(i.originCaller), i.transactionId), (height + delayForHatching)), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), BooleanEntry((("hatching_" + toBase58String(i.transactionId)) + "_babyDuck"), true)] | |
217 | - | } | |
218 | - | ||
219 | - | ||
220 | - | ||
221 | - | @Callable(i) | |
222 | - | func startDuckHatchingForAddress (address) = if ((isLocked() > 0)) | |
223 | - | then throw("ISDHFA: EGG operations are temporarily locked") | |
224 | - | else if ((i.caller != this)) | |
225 | - | then throw("ISDHFA: Permission denied") | |
226 | - | else { | |
227 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
228 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
229 | - | [StringEntry(getHatchingStatusKey(address, i.transactionId), HatchingStarted), IntegerEntry(getHatchingFinishHeightKey(address, i.transactionId), (height + delayForHatching)), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), BooleanEntry((("hatching_" + toBase58String(i.transactionId)) + "_promo"), true)] | |
230 | - | } | |
231 | - | ||
232 | - | ||
233 | - | ||
234 | - | @Callable(i) | |
235 | - | func finishDuckHatching (txIdStr) = { | |
236 | - | let owner = toString(i.originCaller) | |
237 | - | finishHatchingInternal(txIdStr, owner) | |
238 | - | } | |
239 | - | ||
240 | - | ||
241 | - | ||
242 | - | @Callable(i) | |
243 | - | func issueFreeDuck (address,txIdStr) = if ((i.caller != getRebirthAddress())) | |
244 | - | then throw("ISFD: rebirth only") | |
245 | - | else { | |
246 | - | let txId = fromBase58String(txIdStr) | |
247 | - | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
248 | - | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
249 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
250 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
251 | - | let $t093379499 = getRandomName(txId, (valueOrErrorMessage(transactionHeightById(txId), ((txIdStr + " not found ") + toBase58String(txId))) + 1)) | |
252 | - | let duckGen = $t093379499._1 | |
253 | - | let farmGen = $t093379499._2 | |
254 | - | let jackpotRandomEntry = $t093379499._3 | |
255 | - | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
256 | - | let asset = Issue(duckGen, description, 1, 0, false, unit, height) | |
257 | - | let assetId = calculateAssetId(asset) | |
258 | - | let amount = (tryGetInteger(getDuckStatsKey(duckGen)) + 1) | |
259 | - | let duckIdKey = getDuckIdKey(address, txId) | |
260 | - | $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), jackpotRandomEntry, StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getDuckStatsKey(duckGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
261 | - | } | |
262 | - | ||
263 | - | ||
264 | - | ||
265 | - | @Callable(i) | |
266 | - | func issueFreeDuckDefinedGenes (address,txIdStr,genes) = if (if ((i.caller != this)) | |
267 | - | then (i.caller != getTurtleRebirthAddress()) | |
268 | - | else false) | |
269 | - | then throw("IIFDDG: Admin only!") | |
270 | - | else { | |
271 | - | let txId = fromBase58String(txIdStr) | |
272 | - | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
273 | - | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
274 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
275 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
276 | - | let colorRandom = getRandomNumber(4, txId, height, 6) | |
277 | - | let color = if ((colorRandom == 0)) | |
278 | - | then "Y" | |
279 | - | else if ((colorRandom == 1)) | |
280 | - | then "G" | |
281 | - | else if ((colorRandom == 2)) | |
282 | - | then "B" | |
283 | - | else "R" | |
284 | - | let $t01119611273 = $Tuple2(((("DUCK-" + genes) + "-G") + color), (("8" + take(genes, 1)) + "-G")) | |
285 | - | let duckGen = $t01119611273._1 | |
286 | - | let farmGen = $t01119611273._2 | |
287 | - | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
288 | - | let asset = Issue(duckGen, description, 1, 0, false, unit, height) | |
289 | - | let assetId = calculateAssetId(asset) | |
290 | - | let amount = (tryGetInteger(getDuckStatsKey(duckGen)) + 1) | |
291 | - | let duckIdKey = getDuckIdKey(address, txId) | |
292 | - | $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getDuckStatsKey(duckGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
293 | - | } | |
294 | - | ||
295 | - | ||
296 | - | ||
297 | - | @Callable(i) | |
298 | - | func issueJackpot (address,txIdStr,gen) = if (if ((i.caller != getRebirthAddress())) | |
299 | - | then (i.caller != this) | |
300 | - | else false) | |
301 | - | then throw("ISJ: admin or rebirth only") | |
302 | - | else { | |
303 | - | let txId = fromBase58String(txIdStr) | |
304 | - | let hatchingStatusKey = getHatchingStatusKey(address, txId) | |
305 | - | let finishHeightKey = getHatchingFinishHeightKey(address, txId) | |
306 | - | let totalDucksAmount = tryGetInteger("ducks_amount") | |
307 | - | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
308 | - | let $t01272212774 = $Tuple2((("DUCK-" + gen) + "-JU"), "8W-J") | |
309 | - | let duckGen = $t01272212774._1 | |
310 | - | let farmGen = $t01272212774._2 | |
311 | - | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
312 | - | let asset = Issue(duckGen, description, 1, 0, false, unit, height) | |
313 | - | let assetId = calculateAssetId(asset) | |
314 | - | let duckIdKey = getDuckIdKey(address, txId) | |
315 | - | let valueDuckIdKeyExits = tryGetString(duckIdKey) | |
316 | - | if ((valueDuckIdKeyExits != "")) | |
317 | - | then throw((("ISJ: You will override following duckId :" + duckIdKey) + " make sure that your txId is unique!")) | |
318 | - | else $Tuple2([IntegerEntry(getHatchingFinishHeightKey(address, txId), height), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000)), StringEntry(hatchingStatusKey, HatchingFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), IntegerEntry(getDuckStatsKey(duckGen), (tryGetInteger(getDuckStatsKey(duckGen)) + 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(value(addressFromString(address)), 1, assetId)], toBase58String(assetId)) | |
319 | - | } | |
320 | - | ||
321 | - | ||
322 | - | ||
323 | - | @Callable(i) | |
324 | - | func reduceRarity (assetId,fGen) = { | |
325 | - | let asset = fromBase58String(assetId) | |
326 | - | if (if ((i.caller != getRebirthAddress())) | |
327 | - | then (i.caller != this) | |
328 | - | else false) | |
329 | - | then throw("IRR: admin or rebirth only") | |
330 | - | else { | |
331 | - | let duckGen = value(assetInfo(asset)).name | |
332 | - | let letter = takeRight(take(duckGen, 6), 1) | |
333 | - | let farmGen = (("8" + letter) + "-G") | |
334 | - | [IntegerEntry(getDuckStatsKey(duckGen), (tryGetInteger(getDuckStatsKey(duckGen)) - 1)), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) - 1))] | |
420 | + | let amountPaidByCoupons = asInt(invoke(getCouponsAddress(), "useCoupons", [feeAmount], nil)) | |
421 | + | if ((amountPaidByCoupons == amountPaidByCoupons)) | |
422 | + | then { | |
423 | + | let leftToPay = (feeAmount - amountPaidByCoupons) | |
424 | + | let validPayment = checkAdditionalPayment(i.payments[1]) | |
425 | + | if ((validPayment == validPayment)) | |
426 | + | then { | |
427 | + | let payment = if ((leftToPay != 0)) | |
428 | + | then { | |
429 | + | let feePayment = value(i.payments[2]) | |
430 | + | if ((feePayment.assetId != getEggAssetId())) | |
431 | + | then throw("You need to attach EGG tokens as fee") | |
432 | + | else if ((leftToPay > feePayment.amount)) | |
433 | + | then throw(("You need to attach the following amount of EGG tokens as fee: 0." + toString(leftToPay))) | |
434 | + | else { | |
435 | + | let refererRewardForPerch = fraction(leftToPay, 5, 100) | |
436 | + | let refCall = asBoolean(invoke(getRefContractAddress(), "refPayment", [refererAddress], [AttachedPayment(getEggAssetId(), refererRewardForPerch)])) | |
437 | + | if ((refCall == refCall)) | |
438 | + | then { | |
439 | + | let toBurn = if (refCall) | |
440 | + | then (leftToPay - refererRewardForPerch) | |
441 | + | else leftToPay | |
442 | + | let burnCall = invoke(getBurnAddress(), "burnAttachedPayments", nil, [AttachedPayment(getEggAssetId(), toBurn)]) | |
443 | + | if ((burnCall == burnCall)) | |
444 | + | then leftToPay | |
445 | + | else throw("Strict value is not equal to itself.") | |
446 | + | } | |
447 | + | else throw("Strict value is not equal to itself.") | |
448 | + | } | |
449 | + | } | |
450 | + | else 0 | |
451 | + | if ((payment == payment)) | |
452 | + | then { | |
453 | + | let $t01380913858 = getAssetFarmingPower(assetId) | |
454 | + | let gen = $t01380913858._1 | |
455 | + | let rarity = $t01380913858._2 | |
456 | + | let call = invoke(getOrigin(assetId), "reduceRarity", [toBase58String(assetId), gen], nil) | |
457 | + | if ((call == call)) | |
458 | + | then ([IntegerEntry((((("address_" + address) + "_initTx_") + initTx) + "_finishBlock"), (height + delayForHatching)), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_status"), "open"), IntegerEntry((((("address_" + address) + "_initTx_") + initTx) + "_assetRarity"), rarity), StringEntry((((("address_" + address) + "_initTx_") + initTx) + "_assetId"), toBase58String(assetId))] ++ validPayment) | |
459 | + | else throw("Strict value is not equal to itself.") | |
460 | + | } | |
461 | + | else throw("Strict value is not equal to itself.") | |
462 | + | } | |
463 | + | else throw("Strict value is not equal to itself.") | |
464 | + | } | |
465 | + | else throw("Strict value is not equal to itself.") | |
335 | 466 | } | |
336 | 467 | } | |
337 | 468 | ||
338 | 469 | ||
339 | 470 | ||
340 | 471 | @Callable(i) | |
341 | - | func finishDuckHatchingAdmin (txIdStr,owner) = if ((i.caller != this)) | |
342 | - | then throw("IFDHA: Only admins can run this!") | |
343 | - | else finishHatchingInternal(txIdStr, owner) | |
472 | + | func finishRebirth (initTx) = finishRebirthInternal(initTx, toString(i.caller), i.payments[0], false) | |
473 | + | ||
474 | + | ||
475 | + | ||
476 | + | @Callable(i) | |
477 | + | func finishRebirthDouble (initTx) = if (!(if ((size(i.payments) == 2)) | |
478 | + | then (i.payments[0].amount == 1) | |
479 | + | else false)) | |
480 | + | then throw("Invalid payment") | |
481 | + | else { | |
482 | + | let assetId = value(i.payments[0].assetId) | |
483 | + | let boosterType = asString(invoke(getItemsAddress(), "checkArtefactDetails", [toBase58String(assetId)], nil)) | |
484 | + | if ((boosterType == boosterType)) | |
485 | + | then if ((boosterType == "ART-GIFT_DOUBL")) | |
486 | + | then ([Burn(assetId, 1)] ++ finishRebirthInternal(initTx, toString(i.caller), i.payments[1], true)) | |
487 | + | else throw("Error! Wrong item attached to double rewards!") | |
488 | + | else throw("Strict value is not equal to itself.") | |
489 | + | } | |
344 | 490 | ||
345 | 491 | ||
346 | 492 | @Verifier(tx) | |
347 | 493 | func verify () = if (isTestEnv()) | |
348 | 494 | then sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
349 | 495 | else { | |
350 | 496 | let firstUser = base58'6TdaXEfhnjYquvPf3yV7MFxt2CbgFmaqsvGwkKfXtKi4' | |
351 | 497 | let secondUser = base58'7DsP2WaMLocbHuUxux7pbXRjTrrZ1TFQPsi5QumS3gr8' | |
352 | 498 | let thirdUser = base58'BpFWP3p3JgYrrP45xfrKzeMcWMEXoinj4FVPPkUiA8D3' | |
353 | 499 | let firstUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], firstUser)) | |
354 | 500 | then 1 | |
355 | 501 | else if (sigVerify(tx.bodyBytes, tx.proofs[1], firstUser)) | |
356 | 502 | then 1 | |
357 | 503 | else if (sigVerify(tx.bodyBytes, tx.proofs[2], firstUser)) | |
358 | 504 | then 1 | |
359 | 505 | else 0 | |
360 | 506 | let secondUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], secondUser)) | |
361 | 507 | then 1 | |
362 | 508 | else if (sigVerify(tx.bodyBytes, tx.proofs[1], secondUser)) | |
363 | 509 | then 1 | |
364 | 510 | else if (sigVerify(tx.bodyBytes, tx.proofs[2], secondUser)) | |
365 | 511 | then 1 | |
366 | 512 | else 0 | |
367 | 513 | let thirdUserSigned = if (sigVerify(tx.bodyBytes, tx.proofs[0], thirdUser)) | |
368 | 514 | then 1 | |
369 | 515 | else if (sigVerify(tx.bodyBytes, tx.proofs[1], thirdUser)) | |
370 | 516 | then 1 | |
371 | 517 | else if (sigVerify(tx.bodyBytes, tx.proofs[2], thirdUser)) | |
372 | 518 | then 1 | |
373 | 519 | else 0 | |
374 | 520 | let signaturesCount = ((firstUserSigned + secondUserSigned) + thirdUserSigned) | |
375 | 521 | match tx { | |
376 | 522 | case _ => | |
377 | 523 | (signaturesCount >= 2) | |
378 | 524 | } | |
379 | 525 | } | |
380 | 526 |
github/deemru/w8io/026f985 66.23 ms ◑