mirror of
				https://github.com/Instadapp/aave-protocol-v2.git
				synced 2024-07-29 21:47:30 +00:00 
			
		
		
		
	Merge branch 'feat/86-linear-interest-optimization' into 'master'
Fixes #86 Closes #86 See merge request aave-tech/protocol-v2!93
This commit is contained in:
		
						commit
						b1fdd59c39
					
				|  | @ -26,9 +26,7 @@ library MathUtils { | |||
|     //solium-disable-next-line | ||||
|     uint256 timeDifference = block.timestamp.sub(uint256(lastUpdateTimestamp)); | ||||
| 
 | ||||
|     uint256 timeDelta = timeDifference.wadToRay().rayDiv(SECONDS_PER_YEAR.wadToRay()); | ||||
| 
 | ||||
|     return rate.rayMul(timeDelta).add(WadRayMath.ray()); | ||||
|     return (rate.mul(timeDifference) / SECONDS_PER_YEAR).add(WadRayMath.ray()); | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|  |  | |||
|  | @ -1153,11 +1153,12 @@ const calcLinearInterest = ( | |||
|   currentTimestamp: BigNumber, | ||||
|   lastUpdateTimestamp: BigNumber | ||||
| ) => { | ||||
|   const timeDifference = currentTimestamp.minus(lastUpdateTimestamp).wadToRay(); | ||||
|   const timeDifference = currentTimestamp.minus(lastUpdateTimestamp); | ||||
| 
 | ||||
|   const timeDelta = timeDifference.rayDiv(new BigNumber(ONE_YEAR).wadToRay()); | ||||
| 
 | ||||
|   const cumulatedInterest = rate.rayMul(timeDelta).plus(RAY); | ||||
|   const cumulatedInterest = rate | ||||
|     .multipliedBy(timeDifference) | ||||
|     .dividedBy(new BigNumber(ONE_YEAR)) | ||||
|     .plus(RAY); | ||||
| 
 | ||||
|   return cumulatedInterest; | ||||
| }; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 The-3D
						The-3D