-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1326f9
commit 6dd2c08
Showing
10 changed files
with
12,180 additions
and
17,028 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 |
---|---|---|
|
@@ -4,8 +4,8 @@ node_modules/ | |
build/ | ||
site/ | ||
coverage | ||
artifacts | ||
cache | ||
artifacts* | ||
cache* | ||
coverage.json | ||
.log | ||
.env | ||
|
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,15 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
|
||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
import deployContractZkSyncEra from './deployContractZkSyncEra'; | ||
|
||
export default async function (hre: HardhatRuntimeEnvironment) { | ||
try { | ||
await deployContractZkSyncEra(hre, 'router/', 'Router'); | ||
} catch (error) { | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
} |
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,16 @@ | ||
|
||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
|
||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
import deployContractZkSyncEra from './deployContractZkSyncEra'; | ||
|
||
export default async function (hre: HardhatRuntimeEnvironment) { | ||
try { | ||
await deployContractZkSyncEra(hre, 'callers/', 'SimpleCaller'); | ||
} catch (error) { | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
} |
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,47 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { Provider } from "zksync-web3"; | ||
import * as ethers from 'ethers'; | ||
|
||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
import deploymentAddresses from '../scripts/deployment'; | ||
import * as ContractArtifact from "../artifacts-zk/contracts/router/Router.sol/Router.json"; | ||
|
||
export default async function (hre: HardhatRuntimeEnvironment) { | ||
try { | ||
// @ts-ignore | ||
const provider = new Provider(hre.userConfig.networks?.zkSyncEra?.url); | ||
|
||
const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY || ""; | ||
const signer = new ethers.Wallet(PRIVATE_KEY, provider); | ||
|
||
// Initialize contract instance | ||
const chainIdHex = await hre.network.provider.request({ method: 'eth_chainId' }); | ||
// @ts-ignore | ||
const chainId = [parseInt(chainIdHex.toString(), 16).toString()]; | ||
const router = new ethers.Contract( | ||
deploymentAddresses.router[chainId], | ||
ContractArtifact.abi, | ||
signer | ||
); | ||
|
||
console.log(`Working with chainId ${chainId}`); | ||
|
||
const feeSignerTx = await router.functions.setProtocolFeeSigner( | ||
'0x1e126951a7CB895543E4E4c7B2D1398b3C3d09fC', | ||
); | ||
console.log(`Setting fee signer tx hash: ${feeSignerTx.hash}`); | ||
|
||
const feeDefaultTx = await router.functions.setProtocolFeeDefault( | ||
[ | ||
'5000000000000000', | ||
deploymentAddresses.feeBeneficiaries[chainId], | ||
], | ||
); | ||
console.log(`Setting fee defaults tx hash: ${feeDefaultTx.hash}`); | ||
} catch (error) { | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
} |
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,37 @@ | ||
import { Wallet } from "zksync-web3"; | ||
import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; | ||
|
||
async function deployAsyncZkSyncEra(hre, path, contractName) { | ||
// // load wallet private key from env file | ||
const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY || ""; | ||
|
||
// // Initialize the wallet. | ||
const wallet = new Wallet(PRIVATE_KEY); | ||
|
||
// // Create deployer object and load the artifact of the contract you want to deploy. | ||
const deployer = new Deployer(hre, wallet); | ||
const artifact = await deployer.loadArtifact(contractName); | ||
|
||
const contract = await deployer.deploy(artifact); | ||
|
||
console.log(`${contractName} deployed to: ${contract.address}`); | ||
|
||
// Contract MUST be fully qualified name (e.g. path/sourceName:contractName) | ||
const contractFullyQualifedName = `contracts/${path}${contractName}.sol:${contractName}`; | ||
|
||
// Verify contract programmatically | ||
await hre.run("verify:verify", { | ||
address: contract.address, | ||
contract: contractFullyQualifedName, | ||
constructorArguments: [], | ||
bytecode: artifact.bytecode, | ||
}); | ||
|
||
return contract.address; | ||
} | ||
|
||
const deployContractZkSyncEra = (hre, path, contractName) => { | ||
return deployAsyncZkSyncEra(hre, path, contractName); | ||
}; | ||
|
||
export default deployContractZkSyncEra; |
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
Oops, something went wrong.