Skip to content

Commit

Permalink
Merge pull request #241 from VenusProtocol/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
chechu authored Dec 12, 2024
2 parents dcb7986 + ceec9be commit c3c7f98
Show file tree
Hide file tree
Showing 84 changed files with 37,690 additions and 3,772 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ARCHIVE_NODE_ethereum=https://eth-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_zksyncmainnet=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/zksync
#ARCHIVE_NODE_opsepolia=https://sepolia.optimism.io
#ARCHIVE_NODE_opmainnet=https://opt-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
ARCHIVE_NODE_basesepolia=https://sepolia.base.org
ARCHIVE_NODE_basemainnet=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/base

ETHERSCAN_API_KEY=
REPORT_GAS=
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:

- name: Export deployments
run: |
for NETWORK in bsctestnet bscmainnet ethereum sepolia opbnbtestnet opbnbmainnet arbitrumsepolia arbitrumone opsepolia opmainnet; do
for NETWORK in bsctestnet bscmainnet ethereum sepolia opbnbtestnet opbnbmainnet arbitrumsepolia arbitrumone opsepolia opmainnet basesepolia basemainnet; do
EXPORT=true yarn hardhat export --network ${NETWORK} --export ./deployments/${NETWORK}.json
jq -M '{name, chainId, addresses: .contracts | map_values(.address)}' ./deployments/${NETWORK}.json > ./deployments/${NETWORK}_addresses.json
done
Expand Down
90 changes: 90 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,93 @@
## [2.7.0-dev.7](https://github.com/VenusProtocol/oracle/compare/v2.7.0-dev.6...v2.7.0-dev.7) (2024-12-12)


### Features

