Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
brotherlymite committed Oct 29, 2024
1 parent 615b745 commit 21ad391
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
23 changes: 8 additions & 15 deletions src/contracts/AaveStewardInjector.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ contract AaveStewardInjector is Ownable, IAaveStewardInjector {
* @param guardian address of the guardian / owner of the stewards injector.
* @param whitelistedAsset address of the whitelisted asset for which update can be injected.
*/
constructor(
address riskOracle,
address riskSteward,
address guardian,
address whitelistedAsset
) {
constructor(address riskOracle, address riskSteward, address guardian, address whitelistedAsset) {
RISK_ORACLE = riskOracle;
RISK_STEWARD = riskSteward;
WHITELISTED_ASSET = whitelistedAsset;
Expand All @@ -62,10 +57,8 @@ contract AaveStewardInjector is Ownable, IAaveStewardInjector {
* @dev run off-chain, checks if the latest update from risk oracle should be injected on risk steward
*/
function checkUpkeep(bytes memory) public view virtual override returns (bool, bytes memory) {
IRiskOracle.RiskParameterUpdate memory updateRiskParams = IRiskOracle(RISK_ORACLE).getLatestUpdateByParameterAndMarket(
WHITELISTED_UPDATE_TYPE,
WHITELISTED_ASSET
);
IRiskOracle.RiskParameterUpdate memory updateRiskParams = IRiskOracle(RISK_ORACLE)
.getLatestUpdateByParameterAndMarket(WHITELISTED_UPDATE_TYPE, WHITELISTED_ASSET);

if (_canUpdateBeInjected(updateRiskParams)) return (true, '');

Expand All @@ -77,10 +70,8 @@ contract AaveStewardInjector is Ownable, IAaveStewardInjector {
* @dev executes injection of the latest update from the risk oracle into the risk steward.
*/
function performUpkeep(bytes calldata) external override {
IRiskOracle.RiskParameterUpdate memory updateRiskParams = IRiskOracle(RISK_ORACLE).getLatestUpdateByParameterAndMarket(
WHITELISTED_UPDATE_TYPE,
WHITELISTED_ASSET
);
IRiskOracle.RiskParameterUpdate memory updateRiskParams = IRiskOracle(RISK_ORACLE)
.getLatestUpdateByParameterAndMarket(WHITELISTED_UPDATE_TYPE, WHITELISTED_ASSET);

if (!_canUpdateBeInjected(updateRiskParams)) {
revert UpdateCannotBeInjected();
Expand Down Expand Up @@ -114,7 +105,9 @@ contract AaveStewardInjector is Ownable, IAaveStewardInjector {
* @param updateRiskParams struct containing the risk param update from the risk oralce to check if it can be injected.
* @return true if the update could be injected to the risk steward, false otherwise.
*/
function _canUpdateBeInjected(IRiskOracle.RiskParameterUpdate memory updateRiskParams) internal view returns (bool) {
function _canUpdateBeInjected(
IRiskOracle.RiskParameterUpdate memory updateRiskParams
) internal view returns (bool) {
return (
!isUpdateIdExecuted(updateRiskParams.updateId) &&
(updateRiskParams.timestamp + EXPIRATION_PERIOD > block.timestamp) &&
Expand Down
1 change: 0 additions & 1 deletion src/contracts/RiskSteward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ contract RiskSteward is Ownable, IRiskSteward {
if (_restrictedAddresses[asset]) revert AssetIsRestricted();
if (collateralUpdates[i].liqProtocolFee != EngineFlags.KEEP_CURRENT)
revert ParamChangeNotAllowed();

if (
collateralUpdates[i].ltv == 0 ||
collateralUpdates[i].liqThreshold == 0 ||
Expand Down
7 changes: 5 additions & 2 deletions tests/EdgeRiskSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ contract EdgeRiskSteward_Test is RiskSteward_Test {
/* ----------------------------- LST Price Cap Tests ----------------------------- */

function test_updateLstPriceCap() public {
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](1);
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
1
);
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
Expand All @@ -117,7 +119,8 @@ contract EdgeRiskSteward_Test is RiskSteward_Test {
/* ----------------------------- Stable Price Cap Test ----------------------------- */

function test_updateStablePriceCap() public {
IRiskSteward.PriceCapStableUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapStableUpdate[](1);
IRiskSteward.PriceCapStableUpdate[]
memory priceCapUpdates = new IRiskSteward.PriceCapStableUpdate[](1);

priceCapUpdates[0] = IRiskSteward.PriceCapStableUpdate({
oracle: AaveV3EthereumAssets.USDT_ORACLE,
Expand Down
8 changes: 5 additions & 3 deletions tests/RiskSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,11 @@ contract RiskSteward_Test is Test {

vm.warp(block.timestamp + 1 days);

debtCeilingBefore = AaveV3Ethereum.AAVE_PROTOCOL_DATA_PROVIDER.getDebtCeiling(
AaveV3EthereumAssets.UNI_UNDERLYING
) / 100;
debtCeilingBefore =
AaveV3Ethereum.AAVE_PROTOCOL_DATA_PROVIDER.getDebtCeiling(
AaveV3EthereumAssets.UNI_UNDERLYING
) /
100;

collateralUpdates[0] = IEngine.CollateralUpdate({
asset: AaveV3EthereumAssets.UNI_UNDERLYING,
Expand Down
8 changes: 6 additions & 2 deletions tests/RiskStewardCapo.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ contract RiskSteward_Capo_Test is Test {
.getSnapshotTimestamp();

vm.startPrank(riskCouncil);
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](1);
IRiskSteward.PriceCapLstUpdate[] memory priceCapUpdates = new IRiskSteward.PriceCapLstUpdate[](
1
);
priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
oracle: AaveV3EthereumAssets.wstETH_ORACLE,
priceCapUpdateParams: IPriceCapAdapter.PriceCapUpdateParams({
Expand All @@ -348,7 +350,9 @@ contract RiskSteward_Capo_Test is Test {
});

// if same snapshot timestamp is used reverts
vm.expectRevert(abi.encodeWithSelector(IPriceCapAdapter.InvalidRatioTimestamp.selector, snapshotTsBefore));
vm.expectRevert(
abi.encodeWithSelector(IPriceCapAdapter.InvalidRatioTimestamp.selector, snapshotTsBefore)
);
steward.updateLstPriceCaps(priceCapUpdates);

priceCapUpdates[0] = IRiskSteward.PriceCapLstUpdate({
Expand Down

0 comments on commit 21ad391

Please sign in to comment.