Skip to content

Conversation

@sledro
Copy link
Member

@sledro sledro commented Jun 10, 2025

  • This PR is branched off op-contracts/v3.0.0
  • It introduces a new predeploy GasStation.sol
  • The L2Genesis script is modified to generate the new predeploy alloc as a proxy
  • To deploy this release, we can forge build the artifacts and point op-deployer to them

sledro added 5 commits June 10, 2025 18:06
- Changed Solidity version to 0.8.25.
- Added interfaces for ERC20 and burnable ERC20 tokens.
- Introduced a new storage structure for GasStation.
- Enhanced contract registration with admin management and credit packages.
- Implemented functions for credit management, including purchasing, adding, and removing credits.
- Added modifiers for access control and validation.
- Included events for better tracking of contract activities.
- Improved error handling with custom errors for gas efficiency.
- Added support for single-use gasless transactions, including a new state variable and mapping to track used addresses.
- Introduced functions to check if an address has used gasless transactions and to configure single-use mode for contracts.
- Implemented an event to signal changes in single-use status.
- Updated existing functions to accommodate the new single-use feature.
…redeploys library

- Added GasStation address and related functionality to the Predeploys library.
- Updated L2Genesis contract to handle GasStation separately for proxy management.
- Implemented a dedicated method for setting the GasStation predeploy in the initialization process.
- Updated the notProxied function in the Predeploys library to exclude the GasStation address from the check, streamlining the proxy management process for predeploys.
@sledro sledro changed the title Add support for gasless system Add GasStation predeploy Jun 10, 2025
sledro added 12 commits June 11, 2025 17:02
- Updated the isPredeployNamespace function to include a special case for the GasStation address, ensuring it is correctly recognized as part of the predeploy namespace. This change enhances the proxy management for the GasStation predeploy.
- Integrated ReentrancyGuard into the GasStation contract to prevent reentrant calls on critical functions.
- Applied the nonReentrant modifier to purchaseCredits, withdrawETH, and other relevant functions to improve security.
- Updated the withdrawTokens function to improve clarity and efficiency by removing redundant checks for ETH withdrawal.
- Enhanced error handling by introducing a revert for zero address cases.
- Maintained functionality for ERC20 token withdrawals while ensuring proper balance checks and transfer handling.
…urchase

- Updated the registerContract function to require a credit package purchase during registration, ensuring contracts are registered only after successful credit acquisition.
- Introduced an internal _purchaseCredits function to handle credit validation and payment processing.
- Emitted CreditsPurchased events to track credit transactions associated with contract registrations.
- Introduced a new test file for the GasStation contract, covering various functionalities including contract registration, credit management, and admin configuration.
- Implemented tests for constructor behavior, credit package management, and event emissions to ensure contract integrity.
- Enhanced coverage with edge case scenarios and reentrancy protection checks to validate contract security and performance.
…tionality

- Modified event signatures in the GasStation contract to include additional parameters for better tracking of actions, such as the user initiating the action.
- Updated the test suite to reflect changes in event emissions, ensuring comprehensive coverage of new event signatures.
- Enhanced clarity in event logging for contract management, credit transactions, and administrative actions.
- Modified test functions in GasStationTest to include the view modifier for better clarity and to reflect their read-only nature.
- Ensured that the tests maintain their functionality while adhering to best practices for Solidity function visibility.
- Changed the test_constructor_setsDAO function in GasStationTest to include the view modifier, clarifying its read-only nature.
- Ensured the test continues to validate the correct initialization of the DAO and package ID.
…tructor

- Added the GasStation contract import to L2Genesis and modified the setGasStation function to initialize the GasStation instance with the DAO address.
- Updated the GasStation contract to use an initializer instead of a constructor, enhancing its proxy compatibility.
- Adjusted the GasStationTest to deploy the GasStation via a proxy and validate the initialization process, ensuring proper handling of zero address cases.
…age reference

- Changed the GAS_STATION_STORAGE_LOCATION constant in the GasStation contract to ensure accurate storage location for gas station data.
- This update is crucial for maintaining the integrity of the contract's storage layout and ensuring proper functionality.
- Simplified the initialize function in the GasStation contract by removing the validAddress modifier, as the address is now directly set in storage.
- This change streamlines the initialization process while maintaining the integrity of the contract's functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants