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

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.

Related

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

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?

How do I modify my smart contract code so I'm the only one who can sell tokens? Everyone else send their tokens to me to exchange for either ETH, etc

So I have a token that has about 103 users. What I need to do is restrict the ability to sell those tokens to just myself the developer, so the other users can redeem their tokens for ETH or MATIC by sending to me. The alternative would be to just write a new smart contract, including this function and moving all users to the new platform. How would I write that new contract?
The first, you can't change code of deployed contract in Ethereum.
The second, look at ERC-20 and ERC-721 (NFT) standarts, its already have functionality you need.

How to interact with standard Opensea contract via my own smartcontract?

I am writing my smart contract and one of its functions should be the function of buying nft directly from open sea. Is it possible to interact with an open-sea contract directly from my personal solidity contract? If this is not possible, then how can it be properly implemented?
As far as i know, OpenSea contracts only manage the NFTs collection contracts published by other users, so you can't "directly" buy from OpeanSea's contract, but what you can do is interact directly with the collection's contract.
To find the collection's contract address on OpenSea, for example on an NFT's page, under Details, there is a blue hyperlinked value labeled "Contract Address". If you click on this, it will take you to the contract's address on Etherscan; at the top-left of that page, there should be an icon labeled "Contract", and to the right, a long string of letters and numbers. This is the address of the contract that created your NFT.
Click on the "copy" icon to the right of the address, and you'll have it on your clipboard.
From: https://ethereum.stackexchange.com/questions/113932/where-to-find-the-address-of-the-nft-contract-i-created-on-opensea

Solidity minting NFT images not in the sequence from first to last one

I have my contract in solidity for my NFT collection. Usually people are minting from contract from first to last piece. Is it possible that they will mint only one exact piece? I mean something like reservation. Can I store this reservation list somewhere for example it will be address and number of image:
"0x62e4613BBA89f81F8ea6f286eC4c3d7e6896509e": 4
so user with address 0x62e4613BBA82f81F8ea6f686eC4c3d7e6896509e will be minting 4th element of the collection. He cannot mint any other but he can mint whenever he wants. Is it even possible? Can I pass any argument to mint method that will mint exact piece from whole collection?
well, is technically possible, maybe with some mappings, requires and that, but maybe will be more hard to know exactly how much nft have been minted or what nft have already been minted, but you can have a mapping of address to an array of uint where the address is the user address and in the array of uint will be the tokenId that are reserved to that address, and another mapping of uint to addres, where the uint is the token id and the address is the user address and you can use it to know if that token id is already reserved or minted

ERC20 solidity contract with pre-existing balances - possible?

There's a part of me that thinks that if this is possible it kind of goes against the whole idea of a secure blockchain, but I just want to check and make sure.
Is it possible to create and deploy a smartcontract which creates a number of addresses, each with a pre-defined, initial balance of tokens? And if so, can these addresses then be made 'accessible' as a wallet for someone to use?
So, suppose I create a coin ABC, and it has a supply of 1.000.000.000 and I then create 10 addresses, each with, say, 50.000 ABC in them, with the remaining ABC tokens still in the 'genesis'/initial address - is that possible? Alternatively, can this kind of "pre-walleting" be done with a second contract after the token creation? And suppose now that I have said 50K ABC addresses, can they then be 'given' to users/made accessible?
Of course one can always create the coin and then do a bunch of transactions to do the above 'the old fashioned way' but I am curious if such a setup can be obtained in a faster/shortcut way.
This can not be achieved using the standard ERC20 token definition, what you want to do is very similar to an "Airdrop", in that case that can be achieved following these steps:
Create and deploy the ERC20 token.
Create a smart contract to handle the token distribution, this contract will contain the logic to handle or the distribution process.
Call the distribution contract and pass the array of addresses that
will receive the token.
The problem that i see with your proposed approach is that in order to give the addresses to the users you must provide them the private key, which means that they will not be in total control of their funds since you already know those keys, so i don't think this is a good decision.