8000 Missing ERC20 Functionality · Issue #124 · base/op-viem · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Missing ERC20 Functionality #124
Open
@roninjin10

Description

@roninjin10

Context

The following functionality is missing from the ERC20 story

Major missing functionality

  • Add native l2 tokens support- Native l2 tokens require using one of the bridgeERC20 methods rather than a withdraw. Withdraw is only for mintable tokens not native tokens
  • Deposit token is unsafe - It's easy to lose tokens depositing with the current method because no validation is happening to validate the token is bridgable. At a minimum we should documenting this. Note this is kinda tricky. Validating a mintable token withdrawal is simple since it's all done on l2. Validating an l1 deposit matches l2 is less simple as it requires an l2 public client. The correct solution for now is to document it until higher level multiclient aware abstractions are made
  • No legacy withdrawal support - Prebedrock withdrawals on OP mainnet do not have any support. Pre bedrock withdrawals are not 1559 therefore require extra work to get working encoding and decoding.

Minor missing functionality

  • Add documentation about how to reliably get the bridge and token info from a token address - To use the erc20 bridge well one should be getting the l1 and l2 token info and the bridge info from the l2 token or from the tokenlist
// example
const l2BridgeAddress = l2MintableToken.l2Bridge()
const l1TokenAddress = l2MintableToken.l1Token()

client.withdrawERC20({
  ...sameOptionsAsBefore,
  address: l2BridgeAddress,
  • Add action for getting token info - It would be nice if viem had a native way of getting stuff like the bridge address and matching token too

  • No preregensis support - preregenisis are before the version of optimism that was before bedrock. My suggestion is to not support this completely but simply add a single sentence to the docs about this not being supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0