tx · EucoipR4ifJfHGygWnKvd2ZwraPAb4PDsBfrajXnkTdS 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx: -0.01000000 Waves 2023.03.25 12:47 [2505366] smart account 3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx > SELF 0.00000000 Waves
{ "type": 13, "id": "EucoipR4ifJfHGygWnKvd2ZwraPAb4PDsBfrajXnkTdS", "fee": 1000000, "feeAssetId": null, "timestamp": 1679737735856, "version": 2, "chainId": 84, "sender": "3N5BTH4bjnXn7AAKoj4sswxytsPGmdXUuTx", "senderPublicKey": "DyeDJ3fgwVVux2WRkxpLU9BbVjTM96AyV58b7bRFzCBx", "proofs": [ "65bKy1Nybky1ExufjuZ6gfz6jkXcr88RykZ8JgUFUpcb6F7ox4pWnxK47dBQCob38frYJjcaijcSKymxLU1uyH3D" ], "script": "base64:BgIJCAISBQoDCAgBAAEBaQEGYnV5TmZ0AwZzZWxsZXIEbmZ0cwVwcmljZQQFYnV5ZXIIBQFpBmNhbGxlcgQGYW1vdW50CQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAABmFtb3VudAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDBQVidXllcgUFcHJpY2UFBHVuaXQJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUFYnV5ZXIAAQkA2QQBBQRuZnRzBQNuaWwA9gilbQ==", "height": 2505366, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DwFWPbzX6oQRGuwjHw9JokHNv3GwHpzMUR48YVsYp57A Next: 9FdhTdZerXPHWJ22Pt4U6iv2eeJaz7HXJcDEz7Qapwuk Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | ||
4 | + | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func buyNft (seller,nfts,price | |
7 | + | func buyNft (seller,nfts,price) = { | |
8 | 8 | let buyer = i.caller | |
9 | - | let nft = size(nfts) | |
10 | - | let buyerBalance = assetBalance(buyer, base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq') | |
11 | 9 | let amount = value(i.payments[0].amount) | |
12 | - | let priceOne = ((price[0] / 1000) * 975) | |
13 | - | let priceTwo = ((price[1] / 1000) * 975) | |
14 | - | let priceThree = ((price[2] / 1000) * 975) | |
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 if ((i.payments[0].assetId == teams)) | |
43 | - | then [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, teams), ScriptTransfer(Address(fromBase58String(seller[1])), priceTwo, teams), ScriptTransfer(Address(fromBase58String(seller[1])), priceThree, teams)] | |
44 | - | else nil | |
10 | + | [ScriptTransfer(buyer, price, unit), ScriptTransfer(buyer, 1, fromBase58String(nfts))] | |
45 | 11 | } | |
46 | 12 | ||
47 | 13 |
github/deemru/w8io/169f3d6 30.22 ms ◑