tx · FxXS7swn7hHGXCxxwsN68RkVrPWbycui6b3wKaNd69As 3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b: -0.01400000 Waves 2021.02.08 16:25 [1389281] smart account 3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b > SELF 0.00000000 Waves
{ "type": 13, "id": "FxXS7swn7hHGXCxxwsN68RkVrPWbycui6b3wKaNd69As", "fee": 1400000, "feeAssetId": null, "timestamp": 1612790764024, "version": 2, "chainId": 84, "sender": "3Mt71RiSbWYENDmeyndvwjoJZwUsXfUkR6b", "senderPublicKey": "3BKFQLeo5ExZ5Y1pt9Ftzsno7aRwzD96zoYVHP3tcLgV", "proofs": [ "dAcWUiM9NBMQ2tAcUaYRNv5sNDqN3s2bQ9snnfio2as2btcmDRKG6urjV5HL85Npd4udaQEMjKFZt14GxYwX2S9" ], "script": "base64:AAIDAAAAAAAAAAwIARIGCgQBAQEBEgAAAAAOAAAAAA1sb3R0ZXJ5YW1vdW50AgAAAAdfYW1vdW50AAAAABJsb3R0ZXJ5cHJvYmFiaWxpdHkCAAAADF9wcm9iYWJpbGl0eQAAAAAZbG90dGVyeXByb2JhYmlsaXR5ZGVjaW1hbAIAAAAVX3Byb2JhYmlsaXR5X2RlY2ltYWxfAAAAAAxsb3R0ZXJ5UHJpY2UCAAAABl9wcmljZQAAAAANbG90dGVyeVByaWNlcwIAAAAQX2xvdHRlcnlfcHJpY2VzXwAAAAANY291bnRPZlByaWNlcwIAAAANX2NvdW50X3ByaWNlcwAAAAAUbGFzdEhhc2hSYW5kb21OdW1iZXICAAAAFWxhc3Rfc3Bpbl9yYW5kb21faGFzaAAAAAATbGFzdFRva2VuUmFuZG9tSGFzaAIAAAAXX2xhc3RfdG9rZW5fcmFuZG9tX2hhc2gBAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAIbGFzdFBsYXkEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwUAAAAUbGFzdEhhc2hSYW5kb21Od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N0NDUwNDQ1NDAAAAAAAAAAAAUJAAACAAAAAQIAAAASTGlzdCBzaXplIGV4Y2VlZCA1BAAAAAl3cml0ZVNldHMJAQAAAAhXcml0ZVNldAAAAAEFAAAAA25pbAkBAAAADFNjcmlwdFJlc3VsdAAAAAIFAAAACXdyaXRlU2V0cwkBAAAAC1RyYW5zZmVyU2V0AAAAAQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlR3hoH", "height": 1389281, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CYg4AvbhYq7CNsnSDSYoNb79tmMriZUQ65Vm6fFgkw4r Next: 8oP1j2zeVYEdKUyGUue27LBVD4jwGSqZqH5uhAm7GV59 Diff:
Old | New | Differences | |
---|---|---|---|
120 | 120 | let defaultValue = 1000 | |
121 | 121 | let randNumber = (toInt(randhash) % (1 * 1000)) | |
122 | 122 | let listF = ["priceList", "fsdfd"] | |
123 | + | let tempPrices = getStringValue(this, lotteryPrices) | |
124 | + | let trimPrices = take(tempPrices, (size(tempPrices) - 1)) | |
125 | + | let pricesArray = split(trimPrices, ",") | |
126 | + | let listSize = size(pricesArray) | |
123 | 127 | let amountS = { | |
124 | - | let $ | |
125 | - | let $ | |
126 | - | let $ | |
127 | - | if (($ | |
128 | - | then $ | |
128 | + | let $list45044540 = priceList | |
129 | + | let $size45044540 = size($list45044540) | |
130 | + | let $acc045044540 = 0 | |
131 | + | if (($size45044540 == 0)) | |
132 | + | then $acc045044540 | |
129 | 133 | else { | |
130 | - | let $ | |
131 | - | if (($ | |
132 | - | then $ | |
134 | + | let $acc145044540 = procedLottery($acc045044540, $list45044540[0]) | |
135 | + | if (($size45044540 == 1)) | |
136 | + | then $acc145044540 | |
133 | 137 | else { | |
134 | - | let $acc242934329 = procedLottery($acc142934329, $list42934329[1]) | |
135 | - | throw("List size exceed 1") | |
138 | + | let $acc245044540 = procedLottery($acc145044540, $list45044540[1]) | |
139 | + | if (($size45044540 == 2)) | |
140 | + | then $acc245044540 | |
141 | + | else { | |
142 | + | let $acc345044540 = procedLottery($acc245044540, $list45044540[2]) | |
143 | + | if (($size45044540 == 3)) | |
144 | + | then $acc345044540 | |
145 | + | else { | |
146 | + | let $acc445044540 = procedLottery($acc345044540, $list45044540[3]) | |
147 | + | if (($size45044540 == 4)) | |
148 | + | then $acc445044540 | |
149 | + | else { | |
150 | + | let $acc545044540 = procedLottery($acc445044540, $list45044540[4]) | |
151 | + | if (($size45044540 == 5)) | |
152 | + | then $acc545044540 | |
153 | + | else { | |
154 | + | let $acc645044540 = procedLottery($acc545044540, $list45044540[5]) | |
155 | + | throw("List size exceed 5") | |
156 | + | } | |
157 | + | } | |
158 | + | } | |
159 | + | } | |
136 | 160 | } | |
137 | 161 | } | |
138 | 162 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lotteryamount = "_amount" | |
5 | 5 | ||
6 | 6 | let lotteryprobability = "_probability" | |
7 | 7 | ||
8 | 8 | let lotteryprobabilitydecimal = "_probability_decimal_" | |
9 | 9 | ||
10 | 10 | let lotteryPrice = "_price" | |
11 | 11 | ||
12 | 12 | let lotteryPrices = "_lottery_prices_" | |
13 | 13 | ||
14 | 14 | let countOfPrices = "_count_prices" | |
15 | 15 | ||
16 | 16 | let lastHashRandomNumber = "last_spin_random_hash" | |
17 | 17 | ||
18 | 18 | let lastTokenRandomHash = "_last_token_random_hash" | |
19 | 19 | ||
20 | 20 | func randomizer (inv) = { | |
21 | 21 | let lastPlay = match getBinary(this, lastHashRandomNumber) { | |
22 | 22 | case s: ByteVector => | |
23 | 23 | s | |
24 | 24 | case _: Unit => | |
25 | 25 | base58'2ee4oFDYriWJ9EMeR' | |
26 | 26 | case _ => | |
27 | 27 | throw("Match error") | |
28 | 28 | } | |
29 | 29 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
30 | 30 | sha256(rand) | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func generatorRandomHash (inv) = { | |
35 | 35 | let lastHashForToken = match getBinary(this, lastTokenRandomHash) { | |
36 | 36 | case s: ByteVector => | |
37 | 37 | s | |
38 | 38 | case _: Unit => | |
39 | 39 | base58'4dD7osCQzvuXJdTiGfKvTwnKT' | |
40 | 40 | case _ => | |
41 | 41 | throw("Match error") | |
42 | 42 | } | |
43 | 43 | let rand = (((((lastHashForToken + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
44 | 44 | sha256(rand) | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getSizePriceArray () = { | |
49 | 49 | let tempPrices = getStringValue(this, lotteryPrices) | |
50 | 50 | let trimPrices = take(tempPrices, (size(tempPrices) - 1)) | |
51 | 51 | let pricesArray = split(trimPrices, ",") | |
52 | 52 | let listSize = size(pricesArray) | |
53 | 53 | listSize | |
54 | 54 | } | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getPriceArray () = { | |
58 | 58 | let tempPrices = getStringValue(this, lotteryPrices) | |
59 | 59 | let trimPrices = take(tempPrices, (size(tempPrices) - 1)) | |
60 | 60 | let newArray = split(trimPrices, ",") | |
61 | 61 | newArray | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func getAmountClaimForToken (token,update) = { | |
66 | 66 | let currentAmount = getIntegerValue(this, (token + lotteryamount)) | |
67 | 67 | if ((currentAmount == 0)) | |
68 | 68 | then throw("Amount exceeded") | |
69 | 69 | else if ((update == true)) | |
70 | 70 | then if ((currentAmount == -1)) | |
71 | 71 | then currentAmount | |
72 | 72 | else { | |
73 | 73 | let returnValue = (currentAmount - 1) | |
74 | 74 | returnValue | |
75 | 75 | } | |
76 | 76 | else currentAmount | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func procedLottery (temp,val) = (temp + 1) | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | @Callable(i) | |
84 | 84 | func updateprobability (probability,amount,poolprice,probDecimal) = { | |
85 | 85 | let token = toBase64String(generatorRandomHash(i)) | |
86 | 86 | let payment = extract(i.payment) | |
87 | 87 | let totalRequiredAmount = (amount * poolprice) | |
88 | 88 | if ((totalRequiredAmount > payment.amount)) | |
89 | 89 | then throw("Payment is not equal price") | |
90 | 90 | else { | |
91 | 91 | let tempValue = match getString(this, lotteryPrices) { | |
92 | 92 | case a: String => | |
93 | 93 | a | |
94 | 94 | case _ => | |
95 | 95 | "" | |
96 | 96 | } | |
97 | 97 | let containKey = indexOf(tempValue, token) | |
98 | 98 | let storedTokensValues = match containKey { | |
99 | 99 | case _: Unit => | |
100 | 100 | ((tempValue + token) + ",") | |
101 | 101 | case x: Int => | |
102 | 102 | throw("Token is duplicated") | |
103 | 103 | case _ => | |
104 | 104 | throw("Match error") | |
105 | 105 | } | |
106 | 106 | let countTokens = getSizePriceArray() | |
107 | 107 | let updateLotteryPool = WriteSet([DataEntry((token + lotteryamount), amount), DataEntry((token + lotteryprobability), probability), DataEntry((token + lotteryPrice), poolprice), DataEntry((token + lotteryPrices), storedTokensValues), DataEntry((token + countOfPrices), countTokens), DataEntry((token + lotteryprobabilitydecimal), probDecimal), DataEntry((token + lastTokenRandomHash), token)]) | |
108 | 108 | ScriptResult(updateLotteryPool, TransferSet(nil)) | |
109 | 109 | } | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(i) | |
115 | 115 | func startlotto () = { | |
116 | 116 | let currentKey = toBase58String(i.caller.bytes) | |
117 | 117 | let randhash = randomizer(i) | |
118 | 118 | let sizeTempPrice = getSizePriceArray() | |
119 | 119 | let priceList = getPriceArray() | |
120 | 120 | let defaultValue = 1000 | |
121 | 121 | let randNumber = (toInt(randhash) % (1 * 1000)) | |
122 | 122 | let listF = ["priceList", "fsdfd"] | |
123 | + | let tempPrices = getStringValue(this, lotteryPrices) | |
124 | + | let trimPrices = take(tempPrices, (size(tempPrices) - 1)) | |
125 | + | let pricesArray = split(trimPrices, ",") | |
126 | + | let listSize = size(pricesArray) | |
123 | 127 | let amountS = { | |
124 | - | let $ | |
125 | - | let $ | |
126 | - | let $ | |
127 | - | if (($ | |
128 | - | then $ | |
128 | + | let $list45044540 = priceList | |
129 | + | let $size45044540 = size($list45044540) | |
130 | + | let $acc045044540 = 0 | |
131 | + | if (($size45044540 == 0)) | |
132 | + | then $acc045044540 | |
129 | 133 | else { | |
130 | - | let $ | |
131 | - | if (($ | |
132 | - | then $ | |
134 | + | let $acc145044540 = procedLottery($acc045044540, $list45044540[0]) | |
135 | + | if (($size45044540 == 1)) | |
136 | + | then $acc145044540 | |
133 | 137 | else { | |
134 | - | let $acc242934329 = procedLottery($acc142934329, $list42934329[1]) | |
135 | - | throw("List size exceed 1") | |
138 | + | let $acc245044540 = procedLottery($acc145044540, $list45044540[1]) | |
139 | + | if (($size45044540 == 2)) | |
140 | + | then $acc245044540 | |
141 | + | else { | |
142 | + | let $acc345044540 = procedLottery($acc245044540, $list45044540[2]) | |
143 | + | if (($size45044540 == 3)) | |
144 | + | then $acc345044540 | |
145 | + | else { | |
146 | + | let $acc445044540 = procedLottery($acc345044540, $list45044540[3]) | |
147 | + | if (($size45044540 == 4)) | |
148 | + | then $acc445044540 | |
149 | + | else { | |
150 | + | let $acc545044540 = procedLottery($acc445044540, $list45044540[4]) | |
151 | + | if (($size45044540 == 5)) | |
152 | + | then $acc545044540 | |
153 | + | else { | |
154 | + | let $acc645044540 = procedLottery($acc545044540, $list45044540[5]) | |
155 | + | throw("List size exceed 5") | |
156 | + | } | |
157 | + | } | |
158 | + | } | |
159 | + | } | |
136 | 160 | } | |
137 | 161 | } | |
138 | 162 | } | |
139 | 163 | let writeSets = WriteSet(nil) | |
140 | 164 | ScriptResult(writeSets, TransferSet(nil)) | |
141 | 165 | } | |
142 | 166 | ||
143 | 167 | ||
144 | 168 | @Verifier(tx) | |
145 | 169 | func verify () = match tx { | |
146 | 170 | case _: DataTransaction => | |
147 | 171 | true | |
148 | 172 | case _: SetScriptTransaction => | |
149 | 173 | true | |
150 | 174 | case _ => | |
151 | 175 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
152 | 176 | } | |
153 | 177 |
github/deemru/w8io/03bedc9 32.10 ms ◑![]()