harmony-one / ethhmy-bridge.frontend

Ethereum<>Harmony two way bridge (trusted version) - frontend part
25 stars 62 forks source link

Bridging secondary tokens #76

Closed gupadhyaya closed 3 years ago

gupadhyaya commented 3 years ago

Certain ERC20 contracts like RottonToken https://etherscan.io/address/0xd04785c4d8195e4a54d9dec3a9043872875ae9e2#code burns a portion of the original tokens for every transfer and also mints equivalent amount of burned tokens in the secondary tokens, which is then also sent to the recipient. For example: when a user locks 100,000 ROT tokens, 97500 ROT tokens gets transferred to the bridge manager (2.5% burned) and also 2500 MAGGOT tokens gets transferred to the bridge manager.

Currently, the bridge only mints the original tokens, i.e., 97500 1ROT to the user, however it should also automatically bridge 2500 1MAGGOT tokens to the user.

To accomplish this, the lockToken events call be processed. For example, https://etherscan.io/tx/0x88fb98c4991a149fbbfb800d7562c843b100785e0818fef52a7d672e8c562bea locks 100,000 ROT tokens, emitting two Transfer (index_topic_1 address from, index_topic_2 address to, uint256 value) events, recognizable through topic 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.

Screen Shot 2021-03-11 at 8 02 26 PM Screen Shot 2021-03-11 at 8 02 10 PM

For every such lockToken calls, the bridge backend should capture the secondary token transfer events and initiate bridging of those secondary tokens via another Multisig step.

potvik commented 3 years ago

Done