tx · 29xMgTQ2BN7dk8NY1Ge1pN6Co4H9UuhMdziSgsA3zwEN 3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx: -0.01000000 Waves 2022.11.15 15:27 [2318236] smart account 3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx > SELF 0.00000000 Waves
{ "type": 13, "id": "29xMgTQ2BN7dk8NY1Ge1pN6Co4H9UuhMdziSgsA3zwEN", "fee": 1000000, "feeAssetId": null, "timestamp": 1668515247797, "version": 2, "chainId": 84, "sender": "3N85YW6NZ9pLYvSdt1ASMQTGxvncnU1vUNx", "senderPublicKey": "EKZmHJ5bK3qKKgRdq8rAamt9qrDbVMLARzRqXoQW258v", "proofs": [ "4UpADHBqryQ9mETJg9yYATJNK6fHY64B8V3yLpSaN4z5HBFTqsyy8j99LGPhdXyf5a3vRKxH2hfHheydMyfv4JCY" ], "script": "base64:BgIfCAISCwoJCAgICAgBCAgIEgQKAggIEgMKAQgSAwoBAQUACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAVrU2VsbAIEc2VsbAAGa1ByaWNlAgVwcmljZQEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcEAWkBCWNyZWF0ZU5mdAkIbmZ0X25hbWUJbmZ0X293bmVyD25mdF9kQXBwQWRkcmVzcwhuZnRfdHlwZQhuZnRfdGFncxFuZnRfc2VsbGluZ19wcmljZQ9uZnRfZGVzY3JpcHRpb24KbmZ0X29uU2VsbAhuZnRfZGF0YQQIbmV3VG9rZW4JAMIIBQUIbmZ0X25hbWUFD25mdF9kZXNjcmlwdGlvbgABAAAHBAdpc3N1ZUlkCQC4CAEFCG5ld1Rva2VuCQDMCAIFCG5ld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BnRva2VuMAgFCyR0MDIzNzMyNDU4Al8xBAdhbW91bnQwCAULJHQwMjM3MzI0NTgCXzIDCQEBIQEJAQVpc05mdAEFBnRva2VuMAkAAgECEFRva2VuIGlzIG5vdCBORlQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIFBmtQcmljZQUJc2VwYXJhdG9yCQDYBAEJAQV2YWx1ZQEICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAkApAMBBQVwcmljZQkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgkApQgBCAUBaQZjYWxsZXIFCXNlcGFyYXRvcgUFa1NlbGwJAKwCAgkArAICCQDYBAEFBnRva2VuMAUJc2VwYXJhdG9yCQCkAwEFB2Ftb3VudDAFA25pbAB13X53", "height": 2318236, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ex9kr1B5LcLLh2fX799SbwRGbwH799Qv8v32LVC9AK7K Next: HUdx8ixP9shidW1kSGtf1JQpMa3hDFEtZFyzR1cX6szt Diff:
Old | New | Differences | |
---|---|---|---|
19 | 19 | case _ => | |
20 | 20 | false | |
21 | 21 | } | |
22 | + | ||
23 | + | ||
24 | + | @Callable(i) | |
25 | + | func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
26 | + | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
27 | + | let issueId = calculateAssetId(newToken) | |
28 | + | [newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "nft_owner"), toString(i.caller)), StringEntry(((toBase58String(issueId) + separator) + "nft_type"), nft_type), StringEntry(((toBase58String(issueId) + separator) + "nft_tags"), nft_tags), StringEntry(((toBase58String(issueId) + separator) + "nft_dAppAddress"), nft_dAppAddress), IntegerEntry(((toBase58String(issueId) + separator) + "nft_selling_price"), nft_selling_price), StringEntry(((toBase58String(issueId) + separator) + "nft_onSell"), nft_onSell), StringEntry(((toBase58String(issueId) + separator) + "nft_data"), nft_data)] | |
29 | + | } | |
30 | + | ||
22 | 31 | ||
23 | 32 | ||
24 | 33 | @Callable(i) | |
47 | 56 | ||
48 | 57 | @Callable(i) | |
49 | 58 | func sellNFT (price) = { | |
50 | - | let $ | |
51 | - | let token0 = $ | |
52 | - | let amount0 = $ | |
59 | + | let $t023732458 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
60 | + | let token0 = $t023732458._1 | |
61 | + | let amount0 = $t023732458._2 | |
53 | 62 | if (!(isNft(token0))) | |
54 | 63 | then throw("Token is not NFT") | |
55 | 64 | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "_" | |
5 | 5 | ||
6 | 6 | let kBuy = "buy" | |
7 | 7 | ||
8 | 8 | let kSell = "sell" | |
9 | 9 | ||
10 | 10 | let kPrice = "price" | |
11 | 11 | ||
12 | 12 | func isNft (assetId) = match assetInfo(assetId) { | |
13 | 13 | case token: Asset => | |
14 | 14 | if (if ((token.decimals == 0)) | |
15 | 15 | then (token.quantity == 1) | |
16 | 16 | else false) | |
17 | 17 | then (token.reissuable == false) | |
18 | 18 | else false | |
19 | 19 | case _ => | |
20 | 20 | false | |
21 | 21 | } | |
22 | + | ||
23 | + | ||
24 | + | @Callable(i) | |
25 | + | func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = { | |
26 | + | let newToken = Issue(nft_name, nft_description, 1, 0, false) | |
27 | + | let issueId = calculateAssetId(newToken) | |
28 | + | [newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "nft_owner"), toString(i.caller)), StringEntry(((toBase58String(issueId) + separator) + "nft_type"), nft_type), StringEntry(((toBase58String(issueId) + separator) + "nft_tags"), nft_tags), StringEntry(((toBase58String(issueId) + separator) + "nft_dAppAddress"), nft_dAppAddress), IntegerEntry(((toBase58String(issueId) + separator) + "nft_selling_price"), nft_selling_price), StringEntry(((toBase58String(issueId) + separator) + "nft_onSell"), nft_onSell), StringEntry(((toBase58String(issueId) + separator) + "nft_data"), nft_data)] | |
29 | + | } | |
30 | + | ||
22 | 31 | ||
23 | 32 | ||
24 | 33 | @Callable(i) | |
25 | 34 | func issueNft (name,meta) = { | |
26 | 35 | let newToken = Issue(name, meta, 1, 0, false) | |
27 | 36 | let issueId = calculateAssetId(newToken) | |
28 | 37 | [newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller))] | |
29 | 38 | } | |
30 | 39 | ||
31 | 40 | ||
32 | 41 | ||
33 | 42 | @Callable(i) | |
34 | 43 | func buyNFT (nftID) = { | |
35 | 44 | let assetId = fromBase58String(nftID) | |
36 | 45 | let amount = value(i.payments[0].amount) | |
37 | 46 | let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this NFT") | |
38 | 47 | let owner = valueOrErrorMessage(getStringValue(((nftID + separator) + "Owner")), "No owner") | |
39 | 48 | if ((i.payments[0].assetId != unit)) | |
40 | 49 | then throw("Pay in waves") | |
41 | 50 | else if ((parseIntValue(price) > amount)) | |
42 | 51 | then throw("Invalid payment") | |
43 | 52 | else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(value(addressFromString(owner)), parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))] | |
44 | 53 | } | |
45 | 54 | ||
46 | 55 | ||
47 | 56 | ||
48 | 57 | @Callable(i) | |
49 | 58 | func sellNFT (price) = { | |
50 | - | let $ | |
51 | - | let token0 = $ | |
52 | - | let amount0 = $ | |
59 | + | let $t023732458 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
60 | + | let token0 = $t023732458._1 | |
61 | + | let amount0 = $t023732458._2 | |
53 | 62 | if (!(isNft(token0))) | |
54 | 63 | then throw("Token is not NFT") | |
55 | 64 | else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
56 | 65 | } | |
57 | 66 | ||
58 | 67 |
github/deemru/w8io/026f985 70.81 ms ◑