tx · Di4eWEJXp1eMDhAiZFsASo6tXNVt7uBJU5E2LZp9BAqD

3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq:  -0.01000000 Waves

2022.11.22 07:10 [2327835] smart account 3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq > SELF 0.00000000 Waves

{ "type": 13, "id": "Di4eWEJXp1eMDhAiZFsASo6tXNVt7uBJU5E2LZp9BAqD", "fee": 1000000, "feeAssetId": null, "timestamp": 1669090276197, "version": 2, "chainId": 84, "sender": "3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq", "senderPublicKey": "H6UqxUDcJamDRg1uykVcWMn4zhAMTV7i1nfPq1moLWmJ", "proofs": [ "2ZoJ5xYVnAdsYhGmUiQSFat2qGZrBbWcNwFKFT7WpajpEhrf1CRtQ6iiQg5Fo8vmnEUc84jYSrbRQYgtU13xCmBd" ], "script": "base64:BgIfCAISCwoJCAgICAgBCAgIEgQKAggIEgMKAQgSAwoBAQUACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAVrU2VsbAIEc2VsbAAGa1ByaWNlAgVwcmljZQEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcEAWkBCWNyZWF0ZU5mdAkIbmZ0X25hbWUJbmZ0X293bmVyD25mdF9kQXBwQWRkcmVzcwhuZnRfdHlwZQhuZnRfdGFncxFuZnRfc2VsbGluZ19wcmljZQ9uZnRfZGVzY3JpcHRpb24KbmZ0X29uU2VsbAhuZnRfZGF0YQQIbmV3VG9rZW4JAMIIBQUIbmZ0X25hbWUFD25mdF9kZXNjcmlwdGlvbgABAAAHBAdpc3N1ZUlkCQC4CAEFCG5ld1Rva2VuCQDM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ZW50cwAABmFtb3VudAQGdG9rZW4wCAULJHQwMjM2OTI0NTQCXzEEB2Ftb3VudDAIBQskdDAyMzY5MjQ1NAJfMgMJAQEhAQkBBWlzTmZ0AQUGdG9rZW4wCQACAQIQVG9rZW4gaXMgbm90IE5GVAkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUGa1ByaWNlBQlzZXBhcmF0b3IJANgEAQkBBXZhbHVlAQgJAJEDAggFAWkIcGF5bWVudHMAAAdhc3NldElkCQCkAwEFBXByaWNlCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICCQClCAEIBQFpBmNhbGxlcgUJc2VwYXJhdG9yBQVrU2VsbAkArAICCQCsAgIJANgEAQUGdG9rZW4wBQlzZXBhcmF0b3IJAKQDAQUHYW1vdW50MAUDbmlsACX1Oo8=", "height": 2327835, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DmkU9G4x62MyREjC9jtreXLFH7x88H5WVHa41EUkMRwk Next: 2Xhd6LaLuoFe3iXDPiG8vjeKUThJ2jqKXGmC2nMwBZ4W Diff:
OldNewDifferences
88 let kSell = "sell"
99
1010 let kPrice = "price"
11-
12-let dAppOwner = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq'
1311
1412 func isNft (assetId) = match assetInfo(assetId) {
1513 case token: Asset =>
2422
2523
2624 @Callable(i)
27-func issueNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_image) = {
28- let txId = i.transactionId
29- let creator = toBase58String(i.caller.bytes)
30- let creator_name = nft_owner
31- let issueMetadata = (((((((("{creator: " + creator) + ",") + ("creator_name: " + creator_name)) + ",") + ("description: " + nft_description)) + ",") + ("nft_art_id" + toBase58String(txId))) + "}")
32- let newToken = Issue(nft_name, issueMetadata, 1, 0, false)
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)
3327 let issueId = calculateAssetId(newToken)
34-[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), IntegerEntry(((toBase58String(issueId) + separator) + "nft_selling_price"), nft_selling_price), StringEntry(((toBase58String(issueId) + separator) + "nft_onSell"), nft_onSell), StringEntry(((toBase58String(issueId) + separator) + "nft_image"), nft_image), StringEntry(((toBase58String(issueId) + separator) + "nft_data"), issueMetadata), StringEntry(((toBase58String(i.caller.bytes) + separator) + "nft_owner"), creator), StringEntry(((toBase58String(txId) + separator) + "issue_nft"), toBase58String(issueId))]
28+[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)]
29+ }
30+
31+
32+
33+@Callable(i)
34+func issueNft (name,meta) = {
35+ let newToken = Issue(name, meta, 1, 0, false)
36+ let issueId = calculateAssetId(newToken)
37+[newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller))]
38+ }
39+
40+
41+
42+@Callable(i)
43+func buyNFT (nftID) = {
44+ let assetId = fromBase58String(nftID)
45+ let amount = value(i.payments[0].amount)
46+ let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this NFT")
47+ let owner = valueOrErrorMessage(getStringValue(((nftID + separator) + "Owner")), "No owner")
48+ if ((i.payments[0].assetId != unit))
49+ then throw("Pay in waves")
50+ else if ((parseIntValue(price) > amount))
51+ then throw("Invalid payment")
52+ else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(value(addressFromString(owner)), parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))]
3553 }
3654
3755
3856
3957 @Callable(i)
4058 func sellNFT (price) = {
41- let token = i.payments[0].assetId
42- let assetid = value(i.payments[0].assetId)
43- let amount0 = value(i.payments[0].amount)
44- if (!(isNft(assetid)))
59+ let $t023692454 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
60+ let token0 = $t023692454._1
61+ let amount0 = $t023692454._2
62+ if (!(isNft(token0)))
4563 then throw("Token is not NFT")
46- else [StringEntry((toBase58String(assetid) + "_owner"), toString(i.caller)), StringEntry((toBase58String(assetid) + "_nft_selling_price"), toString(price)), StringEntry((toBase58String(assetid) + "_onsell"), "true"), StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(assetid) + separator) + toString(amount0)))]
47- }
48-
49-
50-
51-@Callable(i)
52-func buyNFT (nftID) = {
53- let caller = toBase64String(i.caller.bytes)
54- let assetId = fromBase58String(nftID)
55- let amount = value(i.payments[0].amount)
56- let nftOwner = getStringValue((toBase58String(assetId) + "_owner"))
57- let price = match getString(this, (toBase58String(assetId) + "_nft_selling_price")) {
58- case a: String =>
59- a
60- case _ =>
61- "0"
62- }
63- let issell = match getString(this, (toBase58String(assetId) + "_onsell")) {
64- case a: String =>
65- a
66- case _ =>
67- "false"
68- }
69- if ((i.payments[0].assetId != unit))
70- then throw("Pay in waves")
71- else if (if ((parseIntValue(price) != amount))
72- then (parseIntValue(price) == 0)
73- else false)
74- then throw("Invalid payment")
75- else if ((caller == nftOwner))
76- then throw("NFT owner will not able to buy this")
77- else if ((caller == toBase58String(dAppOwner)))
78- then throw("You are not eligible due to owner account of app")
79- else if ((issell != "true"))
80- then throw("Not on sell")
81- else [StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), StringEntry((((toString(i.caller) + separator) + kBuy) + "_from"), nftOwner), DeleteEntry((toBase58String(assetId) + "_owner")), DeleteEntry((toBase58String(assetId) + "_onsell")), ScriptTransfer(addressFromStringValue(nftOwner), parseIntValue(price), unit), ScriptTransfer(i.caller, 1, assetId)]
82- }
83-
84-
85-
86-@Callable(i)
87-func deleteNFT () = {
88- let token0 = i.payments[0].assetId
89-[StringEntry(("delete_" + toBase58String(value(i.payments[0].assetId))), "token burn"), Burn(value(token0), 1)]
64+ else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
9065 }
9166
9267
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separator = "_"
55
66 let kBuy = "buy"
77
88 let kSell = "sell"
99
1010 let kPrice = "price"
11-
12-let dAppOwner = base58'3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq'
1311
1412 func isNft (assetId) = match assetInfo(assetId) {
1513 case token: Asset =>
1614 if (if ((token.decimals == 0))
1715 then (token.quantity == 1)
1816 else false)
1917 then (token.reissuable == false)
2018 else false
2119 case _ =>
2220 false
2321 }
2422
2523
2624 @Callable(i)
27-func issueNft (nft_name,nft_owner,nft_dAppAddress,nft_type,nft_tags,nft_selling_price,nft_description,nft_onSell,nft_image) = {
28- let txId = i.transactionId
29- let creator = toBase58String(i.caller.bytes)
30- let creator_name = nft_owner
31- let issueMetadata = (((((((("{creator: " + creator) + ",") + ("creator_name: " + creator_name)) + ",") + ("description: " + nft_description)) + ",") + ("nft_art_id" + toBase58String(txId))) + "}")
32- let newToken = Issue(nft_name, issueMetadata, 1, 0, false)
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)
3327 let issueId = calculateAssetId(newToken)
34-[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), IntegerEntry(((toBase58String(issueId) + separator) + "nft_selling_price"), nft_selling_price), StringEntry(((toBase58String(issueId) + separator) + "nft_onSell"), nft_onSell), StringEntry(((toBase58String(issueId) + separator) + "nft_image"), nft_image), StringEntry(((toBase58String(issueId) + separator) + "nft_data"), issueMetadata), StringEntry(((toBase58String(i.caller.bytes) + separator) + "nft_owner"), creator), StringEntry(((toBase58String(txId) + separator) + "issue_nft"), toBase58String(issueId))]
28+[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)]
29+ }
30+
31+
32+
33+@Callable(i)
34+func issueNft (name,meta) = {
35+ let newToken = Issue(name, meta, 1, 0, false)
36+ let issueId = calculateAssetId(newToken)
37+[newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller))]
38+ }
39+
40+
41+
42+@Callable(i)
43+func buyNFT (nftID) = {
44+ let assetId = fromBase58String(nftID)
45+ let amount = value(i.payments[0].amount)
46+ let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this NFT")
47+ let owner = valueOrErrorMessage(getStringValue(((nftID + separator) + "Owner")), "No owner")
48+ if ((i.payments[0].assetId != unit))
49+ then throw("Pay in waves")
50+ else if ((parseIntValue(price) > amount))
51+ then throw("Invalid payment")
52+ else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(value(addressFromString(owner)), parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))]
3553 }
3654
3755
3856
3957 @Callable(i)
4058 func sellNFT (price) = {
41- let token = i.payments[0].assetId
42- let assetid = value(i.payments[0].assetId)
43- let amount0 = value(i.payments[0].amount)
44- if (!(isNft(assetid)))
59+ let $t023692454 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
60+ let token0 = $t023692454._1
61+ let amount0 = $t023692454._2
62+ if (!(isNft(token0)))
4563 then throw("Token is not NFT")
46- else [StringEntry((toBase58String(assetid) + "_owner"), toString(i.caller)), StringEntry((toBase58String(assetid) + "_nft_selling_price"), toString(price)), StringEntry((toBase58String(assetid) + "_onsell"), "true"), StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(assetid) + separator) + toString(amount0)))]
47- }
48-
49-
50-
51-@Callable(i)
52-func buyNFT (nftID) = {
53- let caller = toBase64String(i.caller.bytes)
54- let assetId = fromBase58String(nftID)
55- let amount = value(i.payments[0].amount)
56- let nftOwner = getStringValue((toBase58String(assetId) + "_owner"))
57- let price = match getString(this, (toBase58String(assetId) + "_nft_selling_price")) {
58- case a: String =>
59- a
60- case _ =>
61- "0"
62- }
63- let issell = match getString(this, (toBase58String(assetId) + "_onsell")) {
64- case a: String =>
65- a
66- case _ =>
67- "false"
68- }
69- if ((i.payments[0].assetId != unit))
70- then throw("Pay in waves")
71- else if (if ((parseIntValue(price) != amount))
72- then (parseIntValue(price) == 0)
73- else false)
74- then throw("Invalid payment")
75- else if ((caller == nftOwner))
76- then throw("NFT owner will not able to buy this")
77- else if ((caller == toBase58String(dAppOwner)))
78- then throw("You are not eligible due to owner account of app")
79- else if ((issell != "true"))
80- then throw("Not on sell")
81- else [StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount))), StringEntry((((toString(i.caller) + separator) + kBuy) + "_from"), nftOwner), DeleteEntry((toBase58String(assetId) + "_owner")), DeleteEntry((toBase58String(assetId) + "_onsell")), ScriptTransfer(addressFromStringValue(nftOwner), parseIntValue(price), unit), ScriptTransfer(i.caller, 1, assetId)]
82- }
83-
84-
85-
86-@Callable(i)
87-func deleteNFT () = {
88- let token0 = i.payments[0].assetId
89-[StringEntry(("delete_" + toBase58String(value(i.payments[0].assetId))), "token burn"), Burn(value(token0), 1)]
64+ else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
9065 }
9166
9267

github/deemru/w8io/026f985 
28.45 ms