Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit 07e6322

Browse files
committed
Merge branch 'development' into feat/adrastia-prudentia-caps
2 parents 7a5ab5a + 2aed06e commit 07e6322

File tree

20 files changed

+1933
-740
lines changed

20 files changed

+1933
-740
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { addTransaction, prepareAndLogTransaction } from "../logging";
2+
import {
3+
AerodromeDeployFnParams,
4+
ChainlinkAsset,
5+
ChainlinkDeployFnParams,
6+
ChainlinkFeedBaseCurrency
7+
} from "../../../chains/types";
8+
9+
import { addUnderlyingsToMpo } from "./utils";
10+
import { Address, encodeFunctionData } from "viem";
11+
import { underlying } from "../utils";
12+
import { DeployResult } from "hardhat-deploy/types";
13+
14+
export const deployAerodromeOracle = async ({
15+
viem,
16+
getNamedAccounts,
17+
deployments,
18+
pricesContract,
19+
assets
20+
}: AerodromeDeployFnParams): Promise<{ apo: DeployResult }> => {
21+
const { deployer } = await getNamedAccounts();
22+
const publicClient = await viem.getPublicClient();
23+
const walletClient = await viem.getWalletClient(deployer as Address);
24+
let tx;
25+
26+
//// Aerodrome Oracle
27+
const apo = await deployments.deploy("AerodromePriceOracle", {
28+
from: deployer,
29+
args: [pricesContract],
30+
log: true,
31+
waitConfirmations: 1
32+
});
33+
if (apo.transactionHash) await publicClient.waitForTransactionReceipt({ hash: apo.transactionHash as Address });
34+
console.log("ChainlinkPriceOracleV2: ", apo.address);
35+
36+
const aerodrome = await viem.getContractAt(
37+
"AerodromePriceOracle",
38+
(await deployments.get("AerodromePriceOracle")).address as Address
39+
);
40+
41+
const underlyings = assets.map((c) => underlying(assets, c.symbol));
42+
43+
const mpo = await viem.getContractAt(
44+
"MasterPriceOracle",
45+
(await deployments.get("MasterPriceOracle")).address as Address
46+
);
47+
await addUnderlyingsToMpo(mpo as any, underlyings, aerodrome.address, deployer, publicClient, walletClient);
48+
49+
const addressesProvider = await viem.getContractAt(
50+
"AddressesProvider",
51+
(await deployments.get("AddressesProvider")).address as Address
52+
);
53+
const aerodromeAddress = await addressesProvider.read.getAddress(["AerodromePriceOracle"]);
54+
if (aerodromeAddress !== aerodrome.address) {
55+
if (((await addressesProvider.read.owner()) as Address).toLowerCase() === deployer.toLowerCase()) {
56+
tx = await addressesProvider.write.setAddress(["AerodromePriceOracle", aerodrome.address]);
57+
await publicClient.waitForTransactionReceipt({ hash: tx });
58+
console.log(`setAddress AerodromePriceOracle at ${tx}`);
59+
} else {
60+
prepareAndLogTransaction({
61+
contractInstance: addressesProvider,
62+
functionName: "setAddress",
63+
args: ["AerodromePriceOracle", aerodrome.address],
64+
description: "Set AerodromePriceOracle address on AddressProvider",
65+
inputs: [
66+
{ internalType: "string", name: "id", type: "string" },
67+
{ internalType: "address", name: "newAddress", type: "address" }
68+
]
69+
});
70+
console.log("Logged Transaction to setAddress ChainlinkPriceOracleV2 on AddressProvider");
71+
}
72+
}
73+
74+
return { apo };
75+
};

chainDeploy/mainnets/base.ts

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,65 @@
1-
// import { ChainDeployConfig, deployChainlinkOracle } from "../helpers";
2-
// import { ChainlinkAsset } from "../../chains/types";
1+
import { ChainDeployConfig } from "../helpers";
2+
import { OracleTypes, SupportedAsset } from "../../chains/types";
3+
import { base } from "../../chains";
4+
import { deployAerodromeOracle } from "../helpers/oracles/aerodrome";
5+
import { HardhatRuntimeEnvironment } from "hardhat/types";
36

4-
// const assets = base.assets;
7+
const assets = base.assets;
58

