Skip to content

Commit

Permalink
add linea config (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxiaobleach authored Jul 17, 2023
1 parent 9a3c883 commit c07085a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ CANTO_ENDPOINT=https://canto.slingshot.finance
POLYGON_ZK_EVM_ENDPOINT=https://zkevm-rpc.com
ANTIMATTER_B2_ENDPOINT=https://rpc.antimatter.finance/

LINEA_ENDPOINT=
LINEA_API_KEY='ABCDEF'
LINEA_API_ENDPOINT=Https://explorer.linea.build/api

KOVAN_PRIVATE_KEY=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

KMS_KEY_ID=
Expand Down
15 changes: 8 additions & 7 deletions deploy/pegged-bridge/tokens/002_multi_bridge_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ const deployFunc: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

await deploy('MultiBridgeToken', {
const args = [
process.env.MULTI_BRIDGE_TOKEN_NAME,
process.env.MULTI_BRIDGE_TOKEN_SYMBOL,
process.env.MULTI_BRIDGE_TOKEN_DECIMALS
];
const multiBridgeToken = await deploy('MultiBridgeToken', {
from: deployer,
log: true,
args: [
process.env.MULTI_BRIDGE_TOKEN_NAME,
process.env.MULTI_BRIDGE_TOKEN_SYMBOL,
process.env.MULTI_BRIDGE_TOKEN_DECIMALS
]
args: args
});
await hre.run('verify:verify', { address: multiBridgeToken.address, constructorArguments: args });
};

deployFunc.tags = ['MultiBridgeToken'];
Expand Down
17 changes: 15 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ const polygonZkevmPrivateKey = process.env.POLYGON_ZKEVM_PRIVATE_KEY || DEFAULT_
const antimatterB2Endpoint = process.env.ANTIMATTER_B2_ENDPOINT || DEFAULT_ENDPOINT;
const antimatterB2PrivateKey = process.env.ANTIMATTER_B2_PRIVATE_KEY || DEFAULT_PRIVATE_KEY;

const lineaEndpoint = process.env.LINEA_ENDPOINT || DEFAULT_ENDPOINT;
const lineaPrivateKey = process.env.LINEA_PRIVATE_KEY || DEFAULT_PRIVATE_KEY;

// use kmsKeyId if it's not empty, otherwise use privateKey
function getNetworkConfig(url: string, kmsKeyId: string, privateKey: string, gasPrice?: number): NetworkUserConfig {
const network: NetworkUserConfig = !kmsKeyId
Expand Down Expand Up @@ -400,7 +403,8 @@ const config: HardhatUserConfig = {
fvm: getNetworkConfig(fvmEndpoint, kmsKeyId, fvmPrivateKey),
canto: getNetworkConfig(cantoEndpoint, kmsKeyId, cantoPrivateKey),
polygonZkevm: getNetworkConfig(polygonZkevmEndpoint, kmsKeyId, polygonZkevmPrivateKey),
antimatterB2: getNetworkConfig(antimatterB2Endpoint, kmsKeyId, antimatterB2PrivateKey)
antimatterB2: getNetworkConfig(antimatterB2Endpoint, kmsKeyId, antimatterB2PrivateKey),
linea: getNetworkConfig(lineaEndpoint, kmsKeyId, lineaPrivateKey)
},
namedAccounts: {
deployer: {
Expand Down Expand Up @@ -451,7 +455,8 @@ const config: HardhatUserConfig = {
moonriver: process.env.MOONRIVER_MOONSCAN_API_KEY || '',
moonbeam: process.env.MOONBEAM_MOONSCAN_API_KEY || '',
heco: process.env.HECOSCAN_API_KEY || '',
arbitrumNova: process.env.ARBISCAN_NOVA_API_KEY || ''
arbitrumNova: process.env.ARBISCAN_NOVA_API_KEY || '',
linea: process.env.LINEA_API_KEY || ''
},
customChains: [
{
Expand All @@ -461,6 +466,14 @@ const config: HardhatUserConfig = {
apiURL: process.env.ARBITRUM_NOVA_ENDPOINT || '',
browserURL: process.env.ARBITRUM_NOVA_EXPLORER || ''
}
},
{
network: 'linea',
chainId: 59144,
urls: {
apiURL: process.env.LINEA_API_ENDPOINT || '',
browserURL: process.env.LINEA_EXPLORER || ''
}
}
]
}
Expand Down
5 changes: 5 additions & 0 deletions scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export async function getDeployerSigner(): Promise<SignerWithAddress> {

export async function getFeeOverrides(): Promise<Overrides> {
const feeData = await ethers.provider.getFeeData();
const network = await ethers.provider.getNetwork();
if (network.chainId == 59144) {
// for linea
return { maxFeePerGas: 5000000000, maxPriorityFeePerGas: 4900000000};
}
if (feeData.maxFeePerGas) {
return { maxFeePerGas: feeData.maxFeePerGas, maxPriorityFeePerGas: feeData.maxPriorityFeePerGas || 0 };
}
Expand Down

0 comments on commit c07085a

Please sign in to comment.