-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add doc store * fix: add some fix to support dms * fix: fix compile error * fix: revert eve sercet * fix: add log to send mutation * feat: update version * fix: fix the code style * fix: add zksync contract
- Loading branch information
Showing
21 changed files
with
811 additions
and
312 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
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
File renamed without changes.
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,81 @@ | ||
// | ||
// deploy_metadata.ts | ||
// Copyright (C) 2023 db3.network Author imotai <[email protected]> | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import { Wallet, utils } from "zksync-web3"; | ||
import * as ethers from "ethers"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; | ||
|
||
// load env file | ||
//import dotenv from "dotenv"; | ||
//dotenv.config(); | ||
|
||
// load wallet private key from env file | ||
const PRIVATE_KEY = process.env.PRIVATE_KEY || ""; | ||
|
||
if (!PRIVATE_KEY) | ||
throw "⛔️ Private key not detected! Add it to the .env file!"; | ||
|
||
// An example of a deploy script that will deploy and call a simple contract. | ||
export default async function (hre: HardhatRuntimeEnvironment) { | ||
console.log(`Running deploy script for the MetaStore contract`); | ||
|
||
// 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("DB3MetaStore"); | ||
|
||
// Estimate contract deployment fee | ||
const greeting = "Hi there!"; | ||
const deploymentFee = await deployer.estimateDeployFee(artifact, []); | ||
|
||
// ⚠️ OPTIONAL: You can skip this block if your account already has funds in L2 | ||
// Deposit funds to L2 | ||
// const depositHandle = await deployer.zkWallet.deposit({ | ||
// to: deployer.zkWallet.address, | ||
// token: utils.ETH_ADDRESS, | ||
// amount: deploymentFee.mul(2), | ||
// }); | ||
// // Wait until the deposit is processed on zkSync | ||
// await depositHandle.wait(); | ||
|
||
// Deploy this contract. The returned object will be of a `Contract` type, similarly to ones in `ethers`. | ||
// `greeting` is an argument for contract constructor. | ||
const parsedFee = ethers.utils.formatEther(deploymentFee.toString()); | ||
console.log(`The deployment is estimated to cost ${parsedFee} ETH`); | ||
const greeterContract = await deployer.deploy(artifact, []); | ||
// Show the contract info. | ||
const contractAddress = greeterContract.address; | ||
console.log(`${artifact.contractName} was deployed to ${contractAddress}`); | ||
// verify contract for tesnet & mainnet | ||
if (process.env.NODE_ENV != "test") { | ||
// Contract MUST be fully qualified name (e.g. path/sourceName:contractName) | ||
const contractFullyQualifedName = "contracts/Greeter.sol:Greeter"; | ||
|
||
// Verify contract programmatically | ||
const verificationId = await hre.run("verify:verify", { | ||
address: contractAddress, | ||
contract: contractFullyQualifedName, | ||
constructorArguments: [greeting], | ||
bytecode: artifact.bytecode, | ||
}); | ||
} else { | ||
console.log(`Contract not verified, deployed locally.`); | ||
} | ||
} |
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
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
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.