tx · HEYUNyhNxe4BQhy8t9eWrpxxQUkPwPvUfitybtLeZLUs

3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg:  -0.01400000 Waves

2022.01.25 12:33 [1894261] smart account 3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg > SELF 0.00000000 Waves

{ "type": 13, "id": "HEYUNyhNxe4BQhy8t9eWrpxxQUkPwPvUfitybtLeZLUs", "fee": 1400000, "feeAssetId": null, "timestamp": 1643103246447, "version": 2, "chainId": 84, "sender": "3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg", "senderPublicKey": "2STNTL69cCYwATq85AKghuBwWjSiZGJcmmmLYVW5wQbx", "proofs": [ "4hxnMMjNenDjPMZcm9mm8WGTrzETnBAB2ihc9q5E3D2hAz2XYAmSQP9ZYRZ5UwYxuWEAXd2DwP3e6iAkLCSFTG5w" ], "script": "base64:AAIFAAAAAAAAAoQIAhIDCgEIGggKAUESA3JlZhoTCgFCEg5hdmFpbGFibGVQdW5rcxoQCgFDEgt3YXZlc05lZWRlZBoRCgFEEgxmaXJzdFBheW1lbnQaFQoBRRIQZmlyc3RQYXltZW50Qm9vbBoGCgFGEgF0GgYKAUcSAXcaFwoBSBISbGlzdEF2YWlsYWJsZVB1bmtzGgkKAUkSBHJhbmQaCwoBShIGcHVua0lkGgkKAUsSBG5hbWUaCQoBTBIEbWV0YRoKCgFNEgVhc3NldBoMCgFOEgdhc3NldElkGhMKAU8SDnJlZmVyYWxBZGRyZXNzGgcKAVASAnR4GgsKAVESBnZlcmlmeRoOCgFhEgltYXhTdXBwbHkaCgoBYhIFd2F2ZXMaEQoBYxIMZ2V0UHVua0lES2V5GgcKAWQSAmlkGhIKAWUSDXRyeUdldEludGVnZXIaCAoBZhIDa2V5GggKAWcSA3ZhbBoMCgFoEgckbWF0Y2gwGgYKAWkSAWIaEQoBahIMdHJ5R2V0U3RyaW5nGhIKAWsSDXRyeUdldEFkZHJlc3MaCQoBbBIEYWRkchoGCgFtEgFh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lnaHQEAAAAAU4JAAQ4AAAAAQUAAAABTQQAAAABTwkBAAAAAWsAAAABBQAAAAFBCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAxwdW5rc19zdXBwbHkJAABkAAAAAgUAAAABegAAAAAAAAAAAQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAA9hdmFpbGFibGVfcHVua3MJAAS5AAAAAgkABFEAAAACBQAAAAFIBQAAAAFJAgAAAAEsCQAETAAAAAIFAAAAAU0JAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAAWMAAAABBQAAAAFKCQACWAAAAAEFAAAAAU4JAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAAlgAAAABBQAAAAFOCQEAAAABYwAAAAEFAAAAAUoJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAXAAAAAGY2FsbGVyAAAAAAAAAAABBQAAAAFOCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAAU8JAABpAAAAAggFAAAAAUQAAAAGYW1vdW50AAAAAAAAAAAKBQAAAAR1bml0BQAAAANuaWwAAAABAAAAAVABAAAAAVEAAAAACQAB9AAAAAMIBQAAAAFQAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAABUAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAFQAAAAD3NlbmRlclB1YmxpY0tleR4ZqJ0=", "height": 1894261, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J62cjciWVHfYVMB4CwL8CgUXQ5dxEJKiB4spDToivn7n Next: 9DYQvaMj2UsCahB8Yz7uv1NmxVLHxS4oGAwVVagbpXeM Diff:
OldNewDifferences
113113 let listAvailablePunks = split(availablePunks, ",")
114114 let rand = getRandomNumber((maxSupply - totalPunksSupply), i.transactionId, height, 0)
115115 let punkId = listAvailablePunks[rand]
116- let name = ("WavesZombiePunk #" + punkId)
116+ let name = ("ZombiePunk #" + punkId)
117117 let meta = (((((("{\"id\": " + punkId) + ", \"type\": \"") + getTypePunk(punkId)) + "\", \"url\": \"") + getURL(punkId)) + "\"}")
118118 let asset = Issue(name, meta, 1, 0, false, unit, height)
119119 let assetId = calculateAssetId(asset)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let maxSupply = 1000
55
66 let waves = 300000000
77
88 func getPunkIDKey (id) = ("punk_" + id)
99
1010
1111 func tryGetInteger (key) = {
1212 let val = match getInteger(this, key) {
1313 case b: Int =>
1414 b
1515 case _ =>
1616 0
1717 }
1818 val
1919 }
2020
2121
2222 func tryGetString (key) = {
2323 let val = match getString(this, key) {
2424 case b: String =>
2525 b
2626 case _ =>
2727 ""
2828 }
2929 val
3030 }
3131
3232
3333 func tryGetAddress (addr) = {
3434 let val = match addressFromString(addr) {
3535 case a: Address =>
3636 a
3737 case a: Unit =>
3838 Address(base58'3Msrw9Kxa6RgHYQ63sSib9uESmaBU9gH6Gy')
3939 case _ =>
4040 throw("Match error")
4141 }
4242 val
4343 }
4444
4545
4646 func getTypePunk (id) = {
4747 let idINT = match parseInt(id) {
4848 case i: Int =>
4949 i
5050 case i: Unit =>
5151 0
5252 case _ =>
5353 throw("Match error")
5454 }
5555 if ((idINT == 0))
5656 then "ultra-rare"
5757 else if ((40 >= idINT))
5858 then "rare"
5959 else "unique"
6060 }
6161
6262
6363 func getURL (id) = {
6464 let idINT = match parseInt(id) {
6565 case i: Int =>
6666 i
6767 case i: Unit =>
6868 0
6969 case _ =>
7070 throw("Match error")
7171 }
7272 if ((idINT == 0))
7373 then (("https://wavespunks.com/zombie/z" + id) + ".gif")
7474 else (("https://wavespunks.com/zombie/z" + id) + ".png")
7575 }
7676
7777
7878 func getRandomNumber (variants,txId,heightBlock,offset) = {
7979 let randomSeedBlock = value(blockInfoByHeight((heightBlock - 1)))
8080 let randomHash = sha256_16Kb((txId + value(randomSeedBlock.vrf)))
8181 (toInt(randomHash, offset) % variants)
8282 }
8383
8484
8585 func calcWavesNeeded (totalPunksSupply) = if ((totalPunksSupply == 0))
8686 then waves
8787 else (((totalPunksSupply / 200) + 1) * waves)
8888
8989
9090 @Callable(i)
9191 func mint (ref) = {
9292 let totalPunksSupply = tryGetInteger("punks_supply")
9393 let availablePunks = tryGetString("available_punks")
9494 let wavesNeeded = calcWavesNeeded(totalPunksSupply)
9595 let firstPayment = value(i.payments[0])
9696 let firstPaymentBool = match firstPayment.assetId {
9797 case t: ByteVector =>
9898 true
9999 case w: Unit =>
100100 false
101101 case _ =>
102102 throw("Match error")
103103 }
104104 if ((totalPunksSupply == maxSupply))
105105 then throw("All punks are minted")
106106 else if ((availablePunks == ""))
107107 then throw("No punks available")
108108 else if (firstPaymentBool)
109109 then throw("Payment must be in Waves tokens only")
110110 else if ((wavesNeeded > firstPayment.amount))
111111 then throw("Insufficient funds")
112112 else {
113113 let listAvailablePunks = split(availablePunks, ",")
114114 let rand = getRandomNumber((maxSupply - totalPunksSupply), i.transactionId, height, 0)
115115 let punkId = listAvailablePunks[rand]
116- let name = ("WavesZombiePunk #" + punkId)
116+ let name = ("ZombiePunk #" + punkId)
117117 let meta = (((((("{\"id\": " + punkId) + ", \"type\": \"") + getTypePunk(punkId)) + "\", \"url\": \"") + getURL(punkId)) + "\"}")
118118 let asset = Issue(name, meta, 1, 0, false, unit, height)
119119 let assetId = calculateAssetId(asset)
120120 let referalAddress = tryGetAddress(ref)
121121 [IntegerEntry("punks_supply", (totalPunksSupply + 1)), StringEntry("available_punks", makeString(removeByIndex(listAvailablePunks, rand), ",")), asset, StringEntry(getPunkIDKey(punkId), toBase58String(assetId)), StringEntry(toBase58String(assetId), getPunkIDKey(punkId)), ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(referalAddress, (firstPayment.amount / 10), unit)]
122122 }
123123 }
124124
125125
126126 @Verifier(tx)
127127 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
128128

github/deemru/w8io/026f985 
26.58 ms