tx · F7WLkbPxZwuAt7Btq8SbePaDv8FYY42x9hzTKfVnfb3C 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo: -0.01000000 Waves 2022.11.16 14:16 [2319597] smart account 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo > SELF 0.00000000 Waves
{ "type": 13, "id": "F7WLkbPxZwuAt7Btq8SbePaDv8FYY42x9hzTKfVnfb3C", "fee": 1000000, "feeAssetId": null, "timestamp": 1668597095013, "version": 2, "chainId": 84, "sender": "3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo", "senderPublicKey": "Kwu4LYBMntApXv8t7csxV23Kvc3tvak26wMKK56tA4V", "proofs": [ "xZyxsaPQcTR8vBFuwKFeZ4ac6dHuTu4paKz5RL6WymNtLS1ApJfBJvJM4cn4esN97sAaJf3Qr9rM3KXgo18yyBy" ], "script": "base64:BgIPCAISCwoJCAgICAgBCAgIBQAJc2VwYXJhdG9yAgFfAARrQnV5AgNidXkABWtTZWxsAgRzZWxsAAZrUHJpY2UCBXByaWNlAQVpc05mdAEHYXNzZXRJZAQHJG1hdGNoMAkA7AcBBQdhc3NldElkAwkAAQIFByRtYXRjaDACBUFzc2V0BAV0b2tlbgUHJG1hdGNoMAMDCQAAAggFBXRva2VuCGRlY2ltYWxzAAAJAAACCAUFdG9rZW4IcXVhbnRpdHkAAQcJAAACCAUFdG9rZW4KcmVpc3N1YWJsZQcHBwEBaQEIaXNzdWVOZnQJCG5mdF9uYW1lCW5mdF9vd25lcg9uZnRfZEFwcEFkZHJlc3MIbmZ0X3R5cGUIbmZ0X3RhZ3MRbmZ0X3NlbGxpbmdfcHJpY2UPbmZ0X2Rlc2NyaXB0aW9uCm5mdF9vblNlbGwIbmZ0X2RhdGEECG5ld1Rva2VuCQDCCAUFCG5mdF9uYW1lBQ9uZnRfZGVzY3JpcHRpb24AAQAABwQHaXNzdWVJZAkAuAgBBQhuZXdUb2tlbgkAzAgCBQhuZXdUb2tlbgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgkA2AQBBQdpc3N1ZUlkBQlzZXBhcmF0b3ICCW5mdF9vd25lcgkApQgBCAUBaQZjYWxsZXIJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJANgEAQUHaXNzdWVJZAUJc2VwYXJhdG9yAghuZnRfdHlwZQUIbmZ0X3R5cGUJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJANgEAQUHaXNzdWVJZAUJc2VwYXJhdG9yAghuZnRfdGFncwUIbmZ0X3RhZ3MJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJANgEAQUHaXNzdWVJZAUJc2VwYXJhdG9yAg9uZnRfZEFwcEFkZHJlc3MFD25mdF9kQXBwQWRkcmVzcwkAzAgCCQEMSW50ZWdlckVudHJ5AgkArAICCQCsAgIJANgEAQUHaXNzdWVJZAUJc2VwYXJhdG9yAhFuZnRfc2VsbGluZ19wcmljZQURbmZ0X3NlbGxpbmdfcHJpY2UJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJANgEAQUHaXNzdWVJZAUJc2VwYXJhdG9yAgpuZnRfb25TZWxsBQpuZnRfb25TZWxsCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICCQDYBAEFB2lzc3VlSWQFCXNlcGFyYXRvcgIIbmZ0X2RhdGEFCG5mdF9kYXRhCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICCQDYBAEFB2lzc3VlSWQFCXNlcGFyYXRvcgIOaXNzdWVOZnRUb1VzZXIJANwEAQUHaXNzdWVJZAUDbmlsAD9OagY=", "height": 2319597, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9xZ3FGXVbxNqSkDzPTjUS1S1UhUiq9DcnGLbuAGPkzks Next: H59DAQKCN8HtqrBsTMMiDFFwwUa3fdjnPVU1bMXUnhw2 Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | ||
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | - | func issueNft (name, | |
26 | - | let newToken = Issue(name, | |
25 | + | func issueNft (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 | 27 | let issueId = calculateAssetId(newToken) | |
28 | - | [newToken, StringEntry(((kPrice + separator) + toBase58String(issueId)), toString(price))] | |
29 | - | } | |
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | @Callable(i) | |
34 | - | func buyNFT (nftID) = { | |
35 | - | let assetId = fromBase58String(nftID) | |
36 | - | let amount = value(i.payments[0].amount) | |
37 | - | let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this nft") | |
38 | - | if ((i.payments[0].assetId != unit)) | |
39 | - | then throw("pay in waves") | |
40 | - | else if ((parseIntValue(price) > amount)) | |
41 | - | then throw("Invalid payment") | |
42 | - | else [ScriptTransfer(i.caller, 1, assetId), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))] | |
43 | - | } | |
44 | - | ||
45 | - | ||
46 | - | ||
47 | - | @Callable(i) | |
48 | - | func sellNFT () = { | |
49 | - | let $t011731258 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
50 | - | let token0 = $t011731258._1 | |
51 | - | let amount0 = $t011731258._2 | |
52 | - | let price = getStringValue(((kPrice + separator) + valueOrErrorMessage(toBase58String(token0), "There is no price for this nft"))) | |
53 | - | if (!(isNft(token0))) | |
54 | - | then throw("Token is not NFT") | |
55 | - | else [ScriptTransfer(i.caller, parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
28 | + | [newToken, 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), StringEntry(((toBase58String(issueId) + separator) + "issueNftToUser"), toBase16String(issueId))] | |
56 | 29 | } | |
57 | 30 | ||
58 | 31 |
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 | 22 | ||
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | - | func issueNft (name, | |
26 | - | let newToken = Issue(name, | |
25 | + | func issueNft (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 | 27 | let issueId = calculateAssetId(newToken) | |
28 | - | [newToken, StringEntry(((kPrice + separator) + toBase58String(issueId)), toString(price))] | |
29 | - | } | |
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | @Callable(i) | |
34 | - | func buyNFT (nftID) = { | |
35 | - | let assetId = fromBase58String(nftID) | |
36 | - | let amount = value(i.payments[0].amount) | |
37 | - | let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this nft") | |
38 | - | if ((i.payments[0].assetId != unit)) | |
39 | - | then throw("pay in waves") | |
40 | - | else if ((parseIntValue(price) > amount)) | |
41 | - | then throw("Invalid payment") | |
42 | - | else [ScriptTransfer(i.caller, 1, assetId), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))] | |
43 | - | } | |
44 | - | ||
45 | - | ||
46 | - | ||
47 | - | @Callable(i) | |
48 | - | func sellNFT () = { | |
49 | - | let $t011731258 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
50 | - | let token0 = $t011731258._1 | |
51 | - | let amount0 = $t011731258._2 | |
52 | - | let price = getStringValue(((kPrice + separator) + valueOrErrorMessage(toBase58String(token0), "There is no price for this nft"))) | |
53 | - | if (!(isNft(token0))) | |
54 | - | then throw("Token is not NFT") | |
55 | - | else [ScriptTransfer(i.caller, parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
28 | + | [newToken, 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), StringEntry(((toBase58String(issueId) + separator) + "issueNftToUser"), toBase16String(issueId))] | |
56 | 29 | } | |
57 | 30 | ||
58 | 31 |
github/deemru/w8io/026f985 36.07 ms ◑