* added ERC4626 oracle ([49beba8](https://github.com/VenusProtocol/oracle/commit/49beba8f270f0b214780ab3e8441122affbf40ce))

## [2.7.0-dev.6](https://github.com/VenusProtocol/oracle/compare/v2.7.0-dev.5...v2.7.0-dev.6) (2024-12-12)


### Features

* add configs ([dfe2c8d](https://github.com/VenusProtocol/oracle/commit/dfe2c8dca46a64feaa76413b0f34ea11d0f8481e))
* deploy redstone oracle ([499c9c0](https://github.com/VenusProtocol/oracle/commit/499c9c053807a0aeb1634850a04c78d6fa120450))
* updating deployment files ([35dd76f](https://github.com/VenusProtocol/oracle/commit/35dd76f964146b595606ffef30b32082b0e0e9eb))
* updating deployment files ([44484d5](https://github.com/VenusProtocol/oracle/commit/44484d558bec6a958e40dd95380539b3d6f7bed8))
* updating deployment files ([4ea0b43](https://github.com/VenusProtocol/oracle/commit/4ea0b43862e3d27208cba9087e84e522e614e28e))


### Bug Fixes

* added xvs config ([f3804c1](https://github.com/VenusProtocol/oracle/commit/f3804c1b0f8cf1b37116b4d2987f3d604f31bfa3))
* deployed oracles ([2da9638](https://github.com/VenusProtocol/oracle/commit/2da963851dc031f605863f80d61a1c19b2dc44f3))
* fixed lint ([f952b28](https://github.com/VenusProtocol/oracle/commit/f952b28657863109ceeeadffefba4221cc5aeadc))
* set the right addresses for underlying assets and feeds on basemainnet ([626ae16](https://github.com/VenusProtocol/oracle/commit/626ae166794fdc6fa29cad2961d88b743e9d9d92))

## [2.7.0-dev.5](https://github.com/VenusProtocol/oracle/compare/v2.7.0-dev.4...v2.7.0-dev.5) (2024-12-05)


### Features

* add oracle deployments for LBTC on eth ([7bbdff7](https://github.com/VenusProtocol/oracle/commit/7bbdff75a73ba45c2d9d82f980077160ba1e54b5))
* updating deployment files ([6293473](https://github.com/VenusProtocol/oracle/commit/62934738a68f84236a65629ff7799476152b19b5))

## [2.7.0-dev.4](https://github.com/VenusProtocol/oracle/compare/v2.7.0-dev.3...v2.7.0-dev.4) (2024-11-22)


### Features

* updating deployment files ([4a7ef0a](https://github.com/VenusProtocol/oracle/commit/4a7ef0a45ebad3cb019d490fa99403f4475c7c40))
* updating deployment files ([1b5aed2](https://github.com/VenusProtocol/oracle/commit/1b5aed207b262399ae909d77cedb189a6d798f66))


### Bug Fixes

* added network to ci ([4979fcb](https://github.com/VenusProtocol/oracle/commit/4979fcb1c7e3642916dfd78c6429b86254ecc41e))
* deployed oracles ([665d04e](https://github.com/VenusProtocol/oracle/commit/665d04ef5ed9f0ef1533f975f3cdf3b2f2b7509a))
* deployed redstone oracle ([d95180d](https://github.com/VenusProtocol/oracle/commit/d95180dfadba0cd14dca77dc950e22fe526ba934))
* fixed lint ([fc955f0](https://github.com/VenusProtocol/oracle/commit/fc955f0a7db71fd0c7983a18e7798ddce0b90a41))

## [2.7.0-dev.3](https://github.com/VenusProtocol/oracle/compare/v2.7.0-dev.2...v2.7.0-dev.3) (2024-11-19)


### Features

* update BNBx oracle to use the new StakeManager ([d4f0440](https://github.com/VenusProtocol/oracle/commit/d4f044063b703851edd0fc0372ee2bdd5d22b8b5))
* updating deployment files ([f56b799](https://github.com/VenusProtocol/oracle/commit/f56b799a5f805cb45c1fcd24310cd4852b2ac0e9))

## [2.7.0-dev.2](https://github.com/VenusProtocol/oracle/compare/v2.7.0-dev.1...v2.7.0-dev.2) (2024-11-18)


### Features

* add eth mainnet deployment for pufETH oracle ([73911cb](https://github.com/VenusProtocol/oracle/commit/73911cbde44ddef70f6cb999f41a533669f2aec6))
* add sepolia deployments for pufETH oracle ([4dcd4eb](https://github.com/VenusProtocol/oracle/commit/4dcd4ebee7ec482e63f90b0738938b4d4187fc1f))
* updating deployment files ([958a9a1](https://github.com/VenusProtocol/oracle/commit/958a9a177c382a238d2c254b1bbe68e43f0b8de7))

## [2.7.0-dev.1](https://github.com/VenusProtocol/oracle/compare/v2.6.0...v2.7.0-dev.1) (2024-11-08)


### Features

* updating deployment files ([b2b592e](https://github.com/VenusProtocol/oracle/commit/b2b592eb1b6d517a4876ebc3ec08c88883b35a21))
* updating deployment files ([fe03739](https://github.com/VenusProtocol/oracle/commit/fe03739156b83b9f084f2e1f3b8404b6bb4ed82a))
* updating deployment files ([12c864e](https://github.com/VenusProtocol/oracle/commit/12c864e5f69523bd5cb112540f22f4f6dc554997))


### Bug Fixes

* added deployment scripts ([cdf4e52](https://github.com/VenusProtocol/oracle/commit/cdf4e52c5c12790d3f0fab88260de95ddcb75b98))
* added ethereum addresses ([f5b82d1](https://github.com/VenusProtocol/oracle/commit/f5b82d18077b15ba600fff8403eaf6b2fdd4b889))
* apply suggestions for generic naming ([1365003](https://github.com/VenusProtocol/oracle/commit/13650032763f09587add3800a95619cf9f309b5f))
* deployed eBTC oracle ([d3a7b41](https://github.com/VenusProtocol/oracle/commit/d3a7b416fe18a03d5a28c40c99dcd589e880db63))
* deployed on ethereum ([0b1dff0](https://github.com/VenusProtocol/oracle/commit/0b1dff01bee4ee81a44467c9b7e881150877b83e))
* fixed lint ([f00e26a](https://github.com/VenusProtocol/oracle/commit/f00e26a9b22900b39fa7d6ffe3e2ab4fdf108244))
* fixed lint ([9020396](https://github.com/VenusProtocol/oracle/commit/90203968c3269b93a6120522bfc8d01453d598c0))
* redeployed on sepolia ([2a61077](https://github.com/VenusProtocol/oracle/commit/2a61077782a51204bc8b708fa7037d92674edf0b))
* revert deployment ([bb48dca](https://github.com/VenusProtocol/oracle/commit/bb48dca8fd7c7b81998c37336d3b97d713cdfa2c))
* revert deployment ([5f84c03](https://github.com/VenusProtocol/oracle/commit/5f84c03afaf4fc869a6a0ac435f9c034884b717d))

## [2.6.0](https://github.com/VenusProtocol/oracle/compare/v2.5.1...v2.6.0) (2024-10-10)


Expand Down
7 changes: 7 additions & 0 deletions contracts/interfaces/IERC4626.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

interface IERC4626 {
function convertToAssets(uint256 shares) external view returns (uint256);
function decimals() external view returns (uint8);
}
29 changes: 29 additions & 0 deletions contracts/oracles/ERC4626Oracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

import { IERC4626 } from "../interfaces/IERC4626.sol";
import { CorrelatedTokenOracle } from "./common/CorrelatedTokenOracle.sol";
import { EXP_SCALE } from "@venusprotocol/solidity-utilities/contracts/constants.sol";

/**
* @title ERC4626Oracle
* @author Venus
* @notice This oracle fetches the price of ERC4626 tokens
*/
contract ERC4626Oracle is CorrelatedTokenOracle {
/// @notice Constructor for the implementation contract.
/// @custom:oz-upgrades-unsafe-allow constructor
constructor(
address correlatedToken,
address underlyingToken,
address resilientOracle
) CorrelatedTokenOracle(correlatedToken, underlyingToken, resilientOracle) {}

/**
* @notice Fetches the amount of underlying token for 1 correlated token
* @return amount The amount of underlying token for correlated token
*/
function _getUnderlyingAmount() internal view override returns (uint256) {
return IERC4626(CORRELATED_TOKEN).convertToAssets(EXP_SCALE);
}
}
38 changes: 38 additions & 0 deletions contracts/oracles/EtherfiAccountantOracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

import { CorrelatedTokenOracle } from "./common/CorrelatedTokenOracle.sol";
import { IAccountant } from "../interfaces/IAccountant.sol";
import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";

/**
* @title EtherfiAccountantOracle
* @author Venus
* @notice This oracle fetches the price of any Ether.fi asset that uses
* Accountant contracts to derive the underlying price
*/
contract EtherfiAccountantOracle is CorrelatedTokenOracle {
/// @notice Address of Accountant
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
IAccountant public immutable ACCOUNTANT;

/// @notice Constructor for the implementation contract.
/// @custom:oz-upgrades-unsafe-allow constructor
constructor(
address accountant,
address correlatedToken,
address underlyingToken,
address resilientOracle
) CorrelatedTokenOracle(correlatedToken, underlyingToken, resilientOracle) {
ensureNonzeroAddress(accountant);
ACCOUNTANT = IAccountant(accountant);
}

/**
* @notice Fetches the conversion rate from the ACCOUNTANT contract
* @return amount Amount of WBTC
*/
function _getUnderlyingAmount() internal view override returns (uint256) {
return ACCOUNTANT.getRateSafe();
}
}
28 changes: 28 additions & 0 deletions deploy/14-dependencies-eBTC-oracle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { ADDRESSES } from "../helpers/deploymentConfig";

const func: DeployFunction = async ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer;

await deploy("MockAccountant_eBTC", {
from: deployer,
contract: "MockAccountant",
args: [],
log: true,
autoMine: true,
skipIfAlreadyDeployed: true,
});

const mockAccountant = await ethers.getContract("MockAccountant_eBTC");
await mockAccountant.transferOwnership(proxyOwnerAddress);
};

export default func;
func.tags = ["eBTCAccountantOracle"];
func.skip = async (hre: HardhatRuntimeEnvironment) => hre.network.name !== "sepolia";
46 changes: 46 additions & 0 deletions deploy/14-deploy-eBTC-oracle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { ADDRESSES } from "../helpers/deploymentConfig";

const func: DeployFunction = async ({
getNamedAccounts,
deployments,
network,
artifacts,
}: HardhatRuntimeEnvironment) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const resilientOracle = await ethers.getContract("ResilientOracle");
const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer;
const defaultProxyAdmin = await artifacts.readArtifact(
"hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin",
);
let { eBTC_Accountant } = ADDRESSES[network.name];
const { WBTC, eBTC } = ADDRESSES[network.name];

eBTC_Accountant = eBTC_Accountant || (await ethers.getContract("MockAccountant_eBTC")).address;

await deploy("eBTCAccountantOracle", {
contract: "EtherfiAccountantOracle",
from: deployer,
log: true,
deterministicDeployment: false,
args: [eBTC_Accountant, eBTC, WBTC, resilientOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentUpgradeableProxy",
viaAdminContract: {
name: "DefaultProxyAdmin",
artifact: defaultProxyAdmin,
},
},
skipIfAlreadyDeployed: true,
});
};

export default func;
func.tags = ["eBTCAccountantOracle"];
func.skip = async (hre: HardhatRuntimeEnvironment) => hre.network.name !== "ethereum" && hre.network.name !== "sepolia";
32 changes: 32 additions & 0 deletions deploy/14-deploy-pufETH-oracle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { ADDRESSES } from "../helpers/deploymentConfig";

const func: DeployFunction = async function ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const proxyOwnerAddress = ADDRESSES[network.name].timelock;
const { pufETH, WETH } = ADDRESSES[network.name];

const redStoneOracle = await hre.ethers.getContract("RedStoneOracle");
const resilientOracle = await hre.ethers.getContract("ResilientOracle");

await deploy("pufETHOneJumpRedStoneOracle", {
contract: "OneJumpOracle",
from: deployer,
log: true,
deterministicDeployment: false,
args: [pufETH, WETH, resilientOracle.address, redStoneOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});
};

func.skip = async () => hre.network.name !== "ethereum" && hre.network.name !== "sepolia";
func.tags = ["pufETHOneJumpRedStoneOracle"];
export default func;
32 changes: 32 additions & 0 deletions deploy/15-deploy-lbtc-oracle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { ADDRESSES } from "../helpers/deploymentConfig";

const func: DeployFunction = async function ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const proxyOwnerAddress = ADDRESSES[network.name].timelock;
const { LBTC, WBTC } = ADDRESSES[network.name];

const redstoneOracle = await hre.ethers.getContract("RedStoneOracle");
const resilientOracle = await hre.ethers.getContract("ResilientOracle");

await deploy("LBTCOneJumpRedStoneOracle", {
contract: "OneJumpOracle",
from: deployer,
log: true,
deterministicDeployment: false,
args: [LBTC, WBTC, resilientOracle.address, redstoneOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});
};

func.skip = async () => hre.network.name !== "ethereum" && hre.network.name !== "sepolia";
func.tags = ["LBTCOneJumpRedStoneOracle"];
export default func;
Loading

0 comments on commit c3c7f98

Please sign in to comment.