tx · 3CxdW29ZnHJZnJvgGYnTE7CvDrUNDYSPyeko638KB3Kh

3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq:  -0.01000000 Waves

2022.11.09 17:59 [2309750] smart account 3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq > SELF 0.00000000 Waves

{ "type": 13, "id": "3CxdW29ZnHJZnJvgGYnTE7CvDrUNDYSPyeko638KB3Kh", "fee": 1000000, "feeAssetId": null, "timestamp": 1668006014535, "version": 2, "chainId": 84, "sender": "3MvjAaDYHpS4A5K4CV3kZMMEH9m9JdBSvbq", "senderPublicKey": "H6UqxUDcJamDRg1uykVcWMn4zhAMTV7i1nfPq1moLWmJ", "proofs": [ "AXaQQXwLbvLBVaFGmipEapAMjkLJrTGBdhr98Zr6teYt9rBX889VfmS7a9737154mimXV2xEaRtjmjQdXZHRG1m" ], "script": "base64:BgIQCAISBQoDCAgBEgMKAQgSAAUACXNlcGFyYXRvcgIBXwAEa0J1eQIDYnV5AAVrU2VsbAIEc2VsbAAGa1ByaWNlAgVwcmljZQEFaXNOZnQBB2Fzc2V0SWQEByRtYXRjaDAJAOwHAQUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgVBc3NldAQFdG9rZW4FByRtYXRjaDADAwkAAAIIBQV0b2tlbghkZWNpbWFscwAACQAAAggFBXRva2VuCHF1YW50aXR5AAEHCQAAAggFBXRva2VuCnJlaXNzdWFibGUHBwcDAWkBCGlzc3VlTmZ0AwRuYW1lBG1ldGEFcHJpY2UECG5ld1Rva2VuCQDCCAUFBG5hbWUFBG1ldGEAAQAABwQHaXNzdWVJZAkAuAgBBQhuZXdUb2tlbgkAzAgCBQhuZXdUb2tlbgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgIJAKwCAgUGa1ByaWNlBQlzZXBhcmF0b3IJANgEAQUHaXNzdWVJZAkApAMBBQVwcmljZQUDbmlsAWkBBmJ1eU5GVAEFbmZ0SUQEB2Fzc2V0SWQJANkEAQUFbmZ0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JpY2UFBHVuaXQJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKUIAQgFAWkGY2FsbGVyBQlzZXBhcmF0b3IFBWtTZWxsCQCsAgIJAKwCAgkA2AQBBQZ0b2tlbjAFCXNlcGFyYXRvcgkApAMBBQdhbW91bnQwBQNuaWwAuZt8xw==", "height": 2309750, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: xu5nwHKFtAy9rSJ4NYBtph9x1nuGWXb5gGXbkXKMopz Next: 75QJvC7KEhhJnXKESwmy2JPnd38NaKHSk8ypF6TQrJUo 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"
1111
1212 func isNft (assetId) = match assetInfo(assetId) {
1313 case token: Asset =>
1414 if (if ((token.decimals == 0))
1515 then (token.quantity == 1)
1616 else false)
1717 then (token.reissuable == false)
1818 else false
1919 case _ =>
2020 false
2121 }
2222
2323
2424 @Callable(i)
2525 func issueNft (name,meta,price) = {
2626 let newToken = Issue(name, meta, 1, 0, false)
2727 let issueId = calculateAssetId(newToken)
2828 [newToken, StringEntry(((kPrice + separator) + toBase58String(issueId)), toString(price))]
2929 }
3030
3131
3232
3333 @Callable(i)
3434 func buyNFT (nftID) = {
3535 let assetId = fromBase58String(nftID)
3636 let amount = value(i.payments[0].amount)
3737 let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this nft")
3838 if ((i.payments[0].assetId != unit))
3939 then throw("pay in waves")
4040 else if ((parseIntValue(price) > amount))
4141 then throw("Invalid payment")
4242 else [ScriptTransfer(i.caller, 1, assetId), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))]
4343 }
4444
4545
4646
4747 @Callable(i)
4848 func sellNFT () = {
4949 let $t011731258 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
5050 let token0 = $t011731258._1
5151 let amount0 = $t011731258._2
5252 let price = getStringValue(((kPrice + separator) + valueOrErrorMessage(toBase58String(token0), "There is no price for this nft")))
5353 if (!(isNft(token0)))
5454 then throw("Token is not NFT")
5555 else [ScriptTransfer(i.caller, parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
5656 }
5757
5858

github/deemru/w8io/026f985 
54.31 ms