Skip to content

Commit

Permalink
Merge pull request #453 from NexusMutual/chore/design-comments
Browse files Browse the repository at this point in the history
Chore: Design comments
  • Loading branch information
shark0der committed Nov 2, 2022
2 parents 6d378f3 + 34bdda7 commit f58de92
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 @@ -658,10 +658,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 f58de92

Please sign in to comment.