Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
updates deps
Browse files Browse the repository at this point in the history
  • Loading branch information
uF4No committed Dec 14, 2022
1 parent 5336522 commit 2c7d5da
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 72 deletions.
50 changes: 31 additions & 19 deletions local-setup-testing/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
require("@matterlabs/hardhat-zksync-deploy");
require("@matterlabs/hardhat-zksync-solc");
import { HardhatUserConfig } from 'hardhat/config';

const zkSyncDeploy = process.env.NODE_ENV == 'test' ? {
zkSyncNetwork: "http://localhost:3050",
ethNetwork: "http://localhost:8545",
} : {
zkSyncNetwork: "https://zksync2-testnet.zksync.dev",
ethNetwork: "goerli",
};
require('@matterlabs/hardhat-zksync-deploy');
require('@matterlabs/hardhat-zksync-solc');

// dynamically changes endpoints for local tests
const zkSyncTestnet =
process.env.NODE_ENV == 'test'
? {
url: 'http://localhost:3050',
ethNetwork: 'http://localhost:8545',
zksync: true,
}
: {
url: 'https://zksync2-testnet.zksync.dev',
ethNetwork: 'goerli',
zksync: true,
};

module.exports = {
const config: HardhatUserConfig = {
zksolc: {
version: "1.2.0",
compilerSource: "docker",
version: '1.2.1',
compilerSource: 'binary',
settings: {
experimental: {
dockerImage: "matterlabs/zksolc",
tag: 'v1.2.0'
dockerImage: 'matterlabs/zksolc',
tag: 'v1.2.0',
},
},
},
zkSyncDeploy,
solidity: {
version: "0.8.11",
},
defaultNetwork: 'zkSyncTestnet',
networks: {
hardhat: {
zksync: true
// @ts-ignore
zksync: true,
},
zkSyncTestnet,
},
solidity: {
version: '0.8.16',
},
};

export default config;
4 changes: 2 additions & 2 deletions local-setup-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@matterlabs/hardhat-zksync-deploy": "^0.4.0",
"@matterlabs/hardhat-zksync-solc": "^0.3.7",
"@matterlabs/hardhat-zksync-deploy": "^0.6.0",
"@matterlabs/hardhat-zksync-solc": "^0.3.12",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.1.0",
"chai": "^4.3.6",
Expand Down
55 changes: 32 additions & 23 deletions local-setup-testing/test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,48 @@ import { expect } from 'chai';
import { Wallet, Contract, utils } from 'zksync-web3';
import * as hre from 'hardhat';
import { ethers } from 'ethers';
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import { Deployer } from '@matterlabs/hardhat-zksync-deploy';

const RICH_WALLET_PK = '0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110';
const RICH_WALLET_PK =
'0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110';

async function deployGreeter(deployer: Deployer): Promise<Contract> {
const artifact = await deployer.loadArtifact("Greeter");
return await deployer.deploy(artifact, ["Hi"]);
try {
console.log('Deploying contract');
const artifact = await deployer.loadArtifact('Greeter');

return await deployer.deploy(artifact, ['Hi']);
} catch (error) {
console.error('Error deploying contract');
console.error(error);
throw new Error('Error deploying contract');
}
}

describe("Greeter", function () {
let deployer: Deployer;
describe('Greeter', function () {
let deployer: Deployer;

before("Fund the wallet", async () => {
deployer = new Deployer(hre, new Wallet(RICH_WALLET_PK));
before('Fund the wallet', async () => {
deployer = new Deployer(hre, new Wallet(RICH_WALLET_PK));

const depositHandle = await deployer.zkWallet.deposit({
to: deployer.zkWallet.address,
token: utils.ETH_ADDRESS,
amount: ethers.utils.parseEther('0.001'),
});

await depositHandle.wait();
const depositHandle = await deployer.zkWallet.deposit({
to: deployer.zkWallet.address,
token: utils.ETH_ADDRESS,
amount: ethers.utils.parseEther('0.001'),
});

it("Should return the new greeting once it's changed", async () => {
const greeter = await deployGreeter(deployer);
await depositHandle.wait();
});

expect(await greeter.greet()).to.eq("Hi");;
it("Should return the new greeting once it's changed", async () => {
const greeter = await deployGreeter(deployer);
console.log('Deployeeeeddd');
expect(await greeter.greet()).to.eq('Hi');
console.log('Hi is hi');

const setGreetingTx = await greeter.setGreeting("Hola, mundo!");
await setGreetingTx.wait();
const setGreetingTx = await greeter.setGreeting('Hola, mundo!');
await setGreetingTx.wait();

expect(await greeter.greet()).to.equal("Hola, mundo!");
});
expect(await greeter.greet()).to.equal('Hola, mundo!');
});
});

36 changes: 8 additions & 28 deletions local-setup-testing/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -428,17 +428,15 @@
"@ethersproject/properties" "^5.6.0"
"@ethersproject/strings" "^5.6.0"

"@matterlabs/hardhat-zksync-deploy@^0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-deploy/-/hardhat-zksync-deploy-0.4.0.tgz#8a6ef1faf7d91cf2b32072eeaa7c7332fb4c27b1"
integrity sha512-r/xp+CL1+qVLNGoSehUe4u80QZRG8e4WEnhJ1JuJSxzOaoivqUDFblf8Q/TQkdFPrilBqpgTJzcPazDsWeH0SQ==
dependencies:
glob "^8.0.1"
"@matterlabs/hardhat-zksync-deploy@^0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-deploy/-/hardhat-zksync-deploy-0.6.0.tgz#c24a79e325344511adb023062205dbc312efdf01"
integrity sha512-Gu7Zuzyx+YipyyKVtGjQ+EYWGtDmPLhH4oStyVLjIGWfdawT+AWUYxe6nwrIYGOxqI5RcGdGIDd5NANAOJKgjA==

"@matterlabs/hardhat-zksync-solc@^0.3.7":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-0.3.7.tgz#1215e8558d7de35cecb875a28e02df697bd63cdb"
integrity sha512-fhqCC+31G4ccW//ENyKzSpCfTTh3D5jeO1jPeDhgvw+0DMC3W1iOvAc+7FXpz1kMJmcQYNLQyMDV71xXTREAMw==
"@matterlabs/hardhat-zksync-solc@^0.3.12":
version "0.3.12"
resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-0.3.12.tgz#0caeb0a2aac1d66057988b981a4d1c72ff614a1e"
integrity sha512-0py4bsqphPYJV1Ub7jlCkMP2lEENIB16jv700rNnikJJn251ofQgzowcspJw+/WchP+Tu4tJSRL0a1MVngtCoQ==
dependencies:
"@nomiclabs/hardhat-docker" "^2.0.0"
dockerode "^3.3.4"
Expand Down Expand Up @@ -1559,17 +1557,6 @@ [email protected], glob@^7.1.3:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^8.0.1:
version "8.0.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e"
integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^5.0.1"
once "^1.3.0"

graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.2.10"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
Expand Down Expand Up @@ -2074,13 +2061,6 @@ minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"

minimatch@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7"
integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==
dependencies:
brace-expansion "^2.0.1"

minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
Expand Down

0 comments on commit 2c7d5da

Please sign in to comment.