tx · 4HnJUdhRFsoCD9ymTfmfSDQbJXFayBp3Gh6Cu9aCggR4

3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh:  -0.01000000 Waves

2021.07.15 19:58 [1614989] smart account 3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh > SELF 0.00000000 Waves

{ "type": 13, "id": "4HnJUdhRFsoCD9ymTfmfSDQbJXFayBp3Gh6Cu9aCggR4", "fee": 1000000, "feeAssetId": null, "timestamp": 1626368328191, "version": 2, "chainId": 84, "sender": "3N51W4fn1aAAdypU26EGUwNZPr3zikN3vwh", "senderPublicKey": "D7edN6TZzQ6PbyWHGFdGMPJkkRNjR1Y32g7MmU7AXR73", "proofs": [ "4LVx2i9zs9GYfGC4iaQb3NBttR1ioJo8tnmCAAkJRbCRtKJXgE7W4JpumPLwLmHTkpkdko6Va1mS8Y8aXqRFct5U" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAAEAAAAAAlCTE9DS1NURVAAAAAAAAAAAAoAAAAACUlOR09UQ09TVAAAAAAAAAAACgAAAAADUkVTAQAAACD3MI5LvZDW9hdsE5mwaJiKnQDcPy9bxLj3SQ9cNYQcswEAAAAKcmFuZG9taXplcgAAAAEAAAADaW52BAAAAAhsYXN0UGxheQQAAAAHJG1hdGNoMAkABBwAAAACBQAAAAR0aGlzAgAAAAhsYXN0UGxheQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAABcwUAAAAHJG1hdGNoMAUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAEAAAAOR29sZE1pbmVyczIwMjEJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAMsAAAACBQAAAAhsYXN0UGxheQgFAAAAA2ludgAAAA10cmFuc2FjdGlvbklkCAUAAAADaW52AAAAD2NhbGxlclB1YmxpY0tleQgFAAAACWxhc3R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EAAAAAAAAAAAAHCQAETAAAAAIJAQAAAARCdXJuAAAAAgUAAAADUkVTAAAAAAAAAAAKCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQUAAAADbmZ0CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAxpbmdvdHNfY291bnQFAAAACW5ld0luZ290cwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAABmluZ290XwkAAaQAAAABBQAAAAluZXdJbmdvdHMJAAJYAAAAAQUAAAADbmZ0BQAAAANuaWwAAAAAUmuXVw==", "height": 1614989, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9p3A64kThR1jptuYhX8eTKvY4t1sgsLkHoD676d7dNRy Next: FwZQ6ea5UhPUtCnr3doyWupnW42F2tgFR4UATXKjPm3d Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BLOCKSTEP = 10
5+
6+let INGOTCOST = 10
57
68 let RES = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4'
79
5456 0
5557 }
5658 let newIngots = (ingots + 1)
57- let balance = assetBalance(i.caller, RES)
58- if ((10 > balance))
59- then throw("Not enough, need 1000 pieces")
59+ if ((size(i.payments) == 0))
60+ then throw("Payment not attached")
6061 else {
61- let issue = Issue("DEMO", "DEMO", 1, 0, false)
62- let nft = calculateAssetId(issue)
63-[Issue("DEMO", "DEMO", 1, 0, false), Burn(RES, 10), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft))]
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("DEMO", "DEMO", 1, 0, false)
69+ let nft = calculateAssetId(issue)
70+[Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false), Burn(RES, 10), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft))]
71+ }
6472 }
6573 }
6674
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BLOCKSTEP = 10
5+
6+let INGOTCOST = 10
57
68 let RES = base58'HdveNhSzDRiEib9RfQ5EAxmpFVica4EqvBFd2S4pdbD4'
79
810 func randomizer (inv) = {
911 let lastPlay = match getBinary(this, "lastPlay") {
1012 case s: ByteVector =>
1113 s
1214 case _: Unit =>
1315 base58'TGCTLFoHxJ8U7rcUofN'
1416 case _ =>
1517 throw("Match error")
1618 }
1719 let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
1820 sha256(rand)
1921 }
2022
2123
2224 @Callable(i)
2325 func goToMine () = {
2426 let caller = toBase58String(i.caller.bytes)
2527 let wait = match getInteger(this, ("wait_" + caller)) {
2628 case a: Int =>
2729 a
2830 case _ =>
2931 0
3032 }
3133 let newWait = (lastBlock.height + BLOCKSTEP)
3234 let randhash = randomizer(i)
3335 let count = (toInt(randhash) % 1000)
3436 if ((wait > lastBlock.height))
3537 then throw((("Still wait block " + toString(lastBlock.height)) + " for mining"))
3638 else [IntegerEntry(("wait_" + caller), newWait), ScriptTransfer(i.caller, count, RES)]
3739 }
3840
3941
4042
4143 @Callable(i)
4244 func craftIngot () = {
4345 let caller = toBase58String(i.caller.bytes)
4446 let craft = match getInteger(this, ("craft_" + caller)) {
4547 case a: Int =>
4648 a
4749 case _ =>
4850 0
4951 }
5052 let ingots = match getInteger(this, "ingots_count") {
5153 case a: Int =>
5254 a
5355 case _ =>
5456 0
5557 }
5658 let newIngots = (ingots + 1)
57- let balance = assetBalance(i.caller, RES)
58- if ((10 > balance))
59- then throw("Not enough, need 1000 pieces")
59+ if ((size(i.payments) == 0))
60+ then throw("Payment not attached")
6061 else {
61- let issue = Issue("DEMO", "DEMO", 1, 0, false)
62- let nft = calculateAssetId(issue)
63-[Issue("DEMO", "DEMO", 1, 0, false), Burn(RES, 10), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft))]
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("DEMO", "DEMO", 1, 0, false)
69+ let nft = calculateAssetId(issue)
70+[Issue(("INGOT" + toString(newIngots)), ("INGOT" + toString(newIngots)), 1, 0, false), Burn(RES, 10), ScriptTransfer(i.caller, 1, nft), IntegerEntry("ingots_count", newIngots), StringEntry(("ingot_" + toString(newIngots)), toBase58String(nft))]
71+ }
6472 }
6573 }
6674
6775

github/deemru/w8io/169f3d6 
38.43 ms