Skip to content

Commit

Permalink
Merge pull request #230 from VenusProtocol/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
chechu authored Oct 10, 2024
2 parents 3c90ce9 + b182056 commit db80eb9
Show file tree
Hide file tree
Showing 83 changed files with 32,865 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ARCHIVE_NODE_ethereum=https://eth-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_arbitrumone=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/arbitrum-nitro/
#ARCHIVE_NODE_zksyncsepolia=https://zksync-sepolia.g.alchemy.com/v2/<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>

ETHERSCAN_API_KEY=
REPORT_GAS=
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
lint:
name: Lint
name: Compile / Lint / Build
runs-on: ubuntu-latest

steps:
Expand All @@ -31,6 +31,9 @@ jobs:
- name: Lint solidity and ts files
run: yarn lint

- name: Lint solidity and ts files
run: yarn build

test:
name: Test
runs-on: ubuntu-latest
Expand Down Expand Up @@ -116,7 +119,7 @@ jobs:

- name: Export deployments
run: |
for NETWORK in bsctestnet bscmainnet ethereum sepolia opbnbtestnet opbnbmainnet arbitrumsepolia arbitrumone; do
for NETWORK in bsctestnet bscmainnet ethereum sepolia opbnbtestnet opbnbmainnet arbitrumsepolia arbitrumone opsepolia opmainnet; 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
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
## [2.6.0-dev.4](https://github.com/VenusProtocol/oracle/compare/v2.6.0-dev.3...v2.6.0-dev.4) (2024-10-10)


### Features