6-
// export const deployConfig: ChainDeployConfig = {
7-
// blocksPerYear: Number(base.specificParams.blocksPerYear),
8-
// cgId: base.specificParams.cgId,
9-
// nativeTokenName: "Base",
10-
// nativeTokenSymbol: "ETH",
11-
// stableToken: base.chainAddresses.STABLE_TOKEN,
12-
// uniswap: {
13-
// flashSwapFee: 30, // TODO set the correct fee
14-
// hardcoded: [],
15-
// uniswapData: [],
16-
// uniswapOracleInitialDeployTokens: [],
17-
// uniswapV2FactoryAddress: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",
18-
// uniswapV2RouterAddress: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
19-
// uniswapV3SwapRouter: "0x2626664c2603336E57B271c5C0b26F421741e481",
20-
// uniswapV3Quoter: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a"
21-
// },
22-
// wtoken: base.chainAddresses.W_TOKEN,
23-
// nativeTokenUsdChainlinkFeed: base.chainAddresses.W_TOKEN_USD_CHAINLINK_PRICE_FEED
24-
// };
9+
const pricesContract = "0xee717411f6E44F9feE011835C8E6FAaC5dEfF166";
2510

26-
// const chainlinkAssets: ChainlinkAsset[] = base.assets
27-
// .filter((asset) => asset.oracle === OracleTypes.ChainlinkPriceOracleV2)
28-
// .map((asset) => ({
29-
// aggregator: (asset.oracleSpecificParams as ChainlinkSpecificParams).aggregator,
30-
// feedBaseCurrency: (asset.oracleSpecificParams as ChainlinkSpecificParams).feedBaseCurrency,
31-
// symbol: asset.symbol
32-
// }));
11+
export const deployConfig: ChainDeployConfig = {
12+
blocksPerYear: Number(base.specificParams.blocksPerYear),
13+
cgId: base.specificParams.cgId,
14+
nativeTokenName: "Base",
15+
nativeTokenSymbol: "ETH",
16+
stableToken: base.chainAddresses.STABLE_TOKEN,
17+
uniswap: {
18+
flashSwapFee: 30, // TODO set the correct fee
19+
hardcoded: [],
20+
uniswapData: [],
21+
uniswapOracleInitialDeployTokens: [],
22+
uniswapV2FactoryAddress: "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",
23+
uniswapV2RouterAddress: "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",
24+
uniswapV3SwapRouter: "0x2626664c2603336E57B271c5C0b26F421741e481",
25+
uniswapV3Quoter: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a"
26+
},
27+
wtoken: base.chainAddresses.W_TOKEN,
28+
nativeTokenUsdChainlinkFeed: base.chainAddresses.W_TOKEN_USD_CHAINLINK_PRICE_FEED
29+
};
3330

34-
// export const deploy = async ({ run, ethers, getNamedAccounts, deployments }): Promise<void> => {
35-
// const { deployer } = await getNamedAccounts();
31+
const aerodromeAssets: SupportedAsset[] = base.assets.filter(
32+
(asset) => asset.oracle === OracleTypes.AerodromePriceOracle
33+
);
3634

37-
// //// ChainLinkV2 Oracle
38-
// await deployChainlinkOracle({
39-
// run,
40-
// ethers,
41-
// getNamedAccounts,
42-
// deployments,
43-
// deployConfig,
44-
// assets,
45-
// chainlinkAssets
46-
// });
35+
export const deploy = async ({ run, viem, getNamedAccounts, deployments }: HardhatRuntimeEnvironment): Promise<void> => {
36+
const { deployer } = await getNamedAccounts();
4737

48-
// //// Uniswap V3 Liquidator Funder
49-
// const uniswapV3LiquidatorFunder = await deployments.deploy("UniswapV3LiquidatorFunder", {
50-
// from: deployer,
51-
// args: [],
52-
// log: true,
53-
// waitConfirmations: 1
54-
// });
55-
// console.log("UniswapV3LiquidatorFunder: ", uniswapV3LiquidatorFunder.address);
38+
//// ChainLinkV2 Oracle
39+
await deployAerodromeOracle({
40+
run,
41+
viem,
42+
getNamedAccounts,
43+
deployments,
44+
deployConfig,
45+
assets: aerodromeAssets,
46+
pricesContract
47+
});
5648

57-
// const solidlySwapLiquidator = await deployments.deploy("SolidlySwapLiquidator", {
58-
// from: deployer,
59-
// args: [],
60-
// log: true,
61-
// waitConfirmations: 1
62-
// });
63-
// console.log("solidlySwapLiquidator: ", solidlySwapLiquidator.address);
64-
// };
49+
//// Uniswap V3 Liquidator Funder
50+
const uniswapV3LiquidatorFunder = await deployments.deploy("UniswapV3LiquidatorFunder", {
51+
from: deployer,
52+
args: [],
53+
log: true,
54+
waitConfirmations: 1
55+
});
56+
console.log("UniswapV3LiquidatorFunder: ", uniswapV3LiquidatorFunder.address);
57+
58+
const solidlySwapLiquidator = await deployments.deploy("SolidlySwapLiquidator", {
59+
from: deployer,
60+
args: [],
61+
log: true,
62+
waitConfirmations: 1
63+
});
64+
console.log("solidlySwapLiquidator: ", solidlySwapLiquidator.address);
65+
};

