tx · 97iEzscZb2Ntqmg32RWyvVYdZ7tiPWG1Do4UL5uHycLX

3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh:  -0.01400000 Waves

2021.07.22 21:10 [1625190] smart account 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh > SELF 0.00000000 Waves

{ "type": 13, "id": "97iEzscZb2Ntqmg32RWyvVYdZ7tiPWG1Do4UL5uHycLX", "fee": 1400000, "feeAssetId": null, "timestamp": 1626977487326, "version": 2, "chainId": 84, "sender": "3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh", "senderPublicKey": "D7edN6TZzQ6PbyWHGFdGMPJkkRNjR1Y32g7MmU7AXR73", "proofs": [ "E3AGT7o9bc1H7M8WdmQgEgVfqxxTErAhTHHV8zmSFDqsJfQpdnesMv3aWU6jmA3VoTfeSqhVPvMdFeCErcSba2j" ], "script": "base64:AAIFAAAAAAAAABUIAhIAEgMKAQESAwoBARIAEgMKAQEAAAAFAAAAAAlCTE9DS1NURVAAAAAAAAAAAAoAAAAACUlOR09UQ09TVAAAAAAAAAAD6AAAAAAIUExPVENPU1QAAAAAAAABhqAAAAAABWdMdW1wAQAAACD3MI5LvZDW9hdsE5mwaJiKnQDcPy9bxLj3SQ9cNYQcswEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAAhsYXN0TWluZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAEAAAAOR29sZE1pbmVyczIwMjEJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACBQAAAAhsYXN0UGxheQgFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAA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JAAACAAAAAQIAAAAbTkZUIFBheW1lbnQgd2Fzbid0IGF0dGFjaGVkAwkAAAAAAAACBQAAAAdhc3NldElkAgAAAAAJAAACAAAAAQkAASwAAAACAgAAABBDYW4ndCBmaW5kIElOR09UCQABpAAAAAEFAAAAA3VpZAQAAAAHcGF5bWVudAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAMJAAAAAAAAAgkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQHCQAAAgAAAAECAAAAATEDCQEAAAACIT0AAAACCAUAAAAHcGF5bWVudAAAAAdhc3NldElkCQACWQAAAAEFAAAAB2Fzc2V0SWQJAAACAAAAAQkAASwAAAACAgAAABdXcm9uZyBJbmdvdCBpbiBQYXltZW50IAUAAAAHYXNzZXRJZAMJAQAAAAIhPQAAAAIIBQAAAAdwYXltZW50AAAABmFtb3VudAAAAAAAAAAAAQkAAAIAAAABAgAAABNXcm9uZyBpbmdvdCdzIGNvdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAICAAAACWdpdmVuX2J5XwUAAAAGY2FsbGVyBQAAAAhuZXdHaXZlbgUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXnYgAAy", "height": 1625190, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DXXGmwcSycnyiaGqiKofSLZ4mb7NcmjhMwW9yJFHZJsf Next: Cjpgr9RroPaobTJ5VFMjrxxqdBrdsz7zvb7N2F8mUwYG Diff:
OldNewDifferences
170170 let payment = i.payments[0]
171171 if ((isDefined(payment.assetId) == false))
172172 then throw("1")
173- else if ((payment.assetId != toBytes(assetId)))
173+ else if ((payment.assetId != fromBase58String(assetId)))
174174 then throw(("Wrong Ingot in Payment " + assetId))
175175 else if ((payment.amount != 1))
176176 then throw("Wrong ingot's count")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BLOCKSTEP = 10
55
66 let INGOTCOST = 1000
77
88 let PLOTCOST = 100000
99
1010 let gLump = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4'
1111
1212 func randomizer (inv) = {
1313 let lastPlay = match getBinary(this, "lastMine") {
1414 case s: ByteVector =>
1515 s
1616 case _: Unit =>
1717 base58'TGCTLFoHxJ8U7rcUofN'
1818 case _ =>
1919 throw("Match error")
2020 }
2121 let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
2222 sha256(rand)
2323 }
2424
2525
2626 @Callable(i)
2727 func goToMine () = {
2828 let caller = toBase58String(i.caller.bytes)
2929 let wait = match getInteger(this, ("wait_" + caller)) {
3030 case a: Int =>
3131 a
3232 case _ =>
3333 0
3434 }
3535 let newWait = (lastBlock.height + BLOCKSTEP)
3636 let randhash = randomizer(i)
3737 let count = (toInt(randhash) % 1000)
3838 if ((wait > lastBlock.height))
3939 then throw((("Wait block " + toString(wait)) + " for mining again"))
4040 else [IntegerEntry(("wait_" + caller), newWait), ScriptTransfer(i.caller, count, gLump), BinaryEntry("lastMine", randhash)]
4141 }
4242
4343
4444
4545 @Callable(i)
4646 func craftIngot (count) = {
4747 let caller = toBase58String(i.caller.bytes)
4848 let craft = match getInteger(this, ("craft_" + caller)) {
4949 case a: Int =>
5050 a
5151 case _ =>
5252 0
5353 }
5454 let ingots = match getInteger(this, "ingots_count") {
5555 case a: Int =>
5656 a
5757 case _ =>
5858 0
5959 }
6060 let newIngots = (ingots + 1)
6161 let newCraft = (lastBlock.height + BLOCKSTEP)
6262 if ((size(i.payments) == 0))
6363 then throw("Payment wasn't attached")
6464 else if ((craft > lastBlock.height))
6565 then throw((("Wait block " + toString(craft)) + " for crafting again"))
6666 else if (if (if ((count != 1))
6767 then (count != 10)
6868 else false)
6969 then (count != 50)
7070 else false)
7171 then throw("Wrong ingot's weight!")
7272 else {
7373 let payment = i.payments[0]
7474 if ((payment.assetId != gLump))
7575 then throw("Payment only in gLump")
7676 else if ((payment.amount != (INGOTCOST * count)))
7777 then throw((("Payment expected " + toString((INGOTCOST * count))) + " gLump"))
7878 else {
7979 let issueName = ("INGOT" + toString(newIngots))
8080 let issueDesc = (((((("{\"weight\":" + toString(count)) + ",\"uid\":") + toString(newIngots)) + ",\"made_by\":\"") + caller) + "\"}")
8181 let issue = Issue(issueName, issueDesc, 1, 0, false)
8282 let nft = calculateAssetId(issue)
8383 [Burn(gLump, (INGOTCOST * count)), Issue(issueName, issueDesc, 1, 0, false), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft)), IntegerEntry(("craft_" + caller), newCraft), IntegerEntry(("weight_" + toBase58String(nft)), count)]
8484 }
8585 }
8686 }
8787
8888
8989
9090 @Callable(i)
9191 func buyPlot (pSize) = {
9292 let caller = toBase58String(i.caller.bytes)
9393 let plotSize = match getInteger(this, ("plot_" + caller)) {
9494 case a: Int =>
9595 a
9696 case _ =>
9797 0
9898 }
9999 if ((plotSize > 0))
100100 then throw("You already have a plot!")
101101 else if (if ((0 > plotSize))
102102 then true
103103 else (plotSize > 1000))
104104 then throw("Correct size value from 1 to 1000")
105105 else {
106106 let payment = i.payments[0]
107107 if (isDefined(payment.assetId))
108108 then throw("Payment only in WAVES")
109109 else if ((payment.amount != (pSize * PLOTCOST)))
110110 then throw((("Payment expected " + toString((pSize * PLOTCOST))) + " WAVELET"))
111111 else [IntegerEntry(("plot_" + caller), pSize)]
112112 }
113113 }
114114
115115
116116
117117 @Callable(i)
118118 func goToPlot () = {
119119 let caller = toBase58String(i.caller.bytes)
120120 let plotSize = match getInteger(this, ("plot_" + caller)) {
121121 case a: Int =>
122122 a
123123 case _ =>
124124 0
125125 }
126126 let wait = match getInteger(this, ("wait_" + caller)) {
127127 case a: Int =>
128128 a
129129 case _ =>
130130 0
131131 }
132132 let newWait = (lastBlock.height + BLOCKSTEP)
133133 let newPlotSize = (plotSize - 1)
134134 if ((0 >= plotSize))
135135 then throw("Plot is empty, buy new!")
136136 else if ((wait > lastBlock.height))
137137 then throw((("Wait block " + toString(wait)) + " for mining again"))
138138 else [IntegerEntry(("wait_" + caller), newWait), ScriptTransfer(i.caller, 1000, gLump), IntegerEntry(("plot_" + caller), newPlotSize)]
139139 }
140140
141141
142142
143143 @Callable(i)
144144 func giveIngot (uid) = {
145145 let caller = toBase58String(i.caller.bytes)
146146 let assetId = match getString(this, ("ingot_" + toString(uid))) {
147147 case a: String =>
148148 a
149149 case _ =>
150150 ""
151151 }
152152 let given = match getInteger(this, ("given_by_" + caller)) {
153153 case a: Int =>
154154 a
155155 case _ =>
156156 0
157157 }
158158 let weight = match getInteger(this, ("weight_" + assetId)) {
159159 case a: Int =>
160160 a
161161 case _ =>
162162 0
163163 }
164164 let newGiven = (given + weight)
165165 if ((size(i.payments) == 0))
166166 then throw("NFT Payment wasn't attached")
167167 else if ((assetId == ""))
168168 then throw(("Can't find INGOT" + toString(uid)))
169169 else {
170170 let payment = i.payments[0]
171171 if ((isDefined(payment.assetId) == false))
172172 then throw("1")
173- else if ((payment.assetId != toBytes(assetId)))
173+ else if ((payment.assetId != fromBase58String(assetId)))
174174 then throw(("Wrong Ingot in Payment " + assetId))
175175 else if ((payment.amount != 1))
176176 then throw("Wrong ingot's count")
177177 else [IntegerEntry(("given_by_" + caller), newGiven)]
178178 }
179179 }
180180
181181
182182 @Verifier(tx)
183183 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
184184

github/deemru/w8io/026f985 
28.32 ms