Replies: 10 comments 30 replies
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
-
Hey Mark! We want to thank you for initiating the discussion thread. At Wonderland, we are excited to contribute to the research and development of the OP Stack Custom Gas Token. We have devised a possible solution to help chain operators address the batcher cost issue and use any ERC20 that adheres to the specified criteria as a gas token without making significant changes to the OP Stack.
1. Modifying the
|
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
Following the instructions here and using base withdrawer, we set up a testnet (commit) with custom gas token. We also completed deposit (L1 ERC20 => L2 Gas) and withdraw (L2 Gas => L1 ERC20). The following are the notes to help reproduce the steps: # check balance and allowance on L1
cast call $GAS_TOKEN_ADDRESS "balanceOf(address)" $TEST_ADDRESS --rpc-url=$L1_RPC_URL
cast call $GAS_TOKEN_ADDRESS "allowance(address,address)" $TEST_ADDRESS $PORTAL_ADDRESS --rpc-url=$L1_RPC_URL
# check native balance on L2
cast balance $TEST_ADDRESS --rpc-url=$L2_RPC_URL
# initiate deposit via bridge
cast send $PORTAL_ADDRESS "depositERC20Transaction(address _to,uint256 _mint,uint256 _value,uint64 _gasLimit,bool _isCreation,bytes memory _data)" $TEST_ADDRESS 1000000000000000000 1000000000000000000 100000 false 0x --private-key=$TEST_PRIVATE_KEY --rpc-url=$L1_RPC_URL
# upon success, the ERC20 gas token should be transferred to the portal via etherscan
# wait for a few seconds and check if the token is received and reflected on native balance on L2
cast balance $TEST_ADDRESS --rpc-url=$L2_RPC_URL
# initiate withdrawal
cast send --value 1234567890 0x4200000000000000000000000000000000000016 "initiateWithdrawal(address _target, uint256 _gasLimit, bytes memory _data)" $TEST_ADDRESS 50000 0x --private-key=$TEST_PRIVATE_KEY --rpc-url=$L2_RPC_URL
# this will return a successful tx and its L2 block number
# check if the L2 block is included in L1 and it is finalized
cast call $OUTPUT_ORALCE_ADDRESS "latestBlockNumber()" --rpc-url $L1_RPC_URL
# send a tx to prove the withdrawal
withdrawer \
--l2-rpc $L2_RPC_URL \
--l2oo-address $OUTPUT_ORACLE_ADDRESS \
--portal-address $PORTAL_ADDRESS \
--withdrawal <tx hash> \
--rpc $L1_RPC_URL \
--private-key ${TEST_PRIVATE_KEY#0x}
# withdraw the actual token (same command)
withdrawer \
--l2-rpc $L2_RPC_URL \
--l2oo-address $OUTPUT_ORACLE_ADDRESS \
--portal-address $PORTAL_ADDRESS \
--withdrawal <tx hash> \
--rpc $L1_RPC_URL \
--private-key ${TEST_PRIVATE_KEY#0x}
|
Beta Was this translation helpful? Give feedback.
-
One improvement to the user experience for the custom gas token feature is to simplify the process of bridging L1 ETH to L2 ERC20. Currently, since directly bridging ETH is prohibited (see code), ETH must first be converted to WETH before bridging via depositERC20. This requires users to sign multiple transactions. We propose simplifying this process by consolidating these multiple transactions into a single transaction that atomically wraps ETH and then calls depositERC20. |
Beta Was this translation helpful? Give feedback.
-
To confirm, the Custom Gas Token feature does not support fault proofs. Is that right? |
Beta Was this translation helpful? Give feedback.
-
Upon careful examination of the Custom Gas Token design proposals and consideration of aforementioned discussions, we have noted a few areas that may benefit from further refinement:
We try to propose to solve the questions.
Involve tokenRatioIn our proposal, we do not need to modify the gas cost, but only need to make changes when verifying and adding/subtracting the balance.
Note Regarding the adaptation of Wallets and SDK, the return of Modifying bridge contractThe ether is handled similarly to previous ERC20 tokens, where all assets are held within the To distinguish the deposit method for CGToken from other ERC20 tokens, we will prohibit operations on CGToken within the On L2, we will modify the |
Beta Was this translation helpful? Give feedback.
-
Hello Introducing opstack-kit a tool designed for faster, more efficient development. Just install it with:
|
Beta Was this translation helpful? Give feedback.
-
This is meant to be an open discussion board for OP Stack Custom Gas Token.
Custom gas token has been released at op-contracts/v2.0.0-beta.2
Open Source Bridge UI
The Custom Gas Token feature is a Beta feature of the MIT licensed OP Stack. While it has received initial review from core contributors, it is still undergoing testing, and may have bugs or other issues.
FAQ
How to Deposit on a Custom Gas Token Chain
There is a new function added to the
OptimismPortal
called depositERC20Transaction. It uses theapprove
/transferFrom
flow, so you must have already calledapprove
on the appropriate ERC20 contract.How to Withdraw from a Custom Gas Token Chain
Using the
L2StandardBridge
will not work when withdrawing native asset on a custom gas token chain. TheL2ToL1MessagePasser
must be used directly. Call the initiateWithdrawal function to kick off a withdrawal on the L2 side. Viem, the deprecated sdk and Base's withdrawer tool can all be used to finalize the withdrawal on L1.How Do Fees Work
The initial release of custom gas token does not have special logic for taking into account the exchange rate between the custom gas token and ether. This logic is nice to have because it requires ether to purchase data availability for Ethereum. If the chain is earning in a custom gas token and spending in ether, then it must earn enough custom gas token such that it can be sold for ether.
For the initial release of custom gas token, the chain operator will need to manage this either out of band or by manually tuning the fee parameters to ensure profitability. A future release may include L1 Fee Abstraction where the L1 fee is calculated in a smart contract instead of native code. This would enable an on chain oracle to take into account the exchange rate of the custom gas token. This oracle could be something like Uniswap TWAP or Chainlink
Beta Was this translation helpful? Give feedback.
All reactions