Skip to content

Commit

Permalink
feat: update collateral price before collateral price related functions
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcoindev committed Dec 15, 2023
1 parent eb9946f commit c825dfe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/contracts/src/dollar/libraries/LibUbiquityPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ library LibUbiquityPool {
"Dollar price too low"
);

// update collateral price
updateChainLinkCollateralPrice(collateralIndex);
// get amount of collateral for incoming Dollars
collateralNeeded = getDollarInCollateral(collateralIndex, dollarAmount);

Expand Down Expand Up @@ -413,6 +415,10 @@ library LibUbiquityPool {
)
)
.div(UBIQUITY_POOL_PRICE_PRECISION);

//update collateral price
updateChainLinkCollateralPrice(collateralIndex);

collateralOut = getDollarInCollateral(collateralIndex, dollarAfterFee);

// checks
Expand Down

0 comments on commit c825dfe

Please sign in to comment.