Hello Guys,
I just want to keep this simple.
There is a function called deposit present in the implementation contract which is controlled by a proxy with _delegate(address implementation) function.
I would like to call that "deposit" function form an other smart contract, which I am unable to do so.
Lets say <contract a> is the main contract (implementation contract) which has got the deposit function.
Then <contract proxy> is the proxy contract which has got the _delegate(address implementation) function using OpenZeppelin Proxies contract upgrades library.
Within a smart contract, I have to call the deposit function present in the <contract a> through <contract proxy>.
Here is the simple code that I am trying to execute through an other contract called <contract b>.
pragma solidity 0.8.10;
interface IERC20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function balanceOf(address) external view returns (uint);
}
interface proxyContract {
function deposit(uint256 amount) external;
}
contract myDeposit {
address proxyAddress = <contract proxy>;
function tokenDeposit(address token, uint256 amount) public
{
IERC20(token).approve(proxyAddress, amount);
proxyContract proxyAddress = proxyContract(proxyAddress);
proxyAddress.deposit(amount);
}
}
I get this error:
"execution reverted: SafeERC20: low-level call failed"
Waiting for replies.
Thank you.
Regards,
Harish