Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
SimplePaymaster
Compiler Version
v0.8.24+commit.e11b9ed9
ZkSolc Version
v1.5.7
Optimization Enabled:
Yes with Mode 3
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; // src/zksync/paymaster/SimplePaymaster.sol struct Transaction { uint256 txType; uint256 from; uint256 to; uint256 gasLimit; uint256 gasPerPubdataByteLimit; uint256 maxFeePerGas; uint256 maxPriorityFeePerGas; uint256 paymaster; uint256 nonce; uint256 value; bytes data; } enum ExecutionResult { Revert, Success } interface IPaymaster { function validateAndPayForPaymasterTransaction( bytes32 _txHash, bytes32 _suggestedSignedHash, Transaction calldata _transaction ) external payable returns (bytes4 magic, bytes memory context); function postTransaction( bytes calldata _context, Transaction calldata _transaction, bytes32 _txHash, bytes32 _suggestedSignedHash, ExecutionResult _txResult, uint256 _maxRefundedGas ) external payable; } contract SimplePaymaster is IPaymaster { address constant BOOTLOADER_ADDRESS = address(uint160(0x8001)); bytes4 constant PAYMASTER_VALIDATION_SUCCESS_MAGIC = IPaymaster.validateAndPayForPaymasterTransaction.selector; address public owner; error Unauthorized(); error TransferFailed(); modifier onlyOwner() { if (msg.sender != owner) { revert Unauthorized(); } _; } constructor() { owner = msg.sender; } function validateAndPayForPaymasterTransaction( bytes32 _txHash, bytes32 _suggestedSignedHash, Transaction calldata _transaction ) external payable override returns (bytes4 magic, bytes memory context) { // Pay for transaction using call instead of send uint256 payment = _transaction.gasLimit * _transaction.maxFeePerGas; (bool success, ) = payable(BOOTLOADER_ADDRESS).call{value: payment}(""); if (!success) { revert TransferFailed(); } return (PAYMASTER_VALIDATION_SUCCESS_MAGIC, ""); } function postTransaction( bytes calldata _context, Transaction calldata _transaction, bytes32 _txHash, bytes32 _suggestedSignedHash, ExecutionResult _txResult, uint256 _maxRefundedGas ) external payable override { // No post-transaction logic needed for this simple implementation } function withdraw(address payable _to, uint256 _amount) external onlyOwner { (bool success, ) = _to.call{value: _amount}(""); if (!success) { revert TransferFailed(); } } receive() external payable {} }
{ "viaIR": true, "codegen": "yul", "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/", "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/", "@matterlabs/=lib/era-contracts/", "era-contracts/=lib/era-contracts/", "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/", "murky/=lib/era-contracts/lib/murky/", "openzeppelin-contracts-upgradeable-v4/=lib/era-contracts/lib/openzeppelin-contracts-upgradeable-v4/", "openzeppelin-contracts-v4/=lib/era-contracts/lib/openzeppelin-contracts-v4/" ], "evmVersion": "cancun", "outputSelection": { "*": { "*": [ "abi", "metadata" ], "": [ "ast" ] } }, "optimizer": { "enabled": true, "mode": "3", "fallback_to_optimizing_for_size": false, "disable_system_request_memoization": true }, "metadata": {}, "libraries": {}, "enableEraVMExtensions": false, "forceEVMLA": false }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_context","type":"bytes"},{"components":[{"internalType":"uint256","name":"txType","type":"uint256"},{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"to","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"gasPerPubdataByteLimit","type":"uint256"},{"internalType":"uint256","name":"maxFeePerGas","type":"uint256"},{"internalType":"uint256","name":"maxPriorityFeePerGas","type":"uint256"},{"internalType":"uint256","name":"paymaster","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Transaction","name":"_transaction","type":"tuple"},{"internalType":"bytes32","name":"_txHash","type":"bytes32"},{"internalType":"bytes32","name":"_suggestedSignedHash","type":"bytes32"},{"internalType":"enum ExecutionResult","name":"_txResult","type":"uint8"},{"internalType":"uint256","name":"_maxRefundedGas","type":"uint256"}],"name":"postTransaction","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_txHash","type":"bytes32"},{"internalType":"bytes32","name":"_suggestedSignedHash","type":"bytes32"},{"components":[{"internalType":"uint256","name":"txType","type":"uint256"},{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"to","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"gasPerPubdataByteLimit","type":"uint256"},{"internalType":"uint256","name":"maxFeePerGas","type":"uint256"},{"internalType":"uint256","name":"maxPriorityFeePerGas","type":"uint256"},{"internalType":"uint256","name":"paymaster","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Transaction","name":"_transaction","type":"tuple"}],"name":"validateAndPayForPaymasterTransaction","outputs":[{"internalType":"bytes4","name":"magic","type":"bytes4"},{"internalType":"bytes","name":"context","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
9c4d535b00000000000000000000000000000000000000000000000000000000000000000100006944878089450234f8d661fdca519aabfac3ce1d628efe7d4921c14edf00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x00010000000000020000008003000039000000400030043f0000000100200190000000190000c13d00000060021002700000004f02200197000000040020008c000000260000413d000000000301043b000000e003300270000000520030009c0000002a0000213d000000550030009c000000460000613d000000560030009c0000007a0000c13d0000000001000416000000000001004b0000007a0000c13d000000000100041a0000005701100197000000800010043f0000005d010000410000013a0001042e0000000001000416000000000001004b0000007a0000c13d000000000100041a00000050011001970000000002000411000000000121019f000000000010041b00000020010000390000010000100443000001200000044300000051010000410000013a0001042e000000000002004b0000007a0000c13d00000000010000190000013a0001042e000000530030009c0000005b0000613d000000540030009c0000007a0000c13d000000440020008c0000007a0000413d0000000003000416000000000003004b0000007a0000c13d0000000403100370000000000303043b000000570030009c0000007a0000213d000000000400041a00000057044001970000000005000411000000000045004b0000007c0000c13d00000057043001970000002403100370000000000303043b0000000005000414000000040040008c000000de0000c13d000000000121034f00000001020000390000000003000031000000fa0000013d000000640020008c0000007a0000413d0000004403100370000000000303043b0000005b0030009c0000007a0000213d00000000023200490000005c0020009c0000007a0000213d000001640020008c0000007a0000413d0000006402300039000000000221034f000000a403300039000000000131034f000000000101043b000000000202043b000000000002004b000000800000c13d0000000001000414000000870000013d000000c40020008c0000007a0000413d0000000403100370000000000303043b0000005b0030009c0000007a0000213d0000002304300039000000000024004b0000007a0000813d0000000404300039000000000441034f000000000404043b0000005b0040009c0000007a0000213d00000000034300190000002403300039000000000023004b0000007a0000213d0000002403100370000000000303043b0000005b0030009c0000007a0000213d00000000023200490000005c0020009c0000007a0000213d000001640020008c0000007a0000413d0000008401100370000000000101043b000000010010008c000000280000a13d00000000010000190000013b000104300000005801000041000000800010043f00000059010000410000013b0001043000000000032100a900000000022300d9000000000021004b000000e50000c13d0000000001000414000000000003004b000000eb0000c13d0000004f0010009c0000004f01008041000000c0011002100000800102000039013901340000040f00000060031002700000004f0030019d0000004f03300198000000b50000613d0000001f0430003900000060044001970000003f044000390000006104400197000000400500043d0000000004450019000000000054004b000000000600003900000001060040390000005b0040009c0000012e0000213d00000001006001900000012e0000c13d000000400040043f0000001f0430018f000000000635043600000062053001980000000003560019000000a80000613d000000000701034f000000007807043c0000000006860436000000000036004b000000a40000c13d000000000004004b000000b50000613d000000000151034f0000000304400210000000000503043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f0000000000130435000000400300043d0000000100200190000000ff0000613d000000650030009c0000012e0000213d0000002002300039000000400020043f0000000000030435000000400100043d000000200410003900000040050000390000000000540435000000660400004100000000004104350000000003030433000000400410003900000000003404350000006004100039000000000003004b000000d10000613d000000000500001900000000064500190000000007250019000000000707043300000000007604350000002005500039000000000035004b000000ca0000413d0000001f0230003900000067022001970000000003430019000000000003043500000060022000390000004f0020009c0000004f0200804100000060022002100000004f0010009c0000004f010080410000004001100210000000000112019f0000013a0001042e0000004f0050009c0000004f05008041000000c001500210000000000003004b000000f30000c13d0000000002040019000000f60000013d0000005e01000041000000000010043f0000001101000039000000040010043f0000005f010000410000013b000104300000004f0010009c0000004f01008041000000c0011002100000005a011001c70000800902000039000080010400003900000000050000190000008b0000013d0000005a011001c700008009020000390000000005000019013901340000040f00000060031002700000004f0030019d0000004f03300197000000000003004b000001060000c13d0000000100200190000000280000c13d000000400300043d000000630100004100000000001304350000004f0030009c0000004f03008041000000400130021000000064011001c70000013b000104300000005b0030009c0000012e0000213d0000001f0530003900000067055001970000003f055000390000006706500197000000400500043d0000000006650019000000000056004b000000000700003900000001070040390000005b0060009c0000012e0000213d00000001007001900000012e0000c13d000000400060043f000000000635043600000067043001980000001f0530018f0000000003460019000001200000613d000000000701034f000000007807043c0000000006860436000000000036004b0000011c0000c13d000000000005004b000000fc0000613d000000000141034f0000000304500210000000000503043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f0000000000130435000000fc0000013d0000005e01000041000000000010043f0000004101000039000000040010043f0000005f010000410000013b0001043000000137002104210000000102000039000000000001042d0000000002000019000000000001042d00000139000004320000013a0001042e0000013b0001043000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000000000000000000000000000ebf39ff300000000000000000000000000000000000000000000000000000000ebf39ff400000000000000000000000000000000000000000000000000000000f3fef3a3000000000000000000000000000000000000000000000000000000000649a8bb000000000000000000000000000000000000000000000000000000008da5cb5b000000000000000000000000ffffffffffffffffffffffffffffffffffffffff82b429000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000008000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000200000008000000000000000004e487b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000000000000000000001ffffffe000000000000000000000000000000000000000000000000000000003ffffffe000000000000000000000000000000000000000000000000000000000ffffffe090b8ec18000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffdf0649a8bb00000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00a4a816fee61a3243fb66202e438e53d8e057d64689087e8f5f2ae1c87687ec1
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.