tx · 3m6Bc7ohHMZoqk32h7X4u7KgAQRJpKcABXZNzsF8KCTd

3MxfEq17wZjAWQfckWycU9o4oTkvf9nfNQX:  -0.01000000 Waves

2021.12.12 20:15 [1831327] smart account 3MxfEq17wZjAWQfckWycU9o4oTkvf9nfNQX > SELF 0.00000000 Waves

{ "type": 13, "id": "3m6Bc7ohHMZoqk32h7X4u7KgAQRJpKcABXZNzsF8KCTd", "fee": 1000000, "feeAssetId": null, "timestamp": 1639329360433, "version": 2, "chainId": 84, "sender": "3MxfEq17wZjAWQfckWycU9o4oTkvf9nfNQX", "senderPublicKey": "HUca7AqRs4Zs9sU1AFcufmBC4XpT4sN79aFScNRT4LxQ", "proofs": [ "idKEwq1nCztQSGMDyAhAtGHRmsTdoWtFrZrXQ15Eprx5VThNUNeZbcKsDM7kwWCeP7kszi6yYTvcJNdzoWmRsFz" ], "script": "base64:AAIFAAAAAAAAAAsIAhIAEgMKAQgSAAAAAAQAAAAABXRva2VuAQAAACC3J58vH5VvqrKqhwl3eYjLul0f2q7s7Aut9MtxiOp72AAAAAAGdG9rZW5kAAAAAAAF9eEAAAAAAAdhaXJkcm9wCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUX+pzJtA2DV6Pr0xhS8z4foIVUAfq2c0IAAAAAAp0ZWFtQWRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUACYJT8ivNONGpFPWk1FdqVPAxApBcmLaAAAAAwAAAAFpAQAAAAVyZXNldAAAAAAJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAVidXJudAAAAAAAAAAAAAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAHZHJvcHBlZAAAAAAAAAAAAAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAFc29sZDE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RhdGFyZWNzAAAAAAAAAAAAAgAAAAh8Ym91Z2h0MQMJAAAAAAAAAgUAAAAOY2FsbGVyQnV5bGV2ZWwAAAAAAAAAAAEJAAEsAAAAAgkAAZEAAAACBQAAAAhkYXRhcmVjcwAAAAAAAAAAAAIAAAAQfGJvdWdodDF8Ym91Z2h0MgIAAAAABAAAAARkZWFsAwMDBQAAAAliYWxhbmNlb2sFAAAADGNhbGxlckNhbkJ1eQcFAAAABXBtdG9rBwYHAwUAAAAEZGVhbAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMFAAAAB25ld2RhdGEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAKdGVhbUFkcmVzcwUAAAALY2FsbGVyUHJpY2UFAAAABHVuaXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAMY2FsbGVyQWRyZXNzBQAAAApzZWxsYW1vdW50BQAAAAV0b2tlbgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQABLAAAAAIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAAGX2Vycm9yBQAAAANuaWwJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAABl9lcnJvcgUAAAAEbWVzcwUAAAADbmlsAAAAAHznuGU=", "height": 1831327, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2LuKF4SEHqb22WJMTpQmY2hRja5UDkD2RnyP1iSgRha3 Next: FJDmXpXbiARPnxxjfckzubLMHrKVkdmtQaFFo9GQBUm4 Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let token = base58'GkDwhWL6fJffdmvUc6agDHvVZYWi6uX4VKX12eUU4FzV'
4+let token = base58'DKxej2DXCbLmBdgXLRhDk8XC1eQC7AfYmbHAnhGm9f3m'
55
66 let tokend = 100000000
77
2121 let trid = fromBase58String(id58)
2222 let callerAdress = Address(i.caller.bytes)
2323 let deadline = 1639310400000
24- let burndeadline = 1639328400000
24+ let burndeadline = 1639330200000
2525 let currenttime = match blockInfoByHeight(height) {
2626 case block: BlockInfo =>
2727 block.timestamp
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let token = base58'GkDwhWL6fJffdmvUc6agDHvVZYWi6uX4VKX12eUU4FzV'
4+let token = base58'DKxej2DXCbLmBdgXLRhDk8XC1eQC7AfYmbHAnhGm9f3m'
55
66 let tokend = 100000000
77
88 let airdrop = Address(base58'3MxfEq17wZjAWQfckWycU9o4oTkvf9nfNQX')
99
1010 let teamAdress = Address(base58'3MovsLjXpJr9HD2vBqmAf7Gze6jwuRxX1fX')
1111
1212 @Callable(i)
1313 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"))]
1414
1515
1616
1717 @Callable(i)
1818 func free (id58) = {
1919 let dropamount = (1000 * tokend)
2020 let teamgift = (10 * tokend)
2121 let trid = fromBase58String(id58)
2222 let callerAdress = Address(i.caller.bytes)
2323 let deadline = 1639310400000
24- let burndeadline = 1639328400000
24+ let burndeadline = 1639330200000
2525 let currenttime = match blockInfoByHeight(height) {
2626 case block: BlockInfo =>
2727 block.timestamp
2828 case _ =>
2929 throw("Can't find block")
3030 }
3131 let balance = assetBalance(airdrop, token)
3232 let burnamount = if (if ((currenttime > burndeadline))
3333 then (getStringValue("burningstage") == "waiting")
3434 else false)
3535 then ((balance - dropamount) - teamgift)
3636 else 0
3737 let isenough = if ((balance > dropamount))
3838 then true
3939 else false
4040 if ((isenough == isenough))
4141 then {
4242 let trexists = match transferTransactionById(trid) {
4343 case ttx: TransferTransaction =>
4444 true
4545 case _ =>
4646 false
4747 }
4848 let trtime = match transferTransactionById(trid) {
4949 case ttx: TransferTransaction =>
5050 ttx.timestamp
5151 case _ =>
5252 9999999999999
5353 }
5454 let trsender = match transferTransactionById(trid) {
5555 case ttx: TransferTransaction =>
5656 ttx.sender
5757 case _ =>
5858 airdrop
5959 }
6060 let received = if ((take(valueOrElse(getString(toBase58String(i.caller.bytes)), ""), 8) == "received"))
6161 then true
6262 else false
6363 let isprooved = if (if (if (if ((trtime > deadline))
6464 then true
6565 else (callerAdress != trsender))
6666 then true
6767 else received)
6868 then true
6969 else !(isenough))
7070 then false
7171 else true
7272 let result = if (trexists)
7373 then if ((trtime > deadline))
7474 then ("transaction is out of time range: " + toString(trtime))
7575 else ("" + (if ((callerAdress != trsender))
7676 then ((("it is incorrect sender: " + toString(callerAdress)) + " / ") + toString(trsender))
7777 else ("" + (if (received)
7878 then getStringValue(toBase58String(i.caller.bytes))
7979 else ("" + (if (isprooved)
8080 then "received"
8181 else ("" + (if (!(isenough))
8282 then (("airdrop ended: " + toString(getIntegerValue("burnt"))) + " burnt")
8383 else ""))))))))
8484 else "can`t find transaction"
8585 if ((burnamount > 0))
8686 then [StringEntry(toBase58String(i.caller.bytes), result), Burn(token, burnamount), StringEntry("burningstage", "them all burnt"), IntegerEntry("burnt", (getIntegerValue("burnt") + burnamount))]
8787 else if (isprooved)
8888 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"))]
8989 else [StringEntry((toBase58String(i.caller.bytes) + "_error"), result)]
9090 }
9191 else throw("Strict value is not equal to itself.")
9292 }
9393
9494
9595
9696 @Callable(i)
9797 func buy () = {
9898 let currenttime = match blockInfoByHeight(height) {
9999 case block: BlockInfo =>
100100 block.timestamp
101101 case _ =>
102102 throw("Can't find block")
103103 }
104104 let balance = assetBalance(airdrop, token)
105105 let sellamount = (1000 * tokend)
106106 let price1 = (1 * 100000000)
107107 let price2 = (2 * 100000000)
108108 let callerAdress = Address(i.caller.bytes)
109109 let balanceok = if ((balance >= sellamount))
110110 then true
111111 else false
112112 let callerData = valueOrElse(getString(toBase58String(i.caller.bytes)), "")
113113 let callerReceived = if ((take(callerData, 8) == "received"))
114114 then true
115115 else false
116116 let callerBuylevel = if (if (callerReceived)
117117 then (size(split(callerData, "|")) == 1)
118118 else false)
119119 then 0
120120 else if (if (callerReceived)
121121 then (size(split(callerData, "|")) == 2)
122122 else false)
123123 then 1
124124 else 99
125125 let callerCanBuy = if (if (callerReceived)
126126 then if ((callerBuylevel == 0))
127127 then true
128128 else (callerBuylevel == 1)
129129 else false)
130130 then true
131131 else false
132132 let callerPrice = if ((callerBuylevel == 0))
133133 then price1
134134 else if ((callerBuylevel == 1))
135135 then price2
136136 else 0
137137 let pmtok = if ((size(i.payments) == 1))
138138 then if (if (!(isDefined(i.payments[0].assetId)))
139139 then (i.payments[0].amount >= callerPrice)
140140 else false)
141141 then true
142142 else false
143143 else false
144144 let mess = if (!(callerCanBuy))
145145 then "not prooved for buy"
146146 else ("" + (if (!(pmtok))
147147 then "not enough payment"
148148 else ("" + (if (!(balanceok))
149149 then "ballance empty "
150150 else ""))))
151151 let datarecs = split(callerData, "|")
152152 let newdata = if ((callerBuylevel == 0))
153153 then (datarecs[0] + "|bought1")
154154 else if ((callerBuylevel == 1))
155155 then (datarecs[0] + "|bought1|bought2")
156156 else ""
157157 let deal = if (if (if (balanceok)
158158 then callerCanBuy
159159 else false)
160160 then pmtok
161161 else false)
162162 then true
163163 else false
164164 if (deal)
165165 then [StringEntry(toBase58String(i.caller.bytes), newdata), ScriptTransfer(teamAdress, callerPrice, unit), ScriptTransfer(callerAdress, sellamount, token), DeleteEntry((toBase58String(i.caller.bytes) + "_error"))]
166166 else [StringEntry((toBase58String(i.caller.bytes) + "_error"), mess)]
167167 }
168168
169169

github/deemru/w8io/026f985 
26.36 ms