Skip to content

Commit 33b73c8

Browse files
committed
[fix] 🐛 add try-catch when deployed_paymaster_address is empty in env
1 parent 68f2f19 commit 33b73c8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

script/DeployAllContracts.s.sol

+7-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,13 @@ contract DeployAllContracts is Script {
119119
* @notice Deploy paymaster with entryPoint and backend signer (config.account)
120120
*/
121121
function deployPaymaster() internal {
122-
address paymasterAddress = vm.envAddress("DEPLOYED_PAYMASTER_ADDRESS");
123-
122+
address paymasterAddress;
123+
try vm.envAddress("DEPLOYED_PAYMASTER_ADDRESS") returns (address addr) {
124+
paymasterAddress = addr;
125+
} catch {
126+
paymasterAddress = address(0);
127+
}
128+
124129
if (paymasterAddress == address(0)) {
125130
console2.log("Creating NEW Paymaster!");
126131
paymaster = new ChatterPayPaymaster(config.entryPoint, config.account);

0 commit comments

Comments
 (0)