mirror of
				https://github.com/Instadapp/aave-protocol-v2.git
				synced 2024-07-29 21:47:30 +00:00 
			
		
		
		
	Initial fix of the borrow tests
This commit is contained in:
		
							parent
							
								
									d542f098c1
								
							
						
					
					
						commit
						d0d1db5e4d
					
				|  | @ -30,12 +30,12 @@ export const calcExpectedUserDataAfterDeposit = ( | |||
| ): UserReserveData => { | ||||
|   const expectedUserData = <UserReserveData>{}; | ||||
| 
 | ||||
|   expectedUserData.currentStableDebt = expectedUserData.principalStableDebt = calcExpectedStableDebtTokenBalance( | ||||
|   expectedUserData.currentStableDebt = calcExpectedStableDebtTokenBalance( | ||||
|     userDataBeforeAction, | ||||
|     txTimestamp | ||||
|   ); | ||||
| 
 | ||||
|   expectedUserData.currentVariableDebt = expectedUserData.principalStableDebt = calcExpectedVariableDebtTokenBalance( | ||||
|   expectedUserData.currentVariableDebt = calcExpectedVariableDebtTokenBalance( | ||||
|     reserveDataBeforeAction, | ||||
|     userDataBeforeAction, | ||||
|     txTimestamp | ||||
|  | @ -285,22 +285,23 @@ export const calcExpectedReserveDataAfterBorrow = ( | |||
| 
 | ||||
|   const amountBorrowedBN = new BigNumber(amountBorrowed); | ||||
| 
 | ||||
|   const userStableDebt = calcExpectedStableDebtTokenBalance(userDataBeforeAction, txTimestamp); | ||||
| 
 | ||||
|   const userVariableDebt = calcExpectedVariableDebtTokenBalance( | ||||
|   expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( | ||||
|     reserveDataBeforeAction, | ||||
|     txTimestamp | ||||
|   ); | ||||
|   expectedReserveData.variableBorrowIndex = calcExpectedVariableBorrowIndex( | ||||
|     reserveDataBeforeAction, | ||||
|     userDataBeforeAction, | ||||
|     txTimestamp | ||||
|   ); | ||||
| 
 | ||||
|   if (borrowRateMode == RateMode.Stable) { | ||||
| 
 | ||||
|     expectedReserveData. | ||||
|     const debtAccrued = userStableDebt.minus(userDataBeforeAction.principalStableDebt); | ||||
| 
 | ||||
|     expectedReserveData.totalLiquidity = reserveDataBeforeAction.totalLiquidity.plus(debtAccrued); | ||||
| 
 | ||||
|     expectedReserveData.totalStableDebt = reserveDataBeforeAction.totalStableDebt | ||||
|       .plus(amountBorrowedBN) | ||||
|       .plus(debtAccrued); | ||||
| 
 | ||||
| 
 | ||||
|     expectedReserveData.averageStableBorrowRate = calcExpectedAverageStableBorrowRate( | ||||
|       reserveDataBeforeAction.averageStableBorrowRate, | ||||
|  | @ -347,15 +348,6 @@ export const calcExpectedReserveDataAfterBorrow = ( | |||
| 
 | ||||
|   expectedReserveData.variableBorrowRate = rates[2]; | ||||
| 
 | ||||
|   expectedReserveData.liquidityIndex = calcExpectedLiquidityIndex( | ||||
|     reserveDataBeforeAction, | ||||
|     txTimestamp | ||||
|   ); | ||||
|   expectedReserveData.variableBorrowIndex = calcExpectedVariableBorrowIndex( | ||||
|     reserveDataBeforeAction, | ||||
|     txTimestamp | ||||
|   ); | ||||
| 
 | ||||
|   expectedReserveData.lastUpdateTimestamp = txTimestamp; | ||||
| 
 | ||||
|   return expectedReserveData; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import {executeStory} from './helpers/scenario-engine'; | |||
| 
 | ||||
| const scenarioFolder = './test/helpers/scenarios/'; | ||||
| 
 | ||||
| const selectedScenarios: string[] = ['withdraw.json']; | ||||
| const selectedScenarios: string[] = ['borrow-repay-variable.json']; | ||||
| 
 | ||||
| fs.readdirSync(scenarioFolder).forEach((file) => { | ||||
|   if (selectedScenarios.length > 0 && !selectedScenarios.includes(file)) return; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 The3D
						The3D