-
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.
- Loading branch information
Showing
11 changed files
with
260 additions
and
217 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
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,36 @@ | ||
// This script will: | ||
// 1. Send ETH to the shared restricted account | ||
|
||
import { ethers } from "ethers"; | ||
import { Provider, Wallet } from "zksync-web3"; | ||
import { getDeployedContractDetailsFromVars, config } from "../deploy/utils"; | ||
|
||
const NETWORK = "zkSyncLocalnet"; | ||
const RPC_URL = config.L2RpcUrl; | ||
const PRIVATE_KEY = config.firstWalletPrivateKey; | ||
|
||
async function main() { | ||
const provider = new Provider(RPC_URL); | ||
const mainWallet = new Wallet(PRIVATE_KEY, provider); | ||
|
||
// Load the contract address from vars.json | ||
const accountAddress = getDeployedContractDetailsFromVars(NETWORK, "SharedRestrictedAccount").address; | ||
// send 100 ETH to the paAddress | ||
const balance = await provider.getBalance(accountAddress); | ||
const tx = await mainWallet.sendTransaction({ | ||
to: accountAddress, | ||
value: ethers.utils.parseEther("100"), | ||
}); | ||
await tx.wait(); | ||
const newBalance = await provider.getBalance(accountAddress); | ||
console.log(`Sent 100 ETH to Pension Account at: ${accountAddress}`); | ||
console.log(`Balance before: ${ethers.utils.formatEther(balance)} ETH`); | ||
console.log(`Balance after: ${ethers.utils.formatEther(newBalance)} ETH`); | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
import { Wallet, Provider, utils } from "zksync-web3"; | ||
import { HardhatRuntimeEnvironment, HttpNetworkConfig } from "hardhat/types"; | ||
import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; | ||
import { config, saveContractToVars } from "../deploy/utils"; | ||
import { ethers } from "ethers"; | ||
|
||
const KEY = config.firstWalletPrivateKey; | ||
|
||
export default async function (hre: HardhatRuntimeEnvironment) { | ||
const provider = new Provider({ url: (hre.network.config as HttpNetworkConfig).url }); | ||
const wallet = new Wallet(KEY).connect(provider); | ||
const deployer = new Deployer(hre, wallet); | ||
const accountFactoryArtifact = await deployer.loadArtifact("SharedRestrictedAccountFactory"); | ||
const accountArtifact = await deployer.loadArtifact("SharedRestrictedAccount"); | ||
|
||
// Deploy the factory | ||
const bytecodeHash = utils.hashBytecode(accountArtifact.bytecode); | ||
const factory = await deployer.deploy(accountFactoryArtifact, [bytecodeHash], undefined, [accountArtifact.bytecode]); | ||
console.log(`SharedRestrictedAccountFactory address: ${factory.address}`); | ||
saveContractToVars(hre.network.name, "SharedRestrictedAccountFactory", factory.address); | ||
|
||
// Deploy the account | ||
const salt = ethers.constants.HashZero; | ||
|
||
// deploy account owned by owner1 & owner2 | ||
const tx = await factory.deployAccount(salt, wallet.address); | ||
await tx.wait(); | ||
|
||
// Getting the address of the deployed contract account | ||
const abiCoder = new ethers.utils.AbiCoder(); | ||
let accountAddress = utils.create2Address(factory.address, await factory.aaBytecodeHash(), salt, abiCoder.encode(["address"], [wallet.address])); | ||
console.log(`SharedRestrictedAccount address: ${accountAddress}`); | ||
saveContractToVars(hre.network.name, "SharedRestrictedAccount", accountAddress); | ||
} |
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.