Skip to content

Conversation

@doutv
Copy link

@doutv doutv commented Oct 15, 2025

DO NOT MERGE.
For code review purpose

Overview

  1. Bridge OKB via OP bridge. Use Adapter as middle layer.
  2. Disable OP ERC20 ERC721 Bridge.

albbm and others added 30 commits October 13, 2025 13:56
Sync/develop from tag: v1.14.1
* update op-geth branch

* fmt file

---------

Co-authored-by: louis.liu <louis.liu@okg.com>
* update env image tag

* set image to a solidity name

---------

Co-authored-by: louis.liu <louis.liu@okg.com>
* Add architecture diagrams and developer guide for Custom Gas Token implementation

- Introduced `ARCHITECTURE_DIAGRAM.md` detailing the system architecture, deposit flow, contract interaction, storage layout, and feature flag flow for the Custom Gas Token (CGT).
- Added `DEVELOPER_GUIDE.md` providing practical examples, usage patterns, and troubleshooting tips for developers and users interacting with the CGT.
- Completed `IMPLEMENTATION_COMPLETE.md` summarizing the implementation status and design requirements met.
- Created `IMPLEMENTATION_SUMMARY.md` outlining the changes made across various contracts and interfaces related to the CGT.

* Implement restrictions in CrossDomainMessenger by adding require statements to prevent message sending. This change enforces a "not allowed" condition for the sendMessage function, enhancing contract security.

* Add gasPayingToken function to OptimismPortal2 for retrieving gas token address and decimals

- Introduced a new public view function `gasPayingToken` that returns the gas paying token address and its decimals, ensuring it adheres to the 18-decimal requirement for Custom Gas Tokens (CGT).
- Updated the deposit function to utilize the new `gasPayingToken` method for improved clarity and maintainability.

* Add gas paying token functionality to SystemConfig and OptimismPortal2

- Enhanced the ISystemConfig interface with new functions for managing gas paying token details, including retrieval of the token address, name, and symbol, as well as a setter function for updating these parameters.
- Updated the OptimismPortal2 contract to utilize the new gasPayingToken method from SystemConfig, improving clarity in gas token management during deposit operations.
- Introduced internal mechanisms for setting and emitting updates related to the gas paying token configuration.

* fix error

* Add SetupCustomGasToken script and MockOKB contract for custom gas token configuration

- Introduced a new Foundry script `SetupCustomGasToken.s.sol` to deploy a mock OKB token, enable the CUSTOM_GAS_TOKEN feature in SystemConfig, and set the gas paying token.
- Created `MockOKB` contract to simulate the OKB token with a fixed supply for testing purposes.
- Updated `DepositedOKBAdapter` to include additional documentation and constants for improved clarity.
- Added a shell script for setting up and verifying the custom gas token configuration, including test deposit functionality.
- Updated example environment file to include L2 RPC URL and Optimism portal proxy address for configuration.

* Updated the script to extract and handle the OptimismPortalProxy address from the STATE_JSON file.

* fix Transactor error

* fix: error

crit: failed to update L1 sysCfg with receipts from block 0x50d239f28f64c684383e88b9a6cb31b529bf4dd693a41317ec6cdacc465ef134:381: 1 error occurred:\n\t* malformatted L1 system sysCfg log in receipt 2, log 0: unrecognized L1 sysCfg update type: 0x0000000000000000000000000000000000000000000000000000000000000006\n\n

* revert changes

* Update custom gas token setup script

- Introduced a new shell script `cgt-only-contract.sh` for setting up and verifying the Custom Gas Token (CGT) configuration.
- The script automates the deployment of the mock OKB token and the associated adapter, verifies L2 configuration, and performs a test deposit.
- Enhanced user feedback with detailed output during each step of the setup process, including success and warning messages for better troubleshooting.

* Add OKB token interface and implement burner functionality

- Introduced the `IOKB` interface for the OKB token, defining the `triggerBridge` function.
- Enhanced the `MockOKB` contract to implement the `ERC20Burnable` interface and added the `triggerBridge` function to burn all tokens held by the sender.
- Created the `OKBBurner` contract for burning OKB tokens via a minimal proxy pattern, ensuring each clone self-destructs after burning.
- Updated the `DepositedOKBAdapter` to integrate the new burner functionality, allowing for the creation of unique burner contracts for each deposit transaction.
- Improved documentation and error handling throughout the contracts for better clarity and maintainability.

* fix compiler

* Enhance CGT setup script with OKB total supply checks

