tx · 2DwtqPaLHE3bdr7sfArN4r2kt4fSLuGafQgpMuF4y1RD

3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx:  -0.01000000 Waves

2023.03.24 12:55 [2503933] smart account 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx > SELF 0.00000000 Waves

{ "type": 13, "id": "2DwtqPaLHE3bdr7sfArN4r2kt4fSLuGafQgpMuF4y1RD", "fee": 1000000, "feeAssetId": null, "timestamp": 1679651902196, "version": 2, "chainId": 84, "sender": "3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx", "senderPublicKey": "DyeDJ3fgwVVux2WRkxpLU9BbVjTM96AyV58b7bRFzCBx", "proofs": [ "4PfQoHq61hezv6LbfbQGLJ8wQsv872DqY2D3daP7aawzLG5tDjz6ZpDuYSoia4HVrQC4TAaKGWzKKGKKY5AL6s9W" ], "script": "base64:BgIJCAISBQoDGBgRAAEBaQEGYnV5TmZ0AwZzZWxsZXIEbmZ0cwVwcmljZQQFYnV5ZXIIBQFpBmNhbGxlcgQDbmZ0CQCQAwEFBG5mdHMEDGJ1eWVyQmFsYW5jZQkA8AcCBQVidXllcgEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4EBmFtb3VudAkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQEBmxlbmd0aAkAsQIBAgVuZnRJZAoBA3N1bQIFYWNjdW0EbmV4dAkAZAIFBWFjY3VtBQRuZXh0BANhcnIFBXByaWNlBAl0b3RhbENvc3QKAAIkbAUDYXJyCgACJHMJAJADAQUCJGwKAAUkYWNjMAAACgEFJGYwXzECAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAQNzdW0CBQIkYQkAkQMCBQIkbAUCJGkKAQUkZjBfMgICJGECJGkDCQBnAgUCJGkFAiRzBQIkYQkAAgECE0xpc3Qgc2l6ZSBleGNlZWRzIDUJAQUkZjBfMgIJAQUkZjBfMQIJAQUkZjBfMQIJAQU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NuaWwA0DPo0Q==", "height": 2503933, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BCvKXonzm7qpH38oEoDcbJZ7HZt8LYzY5Gzso4HTLWKU Next: 9GQCDoXgThMGC7DbsnRw88ZDQr4Evgk6LgfueY1Dvva Diff:
OldNewDifferences
4646 }
4747 let onePro = fromBase58String(total[0])
4848 let twoPro = fromBase58String(total[1])
49- if ((amount != totalCost))
49+ if ((totalCost > amount))
5050 then throw("your paying ammount is wrong ")
5151 else if (if ((size(nfts) != size(seller)))
5252 then true
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 func buyNft (seller,nfts,price) = {
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 let length = size("nftId")
1313 func sum (accum,next) = (accum + next)
1414
1515 let arr = price
1616 let totalCost = {
1717 let $l = arr
1818 let $s = size($l)
1919 let $acc0 = 0
2020 func $f0_1 ($a,$i) = if (($i >= $s))
2121 then $a
2222 else sum($a, $l[$i])
2323
2424 func $f0_2 ($a,$i) = if (($i >= $s))
2525 then $a
2626 else throw("List size exceeds 5")
2727
2828 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
2929 }
3030 func map (accum,next) = (accum :+ next)
3131
3232 let brr = nfts
3333 let total = {
3434 let $l = brr
3535 let $s = size($l)
3636 let $acc0 = nil
3737 func $f1_1 ($a,$i) = if (($i >= $s))
3838 then $a
3939 else map($a, $l[$i])
4040
4141 func $f1_2 ($a,$i) = if (($i >= $s))
4242 then $a
4343 else throw("List size exceeds 5")
4444
4545 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5)
4646 }
4747 let onePro = fromBase58String(total[0])
4848 let twoPro = fromBase58String(total[1])
49- if ((amount != totalCost))
49+ if ((totalCost > amount))
5050 then throw("your paying ammount is wrong ")
5151 else if (if ((size(nfts) != size(seller)))
5252 then true
5353 else (size(seller) != size(price)))
5454 then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.")
5555 else if ((amount > buyerBalance))
5656 then throw("Buyer does not have enough funds to complete the purchase.")
5757 else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, onePro), ScriptTransfer(buyer, 1, twoPro)]
5858 }
5959
6060

github/deemru/w8io/169f3d6 
27.96 ms