tx · 62Tg79ihRh7qyTPbXNMaMcwXmkzAYCSzgywzf2cusKdj

3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx:  -0.01000000 Waves

2023.03.27 18:48 [2508566] smart account 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx > SELF 0.00000000 Waves

{ "type": 13, "id": "62Tg79ihRh7qyTPbXNMaMcwXmkzAYCSzgywzf2cusKdj", "fee": 1000000, "feeAssetId": null, "timestamp": 1679932323800, "version": 2, "chainId": 84, "sender": "3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx", "senderPublicKey": "DyeDJ3fgwVVux2WRkxpLU9BbVjTM96AyV58b7bRFzCBx", "proofs": [ "4zYbVh4NgPGJvA8AeKNUTruzm8eaM7iMEU8SfAojMsGeprDWi8GWJLKxVGHjxZbsQpBcWQd4hJNEseeP3cyNvRwL" ], "script": "base64:BgIICAISBAoCGAEBAAV0ZWFtcwEghWOVo/OIjrDeDBeOCE6/mj+SuybbOuh2jhbcFCIqSH4BAWkBDmJ1eUFsbFByb2R1Y3RzAgduZnRJbmZvC3RvdGFsYW1vdW50BAVidXllcggFAWkGY2FsbGVyBAxidXllckJhbGFuY2UJAPAHAgUFYnV5ZXIFBXRlYW1zBAZhbW91bnQJAQV2YWx1ZQEICQCRAwIIBQFpCHBheW1lbnRzAAAGYW1vdW50BARuZlQxCQC1CQIJAJEDAgUHbmZ0SW5mbwAAAgFfBARuZlQyCQC1CQIJAJEDAgUHbmZ0SW5mbwABAgFfBARuZlQzCQC1CQIJAJEDAgUHbmZ0SW5mbwACAgFfBARuZlQ0CQC1CQIJAJEDAgUHbmZ0SW5mbwADAgFfBARuZlQ1CQC1CQIJAJEDAgUHbmZ0SW5mbwAEAgFfAwkAZgIFC3RvdGFsYW1vdW50BQZhbW91bnQJAAIBAhx5b3VyIHBheWluZyBhbW91bnQgaXMgd3JvbmcgAwkAZgIFBmFtb3VudAUMYnV5ZXJCYWxhbmNlCQACAQI6QnV5ZXIgZG9l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bACykotY", "height": 2508566, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 79JCZFSyNtVnuyy4wQ5EzuactLCnnwNYgdAEs5MXpnr6 Next: GDWBcjbXexDAiPSG8eWXFLhTtTULd8B229fgZyLBgbxe Diff:
OldNewDifferences
44 let a = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
55
66 @Callable(b)
7-func buyNft (c,d,e,f) = {
8- let g = b.caller
9- let h = size(d)
10- let i = assetBalance(g, a)
11- let j = value(b.payments[0].amount)
12- if ((f > j))
13- then throw("your paying ammount is wrong ")
14- else if (if ((size(d) != size(c)))
15- then true
16- else (size(c) != size(e)))
17- then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.")
18- else if ((j > i))
19- then throw("Buyer does not have enough funds to complete the purchase.")
20- else if (if (if ((size(d) == 1))
21- then true
22- else (size(c) == 1))
23- then true
24- else (size(e) == 1))
25- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a)]
26- else if (if (if ((size(d) == 2))
27- then true
28- else (size(c) == 2))
29- then true
30- else (size(e) == 2))
31- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(g, 1, fromBase58String(d[1])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a), ScriptTransfer(Address(fromBase58String(c[1])), e[1], a)]
32- else if (if (if ((size(d) == 3))
33- then true
34- else (size(c) == 3))
35- then true
36- else (size(e) == 3))
37- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(g, 1, fromBase58String(d[1])), ScriptTransfer(g, 1, fromBase58String(d[2])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a), ScriptTransfer(Address(fromBase58String(c[1])), e[1], a), ScriptTransfer(Address(fromBase58String(c[2])), e[2], a)]
38- else if (if (if ((size(d) == 4))
39- then true
40- else (size(c) == 4))
41- then true
42- else (size(e) == 4))
43- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(g, 1, fromBase58String(d[1])), ScriptTransfer(g, 1, fromBase58String(d[2])), ScriptTransfer(g, 1, fromBase58String(d[3])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a), ScriptTransfer(Address(fromBase58String(c[1])), e[1], a), ScriptTransfer(Address(fromBase58String(c[2])), e[2], a), ScriptTransfer(Address(fromBase58String(c[3])), e[3], a)]
44- else if (if (if ((size(d) == 5))
45- then true
46- else (size(c) == 5))
47- then true
48- else (size(e) == 5))
49- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(g, 1, fromBase58String(d[1])), ScriptTransfer(g, 1, fromBase58String(d[2])), ScriptTransfer(g, 1, fromBase58String(d[3])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a), ScriptTransfer(Address(fromBase58String(c[1])), e[1], a), ScriptTransfer(Address(fromBase58String(c[2])), e[2], a), ScriptTransfer(Address(fromBase58String(c[3])), e[3], a), ScriptTransfer(Address(fromBase58String(c[4])), e[4], a)]
7+func buyAllProducts (c,d) = {
8+ let e = b.caller
9+ let f = assetBalance(e, a)
10+ let g = value(b.payments[0].amount)
11+ let h = split(c[0], "_")
12+ let i = split(c[1], "_")
13+ let j = split(c[2], "_")
14+ let k = split(c[3], "_")
15+ let l = split(c[4], "_")
16+ if ((d > g))
17+ then throw("your paying amount is wrong ")
18+ else if ((g > f))
19+ then throw("Buyer does not have enough funds to complete the purchase.")
20+ else if ((size(c) == 1))
21+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a)]
22+ else if ((size(c) == 2))
23+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), StringEntry((((((("second_nft_Info=" + "nftId") + i[0]) + "seller_address") + i[1]) + "price") + i[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(e, 1, fromBase58String(i[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a), ScriptTransfer(Address(fromBase58String(i[1])), parseIntValue(i[2]), a)]
24+ else if ((size(c) == 3))
25+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), StringEntry((((((("second_nft_Info=" + "nftId") + i[0]) + "seller_address") + i[1]) + "price") + i[2]), ("buyer" + toString(e))), StringEntry((((((("third_nft_Info=" + "nftId") + j[0]) + "seller_address") + j[1]) + "price") + j[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(e, 1, fromBase58String(i[0])), ScriptTransfer(e, 1, fromBase58String(j[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a), ScriptTransfer(Address(fromBase58String(i[1])), parseIntValue(i[2]), a), ScriptTransfer(Address(fromBase58String(j[1])), parseIntValue(j[2]), a)]
26+ else if ((size(c) == 4))
27+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), StringEntry((((((("second_nft_Info=" + "nftId") + i[0]) + "seller_address") + i[1]) + "price") + i[2]), ("buyer" + toString(e))), StringEntry((((((("third_nft_Info=" + "nftId") + j[0]) + "seller_address") + j[1]) + "price") + j[2]), ("buyer" + toString(e))), StringEntry((((((("fourth_nft_Info=" + "nftId") + k[0]) + "seller_address") + k[1]) + "price") + k[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(e, 1, fromBase58String(i[0])), ScriptTransfer(e, 1, fromBase58String(j[0])), ScriptTransfer(e, 1, fromBase58String(k[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a), ScriptTransfer(Address(fromBase58String(i[1])), parseIntValue(i[2]), a), ScriptTransfer(Address(fromBase58String(j[1])), parseIntValue(j[2]), a), ScriptTransfer(Address(fromBase58String(k[1])), parseIntValue(k[2]), a)]
28+ else if ((size(c) == 5))
29+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), StringEntry((((((("second_nft_Info=" + "nftId") + i[0]) + "seller_address") + i[1]) + "price") + i[2]), ("buyer" + toString(e))), StringEntry((((((("third_nft_Info=" + "nftId") + j[0]) + "seller_address") + j[1]) + "price") + j[2]), ("buyer" + toString(e))), StringEntry((((((("fourth_nft_Info=" + "nftId") + k[0]) + "seller_address") + k[1]) + "price") + k[2]), ("buyer" + toString(e))), StringEntry((((((("fifth_nft_Info=" + "nftId") + l[0]) + "seller_address") + l[1]) + "price") + l[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(e, 1, fromBase58String(i[0])), ScriptTransfer(e, 1, fromBase58String(j[0])), ScriptTransfer(e, 1, fromBase58String(k[0])), ScriptTransfer(e, 1, fromBase58String(l[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a), ScriptTransfer(Address(fromBase58String(i[1])), parseIntValue(i[2]), a), ScriptTransfer(Address(fromBase58String(j[1])), parseIntValue(j[2]), a), ScriptTransfer(Address(fromBase58String(k[1])), parseIntValue(k[2]), a), ScriptTransfer(Address(fromBase58String(l[1])), parseIntValue(l[2]), a)]
30+ else if ((size(c) > 5))
31+ then throw("sorry! maximum limit of your cart is 5 items")
5032 else nil
5133 }
5234
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
55
66 @Callable(b)
7-func buyNft (c,d,e,f) = {
8- let g = b.caller
9- let h = size(d)
10- let i = assetBalance(g, a)
11- let j = value(b.payments[0].amount)
12- if ((f > j))
13- then throw("your paying ammount is wrong ")
14- else if (if ((size(d) != size(c)))
15- then true
16- else (size(c) != size(e)))
17- then throw("Invalid input: Number of NFTs, seller addresses, and costs must be the same.")
18- else if ((j > i))
19- then throw("Buyer does not have enough funds to complete the purchase.")
20- else if (if (if ((size(d) == 1))
21- then true
22- else (size(c) == 1))
23- then true
24- else (size(e) == 1))
25- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a)]
26- else if (if (if ((size(d) == 2))
27- then true
28- else (size(c) == 2))
29- then true
30- else (size(e) == 2))
31- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(g, 1, fromBase58String(d[1])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a), ScriptTransfer(Address(fromBase58String(c[1])), e[1], a)]
32- else if (if (if ((size(d) == 3))
33- then true
34- else (size(c) == 3))
35- then true
36- else (size(e) == 3))
37- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(g, 1, fromBase58String(d[1])), ScriptTransfer(g, 1, fromBase58String(d[2])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a), ScriptTransfer(Address(fromBase58String(c[1])), e[1], a), ScriptTransfer(Address(fromBase58String(c[2])), e[2], a)]
38- else if (if (if ((size(d) == 4))
39- then true
40- else (size(c) == 4))
41- then true
42- else (size(e) == 4))
43- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(g, 1, fromBase58String(d[1])), ScriptTransfer(g, 1, fromBase58String(d[2])), ScriptTransfer(g, 1, fromBase58String(d[3])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a), ScriptTransfer(Address(fromBase58String(c[1])), e[1], a), ScriptTransfer(Address(fromBase58String(c[2])), e[2], a), ScriptTransfer(Address(fromBase58String(c[3])), e[3], a)]
44- else if (if (if ((size(d) == 5))
45- then true
46- else (size(c) == 5))
47- then true
48- else (size(e) == 5))
49- then [StringEntry(toString(b.caller), toString(j)), ScriptTransfer(g, 1, fromBase58String(d[0])), ScriptTransfer(g, 1, fromBase58String(d[1])), ScriptTransfer(g, 1, fromBase58String(d[2])), ScriptTransfer(g, 1, fromBase58String(d[3])), ScriptTransfer(Address(fromBase58String(c[0])), e[0], a), ScriptTransfer(Address(fromBase58String(c[1])), e[1], a), ScriptTransfer(Address(fromBase58String(c[2])), e[2], a), ScriptTransfer(Address(fromBase58String(c[3])), e[3], a), ScriptTransfer(Address(fromBase58String(c[4])), e[4], a)]
7+func buyAllProducts (c,d) = {
8+ let e = b.caller
9+ let f = assetBalance(e, a)
10+ let g = value(b.payments[0].amount)
11+ let h = split(c[0], "_")
12+ let i = split(c[1], "_")
13+ let j = split(c[2], "_")
14+ let k = split(c[3], "_")
15+ let l = split(c[4], "_")
16+ if ((d > g))
17+ then throw("your paying amount is wrong ")
18+ else if ((g > f))
19+ then throw("Buyer does not have enough funds to complete the purchase.")
20+ else if ((size(c) == 1))
21+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a)]
22+ else if ((size(c) == 2))
23+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), StringEntry((((((("second_nft_Info=" + "nftId") + i[0]) + "seller_address") + i[1]) + "price") + i[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(e, 1, fromBase58String(i[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a), ScriptTransfer(Address(fromBase58String(i[1])), parseIntValue(i[2]), a)]
24+ else if ((size(c) == 3))
25+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), StringEntry((((((("second_nft_Info=" + "nftId") + i[0]) + "seller_address") + i[1]) + "price") + i[2]), ("buyer" + toString(e))), StringEntry((((((("third_nft_Info=" + "nftId") + j[0]) + "seller_address") + j[1]) + "price") + j[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(e, 1, fromBase58String(i[0])), ScriptTransfer(e, 1, fromBase58String(j[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a), ScriptTransfer(Address(fromBase58String(i[1])), parseIntValue(i[2]), a), ScriptTransfer(Address(fromBase58String(j[1])), parseIntValue(j[2]), a)]
26+ else if ((size(c) == 4))
27+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), StringEntry((((((("second_nft_Info=" + "nftId") + i[0]) + "seller_address") + i[1]) + "price") + i[2]), ("buyer" + toString(e))), StringEntry((((((("third_nft_Info=" + "nftId") + j[0]) + "seller_address") + j[1]) + "price") + j[2]), ("buyer" + toString(e))), StringEntry((((((("fourth_nft_Info=" + "nftId") + k[0]) + "seller_address") + k[1]) + "price") + k[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(e, 1, fromBase58String(i[0])), ScriptTransfer(e, 1, fromBase58String(j[0])), ScriptTransfer(e, 1, fromBase58String(k[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a), ScriptTransfer(Address(fromBase58String(i[1])), parseIntValue(i[2]), a), ScriptTransfer(Address(fromBase58String(j[1])), parseIntValue(j[2]), a), ScriptTransfer(Address(fromBase58String(k[1])), parseIntValue(k[2]), a)]
28+ else if ((size(c) == 5))
29+ then [StringEntry((((((("first_nft_Info=" + "nftId") + h[0]) + "seller_address") + h[1]) + "price") + h[2]), ("buyer" + toString(e))), StringEntry((((((("second_nft_Info=" + "nftId") + i[0]) + "seller_address") + i[1]) + "price") + i[2]), ("buyer" + toString(e))), StringEntry((((((("third_nft_Info=" + "nftId") + j[0]) + "seller_address") + j[1]) + "price") + j[2]), ("buyer" + toString(e))), StringEntry((((((("fourth_nft_Info=" + "nftId") + k[0]) + "seller_address") + k[1]) + "price") + k[2]), ("buyer" + toString(e))), StringEntry((((((("fifth_nft_Info=" + "nftId") + l[0]) + "seller_address") + l[1]) + "price") + l[2]), ("buyer" + toString(e))), ScriptTransfer(e, 1, fromBase58String(h[0])), ScriptTransfer(e, 1, fromBase58String(i[0])), ScriptTransfer(e, 1, fromBase58String(j[0])), ScriptTransfer(e, 1, fromBase58String(k[0])), ScriptTransfer(e, 1, fromBase58String(l[0])), ScriptTransfer(Address(fromBase58String(h[1])), parseIntValue(h[2]), a), ScriptTransfer(Address(fromBase58String(i[1])), parseIntValue(i[2]), a), ScriptTransfer(Address(fromBase58String(j[1])), parseIntValue(j[2]), a), ScriptTransfer(Address(fromBase58String(k[1])), parseIntValue(k[2]), a), ScriptTransfer(Address(fromBase58String(l[1])), parseIntValue(l[2]), a)]
30+ else if ((size(c) > 5))
31+ then throw("sorry! maximum limit of your cart is 5 items")
5032 else nil
5133 }
5234
5335

github/deemru/w8io/169f3d6 
39.36 ms