EtherspotPaymaster
contract to allow for a single Paymaster contract that can handle payments from sponsors to fund transaction gas for approved wallets.
^0.8.12
.
mapping(address => mapping(address => bool)) public whitelist
: A mapping of sponsor addresses to another mapping of account addresses to a boolean value that indicates whether the account address is whitelisted for the sponsor address.
event WhitelistInitialized(address owner)
: Triggered when the contract is initialized.event AddedToWhitelist(address indexed paymaster, address indexed account)
: Triggered when an account is added to the whitelist for a specific paymaster.event AddedBatchToWhitelist(address indexed paymaster, address[] indexed accounts)
: Triggered when multiple accounts are added to the whitelist for a specific paymaster.event RemovedFromWhitelist(address indexed paymaster, address indexed account)
: Triggered when an account is removed from the whitelist for a specific paymaster.event RemovedBatchFromWhitelist(address indexed paymaster, address[] indexed accounts)
: Triggered when multiple accounts are removed from the whitelist for a specific paymaster.function check(address _sponsor, address _account) external view returns (bool)
: Checks if an account is whitelisted for a specific sponsor.function add(address _account) external
: Adds an account to the whitelist for the caller.
AddedToWhitelist(msg.sender, _account)
.function addBatch(address[] calldata _accounts) external
: Adds multiple accounts to the whitelist for the caller.
AddedBatchToWhitelist(msg.sender, _accounts)
.function remove(address _account) external
: Removes an account from the whitelist for the caller.
RemovedFromWhitelist(msg.sender, _account)
.function removeBatch(address[] calldata _accounts) external
: Removes multiple accounts from the whitelist for the caller.
RemovedBatchFromWhitelist(msg.sender, _accounts)
.function _check(address _sponsor, address _account) internal view returns (bool)
: Checks if an account is whitelisted for a specific sponsor.function _add(address _account) internal
: Adds an account to the whitelist for the caller.
Whitelist:: Zero address
: Zero address cannot be added to whitelist.Whitelist:: Account is already whitelisted
: Existing whitelisted address cannot be re-added to the whitelist.function _addBatch(address[] calldata _accounts) internal
: Adds multiple accounts to the whitelist for the caller.function _remove(address _account) internal
: Removes an account from the whitelist for the caller.
Whitelist:: Zero address
: Cannot try to remove zero address from whitelist.Whitelist:: Account is not whitelisted
: Must be a valid whitelisted account to be removed from whitelist.function _removeBatch(address[] calldata _accounts) internal
: Removes multiple accounts from the whitelist for the caller.