Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔨 factory/paymaster: utility scripts #80

Merged
merged 10 commits into from
Apr 2, 2024
18 changes: 18 additions & 0 deletions script/AccountFactory/06_FactoryGetVersion.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { AccountFactory } from "src/v1/AccountFactory.sol";
import { BaseScript } from "../Base.s.sol";

/// @title FactoryGetVersion
/// @notice Fetch the version of the factory
contract FactoryGetVersion is BaseScript {
function run() public broadcast returns (uint256 version) {
// address of the factory we wanna use
address factoryAddress = vm.envAddress("FACTORY");
AccountFactory factory = AccountFactory(factoryAddress);

// fetch the version of the factory
version = factory.version();
}
}
18 changes: 18 additions & 0 deletions script/AccountFactory/07_FactoryGetAccountImplem.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { AccountFactory } from "src/v1/AccountFactory.sol";
import { BaseScript } from "../Base.s.sol";

/// @title FactoryGetAccountImplem
/// @notice Fetch the account implementation used
contract FactoryGetAccountImplem is BaseScript {
function run() public broadcast returns (address accountImplementation) {
// address of the factory we wanna use
address factoryAddress = vm.envAddress("FACTORY");
AccountFactory factory = AccountFactory(factoryAddress);

// fetch the version of the factory
accountImplementation = factory.accountImplementation();
}
}
18 changes: 18 additions & 0 deletions script/AccountFactory/08_FactoryGetOwner.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { AccountFactory } from "src/v1/AccountFactory.sol";
import { BaseScript } from "../Base.s.sol";

/// @title FactoryGetOwner
/// @notice Fetch the owner of the factory
contract FactoryGetOwner is BaseScript {
function run() public broadcast returns (address owner) {
// address of the factory we wanna use
address factoryAddress = vm.envAddress("FACTORY");
AccountFactory factory = AccountFactory(factoryAddress);

// fetch the version of the factory
owner = factory.owner();
}
}
18 changes: 18 additions & 0 deletions script/Paymaster/05_PaymasterGetVersion.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { Paymaster } from "src/v1/Paymaster.sol";
import { BaseScript } from "../Base.s.sol";

/// @title PaymasterGetVersion
/// @notice Fetch the version of the paymaster
contract PaymasterGetVersion is BaseScript {
function run() public broadcast returns (uint256 version) {
// address of the paymaster we wanna use
address paymasterAddress = vm.envAddress("PAYMASTER");
Paymaster paymaster = Paymaster(paymasterAddress);

// fetch the version of the paymaster
version = paymaster.version();
}
}
18 changes: 18 additions & 0 deletions script/Paymaster/06_PaymasterGetOwner.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { Paymaster } from "src/v1/Paymaster.sol";
import { BaseScript } from "../Base.s.sol";

/// @title PaymasterGetOwner
/// @notice Fetch the owner of the paymaster
contract PaymasterGetOwner is BaseScript {
function run() public broadcast returns (address owner) {
// address of the paymaster we wanna use
address paymasterAddress = vm.envAddress("PAYMASTER");
Paymaster paymaster = Paymaster(paymasterAddress);

// fetch the owner of the paymaster
owner = paymaster.owner();
}
}
18 changes: 18 additions & 0 deletions script/Paymaster/07_PaymasterGetOperator.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { Paymaster } from "src/v1/Paymaster.sol";
import { BaseScript } from "../Base.s.sol";

/// @title PaymasterGetOperator
/// @notice Fetch the operator of the paymaster
contract PaymasterGetOperator is BaseScript {
function run() public broadcast returns (address operator) {
// address of the paymaster we wanna use
address paymasterAddress = vm.envAddress("PAYMASTER");
Paymaster paymaster = Paymaster(paymasterAddress);

// fetch the operator of the paymaster
operator = paymaster.operator();
}
}
18 changes: 18 additions & 0 deletions script/Paymaster/08_PaymasterGetDeposit.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { Paymaster } from "src/v1/Paymaster.sol";
import { BaseScript } from "../Base.s.sol";

/// @title PaymasterGetDeposit
/// @notice Fetch the current deposit of the paymaster
contract PaymasterGetDeposit is BaseScript {
function run() public broadcast returns (uint256 balance) {
// address of the paymaster we wanna use
address paymasterAddress = vm.envAddress("PAYMASTER");
Paymaster paymaster = Paymaster(paymasterAddress);

// fetch the current deposit of the paymaster
balance = paymaster.getDeposit();
}
}
18 changes: 18 additions & 0 deletions script/Paymaster/09_PaymasterGetEntrypoint.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { Paymaster } from "src/v1/Paymaster.sol";
import { BaseScript } from "../Base.s.sol";

/// @title PaymasterGetEntrypoint
/// @notice Fetch the entrypoint used by the paymaster
contract PaymasterGetEntrypoint is BaseScript {
function run() public broadcast returns (address entryPointAddress) {
// address of the paymaster we wanna use
address paymasterAddress = vm.envAddress("PAYMASTER");
Paymaster paymaster = Paymaster(paymasterAddress);

// fetch the entrypoint used by the paymaster
entryPointAddress = address(paymaster.entryPoint());
}
}
21 changes: 21 additions & 0 deletions script/Paymaster/10_PaymasterTransferOperator.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { Paymaster } from "src/v1/Paymaster.sol";
import { BaseScript } from "../Base.s.sol";

/// @title PaymasterTransferOperator
/// @notice Transfer the operator role to someone else
contract PaymasterTransferOperator is BaseScript {
function run() public broadcast {
// address of the paymaster we wanna use
address paymasterAddress = vm.envAddress("PAYMASTER");
Paymaster paymaster = Paymaster(paymasterAddress);

// address of the new operator
address newOperator = vm.envAddress("NEW_OPERATOR");

// fetch the operator of the paymaster
paymaster.transferOperator(newOperator);
}
}
21 changes: 21 additions & 0 deletions script/Paymaster/11_PaymasterTransferOwner.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: APACHE-2.0
pragma solidity >=0.8.19 <0.9.0;

import { Paymaster } from "src/v1/Paymaster.sol";
import { BaseScript } from "../Base.s.sol";

/// @title PaymasterTransferOwner
/// @notice Transfer the owner role to someone else
contract PaymasterTransferOwner is BaseScript {
function run() public broadcast {
// address of the paymaster we wanna use
address paymasterAddress = vm.envAddress("PAYMASTER");
Paymaster paymaster = Paymaster(paymasterAddress);

// address of the new owner
address newOwner = vm.envAddress("NEW_OWNER");

// fetch the owner of the paymaster
paymaster.transferOwnership(newOwner);
}
}
Loading