Skip to content

Commit

Permalink
feat: Add initial contract to validate operations
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Sep 27, 2021
1 parent 8a041be commit d6af2e5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
8 changes: 8 additions & 0 deletions contracts/interfaces/IOperationalValidator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.7;

interface IOperationalValidator {
function isBorrowAllowed() external returns (bool);

function isLiquidationAllowed() external returns (bool);
}
36 changes: 36 additions & 0 deletions contracts/protocol/configuration/OperationalValidator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.7;

import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
import {IOperationalValidator} from '../../interfaces/IOperationalValidator.sol';

/**
* @title OperationalValidator
* @author Aave
* @notice
*/
contract OperationalValidator is IOperationalValidator {
IPoolAddressesProvider public _addressesProvider;
uint256 public _gracePeriod;

/**
* @notice Constructor
* @dev
* @param provider The address of the PoolAddressesProvider
*/
constructor(IPoolAddressesProvider provider, uint256 gracePeriod) {
_addressesProvider = provider;
_gracePeriod = gracePeriod;
}

/// @inheritdoc IOperationalValidator
function isBorrowAllowed() public override returns (bool) {
// If the sequencer goes down, borrowing is not allowed
}

/// @inheritdoc IOperationalValidator
function isLiquidationAllowed() public override returns (bool) {
// If the sequencer goes down AND HF > 0.9, liquidation is not allowed
// If timestampSequencerGotUp - block.timestamp > gracePeriod, liquidation allowed
}
}

0 comments on commit d6af2e5

Please sign in to comment.