tx · 2Udp9CKgWM17xc5ZqbBL9J2yKf6amseveuj8AzcqwFsQ 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx: -0.01000000 Waves 2023.03.27 09:54 [2508046] smart account 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx > SELF 0.00000000 Waves
{ "type": 13, "id": "2Udp9CKgWM17xc5ZqbBL9J2yKf6amseveuj8AzcqwFsQ", "fee": 1000000, "feeAssetId": null, "timestamp": 1679900222948, "version": 2, "chainId": 84, "sender": "3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx", "senderPublicKey": "DyeDJ3fgwVVux2WRkxpLU9BbVjTM96AyV58b7bRFzCBx", "proofs": [ "3xYtyBPHESfNLPtwoxMyNnb6wTGGjTovuatEVkuaKvLX85Xfd19T7aLFMPZxp9Tbcvo86UtV43cM191yvbUBb2ma" ], "script": "base64:BgIKCAISBgoEGBgRAQEABXRlYW1zASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgEBaQEGYnV5TmZ0BAZzZWxsZXIEbmZ0cwVwcmljZQt0b3RhbGFtb3VudAQFYnV5ZXIIBQFpBmNhbGxlcgQDbmZ0CQCQAwEFBG5mdHMEDGJ1eWVyQmFsYW5jZQkA8AcCBQVidXllcgEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4EBmFtb3VudAkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQKAQNzdW0CBWFjY3VtBG5leHQJAGQCBQVhY2N1bQUEbmV4dAQDYXJyBQVwcmljZQQJdG90YWxDb3N0CgACJGwFA2FycgoAAiRzCQCQAwEFAiRsCgAFJGFjYzAAAAoBBSRmMF8xAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQEDc3VtAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhNMaXN0IHNpemUgZXhjZWVkcyA1CQ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CQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEJANkEAQkAkQMCBQZzZWxsZXIAAQkAkQMCBQVwcmljZQACASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgUDbmlsAJenysA=", "height": 2508046, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3vSppiy9vnnjPuLNXvv5YJBBdxAtQQZRHLm7HWMA6Fw9 Next: JCkYpSGCuTKgEgc9LeGGXN3zJFB4kgg1g6jkj96e4S3G Diff:
Old | New | Differences | |
---|---|---|---|
26 | 26 | ||
27 | 27 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
28 | 28 | } | |
29 | - | func foldFunc (acc,e) = e | |
30 | - | ||
31 | - | let a = nfts | |
32 | - | let final = { | |
33 | - | let $l = a | |
34 | - | let $s = size($l) | |
35 | - | let $acc0 = nil | |
36 | - | func $f1_1 ($a,$i) = if (($i >= $s)) | |
37 | - | then $a | |
38 | - | else foldFunc($a, $l[$i]) | |
39 | - | ||
40 | - | func $f1_2 ($a,$i) = if (($i >= $s)) | |
41 | - | then $a | |
42 | - | else throw("List size exceeds 5") | |
43 | - | ||
44 | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5) | |
45 | - | } | |
46 | 29 | if (if ((totalCost > amount)) | |
47 | 30 | then true | |
48 | 31 | else (totalamount > amount)) | |
53 | 36 | then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.") | |
54 | 37 | else if ((amount > buyerBalance)) | |
55 | 38 | then throw("Buyer does not have enough funds to complete the purchase.") | |
56 | - | else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, | |
39 | + | 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])), price[0], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[1], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[2], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] | |
57 | 40 | } | |
58 | 41 | ||
59 | 42 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq' | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func buyNft (seller,nfts,price,totalamount) = { | |
8 | 8 | let buyer = i.caller | |
9 | 9 | let nft = size(nfts) | |
10 | 10 | let buyerBalance = assetBalance(buyer, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq') | |
11 | 11 | let amount = value(i.payments[0].amount) | |
12 | 12 | func sum (accum,next) = (accum + next) | |
13 | 13 | ||
14 | 14 | let arr = price | |
15 | 15 | let totalCost = { | |
16 | 16 | let $l = arr | |
17 | 17 | let $s = size($l) | |
18 | 18 | let $acc0 = 0 | |
19 | 19 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
20 | 20 | then $a | |
21 | 21 | else sum($a, $l[$i]) | |
22 | 22 | ||
23 | 23 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
24 | 24 | then $a | |
25 | 25 | else throw("List size exceeds 5") | |
26 | 26 | ||
27 | 27 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
28 | 28 | } | |
29 | - | func foldFunc (acc,e) = e | |
30 | - | ||
31 | - | let a = nfts | |
32 | - | let final = { | |
33 | - | let $l = a | |
34 | - | let $s = size($l) | |
35 | - | let $acc0 = nil | |
36 | - | func $f1_1 ($a,$i) = if (($i >= $s)) | |
37 | - | then $a | |
38 | - | else foldFunc($a, $l[$i]) | |
39 | - | ||
40 | - | func $f1_2 ($a,$i) = if (($i >= $s)) | |
41 | - | then $a | |
42 | - | else throw("List size exceeds 5") | |
43 | - | ||
44 | - | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5) | |
45 | - | } | |
46 | 29 | if (if ((totalCost > amount)) | |
47 | 30 | then true | |
48 | 31 | else (totalamount > amount)) | |
49 | 32 | then throw("your paying ammount is wrong ") | |
50 | 33 | else if (if ((size(nfts) != size(seller))) | |
51 | 34 | then true | |
52 | 35 | else (size(seller) != size(price))) | |
53 | 36 | then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.") | |
54 | 37 | else if ((amount > buyerBalance)) | |
55 | 38 | then throw("Buyer does not have enough funds to complete the purchase.") | |
56 | - | else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, | |
39 | + | 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])), price[0], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[1], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'), ScriptTransfer(Address(fromBase58String(seller[1])), price[2], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] | |
57 | 40 | } | |
58 | 41 | ||
59 | 42 |
github/deemru/w8io/169f3d6 28.19 ms ◑