tx · 3GmXrZzCkcfkC3n42RAn4SijJxTnx7sGk1pYpnCUbPCN

3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh:  -0.01000000 Waves

2021.07.19 19:57 [1620759] smart account 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh > SELF 0.00000000 Waves

{ "type": 13, "id": "3GmXrZzCkcfkC3n42RAn4SijJxTnx7sGk1pYpnCUbPCN", "fee": 1000000, "feeAssetId": null, "timestamp": 1626713904525, "version": 2, "chainId": 84, "sender": "3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh", "senderPublicKey": "D7edN6TZzQ6PbyWHGFdGMPJkkRNjR1Y32g7MmU7AXR73", "proofs": [ "6LdbeYJkfYyenJ8oMwbDeqStW5Xw8TXnGzxmvgpsDboXoXdcg6vhLNEezZk9pYiJdr5zoTpLA6nhCLbS9QScCA4" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAEAAAAAAlCTE9DS1NURVAAAAAAAAAAAAoAAAAACUlOR09UQ09TVAAAAAAAAAAACgAAAAADUkVTAQAAACD3MI5LvZDW9hdsE5mwaJiKnQDcPy9bxLj3SQ9cNYQcswEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAAhsYXN0UGxheQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAEAAAAOR29sZE1pbmVyczIwMjEJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACBQAAAAhsYXN0UGxheQgFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAAAADaW52AAAAD2NhbGxlclB1YmxpY0tleQgFAAAACWxhc3RCbG9j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AACAgAAAAVJTkdPVAkAAaQAAAABBQAAAAluZXdJbmdvdHMJAAEsAAAAAgIAAAAFSU5HT1QJAAGkAAAAAQUAAAAJbmV3SW5nb3RzAAAAAAAAAAABAAAAAAAAAAAABwQAAAADbmZ0CQAEOAAAAAEFAAAABWlzc3VlCQAETAAAAAIJAQAAAARCdXJuAAAAAgUAAAADUkVTAAAAAAAAAAAKCQAETAAAAAIJAARCAAAABQkAASwAAAACAgAAAAVJTkdPVAkAAaQAAAABBQAAAAluZXdJbmdvdHMJAAEsAAAAAgIAAAAFSU5HT1QJAAGkAAAAAQUAAAAJbmV3SW5nb3RzAAAAAAAAAAABAAAAAAAAAAAABwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEFAAAAA25mdAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAMaW5nb3RzX2NvdW50BQAAAAluZXdJbmdvdHMJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAAZpbmdvdF8JAAGkAAAAAQUAAAAJbmV3SW5nb3RzCQACWAAAAAEFAAAAA25mdAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAAAZjcmFmdF8FAAAABmNhbGxlcgUAAAAIbmV3Q3JhZnQFAAAAA25pbAAAAAD2rIcn", "height": 1620759, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GSNYATbMQHiuL8haQzBnZ6rdzSDovVvmCJ44RNq5XfuW Next: 5umb5vahDZtLxMT269xKPfqptQhHXkf2ASHSm4dQBMQD Diff:
OldNewDifferences
5656 0
5757 }
5858 let newIngots = (ingots + 1)
59+ let newCraft = (lastBlock.height + BLOCKSTEP)
5960 if ((size(i.payments) == 0))
6061 then throw("Payment not attached")
61- else {
62- let payment = i.payments[0]
63- if ((payment.assetId != RES))
64- then throw("PAY IN RES TOKEN ONLY")
65- else if ((payment.amount != INGOTCOST))
66- then throw((("PAY " + toString(INGOTCOST)) + " RES TOKEN ONLY"))
67- else {
68- let issue = Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false)
69- let nft = calculateAssetId(issue)
70-[Burn(RES, 10), Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft))]
71- }
72- }
62+ else if ((craft > lastBlock.height))
63+ then throw((("Still wait block " + toString(craft)) + " for crafting"))
64+ else {
65+ let payment = i.payments[0]
66+ if ((payment.assetId != RES))
67+ then throw("PAY IN RES TOKEN ONLY")
68+ else if ((payment.amount != INGOTCOST))
69+ then throw((("PAY " + toString(INGOTCOST)) + " RES TOKEN ONLY"))
70+ else {
71+ let issue = Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false)
72+ let nft = calculateAssetId(issue)
73+[Burn(RES, 10), Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft)), IntegerEntry(("craft_" + caller), newCraft)]
74+ }
75+ }
7376 }
7477
7578
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BLOCKSTEP = 10
55
66 let INGOTCOST = 10
77
88 let RES = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4'
99
1010 func randomizer (inv) = {
1111 let lastPlay = match getBinary(this, "lastPlay") {
1212 case s: ByteVector =>
1313 s
1414 case _: Unit =>
1515 base58'TGCTLFoHxJ8U7rcUofN'
1616 case _ =>
1717 throw("Match error")
1818 }
1919 let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
2020 sha256(rand)
2121 }
2222
2323
2424 @Callable(i)
2525 func goToMine () = {
2626 let caller = toBase58String(i.caller.bytes)
2727 let wait = match getInteger(this, ("wait_" + caller)) {
2828 case a: Int =>
2929 a
3030 case _ =>
3131 0
3232 }
3333 let newWait = (lastBlock.height + BLOCKSTEP)
3434 let randhash = randomizer(i)
3535 let count = (toInt(randhash) % 1000)
3636 if ((wait > lastBlock.height))
3737 then throw((("Still wait block " + toString(wait)) + " for mining"))
3838 else [IntegerEntry(("wait_" + caller), newWait), ScriptTransfer(i.caller, count, RES)]
3939 }
4040
4141
4242
4343 @Callable(i)
4444 func craftIngot () = {
4545 let caller = toBase58String(i.caller.bytes)
4646 let craft = match getInteger(this, ("craft_" + caller)) {
4747 case a: Int =>
4848 a
4949 case _ =>
5050 0
5151 }
5252 let ingots = match getInteger(this, "ingots_count") {
5353 case a: Int =>
5454 a
5555 case _ =>
5656 0
5757 }
5858 let newIngots = (ingots + 1)
59+ let newCraft = (lastBlock.height + BLOCKSTEP)
5960 if ((size(i.payments) == 0))
6061 then throw("Payment not attached")
61- else {
62- let payment = i.payments[0]
63- if ((payment.assetId != RES))
64- then throw("PAY IN RES TOKEN ONLY")
65- else if ((payment.amount != INGOTCOST))
66- then throw((("PAY " + toString(INGOTCOST)) + " RES TOKEN ONLY"))
67- else {
68- let issue = Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false)
69- let nft = calculateAssetId(issue)
70-[Burn(RES, 10), Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft))]
71- }
72- }
62+ else if ((craft > lastBlock.height))
63+ then throw((("Still wait block " + toString(craft)) + " for crafting"))
64+ else {
65+ let payment = i.payments[0]
66+ if ((payment.assetId != RES))
67+ then throw("PAY IN RES TOKEN ONLY")
68+ else if ((payment.amount != INGOTCOST))
69+ then throw((("PAY " + toString(INGOTCOST)) + " RES TOKEN ONLY"))
70+ else {
71+ let issue = Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false)
72+ let nft = calculateAssetId(issue)
73+[Burn(RES, 10), Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft)), IntegerEntry(("craft_" + caller), newCraft)]
74+ }
75+ }
7376 }
7477
7578

github/deemru/w8io/026f985 
36.40 ms