tx · E4KrhfLXtqvpnVEHnu45yJiJYEXXbWw3hwWUhifwPuhh

3MxfEq17wZjAWQfckWycU9o4oTkvf9nfNQX:  -0.01000000 Waves

2021.12.13 10:15 [1832169] smart account 3MxfEq17wZjAWQfckWycU9o4oTkvf9nfNQX > SELF 0.00000000 Waves

{ "type": 13, "id": "E4KrhfLXtqvpnVEHnu45yJiJYEXXbWw3hwWUhifwPuhh", "fee": 1000000, "feeAssetId": null, "timestamp": 1639379758634, "version": 2, "chainId": 84, "sender": "3MxfEq17wZjAWQfckWycU9o4oTkvf9nfNQX", "senderPublicKey": "HUca7AqRs4Zs9sU1AFcufmBC4XpT4sN79aFScNRT4LxQ", "proofs": [ "4aCLxb89YW2cHDnVqddjCnQ8CuJbSzzMMMsPLuwEknAsFtxtsijHNkjnAwzwSof5i2GTCrxfH9pyoZG2eGKksPE4" ], "script": "base64:AAIFAAAAAAAAAAsIAhIAEgMKAQgSAAAAAAYAAAAABXRva2VuAQAAACDZi0CLArkkcZNdMZg+wWZc78jMPXwRedDDRg0bRciTFwAAAAAGdG9rZW5kAAAAAAAF9eEAAAAAAAdhaXJkcm9wCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUX+pzJtA2DV6Pr0xhS8z4foIVUAfq2c0IAAAAAAp0ZWFtQWRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUACYJT8ivNONGpFPWk1FdqVPAxApBcmLaAAAAAAhkZWFkbGluZQAAAAF9roOaAAAAAAAMYnVybmRlYWRsaW5lAAAACMRU9bEAAAAAAwAAAAFpAQAAAAVyZXNldAAAAAAJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAVidXJudAAAAAAAAAAAAAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAHZHJvcHBlZAAAAAA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Y2FsbGVyAAAABWJ5dGVzAgAAAAZfZXJyb3IFAAAAA25pbAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAAGX2Vycm9yBQAAAARtZXNzBQAAAANuaWwAAAAADgD9sQ==", "height": 1832169, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 45TQ1ASm7ScBMWgse5qhMHiPExM6GBMNWhLisdQnZRvi Next: HgWPajucG6fmBLaeJ1Rbd5w8E838Fy2RjCBkGXmcJKva Diff:
OldNewDifferences
105105 }
106106 let balance = assetBalance(airdrop, token)
107107 let sellamount = (1000 * tokend)
108+ let burnamount1 = (10 * sellamount)
109+ let burnamount2 = (20 * sellamount)
108110 let price1 = (1 * 100000000)
109111 let price2 = (2 * 100000000)
110112 let callerAdress = Address(i.caller.bytes)
111- let balanceok = if ((balance >= sellamount))
112- then true
113- else false
114113 let callerData = valueOrElse(getString(toBase58String(i.caller.bytes)), "")
115114 let callerReceived = if ((take(callerData, 8) == "received"))
116115 then true
124123 else false)
125124 then 1
126125 else 99
126+ let burnamount = if ((callerBuylevel == 1))
127+ then burnamount1
128+ else if ((callerBuylevel == 2))
129+ then burnamount2
130+ else 0
131+ let balanceok = if ((balance >= (sellamount + burnamount)))
132+ then true
133+ else false
127134 let callerCanBuy = if (if (callerReceived)
128135 then if ((callerBuylevel == 0))
129136 then true
148155 else ("" + (if (!(pmtok))
149156 then "not enough payment"
150157 else ("" + (if (!(balanceok))
151- then "ballance empty "
158+ then "you are lost... not enough ballance"
152159 else ""))))
153160 let datarecs = split(callerData, "|")
154161 let newdata = if ((callerBuylevel == 0))
164171 then true
165172 else false
166173 if (deal)
167- then [StringEntry(toBase58String(i.caller.bytes), newdata), ScriptTransfer(teamAdress, callerPrice, unit), ScriptTransfer(callerAdress, sellamount, token), DeleteEntry((toBase58String(i.caller.bytes) + "_error"))]
174+ then [StringEntry(toBase58String(i.caller.bytes), newdata), ScriptTransfer(teamAdress, callerPrice, unit), ScriptTransfer(callerAdress, sellamount, token), Burn(token, burnamount), DeleteEntry((toBase58String(i.caller.bytes) + "_error"))]
168175 else [StringEntry((toBase58String(i.caller.bytes) + "_error"), mess)]
169176 }
170177
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let token = base58'FeCdHqomybB47PWv1JVvfFpQ6WPmHGYgped6WAxpU7Nv'
55
66 let tokend = 100000000
77
88 let airdrop = Address(base58'3MxfEq17wZjAWQfckWycU9o4oTkvf9nfNQX')
99
1010 let teamAdress = Address(base58'3MovsLjXpJr9HD2vBqmAf7Gze6jwuRxX1fX')
1111
1212 let deadline = 1639310400000
1313
1414 let burndeadline = 9639332000000
1515
1616 @Callable(i)
1717 func reset () = [DeleteEntry(toBase58String(i.caller.bytes)), IntegerEntry("burnt", 0), IntegerEntry("dropped", 0), IntegerEntry("sold1", 0), IntegerEntry("sold2", 0), IntegerEntry("teamgift", 0), IntegerEntry("issued", (1000000000 * 100000000)), StringEntry("burningstage", "waiting"), DeleteEntry((toBase58String(i.caller.bytes) + "_error"))]
1818
1919
2020
2121 @Callable(i)
2222 func free (id58) = {
2323 let dropamount = (1000 * tokend)
2424 let teamgift = (10 * tokend)
2525 let trid = fromBase58String(id58)
2626 let callerAdress = Address(i.caller.bytes)
2727 let currenttime = match blockInfoByHeight(height) {
2828 case block: BlockInfo =>
2929 block.timestamp
3030 case _ =>
3131 throw("Can't find block")
3232 }
3333 let balance = assetBalance(airdrop, token)
3434 let burnamount = if (if ((currenttime > burndeadline))
3535 then (getStringValue("burningstage") == "waiting")
3636 else false)
3737 then balance
3838 else 0
3939 let isenough = if ((balance > dropamount))
4040 then true
4141 else false
4242 if ((isenough == isenough))
4343 then {
4444 let trexists = match transferTransactionById(trid) {
4545 case ttx: TransferTransaction =>
4646 true
4747 case _ =>
4848 false
4949 }
5050 let trtime = match transferTransactionById(trid) {
5151 case ttx: TransferTransaction =>
5252 ttx.timestamp
5353 case _ =>
5454 9999999999999
5555 }
5656 let trsender = match transferTransactionById(trid) {
5757 case ttx: TransferTransaction =>
5858 ttx.sender
5959 case _ =>
6060 airdrop
6161 }
6262 let received = if ((take(valueOrElse(getString(toBase58String(i.caller.bytes)), ""), 8) == "received"))
6363 then true
6464 else false
6565 let isprooved = if (if (if (if ((trtime > deadline))
6666 then true
6767 else (callerAdress != trsender))
6868 then true
6969 else received)
7070 then true
7171 else !(isenough))
7272 then false
7373 else true
7474 let result = if (trexists)
7575 then if ((trtime > deadline))
7676 then ("transaction is out of time range: " + toString(trtime))
7777 else ("" + (if ((callerAdress != trsender))
7878 then ((("it is incorrect sender: " + toString(callerAdress)) + " / ") + toString(trsender))
7979 else ("" + (if (received)
8080 then "allready received"
8181 else ("" + (if (isprooved)
8282 then "received"
8383 else ("" + (if (!(isenough))
8484 then (("airdrop ended: " + toString(getIntegerValue("burnt"))) + " burnt")
8585 else ""))))))))
8686 else "can`t find transaction"
8787 if ((burnamount > 0))
8888 then [StringEntry((toBase58String(i.caller.bytes) + "_error"), (("airdrop ended: " + toString(getIntegerValue("burnt"))) + " burnt")), Burn(token, burnamount), StringEntry("burningstage", "them all burnt"), IntegerEntry("burnt", (getIntegerValue("burnt") + burnamount))]
8989 else if (isprooved)
9090 then [ScriptTransfer(callerAdress, dropamount, token), ScriptTransfer(teamAdress, teamgift, token), StringEntry(toBase58String(i.caller.bytes), result), IntegerEntry("dropped", (getIntegerValue("dropped") + dropamount)), IntegerEntry("teamgift", (getIntegerValue("teamgift") + teamgift)), DeleteEntry((toBase58String(i.caller.bytes) + "_error"))]
9191 else [StringEntry((toBase58String(i.caller.bytes) + "_error"), result)]
9292 }
9393 else throw("Strict value is not equal to itself.")
9494 }
9595
9696
9797
9898 @Callable(i)
9999 func buy () = {
100100 let currenttime = match blockInfoByHeight(height) {
101101 case block: BlockInfo =>
102102 block.timestamp
103103 case _ =>
104104 throw("Can't find block")
105105 }
106106 let balance = assetBalance(airdrop, token)
107107 let sellamount = (1000 * tokend)
108+ let burnamount1 = (10 * sellamount)
109+ let burnamount2 = (20 * sellamount)
108110 let price1 = (1 * 100000000)
109111 let price2 = (2 * 100000000)
110112 let callerAdress = Address(i.caller.bytes)
111- let balanceok = if ((balance >= sellamount))
112- then true
113- else false
114113 let callerData = valueOrElse(getString(toBase58String(i.caller.bytes)), "")
115114 let callerReceived = if ((take(callerData, 8) == "received"))
116115 then true
117116 else false
118117 let callerBuylevel = if (if (callerReceived)
119118 then (size(split(callerData, "|")) == 1)
120119 else false)
121120 then 0
122121 else if (if (callerReceived)
123122 then (size(split(callerData, "|")) == 2)
124123 else false)
125124 then 1
126125 else 99
126+ let burnamount = if ((callerBuylevel == 1))
127+ then burnamount1
128+ else if ((callerBuylevel == 2))
129+ then burnamount2
130+ else 0
131+ let balanceok = if ((balance >= (sellamount + burnamount)))
132+ then true
133+ else false
127134 let callerCanBuy = if (if (callerReceived)
128135 then if ((callerBuylevel == 0))
129136 then true
130137 else (callerBuylevel == 1)
131138 else false)
132139 then true
133140 else false
134141 let callerPrice = if ((callerBuylevel == 0))
135142 then price1
136143 else if ((callerBuylevel == 1))
137144 then price2
138145 else 0
139146 let pmtok = if ((size(i.payments) == 1))
140147 then if (if (!(isDefined(i.payments[0].assetId)))
141148 then (i.payments[0].amount >= callerPrice)
142149 else false)
143150 then true
144151 else false
145152 else false
146153 let mess = if (!(callerCanBuy))
147154 then "not prooved for buy"
148155 else ("" + (if (!(pmtok))
149156 then "not enough payment"
150157 else ("" + (if (!(balanceok))
151- then "ballance empty "
158+ then "you are lost... not enough ballance"
152159 else ""))))
153160 let datarecs = split(callerData, "|")
154161 let newdata = if ((callerBuylevel == 0))
155162 then (datarecs[0] + "|bought1")
156163 else if ((callerBuylevel == 1))
157164 then (datarecs[0] + "|bought1|bought2")
158165 else ""
159166 let deal = if (if (if (balanceok)
160167 then callerCanBuy
161168 else false)
162169 then pmtok
163170 else false)
164171 then true
165172 else false
166173 if (deal)
167- then [StringEntry(toBase58String(i.caller.bytes), newdata), ScriptTransfer(teamAdress, callerPrice, unit), ScriptTransfer(callerAdress, sellamount, token), DeleteEntry((toBase58String(i.caller.bytes) + "_error"))]
174+ then [StringEntry(toBase58String(i.caller.bytes), newdata), ScriptTransfer(teamAdress, callerPrice, unit), ScriptTransfer(callerAdress, sellamount, token), Burn(token, burnamount), DeleteEntry((toBase58String(i.caller.bytes) + "_error"))]
168175 else [StringEntry((toBase58String(i.caller.bytes) + "_error"), mess)]
169176 }
170177
171178

github/deemru/w8io/026f985 
36.07 ms