starknet-io / starkgate-frontend

Bridge interface allows users to transfer ERC20 tokens from Ethereum to StarkNet and vice versa.
https://starkgate.starknet.io
Apache License 2.0
148 stars 84 forks source link

Support the newest StarknetTokenBridge besides LegacyBridge #337

Open 9oelM opened 5 months ago

9oelM commented 5 months ago

Is your feature request related to a problem? Please describe. Hi, I'm Joel from @zkLend. As you might already know, the current version of Starkgate frontend and backend does not support StarknetTokenBridge (aka MultiBridge). It seems that ZEND is the only token that possibly uses this bridge extensively for now. But as Starknet grows, there will be more tokens that will need to use StarknetTokenBridge in the future. I mean, it is designed to replace the LegacyBridge, so we need to support the newest StarknetTokenBridge on Starkgate right?

Describe the solution you'd like First, a few changes need to be made to the frontend because it only supports interaction with LegacyBridge. The arguments and the function names would be a bit different for StarknetTokenBridge because it is meant to support various tokens unlike the LegacyBridge that only supports one token per bridge deployed. For example, a call towithdraw(uint256 amount, address recipient) should change to withdraw(address token, uint256 amount, address recipient), and initiate_withdraw should change to initiate_token_withdraw, and so on.

Then, the existing indexer that is hosted at https://starkgate.starknet.io/transfer-log/api/* would also need to support indexing events from StarknetTokenBridge and the corresponding L2 bridge, because the indexer seems to only pick up events from the existing LegacyBridges.

To facilitate the usage of ZEND token across L1 and L2, a fork has been made at https://github.com/zkLend/zend-bridge with a permission from Starknet and the relevant changes were created here to enable the transfer bilaterally. But it is only meant to be a temporary measure and we would ideally want MultiBridge to be supported at https://starkgate.starknet.io/.

On a related note, @0xSpaceShard team might also want to work on the automatic withdrawal of tokens that use StarknetTokenBridge, as their one-click withdrawal only seems to work with the tokens using LegacyBridge based on some tests I've done.