tx · DNZnDZ4qMEztuQ4GcRnW58DsifTqoJZtWY69e4qspvbt
3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx: -0.01000000 Waves
2023.03.27 09:40 [2508032] smart account 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx > SELF 0.00000000 Waves
{
"type": 13,
"id": "DNZnDZ4qMEztuQ4GcRnW58DsifTqoJZtWY69e4qspvbt",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1679899338003,
"version": 2,
"chainId": 84,
"sender": "3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx",
"senderPublicKey": "DyeDJ3fgwVVux2WRkxpLU9BbVjTM96AyV58b7bRFzCBx",
"proofs": [
"5DpMqYAd1tqY3Few2Fyg3hpKTaCzMV7ayTfToHLC4FCMv13pJttd6CvqEZ2vCg8a6H5HnXSs1FkEUGJriUVV8YmS"
],
"script": "base64:BgIKCAISBgoEGBgRAQEABXRlYW1zASCFY5Wj84iOsN4MF44ITr+aP5K7Jts66HaOFtwUIipIfgEBaQEGYnV5TmZ0BAZzZWxsZXIEbmZ0cwVwcmljZQt0b3RhbGFtb3VudAQFYnV5ZXIIBQFpBmNhbGxlcgQDbmZ0CQCQAwEFBG5mdHMEDGJ1eWVyQmFsYW5jZQkA8AcCBQVidXllcgEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4EBmFtb3VudAkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQKAQNzdW0CBWFjY3VtBG5leHQJAGQCBQVhY2N1bQUEbmV4dAQDYXJyBQVwcmljZQQJdG90YWxDb3N0CgACJGwFA2FycgoAAiRzCQCQAwEFAiRsCgAFJGFjYzAAAAoBBSRmMF8xAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQEDc3VtAgUCJGEJAJEDAgUCJGwFAiRpCgEFJGYwXzICAiRhAiRpAwkAZwIFAiRpBQIkcwUCJGEJAAIBAhNMaXN0IHNpemUgZXh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c3MBCQDZBAEJAJEDAgUGc2VsbGVyAAAJAJEDAgUFcHJpY2UAAAEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4JAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBCQDZBAEJAJEDAgUGc2VsbGVyAAEJAJEDAgUFcHJpY2UAAQEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4JAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwkBB0FkZHJlc3MBCQDZBAEJAJEDAgUGc2VsbGVyAAEJAJEDAgUFcHJpY2UAAgEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4FA25pbABNgkNd",
"height": 2508032,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 4E2K6Thw3YNavQiuE6qyEVWEwd8mtjFiqYcKHi56K8ef
Next: 3vSppiy9vnnjPuLNXvv5YJBBdxAtQQZRHLm7HWMA6Fw9
Diff:
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) = { |
---|
|
9 | 9 | | let nft = size(nfts) |
---|
10 | 10 | | let buyerBalance = assetBalance(buyer, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq') |
---|
11 | 11 | | let amount = value(i.payments[0].amount) |
---|
12 | | - | let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq' |
---|
13 | 12 | | func sum (accum,next) = (accum + next) |
---|
14 | 13 | | |
---|
15 | 14 | | let arr = price |
---|
|
27 | 26 | | |
---|
28 | 27 | | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) |
---|
29 | 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 = 0 |
---|
| 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 | + | } |
---|
30 | 46 | | if (if ((totalCost > amount)) |
---|
31 | 47 | | then true |
---|
32 | 48 | | else (totalamount > amount)) |
---|
33 | | - | then throw("your paying ammount is wrong") |
---|
| 49 | + | then throw("your paying ammount is wrong ") |
---|
34 | 50 | | else if (if ((size(nfts) != size(seller))) |
---|
35 | 51 | | then true |
---|
36 | 52 | | else (size(seller) != size(price))) |
---|
37 | 53 | | then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.") |
---|
38 | 54 | | else if ((amount > buyerBalance)) |
---|
39 | 55 | | then throw("Buyer does not have enough funds to complete the purchase.") |
---|
40 | | - | else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, fromBase58String(nfts[0])), ScriptTransfer(Address(fromBase58String(seller[0])), price[0], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
| 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')] |
---|
41 | 57 | | } |
---|
42 | 58 | | |
---|
43 | 59 | | |
---|
Full:
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 | | - | let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq' |
---|
13 | 12 | | func sum (accum,next) = (accum + next) |
---|
14 | 13 | | |
---|
15 | 14 | | let arr = price |
---|
16 | 15 | | let totalCost = { |
---|
17 | 16 | | let $l = arr |
---|
18 | 17 | | let $s = size($l) |
---|
19 | 18 | | let $acc0 = 0 |
---|
20 | 19 | | func $f0_1 ($a,$i) = if (($i >= $s)) |
---|
21 | 20 | | then $a |
---|
22 | 21 | | else sum($a, $l[$i]) |
---|
23 | 22 | | |
---|
24 | 23 | | func $f0_2 ($a,$i) = if (($i >= $s)) |
---|
25 | 24 | | then $a |
---|
26 | 25 | | else throw("List size exceeds 5") |
---|
27 | 26 | | |
---|
28 | 27 | | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) |
---|
29 | 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 = 0 |
---|
| 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 | + | } |
---|
30 | 46 | | if (if ((totalCost > amount)) |
---|
31 | 47 | | then true |
---|
32 | 48 | | else (totalamount > amount)) |
---|
33 | | - | then throw("your paying ammount is wrong") |
---|
| 49 | + | then throw("your paying ammount is wrong ") |
---|
34 | 50 | | else if (if ((size(nfts) != size(seller))) |
---|
35 | 51 | | then true |
---|
36 | 52 | | else (size(seller) != size(price))) |
---|
37 | 53 | | then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.") |
---|
38 | 54 | | else if ((amount > buyerBalance)) |
---|
39 | 55 | | then throw("Buyer does not have enough funds to complete the purchase.") |
---|
40 | | - | else [StringEntry(toString(i.caller), toString(amount)), ScriptTransfer(buyer, 1, fromBase58String(nfts[0])), ScriptTransfer(Address(fromBase58String(seller[0])), price[0], base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq')] |
---|
| 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')] |
---|
41 | 57 | | } |
---|
42 | 58 | | |
---|
43 | 59 | | |
---|