tx · 8S69Em8547xCcoVMHqgqTrpHAHPtsQtiv1tn8UAuoJcr

3Mx1vNMiWzJ2NgY1t8bqsj8vvpxjaTLJWyo:  -0.01400000 Waves

2021.10.07 11:12 [1735555] smart account 3Mx1vNMiWzJ2NgY1t8bqsj8vvpxjaTLJWyo > SELF 0.00000000 Waves

{ "type": 13, "id": "8S69Em8547xCcoVMHqgqTrpHAHPtsQtiv1tn8UAuoJcr", "fee": 1400000, "feeAssetId": null, "timestamp": 1633594419019, "version": 2, "chainId": 84, "sender": "3Mx1vNMiWzJ2NgY1t8bqsj8vvpxjaTLJWyo", "senderPublicKey": "5fUyPtPgB9o1mWXPYifKATuZc8PG2ErT5CGABbC7pu3", "proofs": [ "55RrVeTuky61BJFUREHjFatYbe3171tY8oL3ZyjTJtoNgXTBUWHJoCo2ADd1CvmDasZPEYjLt1GEVU68aNS8eUWM" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAACAAAAAAJbWF4U3VwcGx5AAAAAAAAAAPoAAAAAAV3YXZlcwAAAAAABfXhAAEAAAAMZ2V0UHVua0lES2V5AAAAAQAAAAJpZAkAASwAAAACAgAAAAVwdW5rXwUAAAACaWQBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADHRyeUdldFN0cmluZwAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAUAAAADdmFsAQAAAA10cnlHZXRBZGRyZXNzAAAAAQAAAARhZGRyBAAAAAN2YWwEAAAAByRt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Status": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3o4QYBJZFHejgb4wf4uv8xH7WEmdWnBWfkGEFWdPb467 Next: bLLaqqkXHUgKA3gSYMfBk9tDPG98G7jTockmUpPVF15 Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let maxSupply = 1337
4+let maxSupply = 1000
55
66 let waves = 100000000
77
5050 }
5151
5252
53-func calcWavesNeeded (totalPunksSupply) = if ((totalPunksSupply >= 1300))
54- then (waves * 20)
55- else (((totalPunksSupply / 100) + 1) * waves)
53+func calcWavesNeeded (totalPunksSupply) = (((totalPunksSupply / 100) + 1) * waves)
5654
5755
5856 @Callable(i)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let maxSupply = 1337
4+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
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 this
3939 case _ =>
4040 throw("Match error")
4141 }
4242 val
4343 }
4444
4545
4646 func getRandomNumber (variants,txId,heightBlock,offset) = {
4747 let randomSeedBlock = value(blockInfoByHeight((heightBlock - 1)))
4848 let randomHash = sha256_16Kb((txId + value(randomSeedBlock.vrf)))
4949 (toInt(randomHash, offset) % variants)
5050 }
5151
5252
53-func calcWavesNeeded (totalPunksSupply) = if ((totalPunksSupply >= 1300))
54- then (waves * 20)
55- else (((totalPunksSupply / 100) + 1) * waves)
53+func calcWavesNeeded (totalPunksSupply) = (((totalPunksSupply / 100) + 1) * waves)
5654
5755
5856 @Callable(i)
5957 func mint (ref) = {
6058 let totalPunksSupply = tryGetInteger("punks_supply")
6159 let availablePunks = tryGetString("available_punks")
6260 let wavesNeeded = calcWavesNeeded(totalPunksSupply)
6361 let firstPayment = value(i.payments[0])
6462 let firstPaymentBool = match firstPayment.assetId {
6563 case t: ByteVector =>
6664 true
6765 case w: Unit =>
6866 false
6967 case _ =>
7068 throw("Match error")
7169 }
7270 if ((totalPunksSupply == maxSupply))
7371 then throw("All punks are minted")
7472 else if ((availablePunks == ""))
7573 then throw("No punks available")
7674 else if (firstPaymentBool)
7775 then throw("Payment must be in Waves tokens only")
7876 else if ((wavesNeeded > firstPayment.amount))
7977 then throw("Insufficient funds")
8078 else {
8179 let listAvailablePunks = split(availablePunks, ",")
8280 let rand = getRandomNumber(totalPunksSupply, i.transactionId, height, 0)
8381 let punkId = listAvailablePunks[rand]
8482 let name = ("WavesPunk #" + punkId)
8583 let asset = Issue(name, name, 1, 0, false, unit, height)
8684 let assetId = calculateAssetId(asset)
8785 let referalAddress = tryGetAddress(ref)
8886 [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)]
8987 }
9088 }
9189
9290
9391 @Verifier(tx)
9492 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
9593

github/deemru/w8io/026f985 
44.65 ms