1

Here's the function:

function transferERC20() external {
        _erc20.transferFrom(msg.sender, erc20Recipient, 6*10**18);
    }

After I imported the IERC20 Interface to interact with ERC20 tokens inside my contract in order to pay for certain functions using the ERC20 instead of ETH Value, I'm always left with a gas estimation error instead of a successful transfer. the balance of function works fine.

function getErc20Balance() external view returns(uint){
        uint balance = _erc20.balanceOf(msg.sender) / 1000000000000000000;
        return balance;
    } 

1 Answer 1

0

You can set up a contract to accept ERC-20 as payment for ERC-721 tokens.

Here is a demonstration of that technique

https://github.com/fulldecent/spend-ERC20-create-ERC721

2
  • Could you please walk me through that code? I consider myself a beginner and I'm a bit overwhelmed.
    – Pequod
    Commented Feb 22, 2022 at 22:53
  • You bet, I have set up a Community Service Hour each week to go through projects like this. Please check out at phor.net/#speaking Commented Feb 24, 2022 at 4:41

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.