Skip to content

Commit

Permalink
add abstract deployment configs and artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
alecananian committed Feb 1, 2025
1 parent cc745f6 commit 3ae8c0d
Show file tree
Hide file tree
Showing 11 changed files with 8,847 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AWS_PROFILE=dev
AWS_REGION=us-west-2
AWS_KMS_KEY_ID=

ARBISCAN_API_KEY=
ABSCAN_API_KEY=
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ build

# misc
.DS_Store
.env*

.idea
.vscode
92 changes: 69 additions & 23 deletions deploy/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,89 @@
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/types';
import type { HardhatRuntimeEnvironment } from "hardhat/types";
import type { DeployFunction } from "hardhat-deploy/types";

const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { getNamedAccounts, deployments } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const DEFAULT_LP_FEE = 30n; // 0.3%
const DEFAULT_PROTOCOL_FEE = 30n; // 0.3%

const protocolFee = 30n; // 0.3%
const lpFee = 30n; // 0.3%
const protocolFeeBeneficiary = "0xA65d67513328445B4A4D2F498624483c2601ddA4"; // L2 Treasury
const CHAIN_PARAMS = {
// Treasure Topaz
978658: {
lpFee: DEFAULT_LP_FEE,
protocolFee: DEFAULT_PROTOCOL_FEE,
protocolFeeBeneficiary: "0xa65d67513328445b4a4d2f498624483c2601dda4",
wethAddress: "0x095ded714d42cbd5fb2e84a0ffbfb140e38dc9e1",
},
// Treasure
61166: {
lpFee: DEFAULT_LP_FEE,
protocolFee: DEFAULT_PROTOCOL_FEE,
protocolFeeBeneficiary: "0xa65d67513328445b4a4d2f498624483c2601dda4",
wethAddress: "0x263d8f36bb8d0d9526255e205868c26690b04b88",
},
// Abstract
2741: {
lpFee: DEFAULT_LP_FEE,
protocolFee: DEFAULT_PROTOCOL_FEE,
protocolFeeBeneficiary: "0x5a25839b49eec2d4c173b42668a84f5988599929",
wethAddress: "0x3439153eb7af838ad19d56e1571fbd09333c2809",
},
} as const;

const uniswapFactoryConstructorArguments = [protocolFee, lpFee, protocolFeeBeneficiary];
const factory = await deploy('UniswapV2Factory', {
type SupportedChainId = keyof typeof CHAIN_PARAMS;

const isSupportedChainId = (chainId: number): chainId is SupportedChainId =>
chainId in CHAIN_PARAMS;

const func: DeployFunction = async ({
deployments: { deploy },
getNamedAccounts,
getChainId
}: HardhatRuntimeEnvironment) => {
const [
{ deployer },
chainIdStr,
] = await Promise.all([
getNamedAccounts(),
getChainId(),
]);

const chainId = Number(chainIdStr);
if (!isSupportedChainId(chainId)) {
throw new Error(`No deployment params configured for chain ID ${chainId}`);
}

const {
lpFee,
protocolFee,
protocolFeeBeneficiary,
wethAddress,
} = CHAIN_PARAMS[chainId];

const factory = await deploy("UniswapV2Factory", {
from: deployer,
args: uniswapFactoryConstructorArguments,
args: [protocolFee, lpFee, protocolFeeBeneficiary],
});

console.log("UniswapV2Factory deployed to:", factory.address);

const wMagic = "0x263D8f36Bb8d0d9526255E205868C26690b04B88";
const routerConstructorArguments = [factory.address, wMagic];
const magicSwapV2Router = await deploy('MagicSwapV2Router', {
const magicSwapV2Router = await deploy("MagicSwapV2Router", {
from: deployer,
args: routerConstructorArguments,
args: [factory.address, wethAddress],
});
console.log("MagicswapV2Router deployed to:", magicSwapV2Router.address);

console.log("MagicSwapV2Router deployed to:", magicSwapV2Router.address);

const nftVaultFactory = await deploy('NftVaultFactory', {
const nftVaultFactory = await deploy("NftVaultFactory", {
from: deployer,
});

console.log("NftVaultFactory deployed to:", nftVaultFactory.address);

const stakingContract = await deploy('StakingContractMainnet', {
const stakingContract = await deploy("StakingContractMainnet", {
from: deployer,
});

console.log("StakingContractMainnet deployed to:", stakingContract.address);

const nftVaultManagerContract = await deploy("NftVaultManager", {
from: deployer,
});
console.log("NftVaultManager deployed to:", nftVaultManagerContract.address);
}

export default func;
1 change: 1 addition & 0 deletions deployments/abstract/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2741
Loading

0 comments on commit 3ae8c0d

Please sign in to comment.