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

base network paraswap adapters #51

Merged
merged 11 commits into from
Feb 27, 2024
1 change: 0 additions & 1 deletion deploy/03_periphery_post/04_paraswap_adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const func: DeployFunction = async function ({
}: HardhatRuntimeEnvironment) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const network = (
process.env.FORK ? process.env.FORK : hre.network.name
) as eNetwork;
Expand Down
18 changes: 17 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
eHarmonyNetwork,
eOptimismNetwork,
ePolygonNetwork,
eTenderly,
eBaseNetwork,
} from "./helpers/types";
import { DEFAULT_NAMED_ACCOUNTS } from "./helpers/constants";

Expand All @@ -23,6 +23,7 @@ import "hardhat-deploy";
import "hardhat-contract-sizer";
import "hardhat-dependency-compiler";
import "@nomicfoundation/hardhat-chai-matchers";
import "@nomiclabs/hardhat-etherscan";

const SKIP_LOAD = process.env.SKIP_LOAD === "true";
const TASK_FOLDERS = ["misc", "market-registry"];
Expand Down Expand Up @@ -121,6 +122,11 @@ export default {
eArbitrumNetwork.goerliNitro,
421613
),
[eBaseNetwork.base]: getCommonNetworkConfig(eBaseNetwork.base, 8453),
[eBaseNetwork.baseGoerli]: getCommonNetworkConfig(
eBaseNetwork.baseGoerli,
84531
),
},
namedAccounts: {
...DEFAULT_NAMED_ACCOUNTS,
Expand Down Expand Up @@ -202,5 +208,15 @@ export default {
: undefined,
etherscan: {
apiKey: ETHERSCAN_KEY,
customChains: [
{
network: eBaseNetwork.base,
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org/",
},
},
],
},
};
4 changes: 4 additions & 0 deletions helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { parseEther, parseUnits } from "ethers/lib/utils";
import {
eArbitrumNetwork,
eAvalancheNetwork,
eBaseNetwork,
eEthereumNetwork,
eFantomNetwork,
eHarmonyNetwork,
Expand Down Expand Up @@ -75,6 +76,7 @@ export const MOCK_CHAINLINK_AGGREGATORS_PRICES: { [key: string]: string } = {
AGEUR: parseUnits("1.126", 8).toString(),
JEUR: parseUnits("1.126", 8).toString(),
DPI: parseUnits("149", 8).toString(),
CBETH: parseUnits("4000", 8).toString(),
};

export const chainlinkAggregatorProxy: Record<string, string> = {
Expand Down Expand Up @@ -137,6 +139,8 @@ export const POOL_ADMIN: Record<string, string> = {
[eOptimismNetwork.main]: "0xE50c8C619d05ff98b22Adf991F17602C774F785c",
[ePolygonNetwork.polygon]: "0xdc9A35B16DB4e126cFeDC41322b3a36454B1F772",
[eEthereumNetwork.main]: ETHEREUM_SHORT_EXECUTOR,
[eBaseNetwork.base]: "0xA9F30e6ED4098e9439B2ac8aEA2d3fc26BcEbb45",
[eBaseNetwork.baseGoerli]: "0xA9F30e6ED4098e9439B2ac8aEA2d3fc26BcEbb45",
[eEthereumNetwork.tenderly]: ETHEREUM_SHORT_EXECUTOR,
};

Expand Down
9 changes: 9 additions & 0 deletions helpers/hardhat-config-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
eAvalancheNetwork,
eFantomNetwork,
eOptimismNetwork,
eBaseNetwork,
} from "./types";

require("dotenv").config();
Expand Down Expand Up @@ -47,6 +48,8 @@ export const getAlchemyKey = (net: eNetwork) => {
return process.env.GOERLI_ALCHEMY_KEY || ALCHEMY_KEY;
case eEthereumNetwork.sepolia:
return process.env.SEPOLIA_ALCHEMY_KEY || ALCHEMY_KEY;
case eBaseNetwork.base:
return process.env.BASE_ALCHEMY_KEY || ALCHEMY_KEY;
default:
return ALCHEMY_KEY;
}
Expand Down Expand Up @@ -91,6 +94,10 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
eEthereumNetwork.sepolia
)}`,
[eArbitrumNetwork.goerliNitro]: `https://goerli-rollup.arbitrum.io/rpc`,
[eBaseNetwork.baseGoerli]: `https://goerli.base.org`,
[eBaseNetwork.base]: `https://base-mainnet.g.alchemy.com/v2/${getAlchemyKey(
eBaseNetwork.base
)}`,
};

