SIO2 is aave v2 foked version on Astar chain. I want to execute flash loan on it and have the following code:
function myFlashLoanCall() public returns (bool){
address receiverAddress = address(this);
address[] memory assets = new address[](2);
assets[0] = address(0x7f27352D5F83Db87a5A3E00f4B07Cc2138D8ee52);
assets[1] = address(0x3795C36e7D12A8c252A20C5a7B455f7c57b60283);
uint256[] memory amounts = new uint256[](2);
amounts[0] = 0 ether;
amounts[1] = 0.0001 ether;
// 0 = no debt, 1 = stable, 2 = variable
uint256[] memory modes = new uint256[](2);
modes[0] = 0;
modes[1] = 0;
address onBehalfOf = address(this);
bytes memory params = "";
uint16 referralCode = 0;
LENDING_POOL.flashLoan(
receiverAddress,
assets,
amounts,
modes,
onBehalfOf,
params,
referralCode
);
return true;
}
Whenever I try to call the myFlashloan()
I am always getting this error in truffle: revert SafeERC20: low-level call failed
. Even I have used the debugging feature of Truffle but not able to solve the issue. May someone tell me what I am doing wrong?
Here's my test case to call myFlashloan()
:
it("Calling myFlashLoanCall()",async ()=>{
let reponse = await debug(myFlashLoanV2.myFlashLoanCall());
})
Note: Truffle is not able to stop at debug()
call even testing with test --debug
in truffle console.