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

Комментарии • 86

  • @deniz517
    @deniz517 2 года назад +1

    Fantastic tutorial! Simple and plain! That is what lean production is all about! Please, keep on going in this way!

  • @syahiraputiaryani5615
    @syahiraputiaryani5615 2 года назад +4

    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 :)

    • @ArturChmaro
      @ArturChmaro  2 года назад +2

      Yes, you are right 🤦🏻‍♂️I've edited video with card alert! Thanks for bringing this up.

  • @LucianoBargmann
    @LucianoBargmann 2 года назад

    Great info, especially related to how the trader contract interact with the NFTs. Thank you Artur!

  • @emcysquare
    @emcysquare 2 года назад

    @Minute 18: you should invert/swap lines 36 and 37 in order to avoid reentrancy attacks

  • @medalofpizza
    @medalofpizza 2 года назад +1

    This was exactly what I was looking for, you're a hero

  • @ArturChmaro
    @ArturChmaro  2 года назад +4

    🎁 Web3 Starter for JS Devs (email course): bit.ly/web3starter

  • @masterofchallenge6438
    @masterofchallenge6438 2 года назад +2

    Fajny poradnik, dzięki za pomoc

    • @ArturChmaro
      @ArturChmaro  2 года назад

      Fajnie, że się przydał :)

  • @fxtr1979
    @fxtr1979 2 года назад +1

    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?

    • @ArturChmaro
      @ArturChmaro  2 года назад

      Check OpenSea API for that. Unfortunately, the last time I checked Polygon was not supported.

    • @fxtr1979
      @fxtr1979 2 года назад

      @@ArturChmaro Thank you so much dear Artur, I tested and ran your code, as you said, polygon does not work

  • @axieclutches2997
    @axieclutches2997 2 года назад

    Nice vid! our assignment is CANCEL LISTING!

  • @Islam4humanity1
    @Islam4humanity1 2 года назад +1

    Finally found a good tutorial, way better than the most out there.. good work man👍. Can you also do similar on ERC-721 ?

    • @Islam4humanity1
      @Islam4humanity1 2 года назад

      also could you tell if an existing live(deployed) contract can be called in our code?? if yes, how?

  • @PlaneToTheBrainES
    @PlaneToTheBrainES 2 года назад +1

    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

    • @ArturChmaro
      @ArturChmaro  2 года назад +1

      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.

  • @drjacky
    @drjacky 2 года назад +1

    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?

    • @ArturChmaro
      @ArturChmaro  2 года назад

      You can customize mint function or just prepare dedicated function that mints and releases for sale in the same moment ;)

    • @drjacky
      @drjacky 2 года назад

      @@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.

  • @gvpranktv8168
    @gvpranktv8168 2 года назад

    Sir can you also tell us smart contract in which we can sell our token in the 1st mint of launch in Binance.

  • @php6515
    @php6515 2 года назад

    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 ?

  • @Banksy_said_hi
    @Banksy_said_hi 2 года назад

    Awesome content !! Please make more videos of these designing samples

  • @1softsoftsoftsoft
    @1softsoftsoftsoft 2 года назад

    Arthur you are too good :)

  • @MrYanissab
    @MrYanissab 2 года назад

    hi there ! Great video thanks !!
    How can we use custom ERC20's instead of wei/eth ?

  • @ehsanali9324
    @ehsanali9324 Год назад

    define safeTransferFrom function? condition failed

  • @Feelosov
    @Feelosov 2 года назад +1

    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 :)

    • @ArturChmaro
      @ArturChmaro  2 года назад

      Awesome, need to check it :D These live translating tools are better every day. Automatic captions from RUclips are pretty good too.

  • @hemantmadnani3557
    @hemantmadnani3557 2 года назад

    Saved a lot amount of time. Thank you , it really helped

  • @periohome7760
    @periohome7760 2 года назад

    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?

  • @viajafabs
    @viajafabs 2 года назад

    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?

    • @ArturChmaro
      @ArturChmaro  2 года назад

      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.

  • @naderaryabarzan8893
    @naderaryabarzan8893 2 года назад

    Thank you for presntation. Does you publish these code on the github?

  • @maztermind101
    @maztermind101 2 года назад

    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!

  • @itsanishjain
    @itsanishjain 2 года назад

    running this code is not showing price within opensea

  • @kathib2571
    @kathib2571 2 года назад

    where is your code from the video?

  • @user-pl8lt5bd1g
    @user-pl8lt5bd1g 2 года назад

    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.

    • @ArturChmaro
      @ArturChmaro  2 года назад

      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.

    • @user-pl8lt5bd1g
      @user-pl8lt5bd1g 2 года назад

      @@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.

    • @ArturChmaro
      @ArturChmaro  2 года назад +1

      @@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

  • @dragnoz
    @dragnoz 2 года назад

    I have some assets on polygon, any idea when the open sea api will incorporate polygon? or another api that i ca use?

    • @ArturChmaro
      @ArturChmaro  2 года назад

      OpenSea supports Polygon/Matic ;)

  • @JFKTLA
    @JFKTLA 2 года назад

    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?

    • @ArturChmaro
      @ArturChmaro  2 года назад

      Yes, there is only one URI for all 100 charizards

  • @newborn7850
    @newborn7850 2 года назад

    One of the best but how to create an interactive frontend

  • @user-is9tk9hi8f
    @user-is9tk9hi8f 2 года назад

    Hello, I would like to ask a question
    In safeTransfer I can send multiple NFT's? and in 1, 2, 3, 4 format?

    • @ArturChmaro
      @ArturChmaro  2 года назад

      No, you have to use safe batch transfer function for that

    • @user-is9tk9hi8f
      @user-is9tk9hi8f 2 года назад

      @@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

  • @MrSteeiii
    @MrSteeiii 2 года назад

    So is there a way to mint and sell erc1155 token from the contract?

  • @Feelosov
    @Feelosov 2 года назад +1

    Sorry for the spam. I thought my comments were being cut out, but it turns out they were just hiding.

    • @ArturChmaro
      @ArturChmaro  2 года назад

      Can't see your comments mate. Join my Discord and pose questions there ;)
      discord.gg/krzC9FEJUq

  • @fuzzyobject
    @fuzzyobject 2 года назад

    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?

    • @ArturChmaro
      @ArturChmaro  2 года назад

      Yes, you will become the owner of a certain token that is part of the erc1155 smart contract deployed by someone else.

    • @fuzzyobject
      @fuzzyobject 2 года назад +1

      @@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?

    • @ArturChmaro
      @ArturChmaro  2 года назад +1

      @@fuzzyobject if you use UI at OpenSea it mints the token on existing smart contract that was deployed by OpenSea .

    • @fuzzyobject
      @fuzzyobject 2 года назад

      @@ArturChmaro Thank you
      !

  • @Venaber
    @Venaber 2 года назад +1

    Do you know of any smart contracts that automatically add and sell the NFTs in opensea? is for a 10k collection

  • @JPougetAvocat
    @JPougetAvocat 2 года назад

    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

    • @ArturChmaro
      @ArturChmaro  2 года назад

      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.

    • @JPougetAvocat
      @JPougetAvocat 2 года назад +1

      @@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

    • @thomasnourry5985
      @thomasnourry5985 2 года назад

      Im actually searching for the thing... It seems Impossible

    • @JPougetAvocat
      @JPougetAvocat 2 года назад +2

      @@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

    • @thomasnourry5985
      @thomasnourry5985 2 года назад +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

  • @DJMatusSubskrybuj
    @DJMatusSubskrybuj 2 года назад

    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?

    • @DJMatusSubskrybuj
      @DJMatusSubskrybuj 2 года назад

      Nie wiem do końca jak to ująć w słowa

    • @DJMatusSubskrybuj
      @DJMatusSubskrybuj 2 года назад

      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

    • @ArturChmaro
      @ArturChmaro  2 года назад +1

      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 🙂

    • @DJMatusSubskrybuj
      @DJMatusSubskrybuj 2 года назад

      @@ArturChmaro czyli pewnie najlepszą drogą byłoby skopiowanie kontraktu jakiejś giełdy NFT

  • @jb3229
    @jb3229 2 года назад +1

    what a waste of time

    • @ArturChmaro
      @ArturChmaro  2 года назад

      Why?

    • @jb3229
      @jb3229 2 года назад

      @@ArturChmaro ur other videos were really good though the deploying ones
      sorry for being rude

    • @jb3229
      @jb3229 2 года назад

      @@ArturChmaro we can't set a price on opensea using this contract it's only for remix

    • @ArturChmaro
      @ArturChmaro  2 года назад

      @@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.

    • @jb3229
      @jb3229 2 года назад

      @@ArturChmaro ya bro I understand that but can u please make video on how to set prices for a whole collection on opensea

  • @08025984
    @08025984 2 года назад

    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