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+SuybbOuh2jhbcFCIqSH4EBmFtb3VudAkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQKAQNzdW0CBWFjY3VtBG5leHQJAGQCBQVhY2N1bQUEbmV4dAQDYXJyBQVwcmljZQQJdG90YWxDb3N0CgACJGwFA2FycgoAAiRzCQCQAwEFAiRsCgAFJGFjYzAAAAoBBSRmMF8xAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQEDc3VtAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhNMaXN0IHNpemUgZXhjZWV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JAQdBZGRyZXNzAQkA2QQBCQCRAwIFBnNlbGxlcgAACQCRAwIFBXByaWNlAAABIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMJAQdBZGRyZXNzAQkA2QQBCQCRAwIFBnNlbGxlcgABCQCRAwIFBXByaWNlAAEBIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMJAQdBZGRyZXNzAQkA2QQBCQCRAwIFBnNlbGxlcgABCQCRAwIFBXByaWNlAAIBIIVjlaPziI6w3gwXjghOv5o/krsm2zrodo4W3BQiKkh+BQNuaWwAH3+Cag==", "height": 2508043, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DNZnDZ4qMEztuQ4GcRnW58DsifTqoJZtWY69e4qspvbt Next: 2Udp9CKgWM17xc5ZqbBL9J2yKf6amseveuj8AzcqwFsQ Diff:
Old | New | Differences | |
---|---|---|---|
32 | 32 | let final = { | |
33 | 33 | let $l = a | |
34 | 34 | let $s = size($l) | |
35 | - | let $acc0 = | |
35 | + | let $acc0 = nil | |
36 | 36 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
37 | 37 | then $a | |
38 | 38 | else foldFunc($a, $l[$i]) | |
53 | 53 | then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.") | |
54 | 54 | else if ((amount > buyerBalance)) | |
55 | 55 | 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')] | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 |
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 | 29 | func foldFunc (acc,e) = e | |
30 | 30 | ||
31 | 31 | let a = nfts | |
32 | 32 | let final = { | |
33 | 33 | let $l = a | |
34 | 34 | let $s = size($l) | |
35 | - | let $acc0 = | |
35 | + | let $acc0 = nil | |
36 | 36 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
37 | 37 | then $a | |
38 | 38 | else foldFunc($a, $l[$i]) | |
39 | 39 | ||
40 | 40 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
41 | 41 | then $a | |
42 | 42 | else throw("List size exceeds 5") | |
43 | 43 | ||
44 | 44 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5) | |
45 | 45 | } | |
46 | 46 | if (if ((totalCost > amount)) | |
47 | 47 | then true | |
48 | 48 | else (totalamount > amount)) | |
49 | 49 | then throw("your paying ammount is wrong ") | |
50 | 50 | else if (if ((size(nfts) != size(seller))) | |
51 | 51 | then true | |
52 | 52 | else (size(seller) != size(price))) | |
53 | 53 | then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.") | |
54 | 54 | else if ((amount > buyerBalance)) | |
55 | 55 | 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')] | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 |
github/deemru/w8io/169f3d6 39.05 ms ◑