File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,16 @@ module aave_math::math_utils {
153153 (numerator + denominator - 1 ) / denominator
154154 }
155155
156+ /// @notice Finds the minimum of two u256 values
157+ /// @dev This function returns the smaller of the two provided u256 values
158+ /// @param a The first value
159+ /// @param b The second value
160+ /// @return The result of the minimum value between a and b
161+ public fun min (a: u256 , b: u256 ): u256 {
162+ if (a <= b) { a }
163+ else { b }
164+ }
165+
156166 /// @dev Returns the seconds per year value
157167 /// @return Seconds per year constant
158168 public fun get_seconds_per_year (): u256 {
Original file line number Diff line number Diff line change @@ -310,10 +310,14 @@ module aave_oracle::oracle {
310310 let underlying_asset_price = assets_prices[0 ];
311311 let asset_base_ratio = assets_prices[1 ];
312312 let underlying_asset_timestamp = assets_timestamps[0 ];
313+ let asset_base_timestamp = assets_timestamps[1 ];
313314 let (underlying_asset_capped_price, _) = get_capped_susde_price (
314315 underlying_asset_price, asset_base_ratio, &cap_info
315316 );
316- (underlying_asset_capped_price, underlying_asset_timestamp)
317+ (
318+ underlying_asset_capped_price,
319+ math_utils::min (underlying_asset_timestamp, asset_base_timestamp)
320+ )
317321 },
318322 AdapterType::STABLE => {
319323 let (underlying_asset_price, underlying_asset_timestamp) = get_asset_price_internal (
You can’t perform that action at this time.
0 commit comments