Skip to content

Commit

Permalink
Merge pull request #187 from VenusProtocol/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
chechu authored Apr 25, 2024
2 parents bc85304 + f83ee00 commit f9c003b
Show file tree
Hide file tree
Showing 74 changed files with 28,692 additions and 4,412 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ARCHIVE_NODE_ethereum=https://eth-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_ethereum=http://127.0.0.1:1248
#ARCHIVE_NODE_opbnbtestnet=https://opbnb-testnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_opbnbmainnet=https://opbnb-mainnet.nodereal.io/v1/<YOUR_KEY_HERE>
#ARCHIVE_NODE_arbitrumsepolia=https://sepolia-rollup.arbitrum.io/rpc
#ARCHIVE_NODE_arbitrumone=https://open-platform.nodereal.io/<YOUR_KEY_HERE>/arbitrum-nitro/

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 @@ -116,7 +116,7 @@ jobs:

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


### Bug Fixes

* update xvs address for arbitrumsepolia ([ca39f18](https://github.com/VenusProtocol/oracle/commit/ca39f180bc55c691af70242dd2462ee047637e2f))

## [2.2.0-dev.2](https://github.com/VenusProtocol/oracle/compare/v2.2.0-dev.1...v2.2.0-dev.2) (2024-04-24)


### Features

* updating deployment files ([156b02f](https://github.com/VenusProtocol/oracle/commit/156b02fc2e57badc786533a2f3ea11fbbfbff061))
* updating deployment files ([077b57a](https://github.com/VenusProtocol/oracle/commit/077b57a569a7d738d0c45b560e4793f2a4058107))
* updating deployment files ([df1e03e](https://github.com/VenusProtocol/oracle/commit/df1e03ef8db38ff48964984d7bd88c9f29553b6f))
* updating deployment files ([d837c8c](https://github.com/VenusProtocol/oracle/commit/d837c8ce22a2db42d78cef71f39eadcf38d220f6))


### Bug Fixes

* added AnkrBNB oracle and mock ankrBNB ([df3d20f](https://github.com/VenusProtocol/oracle/commit/df3d20f701a8a09061294eb03879e6cb961329c2))
* deployed LST oracles on bsctestnet ([4406013](https://github.com/VenusProtocol/oracle/commit/4406013ea3dda84bcda33bf0ead76e9a8bf0f676))
* deployed lst oracles to bsc mainnet ([c14881c](https://github.com/VenusProtocol/oracle/commit/c14881c3cf08136b433d8c6fc8d71c96a2251eef))
* fixed ankrBNB oracle ([58aaa1d](https://github.com/VenusProtocol/oracle/commit/58aaa1d43aa9d06b81ca60b00d4db38b57999142))
* fixed lint ([2680429](https://github.com/VenusProtocol/oracle/commit/2680429c2131058ab190c08c08000c3a1499b80a))
* renamed file ([b067b69](https://github.com/VenusProtocol/oracle/commit/b067b693570fa5a3178cf3aa186fc5b85cd6b609))
* reverted config changes ([df860a8](https://github.com/VenusProtocol/oracle/commit/df860a84c769a0302e9470cbec71ca98f0cb8b62))
* reverted hardhat config ([3ec2d87](https://github.com/VenusProtocol/oracle/commit/3ec2d871e01ee9ea1c58f588d0af71dbb07bcb7a))
* reverted hardhat config ([3f3faf5](https://github.com/VenusProtocol/oracle/commit/3f3faf597478f0d97d2df426e37a68c54cfae841))

## [2.2.0-dev.1](https://github.com/VenusProtocol/oracle/compare/v2.1.0...v2.2.0-dev.1) (2024-04-17)


### Features

* add config and deployments for arbitrum sepolia ([a2f66e7](https://github.com/VenusProtocol/oracle/commit/a2f66e7fae650b8c1e800dc9c88ca153979c844c))
* updating deployment files ([7d2b60b](https://github.com/VenusProtocol/oracle/commit/7d2b60b40741d8b6629ae83b68e9e960ba51e59c))


### Bug Fixes

* import acm address from npm package ([084e080](https://github.com/VenusProtocol/oracle/commit/084e08037567352c98edb3940c8d0101a997968a))
* pr comments ([5f4f8be](https://github.com/VenusProtocol/oracle/commit/5f4f8be3d496f4e7df1ad32a54a4aa6acf5ee422))

## [2.1.0](https://github.com/VenusProtocol/oracle/compare/v2.0.0...v2.1.0) (2024-04-16)


Expand Down
33 changes: 33 additions & 0 deletions contracts/test/MockAnkrBNB.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IAnkrBNB } from "../interfaces/IAnkrBNB.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MockAnkrBNB is ERC20, Ownable, IAnkrBNB {
uint8 private immutable _decimals;
uint256 public exchangeRate;

constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) Ownable() {
_decimals = decimals_;
}

function faucet(uint256 amount) external {
_mint(msg.sender, amount);
}

function setSharesToBonds(uint256 rate) external onlyOwner {
exchangeRate = rate;
}

function sharesToBonds(uint256 amount) external view override returns (uint256) {
return (amount * exchangeRate) / (10 ** uint256(_decimals));
}

function decimals() public view virtual override(ERC20, IAnkrBNB) returns (uint8) {
return _decimals;
}
}
29 changes: 29 additions & 0 deletions contracts/test/MockWBETH.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IWBETH } from "../interfaces/IWBETH.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MockWBETH is ERC20, Ownable, IWBETH {
uint8 private immutable _decimals;
uint256 public override exchangeRate;

constructor(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) Ownable() {
_decimals = decimals_;
}

function faucet(uint256 amount) external {
_mint(msg.sender, amount);
}

function setExchangeRate(uint256 rate) external onlyOwner {
exchangeRate = rate;
}

function decimals() public view virtual override(ERC20, IWBETH) returns (uint8) {
return _decimals;
}
}
2 changes: 1 addition & 1 deletion deploy/1-deploy-oracles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const func: DeployFunction = async function ({ getNamedAccounts, deployments, ne
},
});

if (network.name === "arbitrum") {
if (network.name === "arbitrumone") {
await deploy("SequencerChainlinkOracle", {
contract: "SequencerChainlinkOracle",
from: deployer,
Expand Down
2 changes: 2 additions & 0 deletions deploy/2-deploy-redstone-oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ const func: DeployFunction = async function ({ getNamedAccounts, deployments, ne
}
};

func.skip = async ({ network }: HardhatRuntimeEnvironment) =>
!["hardhat", "bscmainnet", "bsctestnet", "sepolia", "ethereum"].includes(network.name);
func.tags = ["deploy-redstone"];
export default func;
120 changes: 120 additions & 0 deletions deploy/5-deploy-bnb-lst-oracles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

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

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

const oracle = await ethers.getContract("ResilientOracle");
const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer;

const { ankrBNB, stkBNB, BNBx, BNBxStakeManager, slisBNBStakeManager, stkBNBStakePool, slisBNB, wBETH } =
ADDRESSES[network.name];
const ETH = assets[network.name].find(asset => asset.token === "ETH");

await deploy("BNBxOracle", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [BNBxStakeManager, BNBx, oracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});

await deploy("SlisBNBOracle", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [slisBNBStakeManager, slisBNB, oracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});

await deploy("StkBNBOracle", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [stkBNBStakePool, stkBNB, oracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});

let ankrBNBAddress = ankrBNB;
if (!ankrBNB) {
// deploy MockAnkrBNB
await deploy("MockAnkrBNB", {
from: deployer,
log: true,
autoMine: true, // speed up deployment on local network (ganache, hardhat), no effect on live networks
skipIfAlreadyDeployed: true,
args: ["Ankr Staked BNB ", "ankrBNB", "18"],
});

const ankrBNBContract = await ethers.getContract("MockAnkrBNB");
ankrBNBAddress = ankrBNBContract.address;

if ((await ankrBNBContract.owner()) === deployer) {
await ankrBNBContract.transferOwnership(proxyOwnerAddress);
}
}

await deploy("AnkrBNBOracle", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [ankrBNBAddress, oracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});

let wBETHAddress = wBETH;
if (!wBETH) {
// deploy MockWBETH
await deploy("MockWBETH", {
from: deployer,
log: true,
autoMine: true, // speed up deployment on local network (ganache, hardhat), no effect on live networks
skipIfAlreadyDeployed: true,
args: ["Wrapped Binance Beacon ETH", "wBETH", "18"],
});

const wBETHContract = await ethers.getContract("MockWBETH");
wBETHAddress = wBETHContract.address;

if ((await wBETHContract.owner()) === deployer) {
await wBETHContract.transferOwnership(proxyOwnerAddress);
}
}

await deploy("WBETHOracle", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [wBETHAddress, ETH?.address, oracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});
};

export default func;
func.tags = ["bnb_lst"];
func.skip = async (hre: HardhatRuntimeEnvironment) =>
hre.network.name !== "bscmainnet" && hre.network.name !== "bsctestnet";
86 changes: 0 additions & 86 deletions deploy/5-deploy-lst.ts

This file was deleted.

5 changes: 5 additions & 0 deletions deployments/arbitrumone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "arbitrumone",
"chainId": "42161",
"contracts": {}
}
5 changes: 5 additions & 0 deletions deployments/arbitrumone_addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "arbitrumone",
"chainId": "42161",
"addresses": {}
}
Loading

0 comments on commit f9c003b

Please sign in to comment.