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