I am currently looking into creating a smart contract for a NFT auction. But because of certain legal restrictions we are not allowed to store the ether bid during the auction period (that is what usually auction contracts do). So the preferred outcome would be that the user can bid without losing their ether and then if they win the exchange between the seller and the buyer will be handled. I saw that opensea seems to do something similar on their auctions with wrapped ether. But I still trying to figure out how they exchange it without storing the ether in the contract.

Thanks for all the help and suggestions!

1 Answer 1


The wrapped ether contract behaves like an ERC-20 contract. So it is possible to call approve on it. With this function, the NFT buyer can allow the auction contract to spend his tokens as per the bid. What the auction contract would do is call the transferFrom function. It would work because the auction contract is approved.

If the NFT holder also calls approve for their token, then the auction contract is allowed to do the transfers in both directions.

With this setup, the auction contract never holds the Ether, the wrapped ether or the NFT. It only swaps them atomically when the time comes.

Edit: named the function on NFT.

Edit 2: I deployed such a small contract here, where the important lines are:

IERC721(collection).safeTransferFrom(seller, buyer, tokenId);
require(IERC20(token).transferFrom(buyer, seller, price));
  • Thanks a lot Xavier! This is very interesting. So what would happen if in the mean time the buyer spends their WETH and do not have enough balance anymore. Or is this not possible since the WETH would be "frozen"? And in regards to the NFT holder. They need to approve the NFT with the auction. Is this correct?
    – zanzoken
    Commented Jun 29, 2021 at 10:33
  • In this model, the WETH is not frozen, so the potential winner can spend the WETH elsewhere, making it impossible for the auction to complete. A very real issue, which can be mitigated by reputation systems, on the auction contract allowing the seller to pick the second best offer. Commented Jun 29, 2021 at 13:10
  • With ERC721, the NFT seller needs to call the approve function (same name and signature as ERC20, but different meaning), to allow the auction contract to spend the token. Commented Jun 29, 2021 at 13:13
  • I understand. I will try to find an example in which this is used. Thanks a lot!
    – zanzoken
    Commented Jun 29, 2021 at 21:08
  • I added an edit to my answer with an example I deployed myself here etherscan.io/address/… Commented Jul 16, 2021 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.