Skip to content

Commit

Permalink
feat: prepare deployment of CCIP-compatible LDY token
Browse files Browse the repository at this point in the history
  • Loading branch information
LilaRest committed May 4, 2024
1 parent 269f3a5 commit 3efbca2
Show file tree
Hide file tree
Showing 22 changed files with 1,768 additions and 1,277 deletions.
Binary file added bun.lockb
Binary file not shown.
86 changes: 83 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ import { type HardhatUserConfig } from "hardhat/config";
import "hardhat-contract-sizer";
import "hardhat-deploy";
import "@nomicfoundation/hardhat-verify";
import { setupSafeDeployer } from "hardhat-safe-deployer";
import { Wallet } from "@ethersproject/wallet";
import yargs from "yargs";

// Retrieve network from command line arguments
const argv = yargs
.option("network", {
type: "string",
default: "hardhat",
})
.help(false)
.version(false).argv;

// Retrieve deployer private key from secrets.json (if available)
let deployerPrivateKey: string | undefined;
Expand All @@ -17,6 +29,52 @@ try {
etherscanApiKey = secrets.ETHERSCAN_API_KEY;
} catch (e) {}

// Retrive Arbiscan API key from secrets.json (if available)
let arbiscanApiKey: string | undefined;
try {
const secrets = require("./secrets.json");
arbiscanApiKey = secrets.ARBISCAN_API_KEY;
} catch (e) {}

// Retrive BaseScan API key from secrets.json (if available)
let basescanApiKey: string | undefined;
try {
const secrets = require("./secrets.json");
basescanApiKey = secrets.BASESCAN_API_KEY;
} catch (e) {}

const safes = {
arbitrum: {
address: "0x972c17D0adA071db4a0395505dD3Ad0a80809053",
url: "https://safe-transaction-arbitrum.safe.global",
},
ethereum: {
address: "0x30Fa557608017afB6E8e4ABe8027787C00473FF0",
url: "https://safe-transaction.ethereum.safe.global",
},
base: {
address: "0x2E816EA2A7Db3DB4C74298cae0d455f0F800E92A",
url: "https://safe-transaction.base.safe.global",
},
hardhat: {
address: "0x0",
url: "https://willfail.com",
},
};
const safeAddress = safes[argv.network as keyof typeof safes].address;
const safeUrl = safes[argv.network as keyof typeof safes].url;

setupSafeDeployer(
new Wallet(deployerPrivateKey!),
safeAddress,
safeUrl
)

console.log("SAFE INFOS")
console.log("Network:", argv.network)
console.log("Address:", safeAddress)
console.log("URL:", safeUrl)

const config: HardhatUserConfig = {
solidity: {
version: "0.8.20",
Expand All @@ -36,9 +94,7 @@ const config: HardhatUserConfig = {
deployments: "./hardhat/deployments",
},
namedAccounts: {
deployer: {
default: 0,
},
deployer: safeAddress
},
networks: {
hardhat: {
Expand All @@ -58,6 +114,30 @@ const config: HardhatUserConfig = {
},
},
},
arbitrum: {
chainId: 42161,
url: "https://arbitrum-mainnet.infura.io/v3/05368c74554249babb6f126ccf325401",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
verify: {
etherscan: {
apiKey: arbiscanApiKey,
apiUrl: "https://api.arbiscan.io/",
},
},
},
base: {
chainId: 8453,
url: "https://base-mainnet.g.alchemy.com/v2/XH9V8IOVLgFCIP-EAflB27MR0Bc5oVoO",
accounts: deployerPrivateKey ? [deployerPrivateKey] : [],
saveDeployments: true,
verify: {
etherscan: {
apiKey: basescanApiKey,
apiUrl: "https://api.basescan.org",
},
},
},
ethereumGoerli: {
chainId: 5,
url: "https://goerli.infura.io/v3/05368c74554249babb6f126ccf325401",
Expand Down
9 changes: 6 additions & 3 deletions hardhat/deploy/01-LDY.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { type DeployFunction } from "hardhat-deploy/dist/types";
import { parseUnits } from "viem";

module.exports = (async ({ getNamedAccounts, deployments }) => {
const { deployer } = await getNamedAccounts();

await deployments.deploy("LDY", {
await deployments.deploy("TSTTOKEN", {
from: deployer,
contract: "LDY",
contract: "TSTTOKEN",
log: true,
waitConfirmations: 2,
args: ["Test Token", "TSTTOKEN", 18, parseUnits(String(75_000_000), 18)],
deterministicDeployment: false,
});
}) as DeployFunction;
}) as DeployFunction;
1 change: 1 addition & 0 deletions hardhat/deployments/arbitrum/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
42161
Loading

0 comments on commit 3efbca2

Please sign in to comment.