This is the error I'm getting, I'm trying to implement ERC20's _transfer
function without inheritance, calling its Interface IERC20 and passing the ERC20 deployed contracts address and then calling the _transfer
function.
from solidity:
TypeError: Member "_transfer" not found or not visible after argument-dependent lookup in contract IERC20.
--> contracts/Custom/jackpot.sol:123:9:
|
123 | IERC20(0xd9145CCE52D386f254917e481eB44e9943F39138)._transfer(msg.sender,0xd9145CCE52D386f254917 ...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Smart contract code:
function insertPartcipantsInJackpot(uint256 counter)
override
payable
external
{
require(msg.value >= _jackPots[counter]._entryFee,
"You dont have enough balance to participate in this event");
//check balance of caller > entry fee
IERC20(0xd9145CCE52D386f254917e481eB44e9943F39138)._transfer(msg.sender,0xd9145CCE52D386f254917e481eB44e9943F39138,_jackPots[counter]._entryFee);
//deduct that amount
_jackPots[counter]._prizePool += _jackPots[counter]._entryFee;
//put that entry fee in that pool
require(_jackPots[counter]._endTime>_dateTime._now(),
"This Participant Cannot Enter This Jackpot, Because The Event has already started");
_jackPots[counter]._participants.push(msg.sender);
}
Best Answer
In IERC20 doesn't exist _transfer() function but exist transfer() function (wrote in this way)! For call this function you must to change this line about your smart contract code:
with:
You can read more here.