tx · 3vSppiy9vnnjPuLNXvv5YJBBdxAtQQZRHLm7HWMA6Fw9

3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx:  -0.01000000 Waves

2023.03.27 09:50 [2508043] smart account 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx > SELF 0.00000000 Waves

{ "type": 13, "id": "3vSppiy9vnnjPuLNXvv5YJBBdxAtQQZRHLm7HWMA6Fw9", "fee": 1000000, "feeAssetId": null, "timestamp": 1679900010226, "version": 2, "chainId": 84, "sender": "3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx", "senderPublicKey": "DyeDJ3fgwVVux2WRkxpLU9BbVjTM96AyV58b7bRFzCBx", "proofs": [ "377ypSWQF4vHE4NsT9LsReS8Y2XCcqCfYX6HyKVxQ9sBaAM8CSZXGZc59RQLHawwUy9Yq3toANJSm24V3H4GZ3kx" ], "script": "base64:BgIKCAISBgoEGBgRAQEABXRlYW1zASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgEBaQEGYnV5TmZ0BAZzZWxsZXIEbmZ0cwVwcmljZQt0b3RhbGFtb3VudAQFYnV5ZXIIBQFpBmNhbGxlcgQDbmZ0CQCQAwEFBG5mdHMEDGJ1eWVyQmFsYW5jZQkA8AcCBQVidXllcgEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4EBmFtb3VudAkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQKAQNzdW0CBWFjY3VtBG5leHQJAGQCBQVhY2N1bQUEbmV4dAQDYXJyBQVwcmljZQQJdG90YWxDb3N0CgACJGwFA2FycgoAAiRzCQCQAwEFAiRsCgAFJGFjYzAAAAoBBSRmMF8xAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQEDc3VtAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhNMaXN0IHNpemUgZXhjZW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MJAQdBZGRyZXNzAQkA2QQBCQCRAwIFBnNlbGxlcgAACQCRAwIFBXByaWNlAAABIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMJAQdBZGRyZXNzAQkA2QQBCQCRAwIFBnNlbGxlcgABCQCRAwIFBXByaWNlAAEBIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMJAQdBZGRyZXNzAQkA2QQBCQCRAwIFBnNlbGxlcgABCQCRAwIFBXByaWNlAAIBIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+BQNuaWwAH3+Cag==", "height": 2508043, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DNZnDZ4qMEztuQ4GcRnW58DsifTqoJZtWY69e4qspvbt Next: 2Udp9CKgWM17xc5ZqbBL9J2yKf6amseveuj8AzcqwFsQ Diff:
OldNewDifferences
3232 let final = {
3333 let $l = a
3434 let $s = size($l)
35- let $acc0 = 0
35+ let $acc0 = nil
3636 func $f1_1 ($a,$i) = if (($i >= $s))
3737 then $a
3838 else foldFunc($a, $l[$i])
5353 then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.")
5454 else if ((amount > buyerBalance))
5555 then throw("Buyer does not have enough funds to complete the purchase.")
56- else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, toBytes(final)), ScriptTransfer(Address(fromBase58String(seller[0])), price[0], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[1], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[2], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')]
56+ else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, toBytes(final[0])), ScriptTransfer(Address(fromBase58String(seller[0])), price[0], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[1], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[2], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')]
5757 }
5858
5959
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
55
66 @Callable(i)
77 func buyNft (seller,nfts,price,totalamount) = {
88 let buyer = i.caller
99 let nft = size(nfts)
1010 let buyerBalance = assetBalance(buyer, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')
1111 let amount = value(i.payments[0].amount)
1212 func sum (accum,next) = (accum + next)
1313
1414 let arr = price
1515 let totalCost = {
1616 let $l = arr
1717 let $s = size($l)
1818 let $acc0 = 0
1919 func $f0_1 ($a,$i) = if (($i >= $s))
2020 then $a
2121 else sum($a, $l[$i])
2222
2323 func $f0_2 ($a,$i) = if (($i >= $s))
2424 then $a
2525 else throw("List size exceeds 5")
2626
2727 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
2828 }
2929 func foldFunc (acc,e) = e
3030
3131 let a = nfts
3232 let final = {
3333 let $l = a
3434 let $s = size($l)
35- let $acc0 = 0
35+ let $acc0 = nil
3636 func $f1_1 ($a,$i) = if (($i >= $s))
3737 then $a
3838 else foldFunc($a, $l[$i])
3939
4040 func $f1_2 ($a,$i) = if (($i >= $s))
4141 then $a
4242 else throw("List size exceeds 5")
4343
4444 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5)
4545 }
4646 if (if ((totalCost > amount))
4747 then true
4848 else (totalamount > amount))
4949 then throw("your paying ammount is wrong ")
5050 else if (if ((size(nfts) != size(seller)))
5151 then true
5252 else (size(seller) != size(price)))
5353 then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.")
5454 else if ((amount > buyerBalance))
5555 then throw("Buyer does not have enough funds to complete the purchase.")
56- else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, toBytes(final)), ScriptTransfer(Address(fromBase58String(seller[0])), price[0], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[1], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[2], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')]
56+ else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, toBytes(final[0])), ScriptTransfer(Address(fromBase58String(seller[0])), price[0], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[1], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[2], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')]
5757 }
5858
5959

github/deemru/w8io/169f3d6 
39.05 ms