zeta-chain / node

ZetaChain’s blockchain node and an observer validator client
https://zetachain.com
MIT License
167 stars 109 forks source link

Whitelisting of ERC20 tokens #686

Closed fadeev closed 1 year ago

fadeev commented 1 year ago

Multiple steps in terms of transactions.

Update:

  1. Edit the foreign coins structure.
  2. In the contracts, we have ERC20Custody, need to whitelist there.

Strange things may happen if these things don't happen atomically.

Pass a gov proposal or group policy on ZetaChain to whitelist an asset on a particular. This will add to the foreign coins struct. On a connected chain, custody contract needs to whitelist an ERC20. Need to make this atomic, so that nothing happens in between these two steps. Third step: activate on ZetaChain.

Proposed solution

### Tasks
- [ ] add: zetaclient ERC20Custody whitelist methods
- [ ] add: whitelisting zetacore flow
- [ ] add: whitelisting zetaclient flow

Make it possible to whitelist ERC-20 tokens, but not sure how automated it should be.

Manual whitelisting is good enough.

"Automated" after it passes a gov proposal.

aldapp7 commented 1 year ago

@brewmaster012 as it can be classified as CCTX I'm think to avoid making current zetaclient and crosschain flow more complex - to just add special case for CCTX by putting "whitelist" into message, which it will be parsed in zetaclient and sent to ERC20Custody contract.

brewmaster012 commented 1 year ago

@aldapp7 I think that's viable. Would you elaborate on your plans to do the rest of the pieces: governance/policy txs that add new foreign coins; if the foreign coin is ERC20 then it triggers a CCTX to whitelist in ERC20Custody contract; the whitelist tx confirmation bit.

cc @kingpinXD : i think it's possible to write a new Msg type & handler and authenticate both Governance proposal and policy group to do this right?

aldapp7 commented 1 year ago

@brewmaster012 I think it should be possible to just execute it as transaction included in a governance proposal, because I guess governance proposal is a common scheme to execute voted transactions and can execute any transactions doesn't matter the content right @kingpinXD?