tx · ErNqC8KJHfx4EPDTbeYwSxSrL3FPWS9rJW6HKGgex4wK

3MugHf1wRTdGuTrjXGB4qunDNZ6jNEVEAdu:  -0.00900000 Waves

2022.08.17 18:07 [2188628] smart account 3MugHf1wRTdGuTrjXGB4qunDNZ6jNEVEAdu > SELF 0.00000000 Waves

{ "type": 13, "id": "ErNqC8KJHfx4EPDTbeYwSxSrL3FPWS9rJW6HKGgex4wK", "fee": 900000, "feeAssetId": null, "timestamp": 1660748910699, "version": 2, "chainId": 84, "sender": "3MugHf1wRTdGuTrjXGB4qunDNZ6jNEVEAdu", "senderPublicKey": "FbyxDzJQJeCSLtjFFYUf8YN6yLMPB1sXnpiQ13oFNHWd", "proofs": [ "5CXGE6q5qHK7Xo3aXMJbo92FoVCEYzXTgk5yd2WBt4fiARti8xE98mRUufaiiazsG24uBGhghuCp7yqz4A1Mitv" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAACgAAAAAJbWF4U3VwcGx5AAAAAAAAAAPoAAAAAAV3YXZlcwAAAAAABfXhAAEAAAAMZ2V0UHVua0lES2V5AAAAAQAAAAJpZAkAASwAAAACAgAAAAVwdW5rXwUAAAACaWQBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADHRyeUdldFN0cmluZwAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAUAAAADdmFsAQAAAAZnZXRVUkwAAAABAAAAAmlkAwkBAAAAD2NvbnRhaW5zRWxlbWVudAAAAAIJAA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udHJ5AAAAAgIAAAAPcHJlbWludF9hZGRyZXNzCQAEuQAAAAIJAARRAAAAAgUAAAAOcHJlTWludEFkZHJlc3MFAAAABWluZGV4AgAAAAEsBQAAAANuaWwFAAAABHRlbXADCQAAZgAAAAIFAAAACXN0YXJ0TWludAgFAAAACWxhc3RCbG9jawAAAAl0aW1lc3RhbXAJAAACAAAAAQIAAAAVTWludCBoYXNuYHQgeWV0IGJlZ3VuAwUAAAAQZmlyc3RQYXltZW50Qm9vbAkAAAIAAAABAgAAACRQYXltZW50IG11c3QgYmUgaW4gV2F2ZXMgdG9rZW5zIG9ubHkDCQAAZgAAAAIFAAAAC3dhdmVzTmVlZGVkCAUAAAAMZmlyc3RQYXltZW50AAAABmFtb3VudAkAAAIAAAABAgAAABJJbnN1ZmZpY2llbnQgZnVuZHMJAQAAAAVfbWludAAAAAMFAAAAAWkFAAAAEHRvdGFsUHVua3NTdXBwbHkFAAAADmF2YWlsYWJsZVB1bmtzAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkhF4XS", "height": 2188628, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: DZuzK4vAPbzoyMrGGQTutn76wempBaJe3XRLsH1Dq4UW 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 = 100000000
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 getURL (id) = if (containsElement(split(tryGetString("gif_punk"), ","), id))
34+ then (("https://mypunks.wavespunks.com/mad/m" + id) + ".gif")
35+ else (("https://mypunks.wavespunks.com/mad/m" + id) + ".png")
36+
37+
38+func getTypePunk (id) = {
39+ let idINT = match parseInt(id) {
40+ case i: Int =>
41+ i
42+ case i: Unit =>
43+ 0
44+ case _ =>
45+ throw("Match error")
46+ }
47+ if (containsElement(split(tryGetString("gif_punk"), ","), toString(idINT)))
48+ then "ultra-rare"
49+ else if ((29 >= idINT))
50+ then "rare"
51+ else "unique"
52+ }
53+
54+
55+func getRandomNumber (variants,txId,heightBlock,offset) = {
56+ let randomSeedBlock = value(blockInfoByHeight((heightBlock - 1)))
57+ let randomHash = sha256_16Kb((txId + value(randomSeedBlock.vrf)))
58+ (toInt(randomHash, offset) % variants)
59+ }
60+
61+
62+func calcWavesNeeded () = (waves * 6)
63+
64+
65+func _mint (i,totalPunksSupply,availablePunks) = {
66+ let listAvailablePunks = split(availablePunks, ",")
67+ let rand = getRandomNumber((maxSupply - totalPunksSupply), i.transactionId, height, 0)
68+ let punkId = listAvailablePunks[rand]
69+ let name = ("MadPunk #" + punkId)
70+ let meta = tryGetString("collection_description")
71+ let asset = Issue(name, meta, 1, 0, false, unit, height)
72+ let assetId = calculateAssetId(asset)
73+ let tx = [IntegerEntry("punks_supply", (totalPunksSupply + 1)), StringEntry("available_punks", makeString(removeByIndex(listAvailablePunks, rand), ",")), asset, StringEntry(getPunkIDKey(punkId), toBase58String(assetId)), StringEntry((toBase58String(assetId) + "_id"), getPunkIDKey(punkId)), StringEntry((toBase58String(assetId) + "_type"), getTypePunk(punkId)), StringEntry((toBase58String(assetId) + "_url"), getURL(punkId)), StringEntry((toBase58String(assetId) + "_fraction"), tryGetString("fraction")), ScriptTransfer(i.caller, 1, assetId)]
74+ tx
75+ }
76+
77+
78+@Callable(i)
79+func mint () = {
80+ let totalPunksSupply = tryGetInteger("punks_supply")
81+ let availablePunks = tryGetString("available_punks")
82+ let preMintAddress = split(tryGetString("premint_address"), ",")
83+ let startMint = tryGetInteger("start_mint")
84+ let wavesNeeded = calcWavesNeeded()
85+ let firstPayment = value(i.payments[0])
86+ let firstPaymentBool = match firstPayment.assetId {
87+ case t: ByteVector =>
88+ true
89+ case w: Unit =>
90+ false
91+ case _ =>
92+ throw("Match error")
93+ }
94+ if ((totalPunksSupply == maxSupply))
95+ then throw("All punks are minted")
96+ else if ((availablePunks == ""))
97+ then throw("No punks available")
98+ else if (containsElement(preMintAddress, toString(i.caller)))
99+ then {
100+ let index = match indexOf(preMintAddress, toString(i.caller)) {
101+ case b: Int =>
102+ b
103+ case b: Unit =>
104+ 0
105+ case _ =>
106+ throw("Match error")
107+ }
108+ let temp = (_mint(i, totalPunksSupply, availablePunks) ++ [StringEntry("premint_address", makeString(removeByIndex(preMintAddress, index), ","))])
109+ temp
110+ }
111+ else if ((startMint > lastBlock.timestamp))
112+ then throw("Mint hasn`t yet begun")
113+ else if (firstPaymentBool)
114+ then throw("Payment must be in Waves tokens only")
115+ else if ((wavesNeeded > firstPayment.amount))
116+ then throw("Insufficient funds")
117+ else _mint(i, totalPunksSupply, availablePunks)
118+ }
119+
120+
121+@Verifier(tx)
122+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
123+

github/deemru/w8io/169f3d6 
20.60 ms