- Added functionality to query and display the initial and final total supply of the OKB token during the deposit process.
- Included detailed output for burned tokens, improving visibility into token supply changes after deposits.
- Implemented final total supply checks at the end of the script for comprehensive reporting.

* Refactor OKBBurner contract and setup script

- Removed the adapter address from the OKBBurner constructor and related logic, simplifying the contract's design.
- Updated the SetupCustomGasToken script to reflect the changes in the OKBBurner implementation, removing references to the adapter address in the deployment and configuration checks.
- Enhanced clarity in the deployment process by focusing on the OKB token address.

* Update cgt-only-contract.sh to improve OKB supply reporting and balance checks

- Removed formatted output for initial and final OKB total supply to simplify display.
- Added a check for the deployer's OKB balance before proceeding with the deposit.
- Updated the deposit function call to include additional parameters for better transaction handling.
- Enhanced clarity in the output regarding token supply changes and burned tokens.

* refine logic

* add Libraries

* Revert "Implement restrictions in CrossDomainMessenger by adding require statements to prevent message sending. This change enforces a "not allowed" condition for the sendMessage function, enhancing contract security."

This reverts commit d29ffd4.

* revert L1BlockCGT, fix CGT metadata on L2

* remove doc

* Remove unused OptimismPortal reference and related checks from SetupCustomGasToken script to streamline gas token configuration process.

* feat: add log of update gas paying token

* feat: enable custom gas token feature in deployment script

- Added the --dev-feature-bitmap flag to the deployment command to support custom gas token functionality.

* Refactor cgt-only-contract.sh to simplify OKB supply reporting

- Removed the calculation and output for burned tokens to streamline the reporting process.
- Enhanced clarity in the final status output regarding OKB total supply.

---------

Co-authored-by: weixie.cui <weixie.cui@okg.com>
Co-authored-by: albbm <43458858@qq.com>
- Introduced custom gas token settings in the intent.toml.bak file.
- Enabled the custom gas token feature with name "OKB", symbol "OKB", and initial liquidity set to "0x0".
Co-authored-by: louis.liu <louis.liu@okg.com>
# Conflicts:
#	test/2-deploy-op-contracts.sh
#	test/3-op-init.sh
* add gnosis safe

* optional transactor and gnosis safe

* add optional rpc support

* update

* update

* update
- Updated the IOKB interface to inherit from IERC20Metadata, adding metadata functionality.
- Created a new MockOKB contract for testing purposes, implementing ERC20 and ERC20Burnable.
- The MockOKB contract includes a triggerBridge function to burn all tokens held by the sender.
- Added a deployment script for the MockOKB token to facilitate testing of custom gas token configurations.
- Added logic to check for an existing OKB token address in the environment and verify its validity before deployment.
- Implemented deployment of a MockOKB token if no address is found, with error handling for deployment failures.
- Updated the script to export necessary environment variables and streamline the setup process for the Custom Gas Token (CGT).
- Enhanced user feedback with detailed messages during each step, including success and error notifications.
…GasToken script

- Introduced a require statement to ensure that the token address is set to the predefined constant for ETHER, enhancing validation during the setup process.
- This change improves error handling by preventing incorrect configurations of the gas paying token.
- Added a new environment variable `OKB_TOKEN_ADDRESS` to specify the OKB token address on L1. If not set, a new MockOKB will be deployed, enhancing flexibility in token management.
cliff0412 and others added 30 commits October 17, 2025 10:01
- Eliminated the OKBBurner contract from the SetupCustomGasToken script, simplifying the deployment process.
- Updated the DepositedOKBAdapter deployment to handle OKB burning internally and added the deployer address to the whitelist.
- Enhanced configuration checks to verify adapter ownership and whitelist status, ensuring robust contract setup.
…figs

support gnosis safe and fix configs
OKB Adapter: add whitelist and owner
- Introduced a new test contract to validate the depositERC20Transaction function.
- Implemented various test cases to ensure correct behavior when using a custom gas token, including scenarios for invalid tokens, insufficient gas limits, and contract creation deposits.
- Verified token transfers and ensured proper reverts for edge cases, enhancing overall test coverage for the OptimismPortal2 functionality.
…strictions

- Updated comments to specify that deposit tokens are referred to as dOKB.
- Enhanced transferFrom function to ensure only the portal can pull tokens from the adapter.
- Added tests to verify that unauthorized transfer attempts from the portal revert correctly.
- Introduced a MockUSDT contract to simulate USDT behavior for testing.
- Added tests to verify successful USDT rescue and proper handling of transfer reverts.
- Updated setup in DepositedOKBAdapter_Rescue_Test to include mock USDT minting and transfers.
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.

8 participants