-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deposit paymaster fund before spinning up server
- Loading branch information
Showing
5 changed files
with
41 additions
and
4 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
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,26 @@ | ||
import { ethers } from 'ethers'; | ||
import dotenv from 'dotenv'; | ||
import { paymasterAbi } from '../src/abis'; | ||
dotenv.config(); | ||
|
||
async function main() { | ||
const depositAmount = process.env.INITIAL_DEPOSIT as string; | ||
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL as string); | ||
const signer = new ethers.Wallet(process.env.PRIVATE_KEY as string, provider); | ||
|
||
// Paymaster first needs to have funds in Entrypoint contract | ||
const paymasterAddress = process.env.PAYMASTER_ADDRESS as string; | ||
const paymaster = new ethers.Contract( | ||
paymasterAddress, | ||
paymasterAbi, | ||
signer | ||
); | ||
|
||
// Deposit | ||
await (await paymaster.deposit({ value: ethers.parseEther(depositAmount)})).wait(); | ||
await (await paymaster.addStake(3000, { value: ethers.parseEther(depositAmount)})).wait(); | ||
|
||
console.log("Deposit funds successful!"); | ||
} | ||
|
||
main(); |
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