I'm working in remix and I deployed BUSD contract and I want use it's functions. I wrote a contract and I want to use it to users approve the contract here's my code
pragma solidity 0.8.14;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
contract test{
address private token = address(0x26b989b9525Bb775C8DEDf70FeE40C36B397CE67);
IERC20 mytoken = IERC20(token);
function approvetest(uint amount) public{
token.delegatecall(abi.encodeWithSignature("approve(address,uint256)", address(this), amount));
}
}
in the output it returns these:
"owner": "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4",
"spender": "0x8B801270f3e02eA2AACCf134333D5E5A019eFf42",
"value": "10000000000000000000"
and it's correct owner is me and spender is contract address but when I call allowance function in token contract it returns 0. and I can't use "transferFrom" because it returns error
BEP20: transfer amount exceeds allowance
what is the problem?