tx · 6YxgizRCCbShFd1bGnNgNqoZZUqAAwgNhsZ2R3Va2H1K 3Mx2mQfjNt9bjMGLKeVEUqY18DfQE9zE6AX: -0.01000000 Waves 2022.02.01 23:52 [1905044] smart account 3Mx2mQfjNt9bjMGLKeVEUqY18DfQE9zE6AX > SELF 0.00000000 Waves
{ "type": 13, "id": "6YxgizRCCbShFd1bGnNgNqoZZUqAAwgNhsZ2R3Va2H1K", "fee": 1000000, "feeAssetId": null, "timestamp": 1643748802826, "version": 2, "chainId": 84, "sender": "3Mx2mQfjNt9bjMGLKeVEUqY18DfQE9zE6AX", "senderPublicKey": "2psiQevPvpc1FoG6bAPSTXVmPLJXVhCLMtqZZNnysMCQ", "proofs": [ "zyS8eaMZy8pi5fwjKCvWHREPrw4g8zyd8TQcWXXZT6FvNMqq4bFQFwhtuu8m9VWAKu5Jk2gsRA2dNWDqj7QASuV" ], "script": "base64:AAIFAAAAAAAAAOIIAhIDCgEIEgMKAQEaDQoBYRIIVEVTVFVTRE4aDgoBYhIJRFVDS0lTU1VFGg4KAWMSCWlzRHVja05GVBoKCgFkEgVhc3NldBoQCgFlEgtpc0R1Y2tJc3N1ZRoMCgFmEgckbWF0Y2gwGgYKAWcSAWEaBgoBaBIBaRoKCgFpEgVuZnRJZBoPCgFqEgpuZnRBc3NldElkGggKAWsSA3BtdBoQCgFsEgtidXlPdXRQcmljZRoKCgFtEgVvd25lchoGCgFuEgFvGgwKAW8SB2Fzc2V0SWQaDgoBcBIJYXNzZXROYW1lAAAAAwAAAAABYQEAAAAgAIUpTOkTLqoXmGxvzdEleYQFDyLlDcuqJGsbsu9ZirwAAAAAAWIBAAAAGgFXjLVIn36eFdUYl44bd/sJf2di2uFtYyVJAQAAAAFjAAAAAQAAAAFkBAAAAAFlBAAAAAFmCAgFAAAAAWQAAAAGaXNzdWVyAAAABWJ5dGVzAwkAAAEAAAACBQAAAAFmAgAAAApCeXRlVmVjdG9yBAAAAAFnBQAAAAFmCQAAAAAAAAIFAAAAAW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aWwJAAACAAAAAQIAAAAOQ2FuJ3QgZmluZCBORlQJAAACAAAAAQIAAAAQQ2FuJ3QgZmluZCBhc3NldAAAAAAKdm+G", "height": 1905044, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DLM19xYSccAKZEvRAu9EGn2ZBeR9nPFNVdPUZSQom8RU Next: ErvGY6qkjo1jCWvng87k95gAs6b18dzHRSib95t2EjD Diff:
Old | New | Differences | |
---|---|---|---|
12 | 12 | case _ => | |
13 | 13 | false | |
14 | 14 | } | |
15 | - | if (if (if (if (isDuckIssue) | |
16 | - | then (asset.decimals == 0) | |
17 | - | else false) | |
15 | + | if (if (if ((asset.decimals == 0)) | |
18 | 16 | then (asset.reissuable == false) | |
19 | 17 | else false) | |
20 | 18 | then (asset.quantity == 1) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let TESTUSDN = base58'132maRL3uF35tc2bpRih9D6MYq5DR6H28zkop786dKyu' | |
5 | 5 | ||
6 | 6 | let DUCKISSUE = base58'3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv' | |
7 | 7 | ||
8 | 8 | func isDuckNFT (asset) = { | |
9 | 9 | let isDuckIssue = match asset.issuer.bytes { | |
10 | 10 | case a: ByteVector => | |
11 | 11 | (a == DUCKISSUE) | |
12 | 12 | case _ => | |
13 | 13 | false | |
14 | 14 | } | |
15 | - | if (if (if (if (isDuckIssue) | |
16 | - | then (asset.decimals == 0) | |
17 | - | else false) | |
15 | + | if (if (if ((asset.decimals == 0)) | |
18 | 16 | then (asset.reissuable == false) | |
19 | 17 | else false) | |
20 | 18 | then (asset.quantity == 1) | |
21 | 19 | else false) | |
22 | 20 | then contains(asset.name, "DUCK") | |
23 | 21 | else false | |
24 | 22 | } | |
25 | 23 | ||
26 | 24 | ||
27 | 25 | @Callable(i) | |
28 | 26 | func buyNFT (nftId) = { | |
29 | 27 | let nftAssetId = fromBase58String(nftId) | |
30 | 28 | let pmt = if ((size(i.payments) == 1)) | |
31 | 29 | then i.payments[0] | |
32 | 30 | else throw("Attached payment is required") | |
33 | 31 | let buyOutPrice = match getInteger(this, ("buyOutPrice_" + nftId)) { | |
34 | 32 | case a: Int => | |
35 | 33 | a | |
36 | 34 | case _ => | |
37 | 35 | 0 | |
38 | 36 | } | |
39 | 37 | let owner = match getBinary(this, ("owner_" + nftId)) { | |
40 | 38 | case o: ByteVector => | |
41 | 39 | o | |
42 | 40 | case _ => | |
43 | 41 | throw("Can't find owner") | |
44 | 42 | } | |
45 | 43 | let asset = match assetInfo(nftAssetId) { | |
46 | 44 | case a: Asset => | |
47 | 45 | a | |
48 | 46 | case _ => | |
49 | 47 | throw("Can't find NFT") | |
50 | 48 | } | |
51 | 49 | if (!(if (if ((buyOutPrice > 0)) | |
52 | 50 | then (buyOutPrice == pmt.amount) | |
53 | 51 | else false) | |
54 | 52 | then (pmt.assetId == TESTUSDN) | |
55 | 53 | else false)) | |
56 | 54 | then [ScriptTransfer(i.caller, 1, asset.id), ScriptTransfer(Address(owner), buyOutPrice, TESTUSDN), DeleteEntry(("owner_" + nftId)), DeleteEntry(("buyOutPrice_" + nftId))] | |
57 | 55 | else throw("Somthing is wrong") | |
58 | 56 | } | |
59 | 57 | ||
60 | 58 | ||
61 | 59 | ||
62 | 60 | @Callable(i) | |
63 | 61 | func sellNFT (buyOutPrice) = { | |
64 | 62 | let pmt = if ((size(i.payments) == 1)) | |
65 | 63 | then i.payments[0] | |
66 | 64 | else throw("Attached NFT is required") | |
67 | 65 | if (isDefined(pmt.assetId)) | |
68 | 66 | then { | |
69 | 67 | let assetId = value(pmt.assetId) | |
70 | 68 | let asset = match assetInfo(assetId) { | |
71 | 69 | case a: Asset => | |
72 | 70 | a | |
73 | 71 | case _ => | |
74 | 72 | throw("Can't find asset") | |
75 | 73 | } | |
76 | 74 | if (if (isDuckNFT(asset)) | |
77 | 75 | then (buyOutPrice > 0) | |
78 | 76 | else false) | |
79 | 77 | then { | |
80 | 78 | let assetName = toBase58String(asset.id) | |
81 | 79 | [IntegerEntry(("buyOutPrice_" + assetName), buyOutPrice), BinaryEntry(("owner_" + assetName), i.caller.bytes)] | |
82 | 80 | } | |
83 | 81 | else throw("Can't find NFT") | |
84 | 82 | } | |
85 | 83 | else throw("Can't find asset") | |
86 | 84 | } | |
87 | 85 | ||
88 | 86 |
github/deemru/w8io/169f3d6 27.50 ms ◑