Skip to content

Commit

Permalink
Paymaster test code and Relations image
Browse files Browse the repository at this point in the history
  • Loading branch information
linked0 committed Nov 23, 2023
1 parent 6c58bf9 commit 1fb08f3
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 3 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@

[![Logo](eraLogo.png)](https://zksync.io/)

## 테스트
#### 네트워크 및 서버 실행
- 네트워크: poohgithub/poohgeth 리파지토리
```
cd poohnet
./init-cmd local
./enode-cmd
```
- DB 서버: poohgithub/zksync-era 리파지토리
```
cd poohnet/local-setup
./start-sql.sh
```
- zkSync 서버: poohgithub/zksync-era 리파지토리
```
./localentry.sh
```
#### 컨트랙트 테스트
- greeter-example: poohgithub/zksync-era 리파지토리
```
cd poohnet/greeter-example
yarn
yarn deploy-test
yarn greet-test
```
- paymaster-examples: poohgithub/zksync-era 리파지토리
```
cd poohneet/paymaster-examples
yarn deploy:contracts
yarn test:contracts
```

#### 모듈 관계도 및 테스트
- zksync-web3와 hardhat-zksync-deploy 관계
- hardhat-zksync-deploy와 zksync-server의 관계
- paymaster-examples/test/allowlist.test.ts 테스트

![Relations](relations.png)

## Overview
zkSync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or
decentralization. Since it's EVM compatible (Solidity/Vyper), 99% of Ethereum projects can redeploy without refactoring
or re-auditing a single line of code. zkSync Era also uses an LLVM-based compiler that will eventually let developers
Expand Down
4 changes: 3 additions & 1 deletion poohnet/paymaster-examples/contracts/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
WALLET_PRIVATE_KEY=
WALLET_PRIVATE_KEY=0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110
RECIPIENT_ADDRESS=0x82fFb1bB229552D020C88b9eE8D5e4042E6Cbd42
GREETER_ADDRESS=0x5B11c36bf87ED2EAc102C42E9528eC99D77f7aFd
3 changes: 2 additions & 1 deletion poohnet/paymaster-examples/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"zksync-web3": "^0.14.3"
},
"scripts": {
"test": "hardhat test --network zkSyncLocal",
"test": "hardhat test",
"test:greeter": "hardhat deploy-zksync --script use-greeter.ts",
"deploy": "hardhat deploy-zksync",
"greeter": "hardhat deploy-zksync --script greeter.ts",
"gasless": "hardhat deploy-zksync --script gaslessPaymaster.ts",
Expand Down
9 changes: 8 additions & 1 deletion poohnet/paymaster-examples/contracts/test/allowlist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dotenv.config();
// load wallet private key from env file
const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY || "";

describe("AllowlistPaymaster", function () {
describe.only("AllowlistPaymaster", function () {
let provider: Provider;
let wallet: Wallet;
let deployer: Deployer;
Expand All @@ -38,6 +38,13 @@ describe("AllowlistPaymaster", function () {
greeter = await deployContract(deployer, "Greeter", ["Hi"]);
// fund paymaster
await fundAccount(wallet, paymaster.address, "3");

// balance of wallet and paymaster
const walletBalance = await wallet.getBalance();
const paymasterBalance = await provider.getBalance(paymaster.address);
console.log(`Wallet balance: ${walletBalance.toString()}`);
console.log(`Paymaster balance: ${paymasterBalance.toString()}`);

// set allowance for the user wallet
const tx = await paymaster
.connect(wallet)
Expand Down
Binary file added relations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1fb08f3

Please sign in to comment.