* use @venusprotocol/governance-contracts that includes the Optimism deployment ([f13d176](https://github.com/VenusProtocol/oracle/commit/f13d176d007988dba9040ab8dbca2b3c7662387b))

## [2.6.0-dev.3](https://github.com/VenusProtocol/oracle/compare/v2.6.0-dev.2...v2.6.0-dev.3) (2024-09-24)


### Features

* add LST ETH pool deployment on BNB chain ([b1fbeab](https://github.com/VenusProtocol/oracle/commit/b1fbeab71a04786aeaa547f09c4c648b9812b351))
* updating deployment files ([ab4f42e](https://github.com/VenusProtocol/oracle/commit/ab4f42eb74e2d0702e490d33f22723d255eeaeca))

## [2.6.0-dev.2](https://github.com/VenusProtocol/oracle/compare/v2.6.0-dev.1...v2.6.0-dev.2) (2024-09-20)


### Features

* deployment files for oracles on op mainnet ([a157808](https://github.com/VenusProtocol/oracle/commit/a157808679f42c03705fdbfbf86130e79cd14bfd))
* updating deployment files ([54af379](https://github.com/VenusProtocol/oracle/commit/54af379f3b57f68309a1c090b2b7462b872048d3))
* updating deployment files ([8c1c23b](https://github.com/VenusProtocol/oracle/commit/8c1c23b53102f4e08fba1062e5dffa935adcff19))


### Bug Fixes

* update type import ([13b5a1e](https://github.com/VenusProtocol/oracle/commit/13b5a1e3810ae152e1f96c5009825c87fa14cacb))

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


### Features

* updating deployment files ([2006972](https://github.com/VenusProtocol/oracle/commit/20069723205e8cf746a772ba48551fcf2e61f06a))


### Bug Fixes

* minor fix ([9875747](https://github.com/VenusProtocol/oracle/commit/98757475e6ae5bc765aeec3bb13d973432ba22cd))
* xvs address and chainlink feeds ([67b3129](https://github.com/VenusProtocol/oracle/commit/67b3129ad5922de430d8bb5dcb539d7e6538afb8))

## [2.5.1](https://github.com/VenusProtocol/oracle/compare/v2.5.0...v2.5.1) (2024-09-10)


Expand Down
20 changes: 10 additions & 10 deletions contracts/ResilientOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ import "@venusprotocol/governance-contracts/contracts/Governance/AccessControlle
* @title ResilientOracle
* @author Venus
* @notice The Resilient Oracle is the main contract that the protocol uses to fetch prices of assets.
*
*
* DeFi protocols are vulnerable to price oracle failures including oracle manipulation and incorrectly
* reported prices. If only one oracle is used, this creates a single point of failure and opens a vector
* for attacking the protocol.
*
*
* The Resilient Oracle uses multiple sources and fallback mechanisms to provide accurate prices and protect
* the protocol from oracle attacks. Currently it includes integrations with Chainlink, Pyth, Binance Oracle
* and TWAP (Time-Weighted Average Price) oracles. TWAP uses PancakeSwap as the on-chain price source.
*
* For every market (vToken) we configure the main, pivot and fallback oracles. The oracles are configured per
* vToken's underlying asset address. The main oracle oracle is the most trustworthy price source, the pivot
* oracle is used as a loose sanity checker and the fallback oracle is used as a backup price source.
*
*
* For every market (vToken) we configure the main, pivot and fallback oracles. The oracles are configured per
* vToken's underlying asset address. The main oracle oracle is the most trustworthy price source, the pivot
* oracle is used as a loose sanity checker and the fallback oracle is used as a backup price source.
*
* To validate prices returned from two oracles, we use an upper and lower bound ratio that is set for every
* market. The upper bound ratio represents the deviation between reported price (the price that’s being
* validated) and the anchor price (the price we are validating against) above which the reported price will
Expand All @@ -38,8 +38,8 @@ isValid = anchorRatio <= upperBoundAnchorRatio && anchorRatio >= lowerBoundAncho
* In most cases, Chainlink is used as the main oracle, TWAP or Pyth oracles are used as the pivot oracle depending
* on which supports the given market and Binance oracle is used as the fallback oracle. For some markets we may
* use Pyth or TWAP as the main oracle if the token price is not supported by Chainlink or Binance oracles.
*
* use Pyth or TWAP as the main oracle if the token price is not supported by Chainlink or Binance oracles.
*
* For a fetched price to be valid it must be positive and not stagnant. If the price is invalid then we consider the
* oracle to be stagnant and treat it like it's disabled.
*/
Expand Down Expand Up @@ -413,7 +413,7 @@ contract ResilientOracle is PausableUpgradeable, AccessControlledV8, ResilientOr
* @param asset asset address
* @return price USD price in 18 decimals
* @return pivotValidated Boolean representing if the validation of fallback oracle price
* and pivot oracle price were successfull
* and pivot oracle price were successfully
* @custom:error Invalid price error is thrown if fallback oracle fails to fetch price of the asset
* @custom:error Invalid price error is thrown if fallback oracle is not enabled or fallback oracle
* address is null
Expand Down
4 changes: 2 additions & 2 deletions contracts/oracles/ChainlinkOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract ChainlinkOracle is AccessControlledV8, OracleInterface {
* @param asset Asset address
* @param price Asset price in 18 decimals
* @custom:access Only Governance
* @custom:event Emits PricePosted event on succesfully setup of asset price
* @custom:event Emits PricePosted event on successfully setup of asset price
*/
function setDirectPrice(address asset, uint256 price) external notNullAddress(asset) {
_checkAccessAllowed("setDirectPrice(address,uint256)");
Expand Down Expand Up @@ -98,7 +98,7 @@ contract ChainlinkOracle is AccessControlledV8, OracleInterface {
* @custom:error NotNullAddress error is thrown if asset address is null
* @custom:error NotNullAddress error is thrown if token feed address is null
* @custom:error Range error is thrown if maxStale period of token is not greater than zero
* @custom:event Emits TokenConfigAdded event on succesfully setting of the token config
* @custom:event Emits TokenConfigAdded event on successfully setting of the token config
*/
function setTokenConfig(
TokenConfig memory tokenConfig
Expand Down
6 changes: 0 additions & 6 deletions contracts/test/AccessControlManager.sol

This file was deleted.

7 changes: 0 additions & 7 deletions contracts/test/VAI.sol

This file was deleted.

8 changes: 4 additions & 4 deletions deploy/1-deploy-oracles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ const func: DeployFunction = async function ({

let accessControlManager;
if (!network.live) {
await deploy("AccessControlManagerScenario", {
await deploy("AccessControlManager", {
from: deployer,
args: [],
log: true,
autoMine: true,
});

accessControlManager = await hre.ethers.getContract("AccessControlManagerScenario");
accessControlManager = await hre.ethers.getContract("AccessControlManager");
}

let vai;
if (!network.live) {
await deploy("VAIScenario", {
await deploy("VAI", {
from: deployer,
log: true,
autoMine: true,
args: [await getChainId()],
});

vai = await hre.ethers.getContract("VAIScenario");
vai = await hre.ethers.getContract("VAI");
}
const accessControlManagerAddress = network.live ? ADDRESSES[network.name].acm : accessControlManager?.address;
const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer;
Expand Down
44 changes: 27 additions & 17 deletions deploy/13-deploy-wstETH-weETH-oracles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ const func: DeployFunction = async function ({
"hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin",
);

await deploy("wstETHOneJumpChainlinkOracle", {
contract: "OneJumpOracle",
const commonParams = {
from: deployer,
log: true,
deterministicDeployment: false,
args: [wstETH, WETH, resilientOracle.address, chainlinkOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentUpgradeableProxy",
Expand All @@ -43,26 +41,38 @@ const func: DeployFunction = async function ({
},
},
skipIfAlreadyDeployed: true,
waitConfirmations: 1,
};

await deploy("wstETHOneJumpChainlinkOracle", {
contract: "OneJumpOracle",
args: [wstETH, WETH, resilientOracle.address, chainlinkOracle.address],
...commonParams,
});

await deploy("weETHOneJumpChainlinkOracle", {
contract: "OneJumpOracle",
from: deployer,
log: true,
deterministicDeployment: false,
args: [weETH, WETH, resilientOracle.address, chainlinkOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentUpgradeableProxy",
viaAdminContract: {
name: "DefaultProxyAdmin",
artifact: defaultProxyAdmin,
},
},
skipIfAlreadyDeployed: true,
...commonParams,
});

if (["bscmainnet", "bsctestnet"].includes(hre.network.name)) {
const redstoneOracle = await hre.ethers.getContract("RedStoneOracle");

await deploy("wstETHOneJumpRedstoneOracle", {
contract: "OneJumpOracle",
args: [wstETH, WETH, resilientOracle.address, redstoneOracle.address],
...commonParams,
});

await deploy("weETHOneJumpRedstoneOracle", {
contract: "OneJumpOracle",
args: [weETH, WETH, resilientOracle.address, redstoneOracle.address],
...commonParams,
});
}
};

func.skip = async () => hre.network.name !== "arbitrumone" && hre.network.name !== "arbitrumsepolia";
func.tags = ["wstETH_weETH_OneJumpOracles_arbitrum"];
func.skip = async () => !["bscmainnet", "bsctestnet", "arbitrumone", "arbitrumsepolia"].includes(hre.network.name);
func.tags = ["wstETH_weETH_OneJumpOracles"];
export default func;
2 changes: 1 addition & 1 deletion deploy/4-vip-based-configuration.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AccessControlManager } from "@venusprotocol/governance-contracts/dist/typechain";
import { BigNumberish } from "ethers";
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
Expand All @@ -11,7 +12,6 @@ import {
assets,
getOraclesData,
} from "../helpers/deploymentConfig";
import { AccessControlManager } from "../typechain-types";

interface GovernanceCommand {
contract: string;
Expand Down
Loading

0 comments on commit db80eb9

Please sign in to comment.