chainDeploy/mainnets/mode.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Hash, zeroAddress } from "viem";
22

33
import { ChainDeployConfig, deployChainlinkOracle, deployPythPriceOracle } from "../helpers";
4-
import { writeTransactionsToFile } from "../helpers/logging";
54
import { addRedstoneFallbacks } from "../helpers/oracles/redstoneFallbacks";
65
import { addRedstoneWeETHFallbacks } from "../helpers/oracles/redstoneWeETHFallbacks";
76
import { deployRedStoneWrsETHPriceOracle } from "../helpers/oracles/redstoneWrsETH";
@@ -145,5 +144,4 @@ export const deploy = async ({
145144
await publicClient.waitForTransactionReceipt({ hash: algebraSwapLiquidator.transactionHash as Hash });
146145
}
147146
console.log("AlgebraSwapLiquidator: ", algebraSwapLiquidator.address);
148-
await writeTransactionsToFile();
149147
};

chains/assets.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ export enum assetSymbols {
1616
OP = "OP",
1717
LUSD = "LUSD",
1818
SOV = "SOV",
19-
tBTC = "tBTC"
19+
tBTC = "tBTC",
20+
ION = "ION"
2021
}

chains/base/assets.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const WBTC = "0x1ceA84203673764244E05693e42E6Ace62bE9BA5";
1313
export const weETH = "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A";
1414
export const eUSD = "0xcfa3ef56d303ae4faaba0592388f19d7c3399fb4";
1515
export const bsdETH = "0xcb327b99ff831bf8223cced12b1338ff3aa322ff";
16+
export const ION = "0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5";
1617

1718
export const assets: SupportedAsset[] = [
1819
{
@@ -109,7 +110,7 @@ export const assets: SupportedAsset[] = [
109110
aggregator: "0xFC1415403EbB0c693f9a7844b92aD2Ff24775C65",
110111
feedBaseCurrency: ChainlinkFeedBaseCurrency.ETH
111112
},
112-
initialCf: "70"
113+
initialCf: "0.70"
113114
},
114115
{
115116
symbol: assetSymbols.eUSD,
@@ -123,7 +124,7 @@ export const assets: SupportedAsset[] = [
123124
} as ChainlinkSpecificParams,
124125
initialSupplyCap: parseEther(String(10_000_000)).toString(),
125126
initialBorrowCap: parseEther(String(8_000_000)).toString(),
126-
initialCf: "80"
127+
initialCf: "0.80"
127128
},
128129
{
129130
symbol: assetSymbols.bsdETH,
@@ -137,7 +138,14 @@ export const assets: SupportedAsset[] = [
137138
},
138139
initialSupplyCap: parseEther(String(6_500)).toString(),
139140
initialBorrowCap: parseEther(String(5_200)).toString(),
140-
initialCf: "70"
141+
initialCf: "0.70"
142+
},
143+
{
144+
symbol: assetSymbols.ION,
145+
underlying: ION,
146+
name: "Ionic",
147+
decimals: 18,
148+
oracle: OracleTypes.AerodromePriceOracle
141149
}
142150
];
143151

chains/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { default as mode } from "./mode";
2+
import { default as base } from "./base";
23
import { ChainConfig } from "./types";
34

4-
export { mode };
5+
export { mode, base };
56