export const LIVE_NETWORKS: iParamsPerNetwork<boolean> = {
Expand All @@ -101,10 +108,12 @@ export const LIVE_NETWORKS: iParamsPerNetwork<boolean> = {
[eAvalancheNetwork.avalanche]: true,
[eFantomNetwork.main]: true,
[eOptimismNetwork.main]: true,
[eBaseNetwork.base]: true,
};

const GAS_PRICE_PER_NET: iParamsPerNetwork<string | number> = {
[eArbitrumNetwork.goerliNitro]: 100000001,
[eBaseNetwork.baseGoerli]: 8000000000,
};

export const buildForkConfig = ():
Expand Down
2 changes: 1 addition & 1 deletion helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export * from "./utilities/signer";
export * from "../markets/aave/commons";
export * from "../markets/aave/rateStrategies";
export * from "../markets/aave/reservesConfigs";
export * from "../tasks/market-registry/market-registry:add";
export * from "../tasks/market-registry/market-registry-add";
export * from "../tasks/misc/deploy-ui-helpers";
export * from "../tasks/misc/deploy-UiIncentiveDataProvider";
export * from "../tasks/misc/deploy-UiPoolDataProvider";
Expand Down
5 changes: 5 additions & 0 deletions helpers/market-config-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import FantomMarket from "../markets/fantom";
import PolygonMarket from "../markets/polygon";
import OptimisticConfig from "../markets/optimistic";
import ArbitrumConfig from "../markets/arbitrum";
import BaseConfig from "../markets/base";
import { isValidAddress } from "./utilities/utils";
import { AaveProtocolDataProvider } from "../typechain";
import {
Expand Down Expand Up @@ -49,6 +50,8 @@ export enum ConfigNames {
Optimistic = "Optimistic",
Arbitrum = "Arbitrum",
Ethereum = "Ethereum",
Base = "Base",
baseGoerli = "base-goerli",
}

export const getParamPerNetwork = <T>(
Expand Down Expand Up @@ -114,6 +117,8 @@ export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
return ArbitrumConfig;
case ConfigNames.Ethereum:
return EthereumV3Config;
case ConfigNames.Base:
return BaseConfig;
default:
throw new Error(
`Unsupported pool configuration: ${configName} is not one of the supported configs ${Object.values(
Expand Down
8 changes: 7 additions & 1 deletion helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export type eNetwork =
| eHarmonyNetwork
| eFantomNetwork
| eOptimismNetwork
| eTenderlyNetwork;
| eTenderlyNetwork
| eBaseNetwork;

type eTenderlyNetwork = "tenderly";

Expand All @@ -44,6 +45,11 @@ export enum eEthereumNetwork {
sepolia = "sepolia",
}

export enum eBaseNetwork {
base = "base",
baseGoerli = "base-goerli",
}

export enum ePolygonNetwork {
polygon = "polygon",
mumbai = "mumbai",
Expand Down
2 changes: 1 addition & 1 deletion helpers/utilities/defender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { formatEther } from "@ethersproject/units";
import {
DefenderRelaySigner,
DefenderRelayProvider,
} from "defender-relay-client/lib/ethers";
} from "@openzeppelin/defender-relay-client/lib/ethers";
import { Signer } from "ethers";
import { impersonateAddresses, usingTenderly } from "./fork";

Expand Down
5 changes: 5 additions & 0 deletions markets/aave/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
eOptimismNetwork,
ePolygonNetwork,
TransferStrategy,
eBaseNetwork,
} from "./../../helpers/types";
import { ZERO_ADDRESS } from "../../helpers/constants";
import {
Expand Down Expand Up @@ -158,13 +159,17 @@ export const CommonsConfig: ICommonConfiguration = {
[eArbitrumNetwork.arbitrumTestnet]: true,
[eOptimismNetwork.main]: true,
[eOptimismNetwork.testnet]: true,
[eBaseNetwork.base]: true,
[eBaseNetwork.baseGoerli]: true,
},
ParaswapRegistry: {
[eEthereumNetwork.main]: "0xa68bEA62Dc4034A689AA0F58A76681433caCa663",
[ePolygonNetwork.polygon]: "0xca35a4866747Ff7A604EF7a2A7F246bb870f3ca1",
[eAvalancheNetwork.avalanche]: "0xfD1E5821F07F1aF812bB7F3102Bfd9fFb279513a",
[eFantomNetwork.main]: "0x161383b5dAFc1cc05Ec058e5B0b0703BA175bdA6",
[eArbitrumNetwork.arbitrum]: "0xdC6E2b14260F972ad4e5a31c68294Fba7E720701",
[eBaseNetwork.base]: "0x7e31b336f9e8ba52ba3c4ac861b033ba90900bb3",
[eBaseNetwork.baseGoerli]: "0x7e31b336f9e8ba52ba3c4ac861b033ba90900bb3",
[eEthereumNetwork.tenderly]: "0xa68bEA62Dc4034A689AA0F58A76681433caCa663",
[eOptimismNetwork.main]: "0x6e7bE86000dF697facF4396efD2aE2C322165dC3",
},
Expand Down
18 changes: 18 additions & 0 deletions markets/aave/reservesConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ export const strategyWETH: IReserveParams = {
borrowableIsolation: false,
};

export const strategyCBETH: IReserveParams = {
strategy: rateStrategyVolatileOne,
baseLTVAsCollateral: "8000",
liquidationThreshold: "8250",
liquidationBonus: "10500",
liquidationProtocolFee: "1000",
borrowingEnabled: true,
stableBorrowRateEnabled: false,
flashLoanEnabled: true,
reserveDecimals: "18",
aTokenImpl: eContractid.AToken,
reserveFactor: "1000",
supplyCap: "0",
borrowCap: "0",
debtCeiling: "0",
borrowableIsolation: false,
};

export const strategyLINK: IReserveParams = {
strategy: rateStrategyVolatileOne,
baseLTVAsCollateral: "7000",
Expand Down
45 changes: 45 additions & 0 deletions markets/base/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { eBaseNetwork, IAaveConfiguration } from "./../../helpers/types";
import AaveMarket from "../aave";
import { ZERO_ADDRESS } from "../../helpers";
import {
strategyUSDC,
strategyWETH,
strategyCBETH,
} from "../aave/reservesConfigs";

export const BaseConfig: IAaveConfiguration = {
...AaveMarket,
MarketId: "Base Aave Market",
ATokenNamePrefix: "Base",
StableDebtTokenNamePrefix: "Base",
VariableDebtTokenNamePrefix: "Base",
SymbolPrefix: "Base",
ProviderId: 37,
ReservesConfig: {
USDC: strategyUSDC,
WETH: strategyWETH,
CBETH: strategyCBETH,
},
ReserveAssets: {
[eBaseNetwork.base]: {
USDC: "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca", // usdbc
WETH: "0x4200000000000000000000000000000000000006",
CBETH: "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22",
},
[eBaseNetwork.baseGoerli]: {
USDC: ZERO_ADDRESS,
WETH: ZERO_ADDRESS,
CBETH: ZERO_ADDRESS,
},
},
EModes: {},
ChainlinkAggregator: {
[eBaseNetwork.base]: {
USDC: "0x7e860098f58bbfc8648a4311b374b1d669a2bc6b",
WETH: "0x71041dddad3595f9ced3dccfbe3d1f4b0a16bb70",
CBETH: "0xd7818272b9e248357d13057aab0b417af31e817d",
},
},
};

export default BaseConfig;
Loading