tx · A56DmFRNkWksrij4fqTEmSLnTqRd6kKZmtzjtEVPULyd

3MxKNP3dVYS3CCxNsutvwwZhKxXwL1uRZvC:  -0.01000000 Waves

2022.04.11 13:27 [2003807] smart account 3MxKNP3dVYS3CCxNsutvwwZhKxXwL1uRZvC > SELF 0.00000000 Waves

{ "type": 13, "id": "A56DmFRNkWksrij4fqTEmSLnTqRd6kKZmtzjtEVPULyd", "fee": 1000000, "feeAssetId": null, "timestamp": 1649672896299, "version": 2, "chainId": 84, "sender": "3MxKNP3dVYS3CCxNsutvwwZhKxXwL1uRZvC", "senderPublicKey": "2B7BPEYHioEi7vuNHWF8MGv7cJpQe8XMrzDeRcnu4eQD", "proofs": [ "38Q5TXPte9qBXm5Y8LvnENpsbnKB9S4QFzn6B2uaourEYaJh9WrLEm5NffuuNePhSLSjJJtGYo3LtyjD7ZXD5b3o" ], "script": "base64:AAIFAAAAAAAAAAsIAhIAEgUKAwgICAAAAAgAAAAACW1heFN1cHBseQAAAAAAAAALuAAAAAAFd2F2ZXMAAAAAAB3NZQABAAAADGdldFB1bmtJREtleQAAAAEAAAACaWQJAAEsAAAAAgIAAAAFcHVua18FAAAAAmlkAQAAAAtnZXRSZXFJREtleQAAAAEAAAACaWQJAAEsAAAAAgIAAAAEcmVxXwUAAAACaWQBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADHRyeUdldFN0cmluZwAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAUAAAADdmFs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WJsaWNLZXnJJeGe", "height": 2003807, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 7AVR7WNpdEcDmK7WxnNAUQzHNDDZebsNk5mH5TrN8ADY Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let maxSupply = 3000
5+
6+let waves = 500000000
7+
8+func getPunkIDKey (id) = ("punk_" + id)
9+
10+
11+func getReqIDKey (id) = ("req_" + id)
12+
13+
14+func tryGetInteger (key) = {
15+ let val = match getInteger(this, key) {
16+ case b: Int =>
17+ b
18+ case _ =>
19+ 0
20+ }
21+ val
22+ }
23+
24+
25+func tryGetString (key) = {
26+ let val = match getString(this, key) {
27+ case b: String =>
28+ b
29+ case _ =>
30+ ""
31+ }
32+ val
33+ }
34+
35+
36+func tryGetAddress (addr) = {
37+ let val = match addressFromString(addr) {
38+ case a: Address =>
39+ a
40+ case a: Unit =>
41+ Address(base58'3Msrw9Kxa6RgHYQ63sSib9uESmaBU9gH6Gy')
42+ case _ =>
43+ throw("Match error")
44+ }
45+ val
46+ }
47+
48+
49+func getTypePunk (id) = {
50+ let idINT = match parseInt(id) {
51+ case i: Int =>
52+ i
53+ case i: Unit =>
54+ 0
55+ case _ =>
56+ throw("Match error")
57+ }
58+ if ((idINT == 0))
59+ then "ultra-rare"
60+ else if ((41 >= idINT))
61+ then "rare"
62+ else "unique"
63+ }
64+
65+
66+@Callable(i)
67+func request () = {
68+ let totalPunksSupply = tryGetInteger("punks_supply")
69+ let wavesNeeded = waves
70+ let firstPayment = value(i.payments[0])
71+ let firstPaymentBool = match firstPayment.assetId {
72+ case t: ByteVector =>
73+ true
74+ case w: Unit =>
75+ false
76+ case _ =>
77+ throw("Match error")
78+ }
79+ if ((totalPunksSupply == maxSupply))
80+ then throw("All punks are minted")
81+ else if (firstPaymentBool)
82+ then throw("Payment must be in Waves tokens only")
83+ else if ((wavesNeeded > firstPayment.amount))
84+ then throw("Insufficient funds")
85+ else [IntegerEntry("punks_supply", (totalPunksSupply + 1)), StringEntry(getReqIDKey(toString(totalPunksSupply)), toString(i.caller))]
86+ }
87+
88+
89+
90+@Callable(i)
91+func mint (req,punkId,url) = {
92+ let reqAddress = tryGetString(req)
93+ let punk = tryGetString(getTypePunk(punkId))
94+ if ((punk != ""))
95+ then throw("Punk was already minted")
96+ else if ((toString(i.caller) != "3Msrw9Kxa6RgHYQ63sSib9uESmaBU9gH6Gy"))
97+ then throw("The function is available only to the admin")
98+ else {
99+ let name = ("MadPunk #" + punkId)
100+ let meta = (((((("{\"id\": " + punkId) + ", \"type\": \"") + getTypePunk(punkId)) + "\", \"url\": \"") + url) + "\"}")
101+ let asset = Issue(name, meta, 1, 0, false, unit, height)
102+ let assetId = calculateAssetId(asset)
103+[DeleteEntry(req), asset, StringEntry(getPunkIDKey(punkId), toBase58String(assetId)), StringEntry(toBase58String(assetId), getPunkIDKey(punkId)), ScriptTransfer(tryGetAddress(reqAddress), 1, assetId)]
104+ }
105+ }
106+
107+
108+@Verifier(tx)
109+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
110+

github/deemru/w8io/169f3d6 
20.59 ms