Skip to content

Commit

Permalink
setup
Browse files Browse the repository at this point in the history
  • Loading branch information
foodaka committed Oct 2, 2023
1 parent c76e314 commit 0462ed8
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 4 deletions.
7 changes: 6 additions & 1 deletion deploy/03_periphery_post/04_paraswap_adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,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 Expand Up @@ -54,6 +53,12 @@ const func: DeployFunction = async function ({
args: [addressesProvider, paraswapAugustusRegistry, poolAdmin],
});

await deploy("ParaSwapWithdrawSwapAdapter", {
from: deployer,
...COMMON_DEPLOY_PARAMS,
args: [addressesProvider, paraswapAugustusRegistry, poolAdmin],
});

return true;
};

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

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 @@ -191,6 +197,7 @@ export default {
"@aave/periphery-v3/contracts/treasury/AaveEcosystemReserveController.sol",
"@aave/periphery-v3/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol",
"@aave/periphery-v3/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol",
"@aave/periphery-v3/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol",
"@aave/safety-module/contracts/stake/StakedAave.sol",
"@aave/safety-module/contracts/stake/StakedAaveV2.sol",
"@aave/safety-module/contracts/proposals/extend-stkaave-distribution/StakedTokenV2Rev3.sol",
Expand Down
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",
};

export const EMERGENCY_ADMIN: Record<string, string> = {
Expand Down
10 changes: 10 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,12 +108,15 @@ 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,
};

console.log("FORK", FORK);
export const buildForkConfig = ():
| HardhatNetworkForkingUserConfig
| undefined => {
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
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",
},
FlashLoanPremiums: {
total: 0.0005e4,
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
72 changes: 72 additions & 0 deletions markets/base/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { eBaseNetwork, IAaveConfiguration } from "./../../helpers/types";
import AaveMarket from "../aave";
import { ZERO_ADDRESS } from "../../helpers";
import {
strategyDAI,
strategyUSDC,
strategyLINK,
strategyWBTC,
strategyWETH,
strategyUSDT,
strategyAAVE,
strategyEURS,
strategyCBETH,
} from "../aave/reservesConfigs";

export const BaseConfig: IAaveConfiguration = {
...AaveMarket,
MarketId: "Base Aave Market",
ATokenNamePrefix: "Base",
StableDebtTokenNamePrefix: "Base",
VariableDebtTokenNamePrefix: "Base",
SymbolPrefix: "Base",
ProviderId: 37,
ReservesConfig: {
DAI: strategyDAI,
LINK: strategyLINK,
USDC: strategyUSDC,
WBTC: strategyWBTC,
WETH: strategyWETH,
USDT: strategyUSDT,
AAVE: strategyAAVE,
EURS: strategyEURS,
CBETH: strategyCBETH,
},
ReserveAssets: {
[eBaseNetwork.base]: {
USDC: "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca", // usdbc
WETH: "0x4200000000000000000000000000000000000006",
CBETH: "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22",
},
[eBaseNetwork.baseGoerli]: {
DAI: ZERO_ADDRESS,
LINK: ZERO_ADDRESS,
USDC: ZERO_ADDRESS,
WBTC: ZERO_ADDRESS,
WETH: ZERO_ADDRESS,
USDT: ZERO_ADDRESS,
AAVE: ZERO_ADDRESS,
EURS: ZERO_ADDRESS,
CBETH: ZERO_ADDRESS,
},
},
EModes: {
StableEMode: {
id: "1",
ltv: "9700",
liquidationThreshold: "9750",
liquidationBonus: "10100",
label: "Stablecoins",
assets: ["USDC"],
},
},
ChainlinkAggregator: {
[eBaseNetwork.base]: {
USDC: "0x7e860098f58bbfc8648a4311b374b1d669a2bc6b",
WETH: "0x71041dddad3595f9ced3dccfbe3d1f4b0a16bb70",
CBETH: "0xd7818272b9e248357d13057aab0b417af31e817d",
},
},
};

export default BaseConfig;
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
"devDependencies": {
"@aave/aave-token": "^1.0.4",
"@aave/core-v3": "^1.19.0",
"@aave/periphery-v3": "^2.4.1",
"@aave/periphery-v3": "^2.5.0",
"@aave/safety-module": "^1.0.3",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^2.0.0",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@openzeppelin/contracts": "^4.3.2",
"@typechain/ethers-v5": "^10.1.0",
"@typechain/hardhat": "^6.1.2",
"@types/bluebird": "^3.5.36",
"@types/chai": "^4.2.21",
"@types/mkdirp": "^1.0.2",
Expand All @@ -39,7 +42,7 @@
"chalk": "^4.1.2",
"dotenv": "^10.0.0",
"ethers": "^5.4.7",
"hardhat": "^2.12.4",
"hardhat": "^2.17.4",
"hardhat-contract-sizer": "^2.0.3",
"hardhat-dependency-compiler": "^1.1.2",
"hardhat-deploy": "^0.10.6",
Expand All @@ -49,6 +52,7 @@
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.3.0",
"typechain": "^8.1.0",
"typescript": "^4.3.2"
},
"license": "AGPLv3",
Expand Down Expand Up @@ -81,6 +85,7 @@
"url": "git://github.com/aave/aave-v3-deploy"
},
"dependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.0",
"defender-relay-client": "^1.11.1"
}
}
Loading

0 comments on commit 0462ed8

Please sign in to comment.