Skip to content

Commit

Permalink
Fix typos and dedup code
Browse files Browse the repository at this point in the history
  • Loading branch information
Rox committed Oct 27, 2022
1 parent e6a09f7 commit f6e0b2f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
6 changes: 1 addition & 5 deletions contracts/modules/capital/MCR.sol
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,8 @@ contract MCR is IMCR, MasterAware {

// the first asset is ETH. skip it, it's already counted
for (uint i = 1; i < assets.length; i++) {

IPool.Asset memory asset = assets[i];
uint activeCoverAmount = cover.totalActiveCoverInAsset(uint24(i));

uint assetRate = priceFeed.getAssetToEthRate(assets[i].assetAddress);
uint assetAmountInEth = activeCoverAmount * assetRate / 10 ** asset.decimals;
uint assetAmountInEth = priceFeed.getEthForAsset(assets[i].assetAddress, activeCoverAmount);

totalActiveCoverAmountInEth += assetAmountInEth;
}
Expand Down
3 changes: 2 additions & 1 deletion contracts/modules/capital/Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "../../interfaces/IPool.sol";
import "../../interfaces/IPriceFeedOracle.sol";
import "../../interfaces/ITokenController.sol";
import "../../interfaces/IERC20Detailed.sol";
import "../../libraries/Math.sol";
import "../../libraries/SafeUintCast.sol";

contract Pool is IPool, MasterAware, ReentrancyGuard {
Expand Down Expand Up @@ -646,7 +647,7 @@ contract Pool is IPool, MasterAware, ReentrancyGuard {
// Step 3. Min [average[Price(0), Price(1)] x ( 1 - Sell Spread), Price(1) ]
// Sell Spread = 2.5%
uint averagePriceWithSpread = (spotPrice0 + spotPrice1) / 2 * 975 / 1000;
uint finalPrice = averagePriceWithSpread < spotPrice1 ? averagePriceWithSpread : spotPrice1;
uint finalPrice = Math.min(averagePriceWithSpread, spotPrice1);
uint ethAmount = finalPrice * nxmAmount / 1e18;

require(
Expand Down
4 changes: 2 additions & 2 deletions contracts/modules/cover/Cover.sol
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,10 @@ contract Cover is ICover, MasterAwareV2, IStakingPoolBeacon, ReentrancyGuard {
ProductType[] calldata newProductTypes,
string[] calldata ipfsMetadata
) external override onlyAdvisoryBoard {
uint initialProuctTypesCount = _productTypes.length;
uint initialProductTypesCount = _productTypes.length;
for (uint i = 0; i < newProductTypes.length; i++) {
_productTypes.push(newProductTypes[i]);
emit ProductTypeSet(initialProuctTypesCount + i, ipfsMetadata[i]);
emit ProductTypeSet(initialProductTypesCount + i, ipfsMetadata[i]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/governance/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ contract Governance is IGovernance, LegacyMasterAware {
uint category,
uint status,
uint finalVerdict,
uint totalRewar
uint totalReward
)
{
return (
Expand Down

0 comments on commit f6e0b2f

Please sign in to comment.