tx · J62cjciWVHfYVMB4CwL8CgUXQ5dxEJKiB4spDToivn7n

3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg:  -0.01000000 Waves

2022.01.25 09:29 [1894070] smart account 3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg > SELF 0.00000000 Waves

{ "type": 13, "id": "J62cjciWVHfYVMB4CwL8CgUXQ5dxEJKiB4spDToivn7n", "fee": 1000000, "feeAssetId": null, "timestamp": 1643092170486, "version": 2, "chainId": 84, "sender": "3MydZBLyjvR1dzf6nzucCbpCDZgaL4zWPwg", "senderPublicKey": "2STNTL69cCYwATq85AKghuBwWjSiZGJcmmmLYVW5wQbx", "proofs": [ "23r1R5Q4BhRH2BdXc8FjFMrHNL7dkHnvsGFbT69CELS6WdEuM8UFZAqaHZwhq57LYoewRgjomvBZ66PAmB9wbC2K" ], "script": "base64:AAIFAAAAAAAAAoQIAhIDCgEIGggKAUESA3JlZhoTCgFCEg5hdmFpbGFibGVQdW5rcxoQCgFDEgt3YXZlc05lZWRlZBoRCgFEEgxmaXJzdFBheW1lbnQaFQoBRRIQZmlyc3RQYXltZW50Qm9vbBoGCgFGEgF0GgYKAUcSAXcaFwoBSBISbGlzdEF2YWlsYWJsZVB1bmtzGgkKAUkSBHJhbmQaCwoBShIGcHVua0lkGgkKAUsSBG5hbWUaCQoBTBIEbWV0YRoKCgFNEgVhc3NldBoMCgFOEgdhc3NldElkGhMKAU8SDnJlZmVyYWxBZGRyZXNzGgcKAVASAnR4GgsKAVESBnZlcmlmeRoOCgFhEgltYXhTdXBwbHkaCgoBYhIFd2F2ZXMaEQoBYxIMZ2V0UHVua0lES2V5GgcKAWQSAmlkGhIKAWUSDXRyeUdldEludGVnZXIaCAoBZhIDa2V5GggKAWcSA3ZhbBoMCgFoEgckbWF0Y2gwGgYKAWkSAWIaEQoBahIMdHJ5R2V0U3RyaW5nGhIKAWsSDXRyeUdldEFkZHJlc3MaCQoBbBIEYWRkchoGCgFtEgFhGhAKAW4SC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TgkABDgAAAABBQAAAAFNBAAAAAFPCQEAAAABawAAAAEFAAAAAUEJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAADHB1bmtzX3N1cHBseQkAAGQAAAACBQAAAAF6AAAAAAAAAAABCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAAD2F2YWlsYWJsZV9wdW5rcwkABLkAAAACCQAEUQAAAAIFAAAAAUgFAAAAAUkCAAAAASwJAARMAAAAAgUAAAABTQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAABYwAAAAEFAAAAAUoJAAJYAAAAAQUAAAABTgkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQACWAAAAAEFAAAAAU4JAQAAAAFjAAAAAQUAAAABSgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABcAAAAAZjYWxsZXIAAAAAAAAAAAEFAAAAAU4JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAABTwkAAGkAAAACCAUAAAABRAAAAAZhbW91bnQAAAAAAAAAAAoFAAAABHVuaXQFAAAAA25pbAAAAAEAAAABUAEAAAABUQAAAAAJAAH0AAAAAwgFAAAAAVAAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAFQAAAABnByb29mcwAAAAAAAAAAAAgFAAAAAVAAAAAPc2VuZGVyUHVibGljS2V5Jip+yQ==", "height": 1894070, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HEYUNyhNxe4BQhy8t9eWrpxxQUkPwPvUfitybtLeZLUs Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let maxSupply = 1000
5+
6+let waves = 300000000
7+
8+func getPunkIDKey (id) = ("punk_" + id)
9+
10+
11+func tryGetInteger (key) = {
12+ let val = match getInteger(this, key) {
13+ case b: Int =>
14+ b
15+ case _ =>
16+ 0
17+ }
18+ val
19+ }
20+
21+
22+func tryGetString (key) = {
23+ let val = match getString(this, key) {
24+ case b: String =>
25+ b
26+ case _ =>
27+ ""
28+ }
29+ val
30+ }
31+
32+
33+func tryGetAddress (addr) = {
34+ let val = match addressFromString(addr) {
35+ case a: Address =>
36+ a
37+ case a: Unit =>
38+ Address(base58'3Msrw9Kxa6RgHYQ63sSib9uESmaBU9gH6Gy')
39+ case _ =>
40+ throw("Match error")
41+ }
42+ val
43+ }
44+
45+
46+func getTypePunk (id) = {
47+ let idINT = match parseInt(id) {
48+ case i: Int =>
49+ i
50+ case i: Unit =>
51+ 0
52+ case _ =>
53+ throw("Match error")
54+ }
55+ if ((idINT == 0))
56+ then "ultra-rare"
57+ else if ((40 >= idINT))
58+ then "rare"
59+ else "unique"
60+ }
61+
62+
63+func getURL (id) = {
64+ let idINT = match parseInt(id) {
65+ case i: Int =>
66+ i
67+ case i: Unit =>
68+ 0
69+ case _ =>
70+ throw("Match error")
71+ }
72+ if ((idINT == 0))
73+ then (("https://wavespunks.com/zombie/z" + id) + ".gif")
74+ else (("https://wavespunks.com/zombie/z" + id) + ".png")
75+ }
76+
77+
78+func getRandomNumber (variants,txId,heightBlock,offset) = {
79+ let randomSeedBlock = value(blockInfoByHeight((heightBlock - 1)))
80+ let randomHash = sha256_16Kb((txId + value(randomSeedBlock.vrf)))
81+ (toInt(randomHash, offset) % variants)
82+ }
83+
84+
85+func calcWavesNeeded (totalPunksSupply) = if ((totalPunksSupply == 0))
86+ then waves
87+ else (((totalPunksSupply / 200) + 1) * waves)
88+
89+
90+@Callable(i)
91+func mint (ref) = {
92+ let totalPunksSupply = tryGetInteger("punks_supply")
93+ let availablePunks = tryGetString("available_punks")
94+ let wavesNeeded = calcWavesNeeded(totalPunksSupply)
95+ let firstPayment = value(i.payments[0])
96+ let firstPaymentBool = match firstPayment.assetId {
97+ case t: ByteVector =>
98+ true
99+ case w: Unit =>
100+ false
101+ case _ =>
102+ throw("Match error")
103+ }
104+ if ((totalPunksSupply == maxSupply))
105+ then throw("All punks are minted")
106+ else if ((availablePunks == ""))
107+ then throw("No punks available")
108+ else if (firstPaymentBool)
109+ then throw("Payment must be in Waves tokens only")
110+ else if ((wavesNeeded > firstPayment.amount))
111+ then throw("Insufficient funds")
112+ else {
113+ let listAvailablePunks = split(availablePunks, ",")
114+ let rand = getRandomNumber((maxSupply - totalPunksSupply), i.transactionId, height, 0)
115+ let punkId = listAvailablePunks[rand]
116+ let name = ("WavesZombiePunk #" + punkId)
117+ let meta = (((((("{\"id\": " + punkId) + ", \"type\": \"") + getTypePunk(punkId)) + "\", \"url\": \"") + getURL(punkId)) + "\"}")
118+ let asset = Issue(name, meta, 1, 0, false, unit, height)
119+ let assetId = calculateAssetId(asset)
120+ let referalAddress = tryGetAddress(ref)
121+[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)]
122+ }
123+ }
124+
125+
126+@Verifier(tx)
127+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
128+

github/deemru/w8io/026f985 
20.22 ms