tx · 5CPFjjECF7DS9Xr2G3MRdgL5dnuv47k4crptHebLPjqx

3NBxmy6co128zY2x4nz4tdYE7LBLz2RXHuB:  -0.04000000 Waves

2022.03.21 20:53 [1974024] smart account 3NBxmy6co128zY2x4nz4tdYE7LBLz2RXHuB > SELF 0.00000000 Waves

{ "type": 13, "id": "5CPFjjECF7DS9Xr2G3MRdgL5dnuv47k4crptHebLPjqx", "fee": 4000000, "feeAssetId": null, "timestamp": 1647885194127, "version": 2, "chainId": 84, "sender": "3NBxmy6co128zY2x4nz4tdYE7LBLz2RXHuB", "senderPublicKey": "5HaVHwTnAqmQF8TLd8vAqExCLoKuBKoJ4wXKhVbSSapf", "proofs": [ "2Sjv8nhH5NDcZJipdyWskF9CZ3Qvw7vyqHdS4euAVspFLRmwxLF8foaSrTTHtGoy4AqMqo5AFCyLwgDa623d72rX" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAAAAAAAAEAAAABaQEAAAAFemFyQXQAAAAABAAAAAN1bmkAAAAAAAAPQkAEAAAAA3RpYwMJAABmAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABAgAAABhObyBNb25leSBObyBGdW5ueSBIb25leS4DCQAAZgAAAAIIBQAAAAN0aWMAAAAGYW1vdW50AAAAAAAAD0I/BAAAAANnSUQJAASxAAAAAQgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAQAAAABcgkAAGQAAAACCQAAagAAAAIJAABkAAAAAgkAAGQAAAACCQAAZAAAAAIIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0CAUAAAAJbGFzdEJsb2NrAAAACXRpbWVzdGFtcAgFAAAACWxhc3RCbG9jawAAAApiYXNlVGFyZ2V0BQAAAANnSUQAAAAAAAAAAAYAAAAAAAAAAAEJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIJAAGkAAAAAQgFAAAAAWkAAAADZmVlCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkAAGgAAAACCQAAaAAAAAIFAAAAAXIAAAAAAAAAAAMFAAAAA3VuaQUAAAAEdW5pdAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAANOdW0JAAGkAAAAAQUAAAABcgUAAAADbmlsCQAAAgAAAAECAAAAFlRpY2tldHMgYXJlIDAuMDEgV0FWRVMAAAAAOrT2DQ==", "height": 1974024, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 91RYbNxjWzW8A3oXsvNJAUe6ccHg8Q1VQ2cP2ZXerxUN Next: 9hyMXNomGqCdMx9r1TWhFP1cVBKETBoafwK2Fmg9oTa1 Full:
OldNewDifferences
1-{-# STDLIB_VERSION 2 #-}
2-{-# CONTENT_TYPE EXPRESSION #-}
3-let me = tx.sender
4-let oracle = extract(addressFromString("3NCzaYTNDGtR8zf9yfcqePFjCqFx9S5zhs4"))
5-let minWithdrawFee = 500000
6-let registerBetTxFee = 500000
7-match tx {
8- case withdrawTx: TransferTransaction =>
9- let txId = extract(getString(me, (toBase58String(tx.proofs[1]) + "_withdraw")))
10- match transactionById(tx.proofs[1]) {
11- case paymentTx: TransferTransaction =>
12- let isPaymentTookPlace = if ((txId == toBase58String(tx.id)))
13- then sigVerify(tx.bodyBytes, tx.proofs[0], paymentTx.senderPublicKey)
14- else false
15- let feesKey = (toBase58String(tx.proofs[1]) + "_withdraw_fees")
16- let dataTxsFees = extract(getInteger(me, feesKey))
17- let guessUnit = getBinary(me, toBase58String(tx.proofs[1]))
18- let correctAmount = if (!(isDefined(guessUnit)))
19- then ((paymentTx.amount - dataTxsFees) - withdrawTx.fee)
20- else {
21- let guess = extract(guessUnit)
22- let type = take(guess, 1)
23- let val = drop(guess, 1)
24- let key = extract(getString(me, (toBase58String(tx.proofs[1]) + "_round")))
25- let valComplex = extract(getBinary(oracle, key))
26- let koeff = if ((type == drop(toBytes(0), 7)))
27- then 36
28- else if ((type == drop(toBytes(1), 7)))
29- then 2
30- else if ((type == drop(toBytes(2), 7)))
31- then 2
32- else if ((type == drop(toBytes(3), 7)))
33- then 2
34- else if ((type == drop(toBytes(4), 7)))
35- then 3
36- else if ((type == drop(toBytes(5), 7)))
37- then 3
38- else 0
39- ((((paymentTx.amount - registerBetTxFee) * koeff) - dataTxsFees) - withdrawTx.fee)
40- }
41- if (if (if (isPaymentTookPlace)
42- then true
43- else throw("There was no bet"))
44- then if ((withdrawTx.amount == correctAmount))
45- then true
46- else throw(("Amount is incorrect. Correct amount is " + toString(correctAmount)))
47- else false)
48- then if (if (!(isDefined(withdrawTx.feeAssetId)))
49- then !(isDefined(withdrawTx.assetId))
50- else false)
51- then true
52- else throw("Withdraw and fee must be in WAVES")
53- else false
54- case _ =>
55- false
56- }
57- case dtx: DataTransaction =>
58- if ((size(dtx.data) == 3))
59- then {
60- let minBet = 50000000
61- let maxSumBet = 1000000000
62- let paymentTxIdStr = extract(dtx.data[0].key)
63- let guessStr = extract(getString(dtx.data, paymentTxIdStr))
64- let paymentRoundKey = (paymentTxIdStr + "_round")
65- let paymentRound = extract(getString(dtx.data, paymentRoundKey))
66- let sumBetsOld = if (isDefined(getInteger(me, (paymentRound + "_betsSum"))))
67- then extract(getInteger(me, (paymentRound + "_betsSum")))
68- else 0
69- let sumBetsNew = extract(getInteger(dtx.data, (paymentRound + "_betsSum")))
70- let itsTooLate = isDefined(getString(me, (paymentRound + "_stop")))
71- let isPaymentAlreadyMentioned = isDefined(getString(me, paymentTxIdStr))
72- let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
73- match paymentTx {
74- case paymentTx: TransferTransaction =>
75- let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
76- let correctSumBets = ((sumBetsOld + paymentTx.amount) - dtx.fee)
77- if (if (if (if (if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me))
78- then true
79- else throw("Incorrect recipient of the payment"))
80- then if (!(isPaymentAlreadyMentioned))
81- then true
82- else throw("This transfer is already used as a bet")
83- else false)
84- then if ((sumBetsNew == correctSumBets))
85- then true
86- else throw(("Wrong value for Sum of Bets. Must be " + toString(correctSumBets)))
87- else false)
88- then if ((maxSumBet > sumBetsNew))
89- then true
90- else throw(((("Maximum amount of bets for round " + toString(maxSumBet)) + ". With your bet it's ") + toString(sumBetsNew)))
91- else false)
92- then if ((dtx.fee == registerBetTxFee))
93- then true
94- else throw(("Fee of bet registration data transaction must be " + toString(registerBetTxFee)))
95- else false)
96- then if (((paymentTx.amount - registerBetTxFee) >= minBet))
97- then true
98- else throw(((("Your Bet amount is less then minimal bet " + toString(minBet)) + ". Payment amount for such bet must be ") + toString((minBet + registerBetTxFee))))
99- else false)
100- then if (!(isDefined(paymentTx.feeAssetId)))
101- then true
102- else throw("Paymnet must be in WAVES")
103- else false)
104- then if (!(itsTooLate))
105- then true
106- else throw("It's too late to play this round. Try next one")
107- else false
108- case _ =>
109- false
110- }
111- }
112- else if ((size(dtx.data) == 2))
113- then {
114- let isDataCountOk = (size(dtx.data) == 2)
115- let paymentTxIdStr = dropRight(extract(dtx.data[0].key), 9)
116- let feesKey = (paymentTxIdStr + "_withdraw_fees")
117- let paymentTx = transactionById(fromBase58String(paymentTxIdStr))
118- let newFees = extract(getInteger(dtx.data, feesKey))
119- let oldFeesUnit = getInteger(me, feesKey)
120- let oldFees = if (isDefined(oldFeesUnit))
121- then extract(oldFeesUnit)
122- else 0
123- let isFeeCorrect = (newFees == (oldFees + dtx.fee))
124- let withdrawTxIdUnit = getString(me, paymentTxIdStr)
125- let isPaymentAlreadyMentioned = isDefined(withdrawTxIdUnit)
126- let withdrawTransactionId = fromBase58String(extract(withdrawTxIdUnit))
127- match paymentTx {
128- case paymentTx: TransferTransaction =>
129- let isDtxSignedByPayer = sigVerify(dtx.bodyBytes, dtx.proofs[0], paymentTx.senderPublicKey)
130- if (if (if (if (if ((addressFromRecipient(paymentTx.recipient) == me))
131- then if (!(isPaymentAlreadyMentioned))
132- then true
133- else !(isDefined(transactionById(withdrawTransactionId)))
134- else false)
135- then isDtxSignedByPayer
136- else false)
137- then isFeeCorrect
138- else false)
139- then isDataCountOk
140- else false)
141- then {
142- let guess = extract(getBinary(me, paymentTxIdStr))
143- let type = take(guess, 1)
144- let key = extract(getString(me, (paymentTxIdStr + "_round")))
145- let valComplex = extract(getBinary(oracle, key))
146- let koeff = if ((type == drop(toBytes(0), 7)))
147- then 36
148- else if ((type == drop(toBytes(1), 7)))
149- then 2
150- else if ((type == drop(toBytes(2), 7)))
151- then 2
152- else if ((type == drop(toBytes(3), 7)))
153- then 2
154- else if ((type == drop(toBytes(4), 7)))
155- then 3
156- else if ((type == drop(toBytes(5), 7)))
157- then 3
158- else 0
159- let valReal = if ((type == drop(toBytes(0), 7)))
160- then drop(take(valComplex, 2), 1)
161- else if ((type == drop(toBytes(1), 7)))
162- then drop(take(valComplex, 3), 2)
163- else if ((type == drop(toBytes(2), 7)))
164- then drop(take(valComplex, 4), 3)
165- else if ((type == drop(toBytes(3), 7)))
166- then drop(take(valComplex, 5), 4)
167- else if ((type == drop(toBytes(4), 7)))
168- then drop(take(valComplex, 6), 5)
169- else if ((type == drop(toBytes(5), 7)))
170- then drop(take(valComplex, 7), 6)
171- else throw("Incorrect type of guess provided")
172- let isWin = (drop(guess, 1) == valReal)
173- let isMoneyStillEnough = ((((paymentTx.amount - registerBetTxFee) * koeff) + minWithdrawFee) > newFees)
174- if (if (isWin)
175- then true
176- else throw("You didn't guess"))
177- then if (isMoneyStillEnough)
178- then true
179- else throw("Not enough money for withdraw")
180- else false
181- }
182- else false
183- case _ =>
184- false
185- }
186- }
187- else false
188- case _ =>
189- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
190-}
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+
5+
6+@Callable(i)
7+func zarAt () = {
8+ let uni = 1000000
9+ let tic = if ((size(i.payments) > 0))
10+ then i.payments[0]
11+ else throw("No Money No Funny Honey.")
12+ if ((tic.amount > 999999))
13+ then {
14+ let gID = toInt(i.transactionId)
15+ let r = (((((lastBlock.height + lastBlock.timestamp) + lastBlock.baseTarget) + gID) % 6) + 1)
16+[StringEntry(toString(i.caller), toString(i.fee)), ScriptTransfer(i.caller, ((r * 3) * uni), unit), StringEntry("Num", toString(r))]
17+ }
18+ else throw("Tickets are 0.01 WAVES")
19+ }
20+
21+

github/deemru/w8io/169f3d6 
27.60 ms