0

i had a small question that i creast a contract A and there is 1 busd token in the contract A, now i want to transfer the 1 busd out of contract by owner address how to set the contractA? i have use this code to deploy and test

pragma solidity ^0.8;

interface IERC20 {
    function transfer(address to, uint256 amount) external returns (bool);
}

contract MyContract {
    address owner = 0xFAD69bCefb704c1803A9Bf8f04BC314E78838F88;

    function withdrawToken(address tokenContract, uint256 amount) external {
        // send `amount` of tokens
        // from the balance of this contract
        // to the `owner` address
        IERC20(tokenContract).transfer(owner, amount);
    }
}

the feedback is This contract may be abstract, it may not implement an abstract parent's methods completely or it may not invoke an inherited contract's constructor correctly. can someone help me? thanks in advance , i am beginner.

find a way to transfer the busd out of contract .

1 Answers1

0

I recognize this code from my other answer. :)

You're trying to deploy the IERC20 interface - which throws the "This contract may be abstract" error.

You need to deploy the other contract. Depending on how you deploy the contract, there are different ways to do that.

Here's another answer that shows how to select the desired contract in Remix IDE. However, note that this code won't work on the Remix emulated network, as the BUSD contract is not available there. You'll need to deploy the code either to the mainnet or your local fork of the mainnet, where the BUSD contract is available.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100