-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix shovel integration, add deposit for token paymaster fixture
- Loading branch information
Showing
7 changed files
with
106 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.20; | ||
|
||
import {Script, console2} from "forge-std/Script.sol"; | ||
import {Helper} from "../src/Helper.sol"; | ||
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; | ||
import "../src/TokenPaymaster.sol"; | ||
|
||
contract AddTokenPaymasterDepositScript is Script, Helper { | ||
function setUp() public { | ||
this.labels(); | ||
} | ||
|
||
function run() public { | ||
address addr = vm.envAddress("PAYMASTER"); | ||
uint256 deposit = vm.envUint("DEPOSIT"); | ||
|
||
require(addr != address(0), "PAYMASTER env variable not set"); | ||
require(deposit > 0, "DEPOSIT env variable not set"); | ||
|
||
TokenPaymaster paymaster = TokenPaymaster(payable(addr)); | ||
address entryPoint = 0x0000000071727De22E5E9d8BAf0edAc6f37da032; | ||
|
||
vm.startBroadcast(); | ||
IEntryPoint(entryPoint).depositTo{value: deposit}(address(paymaster)); | ||
vm.stopBroadcast(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/contracts/script/anvil-token-paymaster-deposit.ts
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,30 @@ | ||
import 'zx/globals' | ||
$.verbose = true | ||
/** | ||
* This script is used to deposit into the Entrypoint for TokenPaymaster | ||
*/ | ||
|
||
void (async function main() { | ||
console.log(chalk.blue('Enable auto-mining...')) | ||
await $`cast rpc --rpc-url base-local evm_setAutomine true` | ||
|
||
// base mainnet fork | ||
$.env.PAYMASTER = '0x592e1224D203Be4214B15e205F6081FbbaCFcD2D' | ||
$.env.DEPOSIT = await $`cast to-wei 100 ether`.then((r) => r.stdout.trim()) | ||
|
||
console.log(chalk.blue('Adding deposit to paymaster...'), $.env.DEPOSIT) | ||
await $`forge script ./script/AddTokenPaymasterDeposit.s.sol:AddTokenPaymasterDepositScript \ | ||
-vvvv \ | ||
--fork-url base-local \ | ||
--sender 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \ | ||
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \ | ||
--broadcast` | ||
|
||
console.log(chalk.blue('Disable auto-mining...')) | ||
await $`cast rpc --rpc-url base-local evm_setAutomine false` | ||
|
||
console.log(chalk.blue(`Re-enable interval mining... ${$.env.ANVIL_BLOCK_TIME ?? '2'}`)) | ||
await $`cast rpc --rpc-url base-local evm_setIntervalMining ${$.env.ANVIL_BLOCK_TIME ?? '2'}` // mimics Tiltfile default | ||
|
||
console.log(chalk.green('Done!')) | ||
})() |
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