My smart contract is trying to use stETH as collateral to borrow 250 WETH on the Aave Lending Pool V2, but the borrow function reverts with code 59:
BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small.
When I call the getUserData function my account everything looks fine for borrowing:
totalCollateralETH 349999999999999999998 totalDebtETH 0 availableBorrowsETH 251999999999999999999 currentLiquidationThreshold 8300 ltv 7200 healthFactor 115792089237316195423570985008687907853269984665640564039457584007913129639935
Here's the two lines of code I'm using to borrow. Thanks in advance for any help.
IERC20(wethAddress).approve(aaveAddress, loanAmount); IAAVE(aaveAddress).borrow(wethAddress, loanAmount, 2, 0, owner);