Skip to content

Commit

Permalink
feat: Vault manager with permissioned liquidations (#208)
Browse files Browse the repository at this point in the history
* first batch of test done

* update final hash of vaultManager implementation

* changing whitelist

* feat: add tests for whitelisted vault

* vaultManager for IB01

* fix: comments for liquidations

* add USDC collateral

* feat: add debt ceiling vault

* feat: vaultManager deployment

---------

Co-authored-by: gs8nrv <[email protected]>
  • Loading branch information
sogipec and GuillaumeNervoXS authored May 22, 2023
1 parent df978a3 commit b8e1226
Show file tree
Hide file tree
Showing 35 changed files with 3,811 additions and 2,910 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ bin

# temporary delete
typechain/cacheIndex.ts
contracts/mock/MockEulerReactor.sol

# foundry
/out
Expand Down
1 change: 0 additions & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module.exports = {
'oracle/implementations/',
// Router here is a copy pasta of the router in another repo
'router',
'reactor/BaseReactorStorage.sol',
'vaultManager/VaultManagerStorage.sol',
'keeperMulticall/KeeperMulticall.sol',
],
Expand Down
17 changes: 14 additions & 3 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "warning",
"avoid-call-value": "warn",
"avoid-low-level-calls": "off",
"avoid-tx-origin": "warn",
"const-name-snakecase": "warn",
"contract-name-camelcase": "warn",
"imports-on-top": "warn",
"prettier/prettier": "off",
"ordering": "off",
"max-states-count": "off",
"mark-callable-contracts": "off",
"no-empty-blocks": "off",
"no-global-import": "off",
"not-rely-on-time": "off",
"compiler-version": "off",
"private-vars-leading-underscore": "error",
"private-vars-leading-underscore": "warn",
"reentrancy": "warn",
"no-inline-assembly": "off",
"no-complex-fallback": "off",
"reason-string": "off",
"func-visibility": ["error", { "ignoreConstructors": true }]
"func-visibility": ["warn", { "ignoreConstructors": true }]
}
}
36 changes: 0 additions & 36 deletions contracts/mock/MockReactor.sol

This file was deleted.

4 changes: 2 additions & 2 deletions contracts/oracle/BaseOracleChainlinkMulti.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ abstract contract BaseOracleChainlinkMulti is IOracle {
revert InvalidChainlinkRate();
uint256 castedRatio = uint256(ratio);
// Checking whether we should multiply or divide by the ratio computed
if (multiplied == 1) return (quoteAmount * castedRatio) / (10**decimals);
else return (quoteAmount * (10**decimals)) / castedRatio;
if (multiplied == 1) return (quoteAmount * castedRatio) / (10 ** decimals);
else return (quoteAmount * (10 ** decimals)) / castedRatio;
}

// ======================= Governance Related Functions ========================
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.12;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

import "../../../BaseOracleChainlinkMultiTwoFeeds.sol";

/// @title OracleIB01EURChainlink
/// @author Angle Labs, Inc.
/// @notice Gives the price of IB01 in Euro in base 18
contract OracleIB01EURChainlink is BaseOracleChainlinkMultiTwoFeeds {
string public constant DESCRIPTION = "IB01/EUR Oracle";

constructor(uint32 _stalePeriod, address _treasury) BaseOracleChainlinkMultiTwoFeeds(_stalePeriod, _treasury) {}

/// @inheritdoc IOracle
function circuitChainlink() public pure override returns (AggregatorV3Interface[] memory) {
AggregatorV3Interface[] memory _circuitChainlink = new AggregatorV3Interface[](2);
// Oracle IB01/USD
_circuitChainlink[0] = AggregatorV3Interface(0x788D911ae7c95121A89A0f0306db65D87422E1de);
// Oracle EUR/USD
_circuitChainlink[1] = AggregatorV3Interface(0xb49f677943BC038e9857d61E7d053CaA2C1734C1);
return _circuitChainlink;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.12;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

import "../../../BaseOracleChainlinkMultiTwoFeeds.sol";

/// @title OracleUSDCEURChainlink
/// @author Angle Labs, Inc.
/// @notice Gives the price of USDC in Euro in base 18
contract OracleUSDCEURChainlink is BaseOracleChainlinkMultiTwoFeeds {
string public constant DESCRIPTION = "USDC/EUR Oracle";

constructor(uint32 _stalePeriod, address _treasury) BaseOracleChainlinkMultiTwoFeeds(_stalePeriod, _treasury) {}

/// @inheritdoc IOracle
function circuitChainlink() public pure override returns (AggregatorV3Interface[] memory) {
AggregatorV3Interface[] memory _circuitChainlink = new AggregatorV3Interface[](2);
// Oracle USDC/USD
_circuitChainlink[0] = AggregatorV3Interface(0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6);
// Oracle EUR/USD
_circuitChainlink[1] = AggregatorV3Interface(0xb49f677943BC038e9857d61E7d053CaA2C1734C1);
return _circuitChainlink;
}
}
Loading

0 comments on commit b8e1226

Please sign in to comment.