Trade/sell NFTs automatically from Solidity smart contract
HTML-код
- Опубликовано: 6 сен 2024
- #solidity #nft #ethereum
Free Web3 Starter for JS Devs (email course):
bit.ly/web3sta...
Blog: fullstak.pl/
Instagram: / fullstak_pl
Discord: / discord
Twitter: / artichmaro
Fantastic tutorial! Simple and plain! That is what lean production is all about! Please, keep on going in this way!
Thanks, will do!
cool tutorial, but i noticed at the withdraw function the balance of msg sender must be deducted first then transfer otherwise the hacker would be reentrancy many times to this function :)
Yes, you are right 🤦🏻♂️I've edited video with card alert! Thanks for bringing this up.
Great info, especially related to how the trader contract interact with the NFTs. Thank you Artur!
Glad it was helpful!
@Minute 18: you should invert/swap lines 36 and 37 in order to avoid reentrancy attacks
This was exactly what I was looking for, you're a hero
Awesome, glad you like it
🎁 Web3 Starter for JS Devs (email course): bit.ly/web3starter
Fajny poradnik, dzięki za pomoc
Fajnie, że się przydał :)
The best tutorial about listing NFT which I have found, great and good work. Dear Artur, sorry for my idiot question, how can I sell bunch of NFTs without entering each tokenId for listing?
Check OpenSea API for that. Unfortunately, the last time I checked Polygon was not supported.
@@ArturChmaro Thank you so much dear Artur, I tested and ran your code, as you said, polygon does not work
Nice vid! our assignment is CANCEL LISTING!
Finally found a good tutorial, way better than the most out there.. good work man👍. Can you also do similar on ERC-721 ?
also could you tell if an existing live(deployed) contract can be called in our code?? if yes, how?
Doesn't have the withdraw function to use a modifier like 'onlyowner' so only the owner of the contract can withdraw funds? Isn't supposed to get the funds only the owner? I see that it is a public function... I don't know if it is a silly question lol
Well it depends on what you are building. In most of cases onlyOwner can withdraw funds and you are right. However, this contract is bit different as you are dealing with balances[msg.sender] so you can "take out" only caller funds. Not "everybody" funds.
Such great video! Any idea how to mint and put the NFT for sale at the same time? Could you please make a tutorial with this subject?
You can customize mint function or just prepare dedicated function that mints and releases for sale in the same moment ;)
@@ArturChmaro Oh. you replied here. I already asked in the Discord. Could we continue the discussion there? I'm looking for code snippet, an article, a repo. I have the ERC1155 Bulk Mint smart contract but, not sure how to improve it to set them for sale in Bulk way.
Sir can you also tell us smart contract in which we can sell our token in the 1st mint of launch in Binance.
Hi, thanks for the tutrial, i would like to know, what should be the process, if i have nft and i want to sell it on my website, and get a commission fee of 2% to my wallet when ever some one purchases from my website, i should use smart contract for that ?
Awesome content !! Please make more videos of these designing samples
Thanks! Will do!
Arthur you are too good :)
hi there ! Great video thanks !!
How can we use custom ERC20's instead of wei/eth ?
define safeTransferFrom function? condition failed
Wow! Its cool - to listen on my language. Thx, Yandex Browser. Sorry, for this, but im in shock about sync voice translating.
Artur, you have nice russian voice :)
Awesome, need to check it :D These live translating tools are better every day. Automatic captions from RUclips are pretty good too.
Saved a lot amount of time. Thank you , it really helped
Great to hear!
Thanks and great! Your previous video (and other tutorials) which I followed minted/deployed nft contract and uploaded files to ipfs. And they were visible on opensea (in the test.opensea anyway). I presumed they are automatically tradeable on the actual opensea (when deployed live) or do we specifically need to follow this totorial to make the tokens tradeable?
Hello, I would like to thank you for the lesson! And, I would like to ask why there is no amount of tokens parameter inside addListing function?
It's just a simple implementation for learning purposes. It may not cover all the edge cases. You may add amount to listing or just assume that listing is available for all available copies untill you revoke it.
Thank you for presntation. Does you publish these code on the github?
would it be possible for you to make a video that would tackle about paying a token when minting an NFT.. something that is usually used in NFT games, when minting an NFT they would have to pay another specific token :D it would gladly help a starting Dev like me :D thank you!
running this code is not showing price within opensea
where is your code from the video?
I cannot get the idea of how to interact with a contract dynamically. Let's say I am a marketplace and have a proxy contract, and if user wants to upload the NFT, he should "approve" proxy contract, then proxy contract calls "transferFrom" and sends token. But, proxy contract do not know anything about user's contract and all contracts should be imported as a "hardcode" initially. How they interact with each other? I mean, all our imported contracts are imported like an "import ./...sol" but we do not know user contract yet.
If you want to interact with other contracts from your contract you have to include "interface" of that contract in your code. Then you just need address to start calling external contracts.
@@ArturChmaro Agree, but what should do if we do not know the contract address beforehand :) 100 users have different contracts and as a marketplace, I have to interact with them somehow. And I cannot physically know their interface and code as well.
@@user-pl8lt5bd1g That's no problem as you can always pass contract address as parameter to your functions. You can store inside your contract whole array of contract addresses and interact with them however you want. The only "limitation" is that beforehand you need to put contract interface in your contract
I have some assets on polygon, any idea when the open sea api will incorporate polygon? or another api that i ca use?
OpenSea supports Polygon/Matic ;)
Question if I mint 100 “charizard” tokens and a few people own them, then I Change the URI… will that update the uri for the ppl that own them?
Yes, there is only one URI for all 100 charizards
One of the best but how to create an interactive frontend
Hello, I would like to ask a question
In safeTransfer I can send multiple NFT's? and in 1, 2, 3, 4 format?
No, you have to use safe batch transfer function for that
@@ArturChmaro Thank you very much for your reply, I really need your help
How to implement the secure bulk transfer function?
Can multiple NFTs be transferred at once?
How to write the function? I need your help, thanks
So is there a way to mint and sell erc1155 token from the contract?
Yep, thats possible ;)
Sorry for the spam. I thought my comments were being cut out, but it turns out they were just hiding.
Can't see your comments mate. Join my Discord and pose questions there ;)
discord.gg/krzC9FEJUq
Thanks for nice video! Is that correct that if I buy some 1155 tokens on OpenSea I won't be a contract owner. I will be an owner of a few tokens within the contract issued and owned by someone else?
Yes, you will become the owner of a certain token that is part of the erc1155 smart contract deployed by someone else.
@@ArturChmaro But when I mint my first token on OpenSea would it create a new contract for my user to hold my tokens? Or does it have a single OpenSea contract for all tokens of all the users?
@@fuzzyobject if you use UI at OpenSea it mints the token on existing smart contract that was deployed by OpenSea .
@@ArturChmaro Thank you
!
Do you know of any smart contracts that automatically add and sell the NFTs in opensea? is for a 10k collection
hello and thank you for your video. Does it mean that once the contract is deployed, the nfts will already be for sale on opensea ? thanks
No. After deploying the contract owner of token still have to place listing on the OpenSea. Collection owner may also customize details of the collection like cover, description and so on.
@@ArturChmaro Ok thanks, but do you know if it is possible to write a smart contract that allows the nfts to directly be for sale on opensea ? thanks
Im actually searching for the thing... It seems Impossible
@@thomasnourry5985 I see some collections on polygon that are selling directly 10k nft on opensea (no pre-mint). Hard to imagine that they sell their nfts 1 by 1
@@JPougetAvocat After some research, i think its impossible because opensea use is own contracts to do listing. I mean, in this video we are juste creating a contract to list some nfts and sell them, like if we were a marketplace. Opensea use is own contract to list on their market place, that's why they use a sdk to list all nft (api key needed). There is solutions like autoclicker, but i thnk the best is use the opensea sdk
Czy z tokenami na erc721 można zrobić coś podobnego? W sensie czy jest opcja żeby w formie bulk/masowej wypisać wszystkie id/pobrać ze smart kontraktu?
Nie wiem do końca jak to ująć w słowa
swoją drogą super robotę robisz! zapisałem się nawet na tutorial żeby odświeżyć sobie podstawy, tylko jest jakiś problem i nie dostałem jeszcze żadnego maila
W standardowym ERC721 nie masz opcji bulk mintu/transferu. Oczywiście możesz zcustomizować kod kontraktu i dodać te same rzeczy, ale w samym standardzie ich nie ma.
Co do kursu mailowego: zobacz proszę w folder oferty/spam. Jak dalej nic nie ma to napisz mi swój e-mail na artur@fullstak.pl zobaczę co i jak 🙂
@@ArturChmaro czyli pewnie najlepszą drogą byłoby skopiowanie kontraktu jakiejś giełdy NFT
what a waste of time
Why?
@@ArturChmaro ur other videos were really good though the deploying ones
sorry for being rude
@@ArturChmaro we can't set a price on opensea using this contract it's only for remix
@@jb3229 that's ok mate. It's hard to make tutorials for everyone. Some people are enjoying the content, but for some people it's too simple. Regarding OpenSea prices... This video is not about it. It just shows simple Solidity code that you may use with your UI.
@@ArturChmaro ya bro I understand that but can u please make video on how to set prices for a whole collection on opensea
Nice Tutorial. Subscribed. I have a question, Say I want to make an approval function on my contract instead of going to the NFT contract to set the approval, how will you go about this? I did something like this function approveAllNFT(address _NFTAddress,bool state) public {
ERC721 token = ERC721(_NFTAddress);
token.setApprovalForAll(payable(address(this)),state);
} but I keep getting this error: "ERC721: approve to caller". which is from here on the ERC721 contract, require(operator != _msgSender(), "ERC721: approve to caller");. I appreciate your help on this. thanks