tx · DLM19xYSccAKZEvRAu9EGn2ZBeR9nPFNVdPUZSQom8RU

3Mx2mQfjNt9bjMGLKeVEUqY18DfQE9zE6AX:  -0.01000000 Waves

2022.02.01 23:10 [1905001] smart account 3Mx2mQfjNt9bjMGLKeVEUqY18DfQE9zE6AX > SELF 0.00000000 Waves

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

github/deemru/w8io/169f3d6 
34.09 ms