tx · EcxZeLzmt4g7gXgLDKVKYjy5N3iiZzKPWZtH1RUkYV8r

3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H:  -0.01000000 Waves

2022.11.11 10:00 [2312157] smart account 3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H > SELF 0.00000000 Waves

{ "type": 13, "id": "EcxZeLzmt4g7gXgLDKVKYjy5N3iiZzKPWZtH1RUkYV8r", "fee": 1000000, "feeAssetId": null, "timestamp": 1668150064060, "version": 2, "chainId": 84, "sender": "3N4boZRUJ2LxY5jLyp6hmxGktqnawQidu6H", "senderPublicKey": "BDeCphaaC4MZvfmbJqQZ78EvuEBZTJ1VEW7fbxue8BUu", "proofs": [ "4QMn6Je6R5yVx6KTVkt4wk8bpndcCanL97xvL4qX2wZimY3C2odb4RwENGdnkkqyKfVM1h3E8LwdRRGHxLL7mPej" ], "script": "base64:BgISCAISBAoCCAgSAwoBCBIDCgEBBQAJc2VwYXJhdG9yAgFfAARrQnV5AgNidXkABWtTZWxsAgRzZWxsAAZrUHJpY2UCBXByaWNlAQVpc05mdAEHYXNzZXRJZAQHJG1hdGNoMAkA7AcBBQdhc3NldElkAwkAAQIFByRtYXRjaDACBUFzc2V0BAV0b2tlbgUHJG1hdGNoMAMDCQAAAggFBXRva2VuCGRlY2ltYWxzAAAJAAACCAUFdG9rZW4IcXVhbnRpdHkAAQcJAAACCAUFdG9rZW4KcmVpc3N1YWJsZQcHBwMBaQEIaXNzdWVOZnQCBG5hbWUEbWV0YQQIbmV3VG9rZW4JAMIIBQUEbmFtZQUEbWV0YQABAAAHBAdpc3N1ZUlkCQC4CAEFCG5ld1Rva2VuCQDMCAIFCG5ld1Rva2VuCQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgABBQdpc3N1ZUlkCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICCQDYBAEFB2lzc3VlSWQFCXNlcGFyYXRvcgIFT3duZXIJAKUIAQgFAWkGY2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zAl8yAwkBASEBCQEFaXNOZnQBBQZ0b2tlbjAJAAIBAhBUb2tlbiBpcyBub3QgTkZUCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICBQZrUHJpY2UFCXNlcGFyYXRvcgkA2AQBCQEFdmFsdWUBCAkAkQMCCAUBaQhwYXltZW50cwAAB2Fzc2V0SWQJAKQDAQUFcHJpY2UJAMwIAgkBC1N0cmluZ0VudHJ5AgkArAICCQCsAgIJAKUIAQgFAWkGY2FsbGVyBQlzZXBhcmF0b3IFBWtTZWxsCQCsAgIJAKwCAgkA2AQBBQZ0b2tlbjAFCXNlcGFyYXRvcgkApAMBBQdhbW91bnQwBQNuaWwA77hsug==", "height": 2312157, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6jJwfeyjCmZ7SMERF9vngfQiWN5pZmMhQo9wdj87Ma1j Next: 48xskAHzutcnA19wWcGHp2UFaSoH54ia5DxEcd8sGZLn Diff:
OldNewDifferences
5252 let amount0 = $t013981483._2
5353 if (!(isNft(token0)))
5454 then throw("Token is not NFT")
55- else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), ScriptTransfer(i.caller, 1, value(i.payments[0].assetId)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
55+ else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
5656 }
5757
5858
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) = {
2626 let newToken = Issue(name, meta, 1, 0, false)
2727 let issueId = calculateAssetId(newToken)
2828 [newToken, ScriptTransfer(i.caller, 1, issueId), StringEntry(((toBase58String(issueId) + separator) + "Owner"), toString(i.caller))]
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 let owner = valueOrErrorMessage(getStringValue(((nftID + separator) + "Owner")), "No owner")
3939 if ((i.payments[0].assetId != unit))
4040 then throw("Pay in waves")
4141 else if ((parseIntValue(price) > amount))
4242 then throw("Invalid payment")
4343 else [ScriptTransfer(i.caller, 1, assetId), ScriptTransfer(value(addressFromString(owner)), parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))]
4444 }
4545
4646
4747
4848 @Callable(i)
4949 func sellNFT (price) = {
5050 let $t013981483 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount))
5151 let token0 = $t013981483._1
5252 let amount0 = $t013981483._2
5353 if (!(isNft(token0)))
5454 then throw("Token is not NFT")
55- else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), ScriptTransfer(i.caller, 1, value(i.payments[0].assetId)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
55+ else [StringEntry(((kPrice + separator) + toBase58String(value(i.payments[0].assetId))), toString(price)), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))]
5656 }
5757
5858

github/deemru/w8io/026f985 
42.86 ms