tx · 4tkabmMuPbXRwGxZceEPc2cPGyNNRAwHuuruvaQCQBMt

3Muey1cqNaBjjcxXfKHF8qqTZeyGPAsvCpP:  -0.00800000 Waves

2022.08.18 20:14 [2190205] smart account 3Muey1cqNaBjjcxXfKHF8qqTZeyGPAsvCpP > SELF 0.00000000 Waves

{ "type": 13, "id": "4tkabmMuPbXRwGxZceEPc2cPGyNNRAwHuuruvaQCQBMt", "fee": 800000, "feeAssetId": null, "timestamp": 1660842850692, "version": 2, "chainId": 84, "sender": "3Muey1cqNaBjjcxXfKHF8qqTZeyGPAsvCpP", "senderPublicKey": "3bPATHM3GnqSGjJb8saHmYMvsaioqu2etEGkZDiuRCcn", "proofs": [ "4h1YzGLgtWS1gMHSk5hGK2hGTBb5LKHvSV6R7vbbQLtNEkCu5Lh5Sh7hisDsfQCbZ1FUbgEeY92XmsYdeSFx986x" ], "script": "base64:AAIFAAAAAAAAAAQIAhIAAAAACwAAAAAJbWF4U3VwcGx5AAAAAAAAAAPoAAAAAAV3YXZlcwAAAAAABfXhAAEAAAAMZ2V0UHVua0lES2V5AAAAAQAAAAJpZAkAASwAAAACAgAAAAVwdW5rXwUAAAACaWQBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADXRyeUdldEJvb2xlYW4AAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgcFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMA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BheW1lbnRCb29sCQAAAgAAAAECAAAAJFBheW1lbnQgbXVzdCBiZSBpbiBXYXZlcyB0b2tlbnMgb25seQMJAABmAAAAAgUAAAALd2F2ZXNOZWVkZWQIBQAAAAxmaXJzdFBheW1lbnQAAAAGYW1vdW50CQAAAgAAAAECAAAAEkluc3VmZmljaWVudCBmdW5kcwkBAAAABV9taW50AAAAAwUAAAABaQUAAAAQdG90YWxQdW5rc1N1cHBseQUAAAAOYXZhaWxhYmxlUHVua3MAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQEIFXw=", "height": 2190205, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4zErmhgTQAwzcg5BXwwQMWWVnkhKUX5vhBbU3fJKqCM5 Next: none Diff:
OldNewDifferences
1414 b
1515 case _ =>
1616 0
17+ }
18+ val
19+ }
20+
21+
22+func tryGetBoolean (key) = {
23+ let val = match getBoolean(this, key) {
24+ case b: Boolean =>
25+ b
26+ case _ =>
27+ false
1728 }
1829 val
1930 }
95106 then throw("All punks are minted")
96107 else if ((availablePunks == ""))
97108 then throw("No punks available")
98- else if (containsElement(preMintAddress, toString(i.caller)))
109+ else if (tryGetBoolean(toString(i.caller)))
99110 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), ","))])
111+ let temp = _mint(i, totalPunksSupply, availablePunks)
109112 temp
110113 }
111114 else if ((startMint > lastBlock.timestamp))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let maxSupply = 1000
55
66 let waves = 100000000
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
17+ }
18+ val
19+ }
20+
21+
22+func tryGetBoolean (key) = {
23+ let val = match getBoolean(this, key) {
24+ case b: Boolean =>
25+ b
26+ case _ =>
27+ false
1728 }
1829 val
1930 }
2031
2132
2233 func tryGetString (key) = {
2334 let val = match getString(this, key) {
2435 case b: String =>
2536 b
2637 case _ =>
2738 ""
2839 }
2940 val
3041 }
3142
3243
3344 func getURL (id) = if (containsElement(split(tryGetString("gif_punk"), ","), id))
3445 then (("https://mypunks.wavespunks.com/mad/m" + id) + ".gif")
3546 else (("https://mypunks.wavespunks.com/mad/m" + id) + ".png")
3647
3748
3849 func getTypePunk (id) = {
3950 let idINT = match parseInt(id) {
4051 case i: Int =>
4152 i
4253 case i: Unit =>
4354 0
4455 case _ =>
4556 throw("Match error")
4657 }
4758 if (containsElement(split(tryGetString("gif_punk"), ","), toString(idINT)))
4859 then "ultra-rare"
4960 else if ((29 >= idINT))
5061 then "rare"
5162 else "unique"
5263 }
5364
5465
5566 func getRandomNumber (variants,txId,heightBlock,offset) = {
5667 let randomSeedBlock = value(blockInfoByHeight((heightBlock - 1)))
5768 let randomHash = sha256_16Kb((txId + value(randomSeedBlock.vrf)))
5869 (toInt(randomHash, offset) % variants)
5970 }
6071
6172
6273 func calcWavesNeeded () = (waves * 6)
6374
6475
6576 func _mint (i,totalPunksSupply,availablePunks) = {
6677 let listAvailablePunks = split(availablePunks, ",")
6778 let rand = getRandomNumber((maxSupply - totalPunksSupply), i.transactionId, height, 0)
6879 let punkId = listAvailablePunks[rand]
6980 let name = ("MadPunk #" + punkId)
7081 let meta = tryGetString("collection_description")
7182 let asset = Issue(name, meta, 1, 0, false, unit, height)
7283 let assetId = calculateAssetId(asset)
7384 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)]
7485 tx
7586 }
7687
7788
7889 @Callable(i)
7990 func mint () = {
8091 let totalPunksSupply = tryGetInteger("punks_supply")
8192 let availablePunks = tryGetString("available_punks")
8293 let preMintAddress = split(tryGetString("premint_address"), ",")
8394 let startMint = tryGetInteger("start_mint")
8495 let wavesNeeded = calcWavesNeeded()
8596 let firstPayment = value(i.payments[0])
8697 let firstPaymentBool = match firstPayment.assetId {
8798 case t: ByteVector =>
8899 true
89100 case w: Unit =>
90101 false
91102 case _ =>
92103 throw("Match error")
93104 }
94105 if ((totalPunksSupply == maxSupply))
95106 then throw("All punks are minted")
96107 else if ((availablePunks == ""))
97108 then throw("No punks available")
98- else if (containsElement(preMintAddress, toString(i.caller)))
109+ else if (tryGetBoolean(toString(i.caller)))
99110 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), ","))])
111+ let temp = _mint(i, totalPunksSupply, availablePunks)
109112 temp
110113 }
111114 else if ((startMint > lastBlock.timestamp))
112115 then throw("Mint hasn`t yet begun")
113116 else if (firstPaymentBool)
114117 then throw("Payment must be in Waves tokens only")
115118 else if ((wavesNeeded > firstPayment.amount))
116119 then throw("Insufficient funds")
117120 else _mint(i, totalPunksSupply, availablePunks)
118121 }
119122
120123
121124 @Verifier(tx)
122125 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
123126

github/deemru/w8io/169f3d6 
47.92 ms