Skip to content

Commit

Permalink
add more script func
Browse files Browse the repository at this point in the history
  • Loading branch information
RetricSu committed Dec 28, 2022
1 parent c253e2a commit 4646f36
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
17 changes: 17 additions & 0 deletions deploy/deploy-gasless-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ export const addPaymasterStake = async function (paymasterAddr: string, ethAmoun
console.log('tx receipt: ', receipt);
}

export const depositPaymasterStake = async function (entrypointAddr: string, paymasterAddr: string, ethAmount: string) {
const [admin] = await ethers.getSigners()
const Contract = await ethers.getContractFactory("GaslessEntryPoint")
const contract = await Contract.attach(entrypointAddr);
const tx = await contract.connect(admin).depositTo(paymasterAddr, { value: ethers.utils.parseEther(ethAmount) })
console.log('depositPaymasterStake tx sent: ', tx.hash);
const receipt = await tx.wait();
console.log('tx receipt: ', receipt);
}

export const getBalance = async function (entrypointAddr: string, paymasterAddr: string) {
const Contract = await ethers.getContractFactory("GaslessEntryPoint")
const contract = await Contract.attach(entrypointAddr);
const balance = await contract.balanceOf(paymasterAddr);
console.log('paymaster balance: ', balance);
}

export const addWhitelistAddress = async function (paymasterAddr: string, whitelistAddress: string) {
const [admin] = await ethers.getSigners()
const Contract = await ethers.getContractFactory("GaslessDemoPaymaster")
Expand Down
8 changes: 6 additions & 2 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ import {
addPaymasterStake,
addWhitelistAddress,
deployPaymaster,
depositPaymasterStake,
getBalance,
} from "../deploy/deploy-gasless-contract";

async function main() {
//await deployPaymasterContract();

// await addWhitelistAddress(
// "0xa8a0B28AbC58290EF91Dd4375Ea5e1274dE16f47",
// "0xFb2C72d3ffe10Ef7c9960272859a23D24db9e04A"
// "0x73b72d6EE63e16c898AD18C7f447846BfC3AB1aC"
// );

await addPaymasterStake("0xa8a0B28AbC58290EF91Dd4375Ea5e1274dE16f47", "1");
//await addPaymasterStake("0xa8a0B28AbC58290EF91Dd4375Ea5e1274dE16f47", "1000");
await depositPaymasterStake("0xc52059c8cd8f0817f9e67009e014322f5239547f", "0xa8a0B28AbC58290EF91Dd4375Ea5e1274dE16f47", "1000");
await getBalance("0xc52059c8cd8f0817f9e67009e014322f5239547f", "0xa8a0B28AbC58290EF91Dd4375Ea5e1274dE16f47")
}

const deployPaymasterContract = async () => {
Expand Down

0 comments on commit 4646f36

Please sign in to comment.