-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add abstract deployment configs and artifacts
- Loading branch information
1 parent
cc745f6
commit 3ae8c0d
Showing
11 changed files
with
8,847 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,7 +141,6 @@ build | |
|
||
# misc | ||
.DS_Store | ||
.env* | ||
|
||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2741 |
Oops, something went wrong.