Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite ZRC20 to allow setting Gateway address #279

Closed
Tracked by #258
lumtis opened this issue Aug 1, 2024 · 0 comments · Fixed by #281
Closed
Tracked by #258

Rewrite ZRC20 to allow setting Gateway address #279

lumtis opened this issue Aug 1, 2024 · 0 comments · Fixed by #281
Assignees
Labels
v2 New smart contract version

Comments

@lumtis
Copy link
Member

lumtis commented Aug 1, 2024

Rewrite the ZRC20 contract and add the Gateway address part of its data.

  • Add a gatewayAddress as part of its field

    • WARNING: we will upgrade the contract bytecode with MsgUpdateBytecode, we must carefully ensure we add a new field and we don't modify any of the existing field
  • Add a updateGatewayAddress callable by fungible address

  • Add gatewayAddress checks in deposit as the Gateway will be authorized to perform deposit to contracts.

To consider:

  • Solve some of the discrepancies we have in the contract like the non-constant field in all uppercase. Changing field name should not create any issues for bytecode upgrades.

Note: in the future we will proceed with a full refactoring of the ZRC20 contract with complete migration. Here we can give gateway privilege to deposit because we don't have arbitrary smart contract calls from gateway. In the future, when implementing arbitrary smart contract call on ZetaChain from Gateway, similar to EVM, privilege will need to be removed from the gateway like deposit. There will therefore be a full refactoring to do with new ZRC20 contracts. We will also in the future use OpenZeppelin for the ERC20 which is a better practice. Now let's just rewrite the current contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 New smart contract version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants