tx · 3NHwcZZ1t57S5W2ZdovYAvqq8z4AeiPKZVjJ6L1PWw7S 3N4uWa2T9W2p4WgDwLPo3kWRp8eXRatp4vv: -0.01000000 Waves 2021.12.28 11:44 [1853867] smart account 3N4uWa2T9W2p4WgDwLPo3kWRp8eXRatp4vv > SELF 0.00000000 Waves
{ "type": 13, "id": "3NHwcZZ1t57S5W2ZdovYAvqq8z4AeiPKZVjJ6L1PWw7S", "fee": 1000000, "feeAssetId": null, "timestamp": 1640681122593, "version": 2, "chainId": 84, "sender": "3N4uWa2T9W2p4WgDwLPo3kWRp8eXRatp4vv", "senderPublicKey": "6pUz5KTgi8pySNF2EuYHUMBkXbTyxL7R7YWGgb2PkhgU", "proofs": [ "2ipqALLHePA7sNmATHo7CENPtYs9qLLqpBGMvhdeSEoe4aWbScxNZET8Ua5quZVwc3cBvqs54zLH3X75EaUXzcdL" ], "script": "base64:AAIFAAAAAAAAA+gIAhIAEgMKAQgaCAoBQRIDZ2VuGhIKAUISDWdldFJhbmRvbU5hbWUaEgoBQxINamFja3BvdFJhbmRvbRoPCgFEEgp0eXBlUmFuZG9tGhAKAUUSC2NvbG9yUmFuZG9tGgoKAUYSBWNvbG9yGhoKAUcSFWNvdW50RWdnc05lZWRlZEFtb3VudBoVCgFIEhB0b3RhbER1Y2tzQW1vdW50GgYKAUkSAW4aBgoBShIBZxoGCgFLEgF0GgoKAUwSBXByaWNlGgYKAU0SAWkaDwoBThIKZWdnc05lZWRlZBoRCgFPEgxmaXJzdFBheW1lbnQaDAoBUBIHcmVzdWx0cxoMCgFREgd0eElkU3RyGhYKAVISEWhhdGNoaW5nU3RhdHVzS2V5GhQKAVMSD2ZpbmlzaEhlaWdodEtleRoOCgFUEglkdWNrSWRLZXkaEQoBVRIMZHVja0Zyb21CYWJ5GhUKAVYSEGhhdGNoaW5nVHhTdGF0dXMaCwoBVxIGZHVja0lkGg0KAVgSCG5hbWVEYXRhGgwKAVkSB2R1Y2tHZW4aDAoBWhIHZmFybUdlbh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AAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJhZQAAAA9zZW5kZXJQdWJsaWNLZXlr1bNP", "height": 1853867, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 6d77RbPSXSqwXUdHk2bKgv6MwHqT8jXEzUYvq5NsFTY9 Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let eggsAssetId = base58'2cf6jyVG19oHU79R8iHfqFEesjstr3e7nSYEUhb2WagB' | |
5 | + | ||
6 | + | let delayForHatching = 2 | |
7 | + | ||
8 | + | let discountCoefficient = 10 | |
9 | + | ||
10 | + | let typesAmount = 9 | |
11 | + | ||
12 | + | let RefererReward = 5 | |
13 | + | ||
14 | + | let AdoptionStarted = "ADOPTION_STARTED" | |
15 | + | ||
16 | + | let AdoptionFinished = "ADOPTION_FINISHED" | |
17 | + | ||
18 | + | func getHatchingStatusKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_status") | |
19 | + | ||
20 | + | ||
21 | + | func getHatchingFinishHeightKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_fh") | |
22 | + | ||
23 | + | ||
24 | + | func getDuckIdKey (address,txId) = (((address + "_") + toBase58String(txId)) + "_di") | |
25 | + | ||
26 | + | ||
27 | + | func getDuckStatsKey (genString) = (("stats_" + genString) + "_amount") | |
28 | + | ||
29 | + | ||
30 | + | func tryGetInteger (key) = { | |
31 | + | let val = match getInteger(this, key) { | |
32 | + | case b: Int => | |
33 | + | b | |
34 | + | case _ => | |
35 | + | 0 | |
36 | + | } | |
37 | + | val | |
38 | + | } | |
39 | + | ||
40 | + | ||
41 | + | func getRandomNumber (variants,txId,hatchingFinishHeight,offset) = { | |
42 | + | let randomSeedBlock = value(blockInfoByHeight((hatchingFinishHeight - 1))) | |
43 | + | let randomHash = sha256((txId + value(randomSeedBlock.vrf))) | |
44 | + | (toInt(randomHash, (offset * 8)) % variants) | |
45 | + | } | |
46 | + | ||
47 | + | ||
48 | + | func wasUniqueBorn (gen) = tryGetInteger(getDuckStatsKey(gen)) | |
49 | + | ||
50 | + | ||
51 | + | func getRandomName (txId,hatchingFinishHeight) = { | |
52 | + | let jackpotRandom = getRandomNumber(500, txId, hatchingFinishHeight, 0) | |
53 | + | if (if ((jackpotRandom == 111)) | |
54 | + | then (wasUniqueBorn("DUCK-WWWWWWWM-JU") == 0) | |
55 | + | else false) | |
56 | + | then $Tuple2("DUCK-WWWWWWWM-JU", "8W-J") | |
57 | + | else { | |
58 | + | let typeRandom = getRandomNumber(4, txId, hatchingFinishHeight, 0) | |
59 | + | let colorRandom = getRandomNumber(4, txId, hatchingFinishHeight, 1) | |
60 | + | let color = if ((colorRandom == 0)) | |
61 | + | then "Y" | |
62 | + | else if ((colorRandom == 1)) | |
63 | + | then "G" | |
64 | + | else if ((colorRandom == 2)) | |
65 | + | then "B" | |
66 | + | else "R" | |
67 | + | if ((typeRandom == 0)) | |
68 | + | then $Tuple2(("DUCK-FFFFFFFF-G" + color), "8F-G") | |
69 | + | else if ((typeRandom == 1)) | |
70 | + | then $Tuple2(("DUCK-HHHHHHHH-G" + color), "8H-G") | |
71 | + | else if ((typeRandom == 2)) | |
72 | + | then $Tuple2(("DUCK-GGGGGGGG-G" + color), "8G-G") | |
73 | + | else $Tuple2(("DUCK-IIIIIIII-G" + color), "8I-G") | |
74 | + | } | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | func countEggsNeededAmount (totalDucksAmount) = { | |
79 | + | let n = totalDucksAmount | |
80 | + | let g = discountCoefficient | |
81 | + | let t = typesAmount | |
82 | + | let price = pow((100 + ((n * g) / (10 * t))), 2, 5, 1, 2, DOWN) | |
83 | + | (price * 1000000) | |
84 | + | } | |
85 | + | ||
86 | + | ||
87 | + | @Callable(i) | |
88 | + | func startDuckHatching () = { | |
89 | + | let totalDucksAmount = tryGetInteger("ducks_amount") | |
90 | + | let eggsNeeded = countEggsNeededAmount(totalDucksAmount) | |
91 | + | let firstPayment = value(i.payments[0]) | |
92 | + | let results = [StringEntry(getHatchingStatusKey(toString(i.originCaller), i.transactionId), AdoptionStarted), IntegerEntry(getHatchingFinishHeightKey(toString(i.originCaller), i.transactionId), (height + delayForHatching)), IntegerEntry("ducks_amount", (totalDucksAmount + 1)), IntegerEntry("ducks_last_price", (eggsNeeded / 1000000))] | |
93 | + | if ((firstPayment.assetId != eggsAssetId)) | |
94 | + | then throw(("You can attach only EGG tokens with the following asset id: " + toBase58String(eggsAssetId))) | |
95 | + | else if ((eggsNeeded > firstPayment.amount)) | |
96 | + | then throw(("To hatch a duck you currently need the following amount of EGGlets: " + toString(eggsNeeded))) | |
97 | + | else (results ++ [ScriptTransfer(i.caller, (firstPayment.amount - eggsNeeded), eggsAssetId)]) | |
98 | + | } | |
99 | + | ||
100 | + | ||
101 | + | ||
102 | + | @Callable(i) | |
103 | + | func finishDuckHatching (txIdStr) = { | |
104 | + | let txId = fromBase58String(txIdStr) | |
105 | + | let hatchingStatusKey = getHatchingStatusKey(toString(i.caller), txId) | |
106 | + | let finishHeightKey = getHatchingFinishHeightKey(toString(i.caller), txId) | |
107 | + | let duckIdKey = getDuckIdKey(toString(i.caller), txId) | |
108 | + | let duckFromBaby = match getBoolean((("hatching_" + txIdStr) + "_babyDuck")) { | |
109 | + | case t: Boolean => | |
110 | + | t | |
111 | + | case _ => | |
112 | + | false | |
113 | + | } | |
114 | + | let hatchingTxStatus = getStringValue(this, hatchingStatusKey) | |
115 | + | let hatchingFinishHeight = getIntegerValue(this, finishHeightKey) | |
116 | + | if ((hatchingTxStatus == AdoptionFinished)) | |
117 | + | then { | |
118 | + | let duckId = getStringValue(this, getDuckIdKey(toString(i.caller), txId)) | |
119 | + | throw(("The duck was hatched and claimed already, here is the folowing: " + duckId)) | |
120 | + | } | |
121 | + | else if ((hatchingFinishHeight > height)) | |
122 | + | then throw((((("Hatching is not finished yet " + toString((hatchingFinishHeight - height))) + " blocks remaining, it will take around ") + toString((hatchingFinishHeight - height))) + " minutes")) | |
123 | + | else { | |
124 | + | let nameData = getRandomName(txId, hatchingFinishHeight) | |
125 | + | let duckGen = nameData._1 | |
126 | + | let farmGen = nameData._2 | |
127 | + | let description = (("{\"genotype\": \"" + duckGen) + "\", \"crossbreeding\": true}") | |
128 | + | let asset = Issue(duckGen, description, 1, 0, false, unit, hatchingFinishHeight) | |
129 | + | let assetId = calculateAssetId(asset) | |
130 | + | let amount = (tryGetInteger(getDuckStatsKey(duckGen)) + 1) | |
131 | + | [StringEntry(hatchingStatusKey, AdoptionFinished), StringEntry(duckIdKey, toBase58String(assetId)), StringEntry(toBase58String(assetId), duckIdKey), BooleanEntry((("duck_" + toBase58String(assetId)) + "_grown"), duckFromBaby), IntegerEntry(getDuckStatsKey(duckGen), amount), IntegerEntry((("stats_" + farmGen) + "_quantity"), (tryGetInteger((("stats_" + farmGen) + "_quantity")) + 1)), asset, ScriptTransfer(i.caller, 1, assetId)] | |
132 | + | } | |
133 | + | } | |
134 | + | ||
135 | + | ||
136 | + | @Verifier(tx) | |
137 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
138 | + |
github/deemru/w8io/169f3d6 31.19 ms ◑