Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VEN-2968]: oracles for Ethena pool #243

Merged
merged 14 commits into from
Dec 27, 2024
35 changes: 18 additions & 17 deletions deploy/7-deploy-pendle-oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

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

type OracleConfig = {
name: string;
market: string;
token: string;
collateral: string;
customOracle: string;
ptToken: string;
underlyingToken: string;
ptOracle: string;
}[];

const deployPendleOracle = async (
Expand Down Expand Up @@ -57,13 +58,13 @@ const func: DeployFunction = async ({
const fallbackAddress = "0x0000000000000000000000000000000000000001";

const deployOracles = async (oracleConfig: OracleConfig) => {
for (const { name, market, token, collateral, customOracle } of oracleConfig) {
const ptOracleAddress = customOracle || (await ethers.getContract("MockPendlePtOracle")).address;
for (const { name, market, ptToken, underlyingToken, ptOracle } of oracleConfig) {
const ptOracleAddress = ptOracle || (await ethers.getContract("MockPendlePtOracle")).address;
await deployPendleOracle(
deployments,
deployer,
name,
[market || fallbackAddress, ptOracleAddress, token, collateral, oracle.address, 1800],
[market || fallbackAddress, ptOracleAddress, ptToken, underlyingToken, oracle.address, PENDLE_TWAP_DURATION],
proxyOwnerAddress,
defaultProxyAdmin,
);
Expand All @@ -74,29 +75,29 @@ const func: DeployFunction = async ({
{
name: "PendleOracle-PT-weETH-26DEC2024",
market: addresses.PTweETH_26DEC2024_Market,
token: addresses.PTweETH_26DEC2024,
collateral: addresses.WETH,
customOracle: addresses.PTOracle || (await ethers.getContract("MockPendleOracle")).address,
ptToken: addresses.PTweETH_26DEC2024,
underlyingToken: addresses.WETH,
ptOracle: addresses.newPTOracle || (await ethers.getContract("MockPendleOracle")).address,
},
{
name: "PendleOracle_PT_USDe_27MAR2025",
market: addresses.PTUSDe_27MAR2025_Market,
token: addresses.PTUSDe_27MAR2025,
collateral: addresses.USDe,
customOracle:
ptToken: addresses.PTUSDe_27MAR2025,
underlyingToken: addresses.USDe,
ptOracle:
network.name === "sepolia"
? (await ethers.getContract("MockPendleOracle_PT_USDe_27MAR2025")).address
: addresses.PTOracle,
: addresses.newPTOracle,
},
{
name: "PendleOracle_PT_sUSDe_27MAR2025",
market: addresses.PTsUSDe_27MAR2025_Market,
token: addresses.PTsUSDe_27MAR2025,
collateral: addresses.USDe,
customOracle:
ptToken: addresses.PTsUSDe_27MAR2025,
underlyingToken: addresses.USDe,
ptOracle:
network.name === "sepolia"
? (await ethers.getContract("MockPendleOracle_PT_sUSDe_27MAR2025")).address
: addresses.PTOracle,
: addresses.newPTOracle,
},
];

Expand Down
3 changes: 2 additions & 1 deletion helpers/deploymentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const DEFAULT_STALE_PERIOD = 24 * 60 * 60; // 24 hrs
const STALE_PERIOD_100M = 60 * 100; // 100 minutes (for pricefeeds with heartbeat of 1 hr)
const STALE_PERIOD_26H = 60 * 60 * 26; // 26 hours (pricefeeds with heartbeat of 24 hr)
export const ANY_CONTRACT = ethers.constants.AddressZero;
export const PENDLE_TWAP_DURATION = 1800;

export const ADDRESSES: PreconfiguredAddresses = {
bsctestnet: {
Expand Down Expand Up @@ -164,7 +165,7 @@ export const ADDRESSES: PreconfiguredAddresses = {
eBTC_Accountant: "0x1b293DC39F94157fA0D1D36d7e0090C8B8B8c13F",
pufETH: "0xD9A442856C234a39a81a089C06451EBAa4306a72",
LBTC: "0x8236a87084f8B84306f72007F36F2618A5634494",
PTOracleEthena: "0x9a9fa8338dd5e5b2188006f1cd2ef26d921650c2",
newPTOracle: "0x9a9fa8338dd5e5b2188006f1cd2ef26d921650c2",
PTUSDe_27MAR2025_Market: "0xB451A36c8B6b2EAc77AD0737BA732818143A0E25",
PTUSDe_27MAR2025: "0x8a47b431a7d947c6a3ed6e42d501803615a97eaa",
USDe: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
Expand Down
Loading