Skip to content

Commit

Permalink
fix:lint
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrockrises committed Oct 14, 2024
1 parent 24ead05 commit 7b9d010
Show file tree
Hide file tree
Showing 16 changed files with 428 additions and 372 deletions.
20 changes: 10 additions & 10 deletions contracts/base/BasePaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import "account-abstraction/core/UserOperationLib.sol";
abstract contract BasePaymaster is IPaymaster, SoladyOwnable {
IEntryPoint public immutable entryPoint;

Check warning on line 18 in contracts/base/BasePaymaster.sol

View workflow job for this annotation

GitHub Actions / Lint sources

Immutable variables name are set to be in capitalized SNAKE_CASE

uint256 internal constant PAYMASTER_VALIDATION_GAS_OFFSET = UserOperationLib.PAYMASTER_VALIDATION_GAS_OFFSET;
uint256 internal constant PAYMASTER_POSTOP_GAS_OFFSET = UserOperationLib.PAYMASTER_POSTOP_GAS_OFFSET;
uint256 internal constant PAYMASTER_DATA_OFFSET = UserOperationLib.PAYMASTER_DATA_OFFSET;
uint256 internal constant _PAYMASTER_VALIDATION_GAS_OFFSET = UserOperationLib.PAYMASTER_VALIDATION_GAS_OFFSET;
uint256 internal constant _PAYMASTER_POSTOP_GAS_OFFSET = UserOperationLib.PAYMASTER_POSTOP_GAS_OFFSET;
uint256 internal constant _PAYMASTER_DATA_OFFSET = UserOperationLib.PAYMASTER_DATA_OFFSET;

constructor(address _owner, IEntryPoint _entryPoint) SoladyOwnable(_owner) {
_validateEntryPointInterface(_entryPoint);
entryPoint = _entryPoint;
constructor(address owner, IEntryPoint entryPoint) SoladyOwnable(owner) {
_validateEntryPointInterface(entryPoint);
entryPoint = entryPoint;
}

/**
Expand Down Expand Up @@ -105,9 +105,9 @@ abstract contract BasePaymaster is IPaymaster, SoladyOwnable {

//sanity check: make sure this EntryPoint was compiled against the same
// IEntryPoint of this paymaster
function _validateEntryPointInterface(IEntryPoint _entryPoint) internal virtual {
function _validateEntryPointInterface(IEntryPoint entryPoint) internal virtual {
require(

Check warning on line 109 in contracts/base/BasePaymaster.sol

View workflow job for this annotation

GitHub Actions / Lint sources

GC: Use Custom Errors instead of require statements
IERC165(address(_entryPoint)).supportsInterface(type(IEntryPoint).interfaceId),
IERC165(address(entryPoint)).supportsInterface(type(IEntryPoint).interfaceId),
"IEntryPoint interface mismatch"
);
}
Expand Down Expand Up @@ -166,10 +166,10 @@ abstract contract BasePaymaster is IPaymaster, SoladyOwnable {
/**
* Check if address is a contract
*/
function _isContract(address _addr) internal view returns (bool) {
function _isContract(address addr) internal view returns (bool) {
uint256 size;
assembly ("memory-safe") {

Check warning on line 171 in contracts/base/BasePaymaster.sol

View workflow job for this annotation

GitHub Actions / Lint sources

Avoid to use inline assembly. It is acceptable only in rare cases
size := extcodesize(_addr)
size := extcodesize(addr)
}
return size > 0;
}
Expand Down
10 changes: 6 additions & 4 deletions contracts/interfaces/IBiconomySponsorshipPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.27;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

Check warning on line 4 in contracts/interfaces/IBiconomySponsorshipPaymaster.sol

View workflow job for this annotation

GitHub Actions / Lint sources

global import of path @openzeppelin/contracts/token/ERC20/IERC20.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import { PackedUserOperation } from "account-abstraction/core/UserOperationLib.sol";

interface IBiconomySponsorshipPaymaster{
interface IBiconomySponsorshipPaymaster {
event UnaccountedGasChanged(uint256 indexed oldValue, uint256 indexed newValue);
event FixedPriceMarkupChanged(uint256 indexed oldValue, uint256 indexed newValue);
event VerifyingSignerChanged(address indexed oldSigner, address indexed newSigner, address indexed actor);
Expand All @@ -18,9 +18,9 @@ interface IBiconomySponsorshipPaymaster{

function depositFor(address paymasterId) external payable;

function setSigner(address _newVerifyingSigner) external payable;
function setSigner(address newVerifyingSigner) external payable;

function setFeeCollector(address _newFeeCollector) external payable;
function setFeeCollector(address newFeeCollector) external payable;

function setUnaccountedGas(uint256 value) external payable;

Expand All @@ -41,7 +41,9 @@ interface IBiconomySponsorshipPaymaster{
view
returns (bytes32);

function parsePaymasterAndData(bytes calldata paymasterAndData)
function parsePaymasterAndData(
bytes calldata paymasterAndData
)
external
pure
returns (
Expand Down
10 changes: 5 additions & 5 deletions contracts/interfaces/IBiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ interface IBiconomyTokenPaymaster {
event UpdatedTokenDirectory(address indexed tokenAddress, IOracle indexed oracle, uint8 decimals);
event UpdatedNativeAssetOracle(IOracle indexed oldOracle, IOracle indexed newOracle);

function setSigner(address _newVerifyingSigner) external payable;
function setSigner(address newVerifyingSigner) external payable;

function setUnaccountedGas(uint256 value) external payable;

function setPriceMarkup(uint256 _newUnaccountedGas) external payable;
function setPriceMarkup(uint256 newUnaccountedGas) external payable;

function setPriceExpiryDuration(uint256 _newPriceExpiryDuration) external payable;
function setPriceExpiryDuration(uint256 newPriceExpiryDuration) external payable;

function setNativeAssetToUsdOracle(IOracle _oracle) external payable;
function setNativeAssetToUsdOracle(IOracle oracle) external payable;

function updateTokenDirectory(address _tokenAddress, IOracle _oracle) external payable;
function updateTokenDirectory(address tokenAddress, IOracle oracle) external payable;
}
2 changes: 1 addition & 1 deletion contracts/interfaces/oracles/IOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ interface IOracle {
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
}
12 changes: 9 additions & 3 deletions contracts/libraries/TokenPaymasterParserLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ library TokenPaymasterParserLib {
// Start offset of mode in PND
uint256 private constant PAYMASTER_MODE_OFFSET = UserOperationLib.PAYMASTER_DATA_OFFSET;

function parsePaymasterAndData(bytes calldata paymasterAndData)
function parsePaymasterAndData(
bytes calldata paymasterAndData
)
external
pure
returns (IBiconomyTokenPaymaster.PaymasterMode mode, bytes memory modeSpecificData)
Expand All @@ -20,7 +22,9 @@ library TokenPaymasterParserLib {
}
}

function parseExternalModeSpecificData(bytes calldata modeSpecificData)
function parseExternalModeSpecificData(
bytes calldata modeSpecificData
)
external
pure
returns (
Expand All @@ -40,7 +44,9 @@ library TokenPaymasterParserLib {
signature = modeSpecificData[52:];
}

function parseIndependentModeSpecificData(bytes calldata modeSpecificData)
function parseIndependentModeSpecificData(
bytes calldata modeSpecificData
)
external
pure
returns (address tokenAddress)
Expand Down
Loading

0 comments on commit 7b9d010

Please sign in to comment.