tx · 48JwxVcsekFkP6tU3yHsxvrNQyTQGDLo38i64pfXHAyB

3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx:  -0.01000000 Waves

2023.03.25 13:00 [2505376] smart account 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx > SELF 0.00000000 Waves

{ "type": 13, "id": "48JwxVcsekFkP6tU3yHsxvrNQyTQGDLo38i64pfXHAyB", "fee": 1000000, "feeAssetId": null, "timestamp": 1679738561472, "version": 2, "chainId": 84, "sender": "3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx", "senderPublicKey": "DyeDJ3fgwVVux2WRkxpLU9BbVjTM96AyV58b7bRFzCBx", "proofs": [ "vhFn6j7ZAVW3xygnr8dUj7GkDrr7mAyHzCBaZtT1SrhndABh6uwy1auCRAEBVqBVKy48ZBanbTh5HNN4hqd3rPM" ], "script": "base64:BgIKCAISBgoEGBgRAQEABXRlYW1zASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgEBaQEGYnV5TmZ0BAZzZWxsZXIEbmZ0cwVwcmljZQt0b3RhbGFtb3VudAQFYnV5ZXIIBQFpBmNhbGxlcgQDbmZ0CQCQAwEFBG5mdHMEDGJ1eWVyQmFsYW5jZQkA8AcCBQVidXllcgEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4EBmFtb3VudAkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQECHByaWNlT25lCQBoAgkAaQIJAJEDAgUFcHJpY2UAAADoBwAZBAhwcmljZVR3bwkAaAIJAGkCCQCRAwIFBXByaWNlAAEA6AcAGQQKcHJpY2VUaHJlZQkAaAIJAGkCCQCRAwIFBXByaWNlAAIA6AcAGQoBA3N1bQIFYWNjdW0EbmV4dAkAZAIFBWFjY3VtBQRuZXh0BANhcnIFBXByaWNlBAl0b3RhbENvc3QKAAIkbAUDYXJyCgACJHMJAJADAQUCJGwKAAUkYWNjMAAACgEFJGYwX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B0VHJhbnNmZXIDCQEHQWRkcmVzcwEJANkEAQkAkQMCBQZzZWxsZXIAAQUIcHJpY2VUd28FBHVuaXQJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBCQDZBAEJAJEDAgUGc2VsbGVyAAEFCnByaWNlVGhyZWUFBHVuaXQFA25pbAAoL9cM", "height": 2505376, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9FdhTdZerXPHWJ22Pt4U6iv2eeJaz7HXJcDEz7Qapwuk Next: GN1Qub6HPHtwUp7E2w7apMcZSJV6eXmJo6atczC2ZFYd Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-
4+let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
55
66 @Callable(i)
7-func buyNft (seller,nfts,price) = {
7+func buyNft (seller,nfts,price,totalamount) = {
88 let buyer = i.caller
9+ let nft = size(nfts)
10+ let buyerBalance = assetBalance(buyer, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')
911 let amount = value(i.payments[0].amount)
10-[ScriptTransfer(Address(fromBase58String(seller)), price, unit), ScriptTransfer(buyer, 1, fromBase58String(nfts))]
12+ let priceOne = ((price[0] / 1000) * 25)
13+ let priceTwo = ((price[1] / 1000) * 25)
14+ let priceThree = ((price[2] / 1000) * 25)
15+ func sum (accum,next) = (accum + next)
16+
17+ let arr = price
18+ let totalCost = {
19+ let $l = arr
20+ let $s = size($l)
21+ let $acc0 = 0
22+ func $f0_1 ($a,$i) = if (($i >= $s))
23+ then $a
24+ else sum($a, $l[$i])
25+
26+ func $f0_2 ($a,$i) = if (($i >= $s))
27+ then $a
28+ else throw("List size exceeds 5")
29+
30+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
31+ }
32+ if (if ((totalCost > amount))
33+ then true
34+ else (totalamount > amount))
35+ then throw("your paying ammount is wrong ")
36+ else if (if ((size(nfts) != size(seller)))
37+ then true
38+ else (size(seller) != size(price)))
39+ then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.")
40+ else if ((amount > buyerBalance))
41+ then throw("Buyer does not have enough funds to complete the purchase.")
42+ else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, fromBase58String(nfts[0])), ScriptTransfer(buyer, 1, fromBase58String(nfts[1])), ScriptTransfer(buyer, 1, fromBase58String(nfts[2])), ScriptTransfer(Address(fromBase58String(seller[0])), priceOne, unit), ScriptTransfer(Address(fromBase58String(seller[1])), priceTwo, unit), ScriptTransfer(Address(fromBase58String(seller[1])), priceThree, unit)]
1143 }
1244
1345

github/deemru/w8io/169f3d6 
28.63 ms