67
export const chainIdToConfig: { [chainId: number]: ChainConfig } = {
7-
[mode.chainId]: mode
8+
[mode.chainId]: mode,
9+
[base.chainId]: base
810
};

chains/mode/assets.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const mBTC = "0x59889b7021243dB5B1e065385F918316cD90D46c";
1717
export const MODE = "0xDfc7C877a950e49D2610114102175A06C2e3167a";
1818
// export const ION = "0x18470019bf0e94611f15852f7e93cf5d65bc34ca";
1919
export const KIM = "0x6863fb62Ed27A9DdF458105B507C15b5d741d62e";
20+
export const STONE = "0x80137510979822322193fc997d400d5a6c747bf7";
2021

2122
export const assets: SupportedAsset[] = [
2223
{
@@ -52,21 +53,32 @@ export const assets: SupportedAsset[] = [
5253
underlying: ezETH,
5354
name: "Renzo Restaked ETH",
5455
decimals: 18,
55-
oracle: OracleTypes.RedstoneAdapterPriceOracle
56+
oracle: OracleTypes.RedstoneAdapterPriceOracle,
57+
initialCf: "0.8"
5658
},
5759
{
5860
symbol: "weETH",
5961
underlying: weETH,
6062
name: "Wrapped eETH",
6163
decimals: 18,
62-
oracle: OracleTypes.RedstoneAdapterPriceOracle
64+
oracle: OracleTypes.RedstoneAdapterPriceOracle,
65+
initialCf: "0.8"
66+
},
67+
{
68+
symbol: "STONE",
69+
underlying: STONE,
70+
name: "StakeStone Ether",
71+
decimals: 18,
72+
oracle: OracleTypes.RedstoneAdapterPriceOracle,
73+
initialCf: "0.775"
6374
},
6475
{
6576
symbol: "wrsETH",
6677
underlying: wrsETH,
6778
name: "rsETHWrapper",
6879
decimals: 18,
69-
oracle: OracleTypes.RedstoneAdapterWrsETHPriceOracle
80+
oracle: OracleTypes.RedstoneAdapterWrsETHPriceOracle,
81+
initialCf: "0.775"
7082
},
7183
{
7284
symbol: "MODE",

chains/types.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ export type ChainlinkDeployFnParams = ChainDeployFnParams & {
169169
deployConfig: ChainDeployConfig;
170170
};
171171

172+
export type AerodromeDeployFnParams = ChainDeployFnParams & {
173+
assets: SupportedAsset[];
174+
pricesContract: Address;
175+
deployConfig: ChainDeployConfig;
176+
};
177+
172178
export type DiaDeployFnParams = ChainDeployFnParams & {
173179
diaAssets: DiaAsset[];
174180
deployConfig: ChainDeployConfig;
@@ -282,6 +288,10 @@ export type PythSpecificParams = {
282288
feed: string;
283289
};
284290

291+
export type VelodromeSpecificParams = {
292+
pricesContract: Address;
293+
};
294+
285295
export type SupportedAsset = {
286296
symbol: string;
287297
underlying: Address;
@@ -292,7 +302,7 @@ export type SupportedAsset = {
292302
oracle?: OracleTypes;
293303
simplePriceOracleAssetPrice?: bigint;
294304
originalSymbol?: string;
295-
oracleSpecificParams?: ChainlinkSpecificParams | PythSpecificParams;
305+
oracleSpecificParams?: ChainlinkSpecificParams | PythSpecificParams | VelodromeSpecificParams;
296306
initialCf?: string;
297307
initialBorrowCap?: string;
298308
initialSupplyCap?: string;
@@ -310,7 +320,9 @@ export enum OracleTypes {
310320
ERC4626Oracle = "ERC4626Oracle",
311321
PythPriceOracle = "PythPriceOracle",
312322
RedstoneAdapterPriceOracle = "RedstoneAdapterPriceOracle",
313-
RedstoneAdapterWrsETHPriceOracle = "RedstoneAdapterWrsETHPriceOracle"
323+
RedstoneAdapterWrsETHPriceOracle = "RedstoneAdapterWrsETHPriceOracle",
324+
VelodromePriceOracle = "VelodromePriceOracle",
325+
AerodromePriceOracle = "AerodromePriceOracle"
314326
}
315327

316328
export type ChainAddresses = {

0 commit comments

Comments
 (0)