Skip to content

Commit

Permalink
feat: deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm committed Oct 30, 2023
1 parent bd4610f commit d4a548f
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 104 deletions.
103 changes: 0 additions & 103 deletions contracts/integration/GrumpyCat/GrumpyCatXERC20Adapter.sol

This file was deleted.

45 changes: 45 additions & 0 deletions deploy/GrumpyCat/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { config as envConfig } from "dotenv";
import { DEFAULT_ARGS, GRUMPYCAT_CONFIG, MIDAS_CONFIG } from "../index";

envConfig();

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Get the chain id
const chainId = +(await hre.getChainId());
console.log("chainId", chainId);

if (!GRUMPYCAT_CONFIG[chainId]) {
throw new Error(`No defaults provided for ${chainId}`);
}

// Get the constructor args
const args = [
DEFAULT_ARGS[chainId].CONNEXT,
GRUMPYCAT_CONFIG[chainId].LOCKBOX,
GRUMPYCAT_CONFIG[chainId].ERC20,
GRUMPYCAT_CONFIG[chainId].XERC20,
];

// Get the deployer
const [deployer] = await hre.ethers.getSigners();
if (!deployer) {
throw new Error(`Cannot find signer to deploy with`);
}
console.log("\n============================= Deploying MidasProtocolTarget ===============================");
console.log("deployer: ", deployer.address);
console.log("constructorArgs:", args);

// Deploy contract
const adapter = await hre.deployments.deploy("GrumpyCatLockboxAdapter", {
from: deployer.address,
args: args,
skipIfAlreadyDeployed: true,
log: true,
// deterministicDeployment: true,
});
console.log(`GrumpyCatLockboxAdapter deployed to ${adapter.address}`);
};
export default func;
func.tags = ["grumpycat", "test", "prod"];
17 changes: 17 additions & 0 deletions deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ export const DEFAULT_ARGS: Record<number, any> = {
ONEINCH_ROUTER: "",
UNIV3_ROUTER: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
},
// Ethereum
1: {
CONNEXT: "0x8898B472C54c31894e3B9bb83cEA802a5d0e63C6",
WETH: "",
USDC: "",
DOMAIN: "",
ONEINCH_ROUTER: "",
UNIV3_ROUTER: "",
},
// Optimism
10: {
CONNEXT: "0x8f7492DE823025b4CfaAB1D34c58963F2af5DEDA",
Expand Down Expand Up @@ -53,6 +62,14 @@ export const DEFAULT_ARGS: Record<number, any> = {
},
};

export const GRUMPYCAT_CONFIG: Record<number, any> = {
1: {
LOCKBOX: "0x713F8CE92B4369f2206AFEE90bD13464Bbfb28bE",
XERC20: "0x3B350F202473932411772C8Cb76DB7975f42397E",
ERC20: "0xd8E2D95C8614F28169757cD6445a71c291dEc5bF",
},
};

export const MIDAS_CONFIG: Record<number, any> = {
137: {
COMPTROLLER: "0xDb984f8cbc1cF893a18c2DA50282a1492234602c",
Expand Down
1 change: 1 addition & 0 deletions deployments/mainnet/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
238 changes: 238 additions & 0 deletions deployments/mainnet/GrumpyCatLockboxAdapter.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getNetworkUrl(networkType: string) {
else if (networkType === "fantom") return `https://rpc.ftm.tools/`;
else if (networkType === "bnb") return `https://bsc-dataseed.binance.org`;
else if (networkType === "xdai") return `https://rpc.ankr.com/gnosis`;
else return alchemyApiKey ? `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}` : "https://cloudflare-eth.com";
else return alchemyApiKey ? `https://eth-mainnet.alchemyapi.io/v2/${alchemyApiKey}` : "https://eth.llamarpc.com";
}

const config: HardhatUserConfig = {
Expand Down

0 comments on commit d4a548f

Please sign in to comment.