How to delete NFT listing if the NFT is transferred out of the owner wallet - solidity

I'm working on a project to create an NFTs marketplace.
When an NFT is listed, the owner can transfer that NFT to another wallet and the listing would still be there.
This raises a few problems:
When the NFT is returned to the original, the listing is up again and bots can snipe the NFT if the listing is below the floor price.
Buyers can still call the function but the transaction will be reverted, buyers would receive no NFT and lose the gas fee.
Apparently, Opensea is fighting this problem using front-end solution. CMIIW.
You can see more below:
https://opensea.io/blog/safety-security/important-updates-for-listing-and-delisting-your-nfts/
https://support.opensea.io/hc/en-us/articles/4415742560403-What-is-an-inactive-listing-
Are there any other ways for the smart contracts to recognize the NFT being transferred out of the wallet and make the listing invalid, only using smart contracts?

Related

Create own NFTs only can be sold on own marketplace

I'm facing a challenge with my NFT marketplace project. How I can create NFTs with the rule that those NFTs can only be sold on our own platform but others. Technically is possible, however, I need some help here.
Thank you.
Yes this possible For that you have to maintain a mapping or some sort of logic on smart contract level to keep track of whether to and from address belong to your ERC 721 contract or not.
transferFrom(from, to, tokenId)
Like when someone mints NFT on your smart contract you can save the address of the minter. And at the time of selling of you can have a condition at the start of transferFrom like.
require(to == exists[to], "Warning, You are selling outside of the contract")
mapping can be something of like this. mapping(address => address) exists;

Solidity openzeppelin public mint ERC721 token function, is any arguments really neccessary? [duplicate]

I'm trying to build an NFT marketplace. So I wanted to create an ERC1155 smart contract to allow content creators to put their art into the smart contract. I'm using OpenZeppelins wizard as a base but I found some weirdness on the mint function. It's allowing only the owner of the contract to mint:
It's made me suspicious about my actions. Should I disallow users to mint to create items on my contract?
I can't speak for the wizard authors why they decided on some specific approach.
However it's an established practice that when an artist or any other authorized person publishes an NFT collection, they don't want other people to contribute to this specific collection and change the overall meaning of it. For example, if you have a collection of NFTs representing pictures of dogs, you might not want other people to create NFTs representing pictures of cats in the same collection. Or any other unrelated pictures for that matter.
If you want to allow minting tokens in the collection by anyone, you can remove the onlyOwner modifier from the mint functions As well as the Ownable extension of MyTokens contract and its import, assuming you don't use the Ownable features elsewhere in your contract.

adding credit card option function in smart contract for minting NFT

I'm looking into adding a function to allow payments by cc during mint. Has anyone done this successfully and is willing to share how you went about it? Thanks!
The only way for doing this is after user paying you need to make the minting from your server and transfer it to the user or mint it directly to the user wallet

what's the purpose of the approve function in erc 20

I'm new in solidity and erc20, so I read ERC20 description on the openzeppelin and find this function which isn't clear for me.
approve(spender, amount)
What's the purpose of allowing to the spender spend my token, instead of send my tokens to the spender directly?
You can change the approved amount or revoke it altogether (only the unspent amount). But you cannot take back an already sent transfer.
A common use case for the approve() function is trading on a DEX (decentralized exchange). You approve the DEX contract address to spend your USDT tokens for example. And when you want to buy an XYZ token (against USDT), the DEX simply pulls the already approved USDT from your address and sends you the XYZ tokens.
Approve is a function used to give permission the spender can be anyone an exchange or EOA to withdraw as many times from your token contract up to the _value.
You can check this reference here
As others said, Approve function can give permission to the spender to pulls the amount of token in your address. It can be used in: DEX (decentralized exchange) or in Custody services.
In custody services, after you approve the custody provider to take your token, whenever your wallet receives token, the custody provider is able to transfer your token into some internal wallets and keep them save for you. (It's just like how the traditional banks work)

Vesting via Cardano smart contract fails if receiver wallet is empty

Assume vesting code block in Plutus playground. Simply, if receiver wallet has some ADA, the contract works normally. But in case of an empty receiver wallet, transaction will fail because sending money from script to wallet needs an amount of fee and this fee should be paid by receiver. Any modification for such problem?
That's not a problem, that's the way smart contracts works in cardano, even that's the way everything works on blockchain. When an address sends money to another, the source address should pay for the fees. That logic applies to any blockchain (as I know).
So, in smart contracts is the same. If a wallet wants to retrieve (not receive as you said) money from a validator script, then should pay for the fees. This is because the wallet wants those funds, therefore it should submit a transaction in the blockchain, that implies to pay the fees for it.
In blockchain, every user/wallet/addres that submit a transaction to the network, should pay fees.