Skip to content

Commit 253e376

Browse files
authored
feat: cbETH Deployment (#195)
* adding cbETH oracle * checking deployment scripts * deploying contracts * remove flattened * change README to add new reference
1 parent 0c7e088 commit 253e376

22 files changed

Lines changed: 8944 additions & 18 deletions

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Angle is a decentralized stablecoin protocol, designed to be both over-collatera
1212

1313
The protocol is made of different modules, each with their own set of smart contracts. This repo contains the Borrowing module smart contracts.
1414

15+
Smart contracts used to for yield-bearing tokens as collateral assets in the Borrowing module are in a different repository that you can find [here](https://github.com/AngleProtocol/borrow-lpTokens-contracts).
16+
1517
Documentation to understand Angle Protocol's Borrowing Module is available [here](https://docs.angle.money).
1618

1719
Developers documentation to understand how these smart contracts work together is available [here](https://developers.angle.money/borrowing-module-contracts/architecture-overview).
@@ -27,7 +29,7 @@ Other Angle-related smart contracts can be found in the following repositories:
2729
- [Angle Core module contracts](https://github.com/AngleProtocol/angle-core)
2830
- [Angle Strategies](https://github.com/AngleProtocol/angle-strategies)
2931
- [Angle Router contracts](https://github.com/AngleProtocol/angle-router)
30-
- [Angle Algorithmic Market Operations](https://github.com/AngleProtocol/angle-amo)
32+
- [Angle Direct Deposit Modules (or Algorithmic market operations)](https://github.com/AngleProtocol/angle-amo)
3133

3234
Otherwise, for more info about the protocol, check out [this portal](https://linktr.ee/angleprotocol) of resources.
3335

contracts/oracle/BaseOracleChainlinkMultiTwoFeeds.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract contract BaseOracleChainlinkMultiTwoFeeds is BaseOracleChainlinkMulti {
1919
}
2020

2121
/// @inheritdoc IOracle
22-
function read() external view override returns (uint256 quoteAmount) {
22+
function read() external view virtual override returns (uint256 quoteAmount) {
2323
quoteAmount = _getQuoteAmount();
2424
AggregatorV3Interface[] memory _circuitChainlink = circuitChainlink();
2525
uint8[2] memory circuitChainIsMultiplied = [1, 0];
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// SPDX-License-Identifier: GPL-3.0
2+
3+
pragma solidity ^0.8.12;
4+
5+
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
6+
7+
import "../../BaseOracleChainlinkMultiTwoFeeds.sol";
8+
9+
/// @title OracleCBETHEURChainlink
10+
/// @author Angle Labs, Inc.
11+
/// @notice Gives the price of cbETH in Euro in base 18
12+
contract OracleCBETHEURChainlink is BaseOracleChainlinkMultiTwoFeeds {
13+
string public constant DESCRIPTION = "cbETH/EUR Oracle";
14+
15+
constructor(uint32 _stalePeriod, address _treasury) BaseOracleChainlinkMultiTwoFeeds(_stalePeriod, _treasury) {}
16+
17+
/// @inheritdoc IOracle
18+
function circuitChainlink() public pure override returns (AggregatorV3Interface[] memory) {
19+
AggregatorV3Interface[] memory _circuitChainlink = new AggregatorV3Interface[](3);
20+
// Oracle cbETH/ETH
21+
_circuitChainlink[0] = AggregatorV3Interface(0xF017fcB346A1885194689bA23Eff2fE6fA5C483b);
22+
// Oracle ETH/USD
23+
_circuitChainlink[1] = AggregatorV3Interface(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
24+
// Oracle EUR/USD
25+
_circuitChainlink[2] = AggregatorV3Interface(0xb49f677943BC038e9857d61E7d053CaA2C1734C1);
26+
return _circuitChainlink;
27+
}
28+
29+
/// @inheritdoc BaseOracleChainlinkMultiTwoFeeds
30+
function read() external view virtual override returns (uint256 quoteAmount) {
31+
quoteAmount = _getQuoteAmount();
32+
AggregatorV3Interface[] memory _circuitChainlink = circuitChainlink();
33+
uint8[3] memory circuitChainIsMultiplied = [1, 1, 0];
34+
uint8[3] memory chainlinkDecimals = [18, 8, 8];
35+
uint256 circuitLength = _circuitChainlink.length;
36+
for (uint256 i; i < circuitLength; ++i) {
37+
quoteAmount = _readChainlinkFeed(
38+
quoteAmount,
39+
_circuitChainlink[i],
40+
circuitChainIsMultiplied[i],
41+
chainlinkDecimals[i]
42+
);
43+
}
44+
}
45+
}

contracts/vaultManager/VaultManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ contract VaultManager is VaultManagerPermit, IVaultManagerFunctions {
798798
BASE_PARAMS *
799799
liquidationDiscount) /
800800
(surcharge * targetHealthFactor * liquidationDiscount - (BASE_PARAMS**2) * collateralFactor);
801-
// Need to check for the dustas liquidating should not leave a dusty amount in the vault
801+
// Need to check for the dust as liquidating should not leave a dusty amount in the vault
802802
uint256 dustParameter = dustLiquidation;
803803
if (currentDebt * BASE_PARAMS <= maxAmountToRepay * surcharge + dustParameter * BASE_PARAMS) {
804804
// If liquidating to the target threshold would leave a dusty amount: the liquidator can repay all.

deploy/4_oracle.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ const argv = yargs.env('').boolean('ci').parseSync();
88
const func: DeployFunction = async ({ deployments, web3, ethers, network }) => {
99
const { deploy } = deployments;
1010
const { deployer } = await ethers.getNamedSigners();
11-
const treasury = (await deployments.get('Treasury')).address;
11+
// const treasury = (await deployments.get('Treasury')).address;
12+
const treasury = '0x8667DBEBf68B0BFa6Db54f550f41Be16c4067d60';
1213

1314
const chainName = network.name.charAt(0).toUpperCase() + network.name.substring(1);
1415

1516
if (!network.live || network.config.chainId === ChainId.MAINNET) {
16-
console.log('Now deploying the Oracle LUSD/EUR');
17-
await deploy('Oracle_LUSD_EUR', {
18-
contract: 'OracleLUSDEURChainlink',
17+
console.log('Now deploying the Oracle CBETH/EUR');
18+
await deploy('Oracle_CBETH_EUR', {
19+
contract: 'OracleCBETHEURChainlink',
1920
from: deployer.address,
2021
args: [3600 * 48, treasury],
2122
log: !argv.ci,
2223
});
23-
const oracle = (await deployments.get('Oracle_LUSD_EUR')).address;
24-
console.log(`Successfully deployed Oracle LUSD/EUR at the address ${oracle}`);
24+
const oracle = (await deployments.get('Oracle_CBETH_EUR')).address;
25+
console.log(`Successfully deployed Oracle CBETH/EUR at the address ${oracle}`);
2526
console.log('');
2627
} else {
2728
await deploy('Oracle_AVAX_EUR', {

deploy/6_vaultManagerProxy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
5858
const treasuryAddress = (await ethers.getContract('Treasury')).address;
5959
const treasury = new Contract(treasuryAddress, Treasury__factory.abi, deployer);
6060

61-
const implementation = (await ethers.getContract('VaultManager_Implementation')).address;
61+
const implementation = (await ethers.getContract('VaultManager_V2_0_Implementation')).address;
6262
const callData = new ethers.Contract(
6363
implementation,
6464
VaultManager__factory.createInterface(),
@@ -71,6 +71,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
7171
]);
7272

7373
// await deployProxy(name, implementation, proxyAdminAddress, callData);
74+
7475
await deploy(name, {
7576
contract: 'TransparentUpgradeableProxy',
7677
from: deployer.address,

deploy/networks/mainnet.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"oneInchRouter": "0x1111111254eeb25477b68fb85ed929f73a960582",
99
"angleRouter": "0xBB755240596530be0c1DE5DFD77ec6398471561d",
1010
"dust": "0",
11-
"vaultsList": ["LUSD"]
11+
"vaultsList": ["cbETH"]
1212
}

0 commit comments

Comments
 (0)