tx · CJ9TwmPX3b18PrpqzPMaLJMx9pHmGaXnZERsXS3oodpM

3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn:  -0.01000000 Waves

2022.11.01 13:26 [2297923] smart account 3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn > SELF 0.00000000 Waves

{ "type": 13, "id": "CJ9TwmPX3b18PrpqzPMaLJMx9pHmGaXnZERsXS3oodpM", "fee": 1000000, "feeAssetId": null, "timestamp": 1667298342377, "version": 2, "chainId": 84, "sender": "3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn", "senderPublicKey": "Cq4RbcVcQJpCWyHiACDqUf2PbU8PaX949Dun9wRSeDzE", "proofs": [ "2UAabALb9fdwZ6TYT8qnpeK4ZYNEWGskLNG5WbBdHK6HcBtJmXk31y14j3jdn9yM1sSJKqnNZuUb882Br2Qegz5K" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAADQAAAAAMb3duZXJBZGRyZXNzAQAAAAAAAAAACm5mdEFkZHJlc3MBAAAAAAAAAAAQYXJ0ZWZhY3RzQWRkcmVzcwEAAAAAAAAAAA1mZWVBZ2dyZWdhdG9yAQAAAAAAAAAACm5mdEFzc2V0SWQBAAAAAAAAAAAOa0dsb2JhbENvdW50ZXICAAAADkdMT0JBTF9DT1VOVEVSAAAAAApmZWVQZXJjZW50AAAAAAAAAAAFAAAAABNhcnRlZmFjdHNGZWVQZXJjZW50AAAAAAAAAAAUAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAUAAAADdmFsAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAA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AAAhmaW5hbEZlZQAAAAAAAAAAZAUAAAAOcGF5bWVudEFzc2V0SWQFAAAAA25pbAAAAAArNAcC", "height": 2297923, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6FtvMC2dQoa5NeVc1WMVD7tvD2Fo48QvkVXXJjtBDjFw Next: AG2dJjbJq5iek81bmJd5XZs5SrZNkfCdUo5ftb2FfJFk Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ownerAddress = base58''
55
66 let nftAddress = base58''
77
88 let artefactsAddress = base58''
99
1010 let feeAggregator = base58''
1111
1212 let nftAssetId = base58''
1313
1414 let kGlobalCounter = "GLOBAL_COUNTER"
1515
1616 let feePercent = 5
1717
1818 let artefactsFeePercent = 20
1919
2020 func tryGetInteger (key) = {
2121 let val = match getInteger(this, key) {
2222 case b: Int =>
2323 b
2424 case _ =>
2525 0
2626 }
2727 val
2828 }
2929
3030
3131 func tryGetString (key) = {
3232 let val = match getString(this, key) {
3333 case b: String =>
3434 b
3535 case _ =>
3636 ""
3737 }
3838 val
3939 }
4040
4141
4242 func tryGetBoolean (key) = match getBoolean(this, key) {
4343 case b: Boolean =>
4444 b
4545 case _ =>
4646 false
4747 }
4848
4949
5050 func getGlobalCounter () = tryGetInteger(kGlobalCounter)
5151
5252
5353 func getAssetGenotype (assetId) = if ((value(assetInfo(assetId)).issuer == Address(artefactsAddress)))
5454 then "ART"
5555 else {
5656 let asset1 = match getString(Address(ownerAddress), toBase58String(assetId)) {
5757 case b: String =>
5858 b
5959 case _ =>
6060 ""
6161 }
6262 if ((asset1 != ""))
6363 then asset1
6464 else {
6565 let asset2 = match getString(Address(nftAddress), toBase58String(assetId)) {
6666 case c: String =>
6767 c
6868 case _ =>
6969 ""
7070 }
7171 if ((asset2 != ""))
7272 then asset2
7373 else ""
7474 }
7575 }
7676
7777
7878 @Callable(i)
7979 func nftBuy (nftId) = {
8080 let isnftart = tryGetBoolean((("nft_" + nftId) + "_nftart"))
8181 let paymentAssetId = if ((isnftart == true))
8282 then nftAssetId
8383 else unit
8484 let paymentAssetName = if ((isnftart == true))
8585 then "nftart"
8686 else "WAVES"
8787 let pmt = value(i.payments[0])
8888 let amount = pmt.amount
8989 let assetId = tryGetString((("nft_" + nftId) + "_assetId"))
9090 let bidId = toBase58String(i.transactionId)
9191 let nftStatus = tryGetString((("nft_" + nftId) + "_status"))
9292 let finalFee = if ((tryGetBoolean((("nft_" + nftId) + "_isArtefact")) == true))
9393 then artefactsFeePercent
9494 else feePercent
9595 if ((pmt.assetId != paymentAssetId))
9696 then throw((("nft does only support " + paymentAssetName) + " payments."))
9797 else if ((nftStatus != "open"))
9898 then throw("nft is closed. You cannot place a bid.")
9999 else {
100100 let instantPrice = tryGetInteger((("nft_" + nftId) + "_instantPrice"))
101101 if ((instantPrice > amount))
102102 then throw(("For instant purchase you need to pay at least " + toString(instantPrice)))
103103 else {
104104 let nftOwner = tryGetString((("nft_" + nftId) + "_owner"))
105105 let recordPrice = tryGetInteger((assetId + "_recordPrice"))
106106 let newRecordPrice = max([recordPrice, amount])
107107 [StringEntry((("nft_" + nftId) + "_status"), "finished"), IntegerEntry((("nft_" + nftId) + "_finalPrice"), amount), IntegerEntry((assetId + "_recordPrice"), newRecordPrice), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"nftId\": \"" + nftId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(amount)) + "\", \"status\": \"finished\"}")), DeleteEntry((((("address_" + nftOwner) + "_nft_") + nftId) + "_lockedNFT")), ScriptTransfer(i.originCaller, 1, fromBase58String(getStringValue(this, (("nft_" + nftId) + "_assetId")))), ScriptTransfer(addressFromStringValue(nftOwner), fraction(amount, (100 - finalFee), 100), paymentAssetId), ScriptTransfer(Address(feeAggregator), fraction(amount, finalFee, 100), paymentAssetId)]
108108 }
109109 }
110110 }
111111
112112

github/deemru/w8io/026f985 
24.38 ms