How to transfer ERC20 Token to Native Token ? #481
-
We have a ERC20 Token on Ethereum. Now, Our use case is we need to get this ERC20 Token for holders to get transferred/swapped to a Native Token of Polygon-Edge SideChain. By Native Token, I mean that the general token generated by Polygon-Edge Sidechain and which is represented as ETH internally. What I understand from this ERC20 Token Transfer doc is that, we can transfer ERC20 Token in b/w chains. But I wonder,
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 1 reply
-
@spunkyshooter Thank you for your question.
|
Beta Was this translation helpful? Give feedback.
-
@Kourin1996 Thanks for the reply. Hope I got it right, Correct me, If I am wrong. Lets say, we have ABC Native Token on Polygon-Edge and SPRING ERC20 Token on Ethereum. I understand that if a User needs ABC Native token, Contract can transfer it to them. But, this doesn't solve the use case of swapping from SPRING to ABC right, In order for that to work, SPRING has to be burnt on Ethereum and Native Token has to be minted on Polygon-Edge. Can you please suggest how do we achieve this if not supported by Polygon-Edge ? |
Beta Was this translation helpful? Give feedback.
-
@spunkyshooter I'm afraid I couldn't follow what you said. Currently, there is no way to mint new native tokens on Edge, except for premined accounts. I said that you could release native tokens from contract on Edge with ChainBridge. And if you want to send back tokens to Ethereum, you can lock native tokens into the contract on Edge again. |
Beta Was this translation helpful? Give feedback.
-
Right, I understand both points. To reiterate, Our use case is to transfer ERC20 Token on Ethereum to Native Token on Polygon-Edge I believe we can achieve this in 2 steps:
I think we need 2-way peg mechanism to achieve it similar to ChainBridge. But I don't think ChainBridge supports our use case. My concern, I don't want to rebuild if there is some existing solution for our use case, I came across this, https://github.com/maticnetwork/matic.js I understand that Matic Bridge does exactly similar to what we need, i.e transferring MATIC ERC20 on Ethereum chain to MATIC Native token on Polygon. So are you aware of any such existing solution which we can use for polygon-edge ? |
Beta Was this translation helpful? Give feedback.
-
@spunkyshooter Please note ChainBridge supports bidirectional bridging. I checked MATIC token on Polygon side quickly. It's a native token that implements ERC20 interface on Bor chain. (Bor is the processing chain in Polygon). So Polygon has Matic Token Contract that implements ERC20 interface, holds Native Token, releases native tokens by bridging event. So I don't think they use difficult technics for ERC20-Native token bridge and you can implement a similar one with ChainBridge. |
Beta Was this translation helpful? Give feedback.
-
@spunkyshooter Please check this for more details https://docs.polygon.technology/docs/contribute/bor/core_concepts/#matic-erc20-token |
Beta Was this translation helpful? Give feedback.
-
@Kourin1996 Thanks a lot for pointing me in the right direction. I was going through the docs of ChainBridge and found this section ERC20 ⇒ Substrate Native Token Meanwhile the commands are same as shown on ERC20 Token Transfer of polygon-edge docs except few additional parameters. I wanted to try whether we can transfer ERC20 => Native Token for clarifying my doubt. I am stuck at approving step, it shows Anyways, Do you think this could solve our use case ? Any thoughts ? |
Beta Was this translation helpful? Give feedback.
-
ChainBridge bridges arbitrary bytes by multiple relayers's votes basically. So if the contract in destination chain can handle native token transfer, then you can handle Native Token on Bridge, in principal. I think briding is done in the same way on SubStarate. I can't explain and advise you in detail because I've not read ChainBridge integration into Substrate and also I'm not familiar with SubStrate as well. |
Beta Was this translation helpful? Give feedback.
@spunkyshooter Thank you for your question.