Skip to content

Commit

Permalink
Solidity lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sicknick99 committed Feb 17, 2022
1 parent 7baf457 commit c3b1e93
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
19 changes: 7 additions & 12 deletions contracts/feeds/balancerv2/OverlayV1BalancerV2Factory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ contract OverlayV1BalancerV2Factory is OverlayV1FeedFactory {
);

BalancerV2PoolInfo.Pool memory balancerV2Pool = BalancerV2PoolInfo.Pool(
marketPool,
ovlWethPool,
ovl,
marketBaseToken,
marketQuoteToken,
marketBaseAmount
marketPool,
ovlWethPool,
ovl,
marketBaseToken,
marketQuoteToken,
marketBaseAmount
);

// Use the CREATE2 opcode to deploy a new Feed contract.
Expand All @@ -69,12 +69,7 @@ contract OverlayV1BalancerV2Factory is OverlayV1FeedFactory {
salt: keccak256(
abi.encode(marketPool, marketBaseToken, marketQuoteToken, marketBaseAmount)
)
}(
balancerV2Pool,
balancerV2Tokens,
microWindow,
macroWindow
)
}(balancerV2Pool, balancerV2Tokens, microWindow, macroWindow)
);

// store feed registry record for (marketPool, marketBaseToken, marketQuoteToken) combo
Expand Down
17 changes: 9 additions & 8 deletions contracts/feeds/balancerv2/OverlayV1BalancerV2Feed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,19 @@ contract OverlayV1BalancerV2Feed is OverlayV1Feed {
uint256 _microWindow,
uint256 _macroWindow
) OverlayV1Feed(_microWindow, _macroWindow) {

VAULT = balancerV2Tokens.vault;
// Check if gas cost is reduced by storing vault in memory
IBalancerV2Vault vault = IBalancerV2Vault(balancerV2Tokens.vault);
(IERC20[] memory marketTokens, , ) = getPoolTokensData(balancerV2Tokens.marketPoolId);

require(
getPoolId(balancerV2Pool.marketPool) == balancerV2Tokens.marketPoolId,
"OVLV1Feed: marketPoolId mismatch"
getPoolId(balancerV2Pool.marketPool) == balancerV2Tokens.marketPoolId,
"OVLV1Feed: marketPoolId mismatch"
);

require(
getPoolId(balancerV2Pool.ovlWethPool) == balancerV2Tokens.ovlWethPoolId,
"OVLV1Feed: ovlWethPoolId mismatch"
getPoolId(balancerV2Pool.ovlWethPool) == balancerV2Tokens.ovlWethPoolId,
"OVLV1Feed: ovlWethPoolId mismatch"
);

// TODO: verify token ordering
Expand All @@ -58,11 +57,13 @@ contract OverlayV1BalancerV2Feed is OverlayV1Feed {
marketToken1 = _marketToken1;

require(
_marketToken0 == balancerV2Pool.marketBaseToken || _marketToken1 == balancerV2Pool.marketBaseToken,
_marketToken0 == balancerV2Pool.marketBaseToken ||
_marketToken1 == balancerV2Pool.marketBaseToken,
"OVLV1Feed: marketToken != marketBaseToken"
);
require(
_marketToken0 == balancerV2Pool.marketQuoteToken || _marketToken1 == balancerV2Pool.marketQuoteToken,
_marketToken0 == balancerV2Pool.marketQuoteToken ||
_marketToken1 == balancerV2Pool.marketQuoteToken,
"OVLV1Feed: marketToken != marketQuoteToken"
);

Expand Down Expand Up @@ -107,7 +108,7 @@ contract OverlayV1BalancerV2Feed is OverlayV1Feed {
}

function getPoolId(address pool) public view returns (bytes32) {
return IBalancerV2Pool(pool).getPoolId();
return IBalancerV2Pool(pool).getPoolId();
}

function _fetch() internal view virtual override returns (Oracle.Data memory) {
Expand Down
4 changes: 1 addition & 3 deletions contracts/interfaces/feeds/balancerv2/IBalancerV2Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
pragma solidity 0.8.10;
pragma experimental ABIEncoderV2;


interface IBalancerV2Pool {
function getPoolId() external view returns (bytes32);
function getPoolId() external view returns (bytes32);
}

1 change: 0 additions & 1 deletion contracts/libraries/balancerv2/BalancerV2PoolInfo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ library BalancerV2PoolInfo {
uint128 marketBaseAmount;
}
}

0 comments on commit c3b1e93

Please sign in to comment.