tx · GUAo8SFDYjkqUsN9KHfxxoEpzF5HPeymBK26WPTQT6CZ

3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw:  -0.01000000 Waves

2023.02.03 14:28 [2433381] smart account 3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw > SELF 0.00000000 Waves

{ "type": 13, "id": "GUAo8SFDYjkqUsN9KHfxxoEpzF5HPeymBK26WPTQT6CZ", "fee": 1000000, "feeAssetId": null, "timestamp": 1675423819777, "version": 2, "chainId": 84, "sender": "3NBYw8rxLmTvyEdsvaYor8nHG6GJ4NjB2Aw", "senderPublicKey": "4NDsd3dGKXuKLCoSbYvcWCX276K9ShP75cs9HTBMLJEN", "proofs": [ "481k7GbgeE3tg4vxarwK8smjAbWBS32Bxop5WGL6kZ8CNUV7SuYgZouu8YppwH6g4GrxwyHSVNKYp6cmTVRz2A7n" ], "script": "base64:BgIHCAISAwoBCAABAWkBCWNyZWF0ZU5mdAENaXBmc0ltYWdlSGFzaAQJcmVjaXBpZW50CAUBaQZjYWxsZXIEBWFzc2V0CQDCCAUJAKwCAgIHZG9ua2V5LQkApAMBAAACCWZpcnN0IE5mdAABAAAHBAdhc3NldElkCQC4CAEFBWFzc2V0CQDMCAIFBWFzc2V0CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMFCXJlY2lwaWVudAACBQdhc3NldElkCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkA2AQBBQdhc3NldElkAgVfaXBmcwUNaXBmc0ltYWdlSGFzaAUDbmlsAPXd8fk=", "height": 2433381, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DDDLYERNDpEi2VVbSCzgDizycTdf66kK8cRfzwNMH3mV Next: vzLeYg95AoD8LuNnuNApfK1NZbBCTEfDKQ64G2mAK4X Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let separator = "_"
5-
6-let kBuy = "buy"
7-
8-let kPrice = "price"
9-
10-let kSell = "sell"
11-
12-let teams = base58'9yhJDfWjPpv6tFjWRD1AJyBQwausJf2ZdxzLn86Uknnq'
13-
14-let waves = base58''
15-
16-let maxAuctionDuration = 7
17-
18-let kBid = "bid"
19-
20-let statusForNFT = $Tuple4("OPEN", "CLOSED", "REWARDED", "CANCELED")
21-
22-let dAppAddress = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq'
23-
24-func isNft (assetId) = match assetInfo(assetId) {
25- case token: Asset =>
26- if (if ((token.decimals == 0))
27- then (token.quantity == 1)
28- else false)
29- then (token.reissuable == false)
30- else false
31- case _ =>
32- false
33-}
344
355
366 @Callable(i)
37-func createNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_data) = {
38- let newToken = Issue(nft_name, nft_description, 1, 0, false)
39- let issueId = calculateAssetId(newToken)
40- let txId = i.transactionId
41-[newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "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(txId) + separator) + "issue_nft"), toBase58String(issueId))]
42- }
43-
44-
45-
46-@Callable(i)
47-func sellNFT (price) = {
48- let txId = i.transactionId
49- let seller = i.caller.bytes
50- let $t018801965 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
51- let token0 = $t018801965._1
52- let amount0 = $t018801965._2
53- if (!(isNft(token0)))
54- then throw("Token is not NFT")
55- else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), price), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
56- }
57-
58-
59-
60-@Callable(i)
61-func buyNFT (nftID,current_nft_owner) = {
62- let assetId = fromBase58String(nftID)
63- let amount = value(i.payments[0].amount)
64- let checkOwnerIsSame = match getString(this, (("nft_" + current_nft_owner) + "_owner")) {
65- case a: String =>
66- a
67- case _ =>
68- false
69- }
70- let price = getStringValue(((((kPrice + separator) + nftID) + "_") + current_nft_owner))
71- if ((current_nft_owner == toString(i.caller)))
72- then throw("current Owner of NFT not able to purchase")
73- else if ((i.payments[0].assetId == teams))
74- then [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, teams), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))]
75- else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(Address(fromBase58String(current_nft_owner)), amount, unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), DeleteEntry((("nft_" + current_nft_owner) + "_owner")), StringEntry((("nft_" + current_nft_owner) + "_owner"), toString(i.caller)), StringEntry(((nftID + separator) + "_owner"), toString(i.caller))]
76- }
77-
78-
79-
80-@Callable(i)
81-func cancelSell (nftId) = {
82- let txId = toBase58String(i.transactionId)
83- let seller = i.caller.bytes
84-[StringEntry(((txId + nftId) + "_nft_status"), "CANCELED"), ScriptTransfer(Address(seller), 1, fromBase58String(nftId))]
7+func createNft (ipfsImageHash) = {
8+ let recipient = i.caller
9+ let asset = Issue(("donkey-" + toString(0)), "first Nft", 1, 0, false)
10+ let assetId = calculateAssetId(asset)
11+[asset, ScriptTransfer(recipient, 2, assetId), StringEntry((toBase58String(assetId) + "_ipfs"), ipfsImageHash)]
8512 }
8613
8714

github/deemru/w8io/169f3d6 
48.59 ms