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

feat(evmutil): implement MsgConvertCosmosCoinFromERC20 #1609

Merged
merged 7 commits into from
Jun 2, 2023

Conversation

pirtleshell
Copy link
Member

Description

Adds message server implementation for MsgConvertCosmosCoinToERC20, with tests & spec updates.

Checklist

  • Changelog has been updated as necessary.

@@ -54,6 +54,8 @@ Only Cosmos co-chain denominations that are in the `AllowedCosmosDenoms` param (

The ERC20 contracts are deployed and managed by x/evmutil. The contract is deployed on first convert of the coin. Once deployed, the addresses of the contracts can be queried via the `DeployedCosmosCoinContracts` query (`deployed_cosmos_coin_contracts` endpoint).

If a denom is removed from the `AllowedCosmosDenoms` param, existing ERC20 tokens can be converted back to the underlying sdk.Coin via `MsgConvertCosmosCoinFromERC20`, but no conversions from sdk.Coin -> ERC via `MsgConvertCosmosCoinToERC20` are allowed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a test for this expected behaviour? Might be good to include if not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, i've added a test of the full flow, including re-enabling the coin using the original contract address:
https://github.com/Kava-Labs/kava/pull/1609/files#diff-b41fd85eddf7b0e552e3551ed6991584ba52d5d9e7605f76facbb676139dadf1R654-R659

Copy link
Member

@nddeluca nddeluca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Base automatically changed from rp-convert-evm-to-sdk to master June 2, 2023 19:37
Comment on lines +654 to +659
// the test verifies the behavior for when a denom is removed from the params list
// after conversions have been made:
// - it should prevent more conversions from sdk -> evm for that denom
// - existing erc20s should be allowed to get converted back to a sdk.Coins
// - allowing the denom again should use existing contract
func (suite *MsgServerSuite) TestConvertCosmosCoinForRemovedDenom() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition here 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that last case of re-enabled when reviewing

@pirtleshell pirtleshell merged commit f4b8bf8 into master Jun 2, 2023
@pirtleshell pirtleshell deleted the rp-convert-evm-to-sdk-msg branch June 2, 2023 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants