1 way swap erc20


We have an ERC20 contract which is not burnable, and migrating to a new chain.

So far the new “swap” contract has a function to swap which checks the balance of the user and allowance before transferring to burn address, emitting a log of the burn with sender, amount and nonce (no use for the nonce so I may remove this)

Then we monitor the events and mint on the new chain.

Is this a reasonable approach? Appreciate any ideas or samples of other contracts like this to look at.

1 Like

Hi @taariq,

Welcome to the community :wave:.

With your proposed migration mechanism (one way bridge), your community have to trust that you will mint the appropriate tokens on the new chain. You may want to see what you could do to reduce the trust required.

You may want to look at how POA Networks Token bridge works: https://docs.tokenbridge.net/

I haven’t looked into how it works, though I have used it for small amounts moving Dai from mainnet to xDai network.

You could look for reputable projects that have migrated tokens across chains to see how they have done this. Sorry I haven’t got any more ideas.

For your migration mechanism, I recommend ensuring that you have appropriate testing and auditing.

Thanks for this, really useful, the erc20 to BNB bridge is very interesting, a lot more sophisticated than what we’re building.

As the project is community driven I believe there’ll be enough transparency to trust the one way bridge that simply burns, given as you say some audited and tested code that can be run to mint whenever needed.

1 Like