Lesson 13 : VM Exception while processing transaction: reverted with reason string '31' #5596
Replies: 3 comments 3 replies
-
Not sure why... But this error only comes when the "borrow" function is called on the IPool.sol with the third parameter (uint256 InterestRateMode) settled as "1" (Stable). On the other hand... when I called the function with the number "2" (variable) the code didn't break. How can we know there is a mistake on aave's side? or There was something wrong in my code? In the meantime I will use the Variable Rate to continue the project. |
Beta Was this translation helpful? Give feedback.
-
Hello @BalamRamGas @haoleo10 @Marcrus813 Please be informed that Aave got updated and you should amend your codes accordingly to get those running. async function borrowAsset(assetAddress, lendingPool, amountToBorrow, account) {
/** @dev ILendingPool: function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) external; */
/** Stable Interest Rate: 1 Variable Interest Rate: 2 (New Aave allows "2" variable now) */
const borrowTx = await lendingPool.borrow(assetAddress, amountToBorrow, 2, 0, account)
await borrowTx.wait(1)
} Please also check following link |
Beta Was this translation helpful? Give feedback.
-
You should set the parameter for the 3rd argument which is interestRate to 2 |
Beta Was this translation helpful? Give feedback.
-
Hi everyone!!
When I run the aaveBorrow.js file I got the following error.
Error: VM Exception while processing transaction: reverted with reason string '31'
It seems that the function that is not working when called is borrowDai() because prior to that all the code was read properly but can't find the failure yet.
I consoled log the objects that the function need and everything seems to be correct.
By the way... I chose to work with aave V3.
aaveBorrow.js
It seems that someone else asked for the same question but didn't got a solution. I've been tinkering around for a while but not finding the answer out.
Beta Was this translation helpful? Give feedback.
All reactions