update new names, NativeCoin -> CosmosCoin (#1596)

* rename contract NativeCoin -> CosmosCoin

* rename all entities NativeCoin -> CosmosCoin

* update changelog

* update protonet genesis.json
This commit is contained in:
Robert Pirtle 2023-05-23 12:32:27 -07:00 committed by GitHub
parent 61c3aa090b
commit d4cbc759f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 472 additions and 470 deletions

View File

@ -18,9 +18,10 @@ jobs:
- run: make check-proto-deps
- run: make check-proto-lint
- run: make check-proto-format
- run: make check-proto-breaking-remote
- run: BUF_CHECK_BREAKING_AGAINST_REMOTE="branch=$GITHUB_BASE_REF" make check-proto-breaking-remote
if: github.event_name == 'pull_request'
# TODO: reenable me after merge of Native -> Cosmos name change committed to master.
# - run: make check-proto-breaking-remote
# - run: BUF_CHECK_BREAKING_AGAINST_REMOTE="branch=$GITHUB_BASE_REF" make check-proto-breaking-remote
# if: github.event_name == 'pull_request'
- run: make check-proto-gen
- run: make check-proto-gen-doc
- run: make check-proto-gen-swagger

View File

@ -37,8 +37,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [Unreleased]
## Features
- (evmutil) [#1590] Add allow list param of sdk native denoms that can be transferred to evm
- (evmutil) [#1591] Configure module to support deploying ERC20KavaWrappedNativeCoin contracts
- (evmutil) [#1590] & [#1596] Add allow list param of sdk native denoms that can be transferred to evm
- (evmutil) [#1591] & [#1596] Configure module to support deploying ERC20KavaWrappedCosmosCoin contracts
## [v0.23.0]
@ -241,6 +241,7 @@ the [changelog](https://github.com/cosmos/cosmos-sdk/blob/v0.38.4/CHANGELOG.md).
- [#257](https://github.com/Kava-Labs/kava/pulls/257) Include scripts to run
large-scale simulations remotely using aws-batch
[#1596]: https://github.com/Kava-Labs/kava/pull/1596
[#1591]: https://github.com/Kava-Labs/kava/pull/1591
[#1590]: https://github.com/Kava-Labs/kava/pull/1590
[#1568]: https://github.com/Kava-Labs/kava/pull/1568

View File

@ -2004,7 +2004,7 @@
"evmutil": {
"accounts": [],
"params": {
"allowed_native_denoms": [],
"allowed_cosmos_denoms": [],
"enabled_conversion_pairs": [
{
"kava_erc20_address": "0xBb304f44b7EFD865361F2AD973d8ebA433893ABC",

View File

@ -5,10 +5,10 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title An ERC20 token contract owned and deployed by the evmutil module of Kava.
/// Tokens are backed one-for-one by sdk coins held in the module account.
/// Tokens are backed one-for-one by cosmos-sdk coins held in the module account.
/// @author Kava Labs, LLC
/// @custom:security-contact security@kava.io
contract ERC20KavaWrappedNativeCoin is ERC20, Ownable {
contract ERC20KavaWrappedCosmosCoin is ERC20, Ownable {
/// @notice The decimals places of the token. For display purposes only.
uint8 private immutable _decimals;

View File

@ -12,7 +12,7 @@
"clean": "hardhat clean",
"compile": "hardhat compile",
"coverage": "hardhat coverage",
"ethermint-json": "jq '{ abi: .abi | tostring, bin: .bytecode | ltrimstr(\"0x\")}' artifacts/contracts/ERC20KavaWrappedNativeCoin.sol/ERC20KavaWrappedNativeCoin.json > ../x/evmutil/types/ethermint_json/ERC20KavaWrappedNativeCoin.json",
"ethermint-json": "jq '{ abi: .abi | tostring, bin: .bytecode | ltrimstr(\"0x\")}' artifacts/contracts/ERC20KavaWrappedCosmosCoin.sol/ERC20KavaWrappedCosmosCoin.json > ../x/evmutil/types/ethermint_json/ERC20KavaWrappedCosmosCoin.json",
"gen-ts-types": "hardhat typechain",
"lint": "eslint '**/*.{js,ts}'",
"lint-fix": "eslint '**/*.{js,ts}' --fix",

View File

@ -5,10 +5,10 @@ async function main() {
const tokenSymbol = "kATOM";
const tokenDecimals = 6;
const ERC20KavaWrappedNativeCoin = await ethers.getContractFactory(
"ERC20KavaWrappedNativeCoin"
const ERC20KavaWrappedCosmosCoin = await ethers.getContractFactory(
"ERC20KavaWrappedCosmosCoin"
);
const token = await ERC20KavaWrappedNativeCoin.deploy(
const token = await ERC20KavaWrappedCosmosCoin.deploy(
tokenName,
tokenSymbol,
tokenDecimals

View File

@ -2,21 +2,21 @@ import { expect } from "chai";
import { Signer } from "ethers";
import { ethers } from "hardhat";
import {
ERC20KavaWrappedNativeCoin,
ERC20KavaWrappedNativeCoin__factory as ERC20KavaWrappedNativeCoinFactory,
ERC20KavaWrappedCosmosCoin,
ERC20KavaWrappedCosmosCoin__factory as ERC20KavaWrappedCosmosCoinFactory,
} from "../typechain-types";
const decimals = 6n;
describe("ERC20KavaWrappedNativeCoin", function () {
let erc20: ERC20KavaWrappedNativeCoin;
let erc20Factory: ERC20KavaWrappedNativeCoinFactory;
describe("ERC20KavaWrappedCosmosCoin", function () {
let erc20: ERC20KavaWrappedCosmosCoin;
let erc20Factory: ERC20KavaWrappedCosmosCoinFactory;
let owner: Signer;
let sender: Signer;
beforeEach(async function () {
erc20Factory = await ethers.getContractFactory(
"ERC20KavaWrappedNativeCoin"
"ERC20KavaWrappedCosmosCoin"
);
erc20 = await erc20Factory.deploy("Wrapped ATOM", "ATOM", decimals);
[owner, sender] = await ethers.getSigners();

View File

@ -247,7 +247,7 @@
- [Msg](#kava.earn.v1beta1.Msg)
- [kava/evmutil/v1beta1/conversion_pair.proto](#kava/evmutil/v1beta1/conversion_pair.proto)
- [AllowedNativeCoinERC20Token](#kava.evmutil.v1beta1.AllowedNativeCoinERC20Token)
- [AllowedCosmosCoinERC20Token](#kava.evmutil.v1beta1.AllowedCosmosCoinERC20Token)
- [ConversionPair](#kava.evmutil.v1beta1.ConversionPair)
- [kava/evmutil/v1beta1/genesis.proto](#kava/evmutil/v1beta1/genesis.proto)
@ -264,10 +264,10 @@
- [kava/evmutil/v1beta1/tx.proto](#kava/evmutil/v1beta1/tx.proto)
- [MsgConvertCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCoinToERC20)
- [MsgConvertCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCoinToERC20Response)
- [MsgConvertCosmosCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20)
- [MsgConvertCosmosCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response)
- [MsgConvertERC20ToCoin](#kava.evmutil.v1beta1.MsgConvertERC20ToCoin)
- [MsgConvertERC20ToCoinResponse](#kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse)
- [MsgConvertNativeCoinToERC20](#kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20)
- [MsgConvertNativeCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20Response)
- [Msg](#kava.evmutil.v1beta1.Msg)
@ -3661,18 +3661,18 @@ Msg defines the earn Msg service.
<a name="kava.evmutil.v1beta1.AllowedNativeCoinERC20Token"></a>
<a name="kava.evmutil.v1beta1.AllowedCosmosCoinERC20Token"></a>
### AllowedNativeCoinERC20Token
AllowedNativeCoinERC20Token defines allowed sdk denom & metadata
### AllowedCosmosCoinERC20Token
AllowedCosmosCoinERC20Token defines allowed cosmos-sdk denom & metadata
for evm token representations of sdk assets.
NOTE: once evm token contracts are deployed, changes to metadata for a given
sdk_denom will not change metadata of deployed contract.
cosmos_denom will not change metadata of deployed contract.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sdk_denom` | [string](#string) | | Denom of the sdk.Coin |
| `cosmos_denom` | [string](#string) | | Denom of the sdk.Coin |
| `name` | [string](#string) | | Name of ERC20 contract |
| `symbol` | [string](#string) | | Symbol of ERC20 contract |
| `decimals` | [uint32](#uint32) | | Number of decimals ERC20 contract is deployed with. |
@ -3756,7 +3756,7 @@ Params defines the evmutil module params
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `enabled_conversion_pairs` | [ConversionPair](#kava.evmutil.v1beta1.ConversionPair) | repeated | enabled_conversion_pairs defines the list of conversion pairs allowed to be converted between Kava ERC20 and sdk.Coin |
| `allowed_native_denoms` | [AllowedNativeCoinERC20Token](#kava.evmutil.v1beta1.AllowedNativeCoinERC20Token) | repeated | allowed_native_denoms is a list of denom & erc20 token metadata pairs. if a denom is in the list, it is allowed to be converted to an erc20 in the evm. |
| `allowed_cosmos_denoms` | [AllowedCosmosCoinERC20Token](#kava.evmutil.v1beta1.AllowedCosmosCoinERC20Token) | repeated | allowed_cosmos_denoms is a list of denom & erc20 token metadata pairs. if a denom is in the list, it is allowed to be converted to an erc20 in the evm. |
@ -3857,6 +3857,33 @@ MsgConvertCoinToERC20Response defines the response value from Msg/ConvertCoinToE
<a name="kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20"></a>
### MsgConvertCosmosCoinToERC20
ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `initiator` | [string](#string) | | Kava bech32 address initiating the conversion. |
| `receiver` | [string](#string) | | EVM hex address that will receive the ERC20 tokens. |
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Amount is the sdk.Coin amount to convert. |
<a name="kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response"></a>
### MsgConvertCosmosCoinToERC20Response
MsgConvertCosmosCoinToERC20Response defines the response value from Msg/MsgConvertCosmosCoinToERC20.
<a name="kava.evmutil.v1beta1.MsgConvertERC20ToCoin"></a>
### MsgConvertERC20ToCoin
@ -3885,33 +3912,6 @@ Msg/MsgConvertERC20ToCoin.
<a name="kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20"></a>
### MsgConvertNativeCoinToERC20
ConvertNativeCoinToERC20 defines a conversion from native sdk.Coin to ERC20.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `initiator` | [string](#string) | | Kava bech32 address initiating the conversion. |
| `receiver` | [string](#string) | | EVM hex address that will receive the ERC20 tokens. |
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | Amount is the sdk.Coin amount to convert. |
<a name="kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20Response"></a>
### MsgConvertNativeCoinToERC20Response
MsgConvertNativeCoinToERC20Response defines the response value from Msg/MsgConvertNativeCoinToERC20.
<!-- end messages -->
<!-- end enums -->
@ -3928,7 +3928,7 @@ Msg defines the evmutil Msg service.
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `ConvertCoinToERC20` | [MsgConvertCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCoinToERC20) | [MsgConvertCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCoinToERC20Response) | ConvertCoinToERC20 defines a method for converting sdk.Coin to Kava ERC20. | |
| `ConvertERC20ToCoin` | [MsgConvertERC20ToCoin](#kava.evmutil.v1beta1.MsgConvertERC20ToCoin) | [MsgConvertERC20ToCoinResponse](#kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse) | ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin. | |
| `ConvertNativeCoinToERC20` | [MsgConvertNativeCoinToERC20](#kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20) | [MsgConvertNativeCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20Response) | ConvertNativeCoinToERC20 defines a method for converting a native sdk.Coin to an ERC20. | |
| `ConvertCosmosCoinToERC20` | [MsgConvertCosmosCoinToERC20](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20) | [MsgConvertCosmosCoinToERC20Response](#kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response) | ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20. | |
<!-- end services -->

View File

@ -22,15 +22,15 @@ message ConversionPair {
string denom = 2;
}
// AllowedNativeCoinERC20Token defines allowed sdk denom & metadata
// AllowedCosmosCoinERC20Token defines allowed cosmos-sdk denom & metadata
// for evm token representations of sdk assets.
// NOTE: once evm token contracts are deployed, changes to metadata for a given
// sdk_denom will not change metadata of deployed contract.
message AllowedNativeCoinERC20Token {
// cosmos_denom will not change metadata of deployed contract.
message AllowedCosmosCoinERC20Token {
option (gogoproto.goproto_getters) = false;
// Denom of the sdk.Coin
string sdk_denom = 1;
string cosmos_denom = 1;
// Name of ERC20 contract
string name = 2;
// Symbol of ERC20 contract

View File

@ -45,10 +45,10 @@ message Params {
(gogoproto.castrepeated) = "ConversionPairs"
];
// allowed_native_denoms is a list of denom & erc20 token metadata pairs.
// allowed_cosmos_denoms is a list of denom & erc20 token metadata pairs.
// if a denom is in the list, it is allowed to be converted to an erc20 in the evm.
repeated AllowedNativeCoinERC20Token allowed_native_denoms = 1 [
repeated AllowedCosmosCoinERC20Token allowed_cosmos_denoms = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "AllowedNativeCoinERC20Tokens"
(gogoproto.castrepeated) = "AllowedCosmosCoinERC20Tokens"
];
}

View File

@ -17,8 +17,8 @@ service Msg {
// ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin.
rpc ConvertERC20ToCoin(MsgConvertERC20ToCoin) returns (MsgConvertERC20ToCoinResponse);
// ConvertNativeCoinToERC20 defines a method for converting a native sdk.Coin to an ERC20.
rpc ConvertNativeCoinToERC20(MsgConvertNativeCoinToERC20) returns (MsgConvertNativeCoinToERC20Response);
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
rpc ConvertCosmosCoinToERC20(MsgConvertCosmosCoinToERC20) returns (MsgConvertCosmosCoinToERC20Response);
}
// MsgConvertCoinToERC20 defines a conversion from sdk.Coin to Kava ERC20.
@ -54,8 +54,8 @@ message MsgConvertERC20ToCoin {
// Msg/MsgConvertERC20ToCoin.
message MsgConvertERC20ToCoinResponse {}
// ConvertNativeCoinToERC20 defines a conversion from native sdk.Coin to ERC20.
message MsgConvertNativeCoinToERC20 {
// ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20.
message MsgConvertCosmosCoinToERC20 {
// Kava bech32 address initiating the conversion.
string initiator = 1;
// EVM hex address that will receive the ERC20 tokens.
@ -64,5 +64,5 @@ message MsgConvertNativeCoinToERC20 {
cosmos.base.v1beta1.Coin amount = 3;
}
// MsgConvertNativeCoinToERC20Response defines the response value from Msg/MsgConvertNativeCoinToERC20.
message MsgConvertNativeCoinToERC20Response {}
// MsgConvertCosmosCoinToERC20Response defines the response value from Msg/MsgConvertCosmosCoinToERC20.
message MsgConvertCosmosCoinToERC20Response {}

View File

@ -79,12 +79,12 @@ func (s *genesisTestSuite) TestExportGenesis() {
KavaERC20Address: testutil.MustNewInternalEVMAddressFromString("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2").Bytes(),
Denom: "weth"},
}
params.AllowedNativeDenoms = []types.AllowedNativeCoinERC20Token{
params.AllowedCosmosDenoms = []types.AllowedCosmosCoinERC20Token{
{
SdkDenom: "hard",
Name: "Kava EVM HARD",
Symbol: "HARD",
Decimals: 6,
CosmosDenom: "hard",
Name: "Kava EVM HARD",
Symbol: "HARD",
Decimals: 6,
},
}
s.Keeper.SetParams(s.Ctx, params)

View File

@ -65,18 +65,18 @@ func (k Keeper) DeployTestMintableERC20Contract(
return types.NewInternalEVMAddress(contractAddr), nil
}
// DeployKavaWrappedNativeCoinERC20Contract validates token details and then deploys an ERC20
// DeployKavaWrappedCosmosCoinERC20Contract validates token details and then deploys an ERC20
// contract with the token metadata.
// This method does NOT check if a token for the provided SdkDenom has already been deployed.
func (k Keeper) DeployKavaWrappedNativeCoinERC20Contract(
func (k Keeper) DeployKavaWrappedCosmosCoinERC20Contract(
ctx sdk.Context,
token types.AllowedNativeCoinERC20Token,
token types.AllowedCosmosCoinERC20Token,
) (types.InternalEVMAddress, error) {
if err := token.Validate(); err != nil {
return types.InternalEVMAddress{}, errorsmod.Wrapf(err, "failed to deploy erc20 for sdk denom %s", token.SdkDenom)
return types.InternalEVMAddress{}, errorsmod.Wrapf(err, "failed to deploy erc20 for sdk denom %s", token.CosmosDenom)
}
packedAbi, err := types.ERC20KavaWrappedNativeCoinContract.ABI.Pack(
packedAbi, err := types.ERC20KavaWrappedCosmosCoinContract.ABI.Pack(
"", // Empty string for contract constructor
token.Name,
token.Symbol,
@ -86,13 +86,13 @@ func (k Keeper) DeployKavaWrappedNativeCoinERC20Contract(
return types.InternalEVMAddress{}, errorsmod.Wrapf(err, "failed to pack token with details %+v", token)
}
data := make([]byte, len(types.ERC20KavaWrappedNativeCoinContract.Bin)+len(packedAbi))
data := make([]byte, len(types.ERC20KavaWrappedCosmosCoinContract.Bin)+len(packedAbi))
copy(
data[:len(types.ERC20KavaWrappedNativeCoinContract.Bin)],
types.ERC20KavaWrappedNativeCoinContract.Bin,
data[:len(types.ERC20KavaWrappedCosmosCoinContract.Bin)],
types.ERC20KavaWrappedCosmosCoinContract.Bin,
)
copy(
data[len(types.ERC20KavaWrappedNativeCoinContract.Bin):],
data[len(types.ERC20KavaWrappedCosmosCoinContract.Bin):],
packedAbi,
)

View File

@ -85,25 +85,25 @@ func (suite *ERC20TestSuite) TestERC20Mint() {
suite.Require().Equal(big.NewInt(1234), balance)
}
func (suite *ERC20TestSuite) TestDeployKavaWrappedNativeCoinERC20Contract() {
func (suite *ERC20TestSuite) TestDeployKavaWrappedCosmosCoinERC20Contract() {
suite.Run("fails to deploy invalid contract", func() {
// empty other fields means this token is invalid.
invalidToken := types.AllowedNativeCoinERC20Token{SdkDenom: "nope"}
_, err := suite.Keeper.DeployKavaWrappedNativeCoinERC20Contract(suite.Ctx, invalidToken)
invalidToken := types.AllowedCosmosCoinERC20Token{CosmosDenom: "nope"}
_, err := suite.Keeper.DeployKavaWrappedCosmosCoinERC20Contract(suite.Ctx, invalidToken)
suite.ErrorContains(err, "token's name cannot be empty")
})
suite.Run("deploys contract with expected metadata & permissions", func() {
caller, privKey := testutil.RandomEvmAccount()
token := types.NewAllowedNativeCoinERC20Token("hard", "EVM HARD", "HARD", 6)
addr, err := suite.Keeper.DeployKavaWrappedNativeCoinERC20Contract(suite.Ctx, token)
token := types.NewAllowedCosmosCoinERC20Token("hard", "EVM HARD", "HARD", 6)
addr, err := suite.Keeper.DeployKavaWrappedCosmosCoinERC20Contract(suite.Ctx, token)
suite.NoError(err)
suite.NotNil(addr)
callContract := func(method string, args ...interface{}) ([]interface{}, error) {
return suite.QueryContract(
types.ERC20KavaWrappedNativeCoinContract.ABI,
types.ERC20KavaWrappedCosmosCoinContract.ABI,
caller,
privKey,
addr,

View File

@ -111,12 +111,12 @@ func (s msgServer) ConvertERC20ToCoin(
// Cosmos SDK-native assets -> EVM
////////////////////////////
// ConvertNativeCoinToERC20 converts a native sdk.Coin to an ERC20.
// ConvertCosmosCoinToERC20 converts a native sdk.Coin to an ERC20.
// If no ERC20 contract has been deployed for the given denom, a new
// contract will be deployed and registered to the module.
func (msgServer) ConvertNativeCoinToERC20(
func (msgServer) ConvertCosmosCoinToERC20(
ctx context.Context,
msg *types.MsgConvertNativeCoinToERC20,
) (*types.MsgConvertNativeCoinToERC20Response, error) {
msg *types.MsgConvertCosmosCoinToERC20,
) (*types.MsgConvertCosmosCoinToERC20Response, error) {
return nil, fmt.Errorf("unimplemented - coming soon")
}

View File

@ -39,13 +39,13 @@ func (suite *ParamsTestSuite) TestEnabledConversionPair() {
}
func (suite *ParamsTestSuite) TestHistoricParamsQuery() {
// setup a params store that lacks allowed_native_denoms param (as was the case in v1)
// setup a params store that lacks allowed_cosmos_denoms param (as was the case in v1)
oldParamStore := suite.App.GetParamsKeeper().Subspace("test_subspace_for_evmutil")
oldParamStore.WithKeyTable(types.ParamKeyTable())
oldParamStore.Set(suite.Ctx, types.KeyEnabledConversionPairs, types.ConversionPairs{})
suite.True(oldParamStore.Has(suite.Ctx, types.KeyEnabledConversionPairs))
suite.False(oldParamStore.Has(suite.Ctx, types.KeyAllowedNativeDenoms))
suite.False(oldParamStore.Has(suite.Ctx, types.KeyAllowedCosmosDenoms))
oldStateKeeper := keeper.NewKeeper(
suite.App.AppCodec(),

View File

@ -8,16 +8,16 @@ import (
)
// MigrateStore performs in-place store migrations for consensus version 2
// V2 adds the allowed_native_denoms param to parameters.
// V2 adds the allowed_cosmos_denoms param to parameters.
func MigrateStore(ctx sdk.Context, paramstore paramtypes.Subspace) error {
migrateParamsStore(ctx, paramstore)
return nil
}
// migrateParamsStore ensures the param key table exists and has the allowed_native_denoms property
// migrateParamsStore ensures the param key table exists and has the allowed_cosmos_denoms property
func migrateParamsStore(ctx sdk.Context, paramstore paramtypes.Subspace) {
if !paramstore.HasKeyTable() {
paramstore.WithKeyTable(types.ParamKeyTable())
}
paramstore.Set(ctx, types.KeyAllowedNativeDenoms, types.DefaultAllowedNativeDenoms)
paramstore.Set(ctx, types.KeyAllowedCosmosDenoms, types.DefaultAllowedCosmosDenoms)
}

View File

@ -22,14 +22,14 @@ func TestStoreMigrationAddsKeyTableIncludingNewParam(t *testing.T) {
paramstore := paramtypes.NewSubspace(encCfg.Codec, encCfg.Amino, evmutilKey, tEvmutilKey, types.ModuleName)
// Check param doesn't exist before
require.False(t, paramstore.Has(ctx, types.KeyAllowedNativeDenoms))
require.False(t, paramstore.Has(ctx, types.KeyAllowedCosmosDenoms))
// Run migrations.
err := v2evmutil.MigrateStore(ctx, paramstore)
require.NoError(t, err)
// Make sure the new params are set.
require.True(t, paramstore.Has(ctx, types.KeyAllowedNativeDenoms))
require.True(t, paramstore.Has(ctx, types.KeyAllowedCosmosDenoms))
}
func TestStoreMigrationSetsNewParamOnExistingKeyTable(t *testing.T) {
@ -43,12 +43,12 @@ func TestStoreMigrationSetsNewParamOnExistingKeyTable(t *testing.T) {
// expect it to have key table
require.True(t, paramstore.HasKeyTable())
// expect it to not have new param
require.False(t, paramstore.Has(ctx, types.KeyAllowedNativeDenoms))
require.False(t, paramstore.Has(ctx, types.KeyAllowedCosmosDenoms))
// Run migrations.
err := v2evmutil.MigrateStore(ctx, paramstore)
require.NoError(t, err)
// Make sure the new params are set.
require.True(t, paramstore.Has(ctx, types.KeyAllowedNativeDenoms))
require.True(t, paramstore.Has(ctx, types.KeyAllowedCosmosDenoms))
}

View File

@ -6,7 +6,7 @@ order: 2
## Parameters and Genesis State
`Parameters` define the list of conversion pairs allowed to be converted between Kava ERC20 tokens & sdk.Coins, and the list of native sdk.Coins that are allowed to be converted to ERC20s.
`Parameters` define the list of conversion pairs allowed to be converted between Kava ERC20 tokens & sdk.Coins, and the list of native cosmos sdk.Coins that are allowed to be converted to ERC20s.
```protobuf
// Params defines the evmutil module params
@ -15,9 +15,9 @@ message Params {
// converted between Kava ERC20 and sdk.Coin
repeated ConversionPair enabled_conversion_pairs = 4;
// allowed_native_denoms is a list of denom & erc20 token metadata pairs.
// allowed_cosmos_denoms is a list of denom & erc20 token metadata pairs.
// if a denom is in the list, it is allowed to be converted to an erc20 in the evm.
repeated AllowedNativeCoinERC20Token allowed_native_denoms = 1;
repeated AllowedCosmosCoinERC20Token allowed_cosmos_denoms = 1;
}
// ConversionPair defines a Kava ERC20 address and corresponding denom that is
@ -29,21 +29,21 @@ message ConversionPair {
string denom = 2;
}
// AllowedNativeCoinERC20Token defines allowed sdk denom & metadata
// AllowedCosmosCoinERC20Token defines allowed cosmos-sdk denom & metadata
// for evm token representations of sdk assets.
// NOTE: once evm token contracts are deployed, changes to metadata for a given
// sdk_denom will not change metadata of deployed contract.
message AllowedNativeCoinERC20Token {
// cosmos_denom will not change metadata of deployed contract.
message AllowedCosmosCoinERC20Token {
option (gogoproto.goproto_getters) = false;
// Denom of the sdk.Coin
string sdk_denom = 1;
string cosmos_denom = 1;
// Name of ERC20 contract
string name = 2;
// Symbol of ERC20 contract
string symbol = 3;
// Number of decimals ERC20 contract is deployed with.
uint32 decimal = 4;
uint32 decimals = 4;
}
```

View File

@ -9,7 +9,7 @@ The evmutil module contains the following parameters:
| Key | Type | Example |
| ---------------------- | ------------------------------------ | ------------- |
| EnabledConversionPairs | array (ConversionPair) | [{see below}] |
| AllowedNativeDenoms | array (AllowedNativeCoinERC20Tokens) | [{see below}] |
| AllowedCosmosDenoms | array (AllowedCosmosCoinERC20Tokens) | [{see below}] |
Example parameters for `ConversionPair`:
@ -18,19 +18,19 @@ Example parameters for `ConversionPair`:
| kava_erc20_Address | string | "0x43d8814fdfb9b8854422df13f1c66e34e4fa91fd" | ERC20 contract address |
| denom | string | "erc20/chain/usdc" | sdk.Coin denom for the ERC20 token |
Example parameters for `AllowedNativeCoinERC20Token`:
Example parameters for `AllowedCosmosCoinERC20Token`:
| Key | Type | Example | Description |
| --------- | ------ | ---------------------------------------------------------------------- | -------------------------------------------------- |
| sdk_denom | string | "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2" | denom of the sdk.Coin |
| name | string | "Kava-wrapped Atom" | name field of the erc20 token |
| symbol | string | "kATOM" | symbol field of the erc20 token |
| decimal | uint32 | 6 | decimal field of the erc20 token, for display only |
| Key | Type | Example | Description |
| ------------ | ------ | ---------------------------------------------------------------------- | -------------------------------------------------- |
| cosmos_denom | string | "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2" | denom of the sdk.Coin |
| name | string | "Kava-wrapped Atom" | name field of the erc20 token |
| symbol | string | "kATOM" | symbol field of the erc20 token |
| decimal | uint32 | 6 | decimal field of the erc20 token, for display only |
## EnabledConversionPairs
The enabled conversion pairs parameter is an array of ConversionPair entries mapping an erc20 address to a sdk.Coin denom. Only erc20 contract addresses that are in this list can be converted to sdk.Coin and vice versa.
## AllowedNativeDenoms
## AllowedCosmosDenoms
The allowed native denoms parameter is an array of AllowedNativeCoinERC20Token entries. They include the sdk.Coin denom and metadata for the ERC20 representation of the asset in Kava's EVM. Coins may only be transferred to the EVM if they are included in this list. A token in this list will have an ERC20 token contract deployed on first conversion. The token will be deployed with the metadata included in the AllowedNativeCoinERC20Token. Once deployed, changes to the metadata will not affect or change the deployed contract.
The allowed cosmos denoms parameter is an array of AllowedCosmosCoinERC20Token entries. They include the cosmos-sdk.Coin denom and metadata for the ERC20 representation of the asset in Kava's EVM. Coins may only be transferred to the EVM if they are included in this list. A token in this list will have an ERC20 token contract deployed on first conversion. The token will be deployed with the metadata included in the AllowedCosmosCoinERC20Token. Once deployed, changes to the metadata will not affect or change the deployed contract.

View File

@ -154,7 +154,7 @@ func (suite *Suite) SetupTest() {
"erc20/usdc",
),
),
types.NewAllowedNativeCoinERC20Tokens(),
types.NewAllowedCosmosCoinERC20Tokens(),
))
queryHelper := baseapp.NewQueryServerTestHelper(suite.Ctx, suite.App.InterfaceRegistry())

View File

@ -34,11 +34,11 @@ var (
// ERC20MintableBurnableAddress is the erc20 module address
ERC20MintableBurnableAddress common.Address
//go:embed ethermint_json/ERC20KavaWrappedNativeCoin.json
ERC20KavaWrappedNativeCoinJSON []byte
//go:embed ethermint_json/ERC20KavaWrappedCosmosCoin.json
ERC20KavaWrappedCosmosCoinJSON []byte
// ERC20KavaWrappedNativeCoinContract is the compiled erc20 contract
ERC20KavaWrappedNativeCoinContract evmtypes.CompiledContract
// ERC20KavaWrappedCosmosCoinContract is the compiled erc20 contract
ERC20KavaWrappedCosmosCoinContract evmtypes.CompiledContract
)
func init() {
@ -53,12 +53,12 @@ func init() {
panic("loading ERC20MintableBurnable contract failed")
}
err = json.Unmarshal(ERC20KavaWrappedNativeCoinJSON, &ERC20KavaWrappedNativeCoinContract)
err = json.Unmarshal(ERC20KavaWrappedCosmosCoinJSON, &ERC20KavaWrappedCosmosCoinContract)
if err != nil {
panic(fmt.Sprintf("failed to unmarshal ERC20KavaWrappedNativeCoinJSON: %s. %s", err, string(ERC20KavaWrappedNativeCoinJSON)))
panic(fmt.Sprintf("failed to unmarshal ERC20KavaWrappedCosmosCoinJSON: %s. %s", err, string(ERC20KavaWrappedCosmosCoinJSON)))
}
if len(ERC20KavaWrappedNativeCoinContract.Bin) == 0 {
panic("loading ERC20KavaWrappedNativeCoin contract failed")
if len(ERC20KavaWrappedCosmosCoinContract.Bin) == 0 {
panic("loading ERC20KavaWrappedCosmosCoin contract failed")
}
}

View File

@ -98,53 +98,53 @@ func validateConversionPairs(i interface{}) error {
// Cosmos SDK -> EVM
///////////////
// NewAllowedNativeCoinERC20Token returns an AllowedNativeCoinERC20Token
func NewAllowedNativeCoinERC20Token(
sdkDenom, name, symbol string,
// NewAllowedCosmosCoinERC20Token returns an AllowedCosmosCoinERC20Token
func NewAllowedCosmosCoinERC20Token(
cosmosDenom, name, symbol string,
decimal uint32,
) AllowedNativeCoinERC20Token {
return AllowedNativeCoinERC20Token{
SdkDenom: sdkDenom,
Name: name,
Symbol: symbol,
Decimals: decimal,
) AllowedCosmosCoinERC20Token {
return AllowedCosmosCoinERC20Token{
CosmosDenom: cosmosDenom,
Name: name,
Symbol: symbol,
Decimals: decimal,
}
}
// Validate validates the fields of a single AllowedNativeCoinERC20Token
func (token AllowedNativeCoinERC20Token) Validate() error {
// Validate validates the fields of a single AllowedCosmosCoinERC20Token
func (token AllowedCosmosCoinERC20Token) Validate() error {
// disallow empty string fields
if err := sdk.ValidateDenom(token.SdkDenom); err != nil {
return fmt.Errorf("allowed native coin erc20 token's sdk denom is invalid: %v", err)
if err := sdk.ValidateDenom(token.CosmosDenom); err != nil {
return fmt.Errorf("allowed cosomos coin erc20 token's sdk denom is invalid: %v", err)
}
if token.Name == "" {
return errors.New("allowed native coin erc20 token's name cannot be empty")
return errors.New("allowed cosomos coin erc20 token's name cannot be empty")
}
if token.Symbol == "" {
return errors.New("allowed native coin erc20 token's symbol cannot be empty")
return errors.New("allowed cosomos coin erc20 token's symbol cannot be empty")
}
// ensure decimals will properly cast to uint8 of erc20 spec
if token.Decimals > math.MaxUint8 {
return fmt.Errorf("allowed native coin erc20 token's decimals must be less than 256, found %d", token.Decimals)
return fmt.Errorf("allowed cosomos coin erc20 token's decimals must be less than 256, found %d", token.Decimals)
}
return nil
}
// AllowedNativeCoinERC20Tokens defines a slice of AllowedNativeCoinERC20Token
type AllowedNativeCoinERC20Tokens []AllowedNativeCoinERC20Token
// AllowedCosmosCoinERC20Tokens defines a slice of AllowedCosmosCoinERC20Token
type AllowedCosmosCoinERC20Tokens []AllowedCosmosCoinERC20Token
// NewAllowedNativeCoinERC20Tokens returns AllowedNativeCoinERC20Tokens from the provided values.
func NewAllowedNativeCoinERC20Tokens(pairs ...AllowedNativeCoinERC20Token) AllowedNativeCoinERC20Tokens {
return AllowedNativeCoinERC20Tokens(pairs)
// NewAllowedCosmosCoinERC20Tokens returns AllowedCosmosCoinERC20Tokens from the provided values.
func NewAllowedCosmosCoinERC20Tokens(pairs ...AllowedCosmosCoinERC20Token) AllowedCosmosCoinERC20Tokens {
return AllowedCosmosCoinERC20Tokens(pairs)
}
// Validate checks that all containing tokens are valid and that there are
// no duplicate denoms or symbols.
func (tokens AllowedNativeCoinERC20Tokens) Validate() error {
func (tokens AllowedCosmosCoinERC20Tokens) Validate() error {
// Disallow multiple instances of a single sdk_denom or evm symbol
denoms := make(map[string]struct{}, len(tokens))
symbols := make(map[string]struct{}, len(tokens))
@ -154,23 +154,23 @@ func (tokens AllowedNativeCoinERC20Tokens) Validate() error {
return fmt.Errorf("invalid token at index %d: %s", i, err)
}
if _, found := denoms[t.SdkDenom]; found {
return fmt.Errorf("found duplicate token with sdk denom %s", t.SdkDenom)
if _, found := denoms[t.CosmosDenom]; found {
return fmt.Errorf("found duplicate token with sdk denom %s", t.CosmosDenom)
}
if _, found := symbols[t.Symbol]; found {
return fmt.Errorf("found duplicate token with symbol %s", t.Symbol)
}
denoms[t.SdkDenom] = struct{}{}
denoms[t.CosmosDenom] = struct{}{}
symbols[t.Symbol] = struct{}{}
}
return nil
}
// validateAllowedNativeCoinERC20Tokens validates an interface as AllowedNativeCoinERC20Tokens
func validateAllowedNativeCoinERC20Tokens(i interface{}) error {
pairs, ok := i.(AllowedNativeCoinERC20Tokens)
// validateAllowedCosmosCoinERC20Tokens validates an interface as AllowedCosmosCoinERC20Tokens
func validateAllowedCosmosCoinERC20Tokens(i interface{}) error {
pairs, ok := i.(AllowedCosmosCoinERC20Tokens)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}

View File

@ -66,13 +66,13 @@ func (m *ConversionPair) XXX_DiscardUnknown() {
var xxx_messageInfo_ConversionPair proto.InternalMessageInfo
// AllowedNativeCoinERC20Token defines allowed sdk denom & metadata
// AllowedCosmosCoinERC20Token defines allowed cosmos-sdk denom & metadata
// for evm token representations of sdk assets.
// NOTE: once evm token contracts are deployed, changes to metadata for a given
// sdk_denom will not change metadata of deployed contract.
type AllowedNativeCoinERC20Token struct {
// cosmos_denom will not change metadata of deployed contract.
type AllowedCosmosCoinERC20Token struct {
// Denom of the sdk.Coin
SdkDenom string `protobuf:"bytes,1,opt,name=sdk_denom,json=sdkDenom,proto3" json:"sdk_denom,omitempty"`
CosmosDenom string `protobuf:"bytes,1,opt,name=cosmos_denom,json=cosmosDenom,proto3" json:"cosmos_denom,omitempty"`
// Name of ERC20 contract
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
// Symbol of ERC20 contract
@ -81,18 +81,18 @@ type AllowedNativeCoinERC20Token struct {
Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"`
}
func (m *AllowedNativeCoinERC20Token) Reset() { *m = AllowedNativeCoinERC20Token{} }
func (m *AllowedNativeCoinERC20Token) String() string { return proto.CompactTextString(m) }
func (*AllowedNativeCoinERC20Token) ProtoMessage() {}
func (*AllowedNativeCoinERC20Token) Descriptor() ([]byte, []int) {
func (m *AllowedCosmosCoinERC20Token) Reset() { *m = AllowedCosmosCoinERC20Token{} }
func (m *AllowedCosmosCoinERC20Token) String() string { return proto.CompactTextString(m) }
func (*AllowedCosmosCoinERC20Token) ProtoMessage() {}
func (*AllowedCosmosCoinERC20Token) Descriptor() ([]byte, []int) {
return fileDescriptor_e1396d08199817d0, []int{1}
}
func (m *AllowedNativeCoinERC20Token) XXX_Unmarshal(b []byte) error {
func (m *AllowedCosmosCoinERC20Token) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AllowedNativeCoinERC20Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
func (m *AllowedCosmosCoinERC20Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_AllowedNativeCoinERC20Token.Marshal(b, m, deterministic)
return xxx_messageInfo_AllowedCosmosCoinERC20Token.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@ -102,21 +102,21 @@ func (m *AllowedNativeCoinERC20Token) XXX_Marshal(b []byte, deterministic bool)
return b[:n], nil
}
}
func (m *AllowedNativeCoinERC20Token) XXX_Merge(src proto.Message) {
xxx_messageInfo_AllowedNativeCoinERC20Token.Merge(m, src)
func (m *AllowedCosmosCoinERC20Token) XXX_Merge(src proto.Message) {
xxx_messageInfo_AllowedCosmosCoinERC20Token.Merge(m, src)
}
func (m *AllowedNativeCoinERC20Token) XXX_Size() int {
func (m *AllowedCosmosCoinERC20Token) XXX_Size() int {
return m.Size()
}
func (m *AllowedNativeCoinERC20Token) XXX_DiscardUnknown() {
xxx_messageInfo_AllowedNativeCoinERC20Token.DiscardUnknown(m)
func (m *AllowedCosmosCoinERC20Token) XXX_DiscardUnknown() {
xxx_messageInfo_AllowedCosmosCoinERC20Token.DiscardUnknown(m)
}
var xxx_messageInfo_AllowedNativeCoinERC20Token proto.InternalMessageInfo
var xxx_messageInfo_AllowedCosmosCoinERC20Token proto.InternalMessageInfo
func init() {
proto.RegisterType((*ConversionPair)(nil), "kava.evmutil.v1beta1.ConversionPair")
proto.RegisterType((*AllowedNativeCoinERC20Token)(nil), "kava.evmutil.v1beta1.AllowedNativeCoinERC20Token")
proto.RegisterType((*AllowedCosmosCoinERC20Token)(nil), "kava.evmutil.v1beta1.AllowedCosmosCoinERC20Token")
}
func init() {
@ -124,30 +124,30 @@ func init() {
}
var fileDescriptor_e1396d08199817d0 = []byte{
// 355 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x91, 0xcf, 0x6a, 0xea, 0x40,
0x18, 0xc5, 0x33, 0xf7, 0x7a, 0x45, 0x87, 0xdb, 0x22, 0x83, 0x94, 0xa0, 0x30, 0x06, 0x57, 0x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x0b, 0xb8, 0x73, 0x16, 0xf3, 0x04, 0x26,
0x82, 0x87, 0x79, 0xf7, 0xa3, 0xf0, 0x20, 0x24, 0x6d, 0x5c, 0x97, 0xae, 0x67, 0x15, 0x3c, 0xca,
0xf9, 0x9a, 0x74, 0xbd, 0xbb, 0xcc, 0x13, 0x82, 0x2b, 0x21, 0x0b, 0xa0, 0xec, 0xcd, 0x35, 0xb9,
0xc0, 0x55, 0xb9, 0x09, 0x6c, 0xe1, 0xab, 0x7f, 0xf3, 0xd3, 0xd2, 0x91, 0x16, 0xae, 0xb9, 0xe0,
0xf0, 0x80, 0xf9, 0x52, 0xad, 0x68, 0xa8, 0x77, 0x66, 0x9e, 0x7c, 0x71, 0x95, 0xf1, 0xec, 0xf0,
0x4d, 0xd1, 0x47, 0x4a, 0xd1, 0x67, 0x4a, 0xd1, 0x2e, 0xa5, 0xe8, 0x90, 0x52, 0xf4, 0x76, 0xa4,
0xca, 0xee, 0x48, 0x95, 0xaf, 0x23, 0x55, 0x9e, 0x2e, 0x17, 0x3c, 0x7e, 0x5e, 0xd9, 0xba, 0x23,
0x02, 0x23, 0x7b, 0xe5, 0xb5, 0xcf, 0x6c, 0x99, 0x2b, 0x63, 0x7d, 0xda, 0x4c, 0xbc, 0x59, 0x82,
0xb4, 0xab, 0xf9, 0xe7, 0xde, 0xfc, 0x06, 0x00, 0x00, 0xff, 0xff, 0x49, 0x37, 0x2c, 0xa6, 0xb6,
0x01, 0x00, 0x00,
// 356 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x91, 0xcf, 0x4a, 0xeb, 0x40,
0x18, 0xc5, 0x33, 0xf7, 0xf6, 0x96, 0xde, 0xb1, 0x4a, 0x19, 0x8a, 0x84, 0x0a, 0xd3, 0xd8, 0x55,
0x15, 0x4c, 0xda, 0xba, 0x73, 0xd7, 0xc6, 0x82, 0x50, 0x10, 0x09, 0xae, 0xdc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92, 0xec, 0x7b, 0x98, 0xf1, 0x88, 0x9c, 0xe2, 0xba, 0x2b, 0x7d, 0xbb, 0x40,
0x20, 0x89, 0x38, 0x28, 0xbc, 0xeb, 0xdc, 0x22, 0x04, 0x57, 0x22, 0x16, 0xf2, 0x92, 0x2e, 0x67,
0x72, 0x8c, 0xab, 0x62, 0x15, 0x3a, 0x10, 0xa8, 0x7f, 0xa5, 0x5b, 0x2a, 0xd2, 0xc2, 0x35, 0x8f,
0xbb, 0x7e, 0xc8, 0x02, 0xa1, 0x56, 0x34, 0xd4, 0x3d, 0xb4, 0xf6, 0xba, 0x38, 0xd0, 0x68, 0xb2,
0xfd, 0xa6, 0xe8, 0x23, 0xa3, 0xe8, 0x33, 0xa3, 0x68, 0x9d, 0x51, 0xb4, 0xcd, 0x28, 0x7a, 0xdb,
0x51, 0x65, 0xbd, 0xa3, 0xca, 0xd7, 0x8e, 0x2a, 0x0f, 0x67, 0x53, 0x3f, 0x79, 0x5c, 0x38, 0xba,
0x0b, 0xa1, 0x91, 0xdf, 0xf5, 0x22, 0x60, 0x8e, 0x90, 0x93, 0xb1, 0xdc, 0xff, 0x4f, 0xb2, 0x9a,
0x73, 0xe1, 0x54, 0xe5, 0x13, 0x5f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x95, 0x40, 0xc5, 0x63,
0xbc, 0x01, 0x00, 0x00,
}
func (this *ConversionPair) VerboseEqual(that interface{}) error {
@ -210,7 +210,7 @@ func (this *ConversionPair) Equal(that interface{}) bool {
}
return true
}
func (this *AllowedNativeCoinERC20Token) VerboseEqual(that interface{}) error {
func (this *AllowedCosmosCoinERC20Token) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
return nil
@ -218,25 +218,25 @@ func (this *AllowedNativeCoinERC20Token) VerboseEqual(that interface{}) error {
return fmt.Errorf("that == nil && this != nil")
}
that1, ok := that.(*AllowedNativeCoinERC20Token)
that1, ok := that.(*AllowedCosmosCoinERC20Token)
if !ok {
that2, ok := that.(AllowedNativeCoinERC20Token)
that2, ok := that.(AllowedCosmosCoinERC20Token)
if ok {
that1 = &that2
} else {
return fmt.Errorf("that is not of type *AllowedNativeCoinERC20Token")
return fmt.Errorf("that is not of type *AllowedCosmosCoinERC20Token")
}
}
if that1 == nil {
if this == nil {
return nil
}
return fmt.Errorf("that is type *AllowedNativeCoinERC20Token but is nil && this != nil")
return fmt.Errorf("that is type *AllowedCosmosCoinERC20Token but is nil && this != nil")
} else if this == nil {
return fmt.Errorf("that is type *AllowedNativeCoinERC20Token but is not nil && this == nil")
return fmt.Errorf("that is type *AllowedCosmosCoinERC20Token but is not nil && this == nil")
}
if this.SdkDenom != that1.SdkDenom {
return fmt.Errorf("SdkDenom this(%v) Not Equal that(%v)", this.SdkDenom, that1.SdkDenom)
if this.CosmosDenom != that1.CosmosDenom {
return fmt.Errorf("CosmosDenom this(%v) Not Equal that(%v)", this.CosmosDenom, that1.CosmosDenom)
}
if this.Name != that1.Name {
return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name)
@ -249,14 +249,14 @@ func (this *AllowedNativeCoinERC20Token) VerboseEqual(that interface{}) error {
}
return nil
}
func (this *AllowedNativeCoinERC20Token) Equal(that interface{}) bool {
func (this *AllowedCosmosCoinERC20Token) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*AllowedNativeCoinERC20Token)
that1, ok := that.(*AllowedCosmosCoinERC20Token)
if !ok {
that2, ok := that.(AllowedNativeCoinERC20Token)
that2, ok := that.(AllowedCosmosCoinERC20Token)
if ok {
that1 = &that2
} else {
@ -268,7 +268,7 @@ func (this *AllowedNativeCoinERC20Token) Equal(that interface{}) bool {
} else if this == nil {
return false
}
if this.SdkDenom != that1.SdkDenom {
if this.CosmosDenom != that1.CosmosDenom {
return false
}
if this.Name != that1.Name {
@ -319,7 +319,7 @@ func (m *ConversionPair) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *AllowedNativeCoinERC20Token) Marshal() (dAtA []byte, err error) {
func (m *AllowedCosmosCoinERC20Token) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -329,12 +329,12 @@ func (m *AllowedNativeCoinERC20Token) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *AllowedNativeCoinERC20Token) MarshalTo(dAtA []byte) (int, error) {
func (m *AllowedCosmosCoinERC20Token) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AllowedNativeCoinERC20Token) MarshalToSizedBuffer(dAtA []byte) (int, error) {
func (m *AllowedCosmosCoinERC20Token) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@ -358,10 +358,10 @@ func (m *AllowedNativeCoinERC20Token) MarshalToSizedBuffer(dAtA []byte) (int, er
i--
dAtA[i] = 0x12
}
if len(m.SdkDenom) > 0 {
i -= len(m.SdkDenom)
copy(dAtA[i:], m.SdkDenom)
i = encodeVarintConversionPair(dAtA, i, uint64(len(m.SdkDenom)))
if len(m.CosmosDenom) > 0 {
i -= len(m.CosmosDenom)
copy(dAtA[i:], m.CosmosDenom)
i = encodeVarintConversionPair(dAtA, i, uint64(len(m.CosmosDenom)))
i--
dAtA[i] = 0xa
}
@ -396,13 +396,13 @@ func (m *ConversionPair) Size() (n int) {
return n
}
func (m *AllowedNativeCoinERC20Token) Size() (n int) {
func (m *AllowedCosmosCoinERC20Token) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.SdkDenom)
l = len(m.CosmosDenom)
if l > 0 {
n += 1 + l + sovConversionPair(uint64(l))
}
@ -542,7 +542,7 @@ func (m *ConversionPair) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *AllowedNativeCoinERC20Token) Unmarshal(dAtA []byte) error {
func (m *AllowedCosmosCoinERC20Token) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@ -565,15 +565,15 @@ func (m *AllowedNativeCoinERC20Token) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: AllowedNativeCoinERC20Token: wiretype end group for non-group")
return fmt.Errorf("proto: AllowedCosmosCoinERC20Token: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AllowedNativeCoinERC20Token: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: AllowedCosmosCoinERC20Token: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SdkDenom", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field CosmosDenom", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@ -601,7 +601,7 @@ func (m *AllowedNativeCoinERC20Token) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SdkDenom = string(dAtA[iNdEx:postIndex])
m.CosmosDenom = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {

View File

@ -232,55 +232,55 @@ func TestConversionPairs_Validate(t *testing.T) {
}
}
func TestAllowedNativeCoinERC20Token_Validate(t *testing.T) {
func TestAllowedCosmosCoinERC20Token_Validate(t *testing.T) {
testCases := []struct {
name string
token types.AllowedNativeCoinERC20Token
token types.AllowedCosmosCoinERC20Token
expErr string
}{
{
name: "valid token",
token: types.NewAllowedNativeCoinERC20Token("uatom", "Kava-wrapped ATOM", "kATOM", 6),
token: types.NewAllowedCosmosCoinERC20Token("uatom", "Kava-wrapped ATOM", "kATOM", 6),
expErr: "",
},
{
name: "valid - highest allowed decimals",
token: types.NewAllowedNativeCoinERC20Token("uatom", "Kava-wrapped ATOM", "kATOM", 255),
token: types.NewAllowedCosmosCoinERC20Token("uatom", "Kava-wrapped ATOM", "kATOM", 255),
expErr: "",
},
{
name: "invalid - Empty SdkDenom",
token: types.AllowedNativeCoinERC20Token{
SdkDenom: "",
Name: "Example Token",
Symbol: "ETK",
Decimals: 0,
token: types.AllowedCosmosCoinERC20Token{
CosmosDenom: "",
Name: "Example Token",
Symbol: "ETK",
Decimals: 0,
},
expErr: "sdk denom is invalid",
},
{
name: "invalid - Empty Name",
token: types.AllowedNativeCoinERC20Token{
SdkDenom: "example_denom",
Name: "",
Symbol: "ETK",
Decimals: 6,
token: types.AllowedCosmosCoinERC20Token{
CosmosDenom: "example_denom",
Name: "",
Symbol: "ETK",
Decimals: 6,
},
expErr: "name cannot be empty",
},
{
name: "invalid - Empty Symbol",
token: types.AllowedNativeCoinERC20Token{
SdkDenom: "example_denom",
Name: "Example Token",
Symbol: "",
Decimals: 6,
token: types.AllowedCosmosCoinERC20Token{
CosmosDenom: "example_denom",
Name: "Example Token",
Symbol: "",
Decimals: 6,
},
expErr: "symbol cannot be empty",
},
{
name: "invalid - decimals higher than uint8",
token: types.NewAllowedNativeCoinERC20Token("uatom", "Kava-wrapped ATOM", "kATOM", 256),
token: types.NewAllowedCosmosCoinERC20Token("uatom", "Kava-wrapped ATOM", "kATOM", 256),
expErr: "decimals must be less than 256",
},
}
@ -297,46 +297,46 @@ func TestAllowedNativeCoinERC20Token_Validate(t *testing.T) {
}
}
func TestAllowedNativeCoinERC20Tokens_Validate(t *testing.T) {
token1 := types.NewAllowedNativeCoinERC20Token("denom1", "Token 1", "TK1", 6)
token2 := types.NewAllowedNativeCoinERC20Token("denom2", "Token 2", "TK2", 0)
invalidToken := types.NewAllowedNativeCoinERC20Token("", "No SDK Denom Token", "TK3", 18)
func TestAllowedCosmosCoinERC20Tokens_Validate(t *testing.T) {
token1 := types.NewAllowedCosmosCoinERC20Token("denom1", "Token 1", "TK1", 6)
token2 := types.NewAllowedCosmosCoinERC20Token("denom2", "Token 2", "TK2", 0)
invalidToken := types.NewAllowedCosmosCoinERC20Token("", "No SDK Denom Token", "TK3", 18)
testCases := []struct {
name string
tokens types.AllowedNativeCoinERC20Tokens
tokens types.AllowedCosmosCoinERC20Tokens
expErr string
}{
{
name: "valid - no tokens",
tokens: types.NewAllowedNativeCoinERC20Tokens(),
tokens: types.NewAllowedCosmosCoinERC20Tokens(),
expErr: "",
},
{
name: "valid - one token",
tokens: types.NewAllowedNativeCoinERC20Tokens(token1),
tokens: types.NewAllowedCosmosCoinERC20Tokens(token1),
expErr: "",
},
{
name: "valid - multiple tokens",
tokens: types.NewAllowedNativeCoinERC20Tokens(token1, token2),
tokens: types.NewAllowedCosmosCoinERC20Tokens(token1, token2),
expErr: "",
},
{
name: "invalid - contains invalid token",
tokens: types.NewAllowedNativeCoinERC20Tokens(token1, token2, invalidToken),
tokens: types.NewAllowedCosmosCoinERC20Tokens(token1, token2, invalidToken),
expErr: "invalid token at index 2",
},
{
name: "invalid - duplicate denoms",
tokens: types.NewAllowedNativeCoinERC20Tokens(token1, token2, token1),
tokens: types.NewAllowedCosmosCoinERC20Tokens(token1, token2, token1),
expErr: "found duplicate token with sdk denom denom1",
},
{
name: "invalid - duplicate symbol",
tokens: types.NewAllowedNativeCoinERC20Tokens(
tokens: types.NewAllowedCosmosCoinERC20Tokens(
token1,
types.NewAllowedNativeCoinERC20Token("diff", "Diff Denom, Same Symbol", "TK1", 6),
types.NewAllowedCosmosCoinERC20Token("diff", "Diff Denom, Same Symbol", "TK1", 6),
),
expErr: "found duplicate token with symbol TK1",
},

View File

@ -111,9 +111,9 @@ type Params struct {
// enabled_conversion_pairs defines the list of conversion pairs allowed to be
// converted between Kava ERC20 and sdk.Coin
EnabledConversionPairs ConversionPairs `protobuf:"bytes,4,rep,name=enabled_conversion_pairs,json=enabledConversionPairs,proto3,castrepeated=ConversionPairs" json:"enabled_conversion_pairs"`
// allowed_native_denoms is a list of denom & erc20 token metadata pairs.
// allowed_cosmos_denoms is a list of denom & erc20 token metadata pairs.
// if a denom is in the list, it is allowed to be converted to an erc20 in the evm.
AllowedNativeDenoms AllowedNativeCoinERC20Tokens `protobuf:"bytes,1,rep,name=allowed_native_denoms,json=allowedNativeDenoms,proto3,castrepeated=AllowedNativeCoinERC20Tokens" json:"allowed_native_denoms"`
AllowedCosmosDenoms AllowedCosmosCoinERC20Tokens `protobuf:"bytes,1,rep,name=allowed_cosmos_denoms,json=allowedCosmosDenoms,proto3,castrepeated=AllowedCosmosCoinERC20Tokens" json:"allowed_cosmos_denoms"`
}
func (m *Params) Reset() { *m = Params{} }
@ -156,9 +156,9 @@ func (m *Params) GetEnabledConversionPairs() ConversionPairs {
return nil
}
func (m *Params) GetAllowedNativeDenoms() AllowedNativeCoinERC20Tokens {
func (m *Params) GetAllowedCosmosDenoms() AllowedCosmosCoinERC20Tokens {
if m != nil {
return m.AllowedNativeDenoms
return m.AllowedCosmosDenoms
}
return nil
}
@ -174,38 +174,38 @@ func init() {
}
var fileDescriptor_d916ab97b8e628c2 = []byte{
// 492 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x41, 0x6b, 0xd4, 0x40,
0x14, 0xce, 0xd4, 0x65, 0x57, 0xa7, 0x05, 0x21, 0xad, 0xba, 0x96, 0x9a, 0x94, 0xa5, 0xc8, 0x2a,
0x24, 0x71, 0xd7, 0x5b, 0x11, 0xa4, 0x59, 0x45, 0x8b, 0x20, 0x25, 0x8a, 0x07, 0x2f, 0xe1, 0x25,
0x19, 0xd6, 0xb0, 0xc9, 0xcc, 0x92, 0x99, 0x4d, 0xed, 0x3f, 0x10, 0x3c, 0xa8, 0xff, 0xc0, 0xa3,
0x78, 0xee, 0x8f, 0x28, 0x78, 0x29, 0x3d, 0x89, 0x87, 0xb5, 0xee, 0xfe, 0x0b, 0x4f, 0x92, 0x99,
0xd9, 0xa5, 0x96, 0x55, 0x7a, 0xca, 0xe4, 0x9b, 0xef, 0x7b, 0xef, 0x9b, 0xef, 0x3d, 0xdc, 0x1a,
0x40, 0x09, 0x1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2, 0xde, 0xce, 0x17, 0x5b, 0xe6, 0x1f, 0xd5, 0xe5, 0x1e, 0xdf, 0xff, 0x13,
0x00, 0x00, 0xff, 0xff, 0xa3, 0x52, 0xb0, 0x81, 0x60, 0x03, 0x00, 0x00,
// 489 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x41, 0x6b, 0x13, 0x41,
0x14, 0xde, 0xa9, 0x21, 0xd1, 0x69, 0x41, 0xd8, 0x56, 0x8d, 0xa5, 0xce, 0x96, 0x50, 0x24, 0x0a,
0xbb, 0x6b, 0xe2, 0xad, 0x08, 0xd2, 0x8d, 0xa2, 0xc5, 0x4b, 0x59, 0xc5, 0x83, 0x97, 0xf0, 0x76,
0x77, 0x88, 0x4b, 0x76, 0x67, 0xc2, 0xce, 0x24, 0xb5, 0xff, 0x40, 0xf0, 0xa0, 0xfe, 0x03, 0x8f,
0xe2, 0xb9, 0x3f, 0xa2, 0xe0, 0xa5, 0xf4, 0x24, 0x1e, 0x62, 0x4d, 0xfe, 0x85, 0x27, 0xd9, 0x99,
0x49, 0xa8, 0x21, 0x8a, 0xa7, 0x9d, 0x7d, 0xf3, 0x7d, 0xef, 0xfb, 0xe6, 0x7b, 0x0f, 0x37, 0xfa,
0x30, 0x02, 0x9f, 0x8e, 0xf2, 0xa1, 0x4c, 0x33, 0x7f, 0xd4, 0x8a, 0xa8, 0x84, 0x96, 0xdf, 0xa3,
0x8c, 0x8a, 0x54, 0x78, 0x83, 0x82, 0x4b, 0x6e, 0x6f, 0x94, 0x18, 0xcf, 0x60, 0x3c, 0x83, 0xd9,
0xbc, 0x19, 0x73, 0x91, 0x73, 0xd1, 0x55, 0x18, 0x5f, 0xff, 0x68, 0xc2, 0xe6, 0x46, 0x8f, 0xf7,
0xb8, 0xae, 0x97, 0x27, 0x53, 0xbd, 0xbb, 0x54, 0x2a, 0xe6, 0x6c, 0x44, 0x0b, 0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4d, 0xba, 0x0b, 0xd3, 0x10, 0xf5, 0x8a, 0xca, 0x7a, 0x67, 0x79, 0x58,
0x9d, 0x39, 0xfa, 0x00, 0xd2, 0x22, 0xb8, 0x51, 0xfa, 0xfb, 0xf2, 0xc3, 0xb9, 0xfa, 0x67, 0x5d,
0x84, 0xd7, 0x4d, 0xfb, 0x85, 0xba, 0xfd, 0x0e, 0xe1, 0x6b, 0x90, 0x65, 0xfc, 0x50, 0x29, 0xab,
0x6d, 0x4a, 0x28, 0xe3, 0xf9, 0x6c, 0xc4, 0xad, 0xbf, 0x8c, 0x58, 0x53, 0x3a, 0x8a, 0xd1, 0xe1,
0x29, 0x7b, 0x1c, 0x76, 0xda, 0xf7, 0x5e, 0xf0, 0x3e, 0x65, 0xc1, 0x8e, 0xf1, 0xb0, 0xf5, 0x0f,
0x90, 0x08, 0xd7, 0xe1, 0xe2, 0xed, 0x23, 0xa5, 0x19, 0x3c, 0x3b, 0xff, 0x49, 0xd0, 0xe7, 0x09,
0x41, 0x27, 0x13, 0x82, 0x4e, 0x27, 0x04, 0x9d, 0x4f, 0x08, 0xfa, 0x30, 0x25, 0xd6, 0xe9, 0x94,
0x58, 0xdf, 0xa6, 0xc4, 0x7a, 0x75, 0xe7, 0x42, 0xf0, 0xa5, 0x33, 0x37, 0x83, 0x48, 0xa8, 0x93,
0xff, 0x66, 0xbe, 0xd8, 0x2a, 0xff, 0xa8, 0xaa, 0xf6, 0xf8, 0xfe, 0xef, 0x00, 0x00, 0x00, 0xff,
0xff, 0xa1, 0xec, 0x74, 0x78, 0x60, 0x03, 0x00, 0x00,
}
func (this *GenesisState) VerboseEqual(that interface{}) error {
@ -371,12 +371,12 @@ func (this *Params) VerboseEqual(that interface{}) error {
return fmt.Errorf("EnabledConversionPairs this[%v](%v) Not Equal that[%v](%v)", i, this.EnabledConversionPairs[i], i, that1.EnabledConversionPairs[i])
}
}
if len(this.AllowedNativeDenoms) != len(that1.AllowedNativeDenoms) {
return fmt.Errorf("AllowedNativeDenoms this(%v) Not Equal that(%v)", len(this.AllowedNativeDenoms), len(that1.AllowedNativeDenoms))
if len(this.AllowedCosmosDenoms) != len(that1.AllowedCosmosDenoms) {
return fmt.Errorf("AllowedCosmosDenoms this(%v) Not Equal that(%v)", len(this.AllowedCosmosDenoms), len(that1.AllowedCosmosDenoms))
}
for i := range this.AllowedNativeDenoms {
if !this.AllowedNativeDenoms[i].Equal(&that1.AllowedNativeDenoms[i]) {
return fmt.Errorf("AllowedNativeDenoms this[%v](%v) Not Equal that[%v](%v)", i, this.AllowedNativeDenoms[i], i, that1.AllowedNativeDenoms[i])
for i := range this.AllowedCosmosDenoms {
if !this.AllowedCosmosDenoms[i].Equal(&that1.AllowedCosmosDenoms[i]) {
return fmt.Errorf("AllowedCosmosDenoms this[%v](%v) Not Equal that[%v](%v)", i, this.AllowedCosmosDenoms[i], i, that1.AllowedCosmosDenoms[i])
}
}
return nil
@ -408,11 +408,11 @@ func (this *Params) Equal(that interface{}) bool {
return false
}
}
if len(this.AllowedNativeDenoms) != len(that1.AllowedNativeDenoms) {
if len(this.AllowedCosmosDenoms) != len(that1.AllowedCosmosDenoms) {
return false
}
for i := range this.AllowedNativeDenoms {
if !this.AllowedNativeDenoms[i].Equal(&that1.AllowedNativeDenoms[i]) {
for i := range this.AllowedCosmosDenoms {
if !this.AllowedCosmosDenoms[i].Equal(&that1.AllowedCosmosDenoms[i]) {
return false
}
}
@ -539,10 +539,10 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0x22
}
}
if len(m.AllowedNativeDenoms) > 0 {
for iNdEx := len(m.AllowedNativeDenoms) - 1; iNdEx >= 0; iNdEx-- {
if len(m.AllowedCosmosDenoms) > 0 {
for iNdEx := len(m.AllowedCosmosDenoms) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.AllowedNativeDenoms[iNdEx].MarshalToSizedBuffer(dAtA[:i])
size, err := m.AllowedCosmosDenoms[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
@ -605,8 +605,8 @@ func (m *Params) Size() (n int) {
}
var l int
_ = l
if len(m.AllowedNativeDenoms) > 0 {
for _, e := range m.AllowedNativeDenoms {
if len(m.AllowedCosmosDenoms) > 0 {
for _, e := range m.AllowedCosmosDenoms {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
@ -892,7 +892,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AllowedNativeDenoms", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field AllowedCosmosDenoms", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@ -919,8 +919,8 @@ func (m *Params) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AllowedNativeDenoms = append(m.AllowedNativeDenoms, AllowedNativeCoinERC20Token{})
if err := m.AllowedNativeDenoms[len(m.AllowedNativeDenoms)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
m.AllowedCosmosDenoms = append(m.AllowedCosmosDenoms, AllowedCosmosCoinERC20Token{})
if err := m.AllowedCosmosDenoms[len(m.AllowedCosmosDenoms)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex

View File

@ -51,7 +51,7 @@ func TestGenesisState_Validate(t *testing.T) {
types.NewConversionPairs(
types.NewConversionPair(types.NewInternalEVMAddress(common.HexToAddress("0xinvalidaddress")), "weth"),
),
types.NewAllowedNativeCoinERC20Tokens(),
types.NewAllowedCosmosCoinERC20Tokens(),
),
success: false,
},

View File

@ -16,8 +16,8 @@ var (
_ sdk.Msg = &MsgConvertERC20ToCoin{}
_ legacytx.LegacyMsg = &MsgConvertERC20ToCoin{}
_ sdk.Msg = &MsgConvertNativeCoinToERC20{}
_ legacytx.LegacyMsg = &MsgConvertNativeCoinToERC20{}
_ sdk.Msg = &MsgConvertCosmosCoinToERC20{}
_ legacytx.LegacyMsg = &MsgConvertCosmosCoinToERC20{}
)
// legacy message types
@ -25,7 +25,7 @@ const (
TypeMsgConvertCoinToERC20 = "evmutil_convert_coin_to_erc20"
TypeMsgConvertERC20ToCoin = "evmutil_convert_erc20_to_coin"
TypeMsgConvertNativeCoinToERC20 = "evmutil_convert_native_coin_to_erc20"
TypeMsgConvertCosmosCoinToERC20 = "evmutil_convert_cosmos_coin_to_erc20"
)
////////////////////////////
@ -160,13 +160,13 @@ func (msg MsgConvertERC20ToCoin) Type() string {
// Cosmos SDK-native assets -> EVM
////////////////////////////
// NewMsgConvertNativeCoinToERC20 returns a new MsgConvertNativeCoinToERC20
func NewMsgConvertNativeCoinToERC20(
// NewMsgConvertCosmosCoinToERC20 returns a new MsgConvertCosmosCoinToERC20
func NewMsgConvertCosmosCoinToERC20(
initiator string,
receiver string,
amount sdk.Coin,
) MsgConvertNativeCoinToERC20 {
return MsgConvertNativeCoinToERC20{
) MsgConvertCosmosCoinToERC20 {
return MsgConvertCosmosCoinToERC20{
Initiator: initiator,
Receiver: receiver,
Amount: &amount,
@ -174,7 +174,7 @@ func NewMsgConvertNativeCoinToERC20(
}
// GetSigners implements types.Msg
func (msg MsgConvertNativeCoinToERC20) GetSigners() []sdk.AccAddress {
func (msg MsgConvertCosmosCoinToERC20) GetSigners() []sdk.AccAddress {
sender, err := sdk.AccAddressFromBech32(msg.Initiator)
if err != nil {
panic(err)
@ -183,7 +183,7 @@ func (msg MsgConvertNativeCoinToERC20) GetSigners() []sdk.AccAddress {
}
// ValidateBasic implements types.Msg
func (msg MsgConvertNativeCoinToERC20) ValidateBasic() error {
func (msg MsgConvertCosmosCoinToERC20) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Initiator)
if err != nil {
return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid initiator address (%s): %s", msg.Initiator, err.Error())
@ -201,12 +201,12 @@ func (msg MsgConvertNativeCoinToERC20) ValidateBasic() error {
}
// GetSignBytes implements legacytx.LegacyMsg
func (msg MsgConvertNativeCoinToERC20) GetSignBytes() []byte {
func (msg MsgConvertCosmosCoinToERC20) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
// Route implements legacytx.LegacyMsg
func (MsgConvertNativeCoinToERC20) Route() string { return RouterKey }
func (MsgConvertCosmosCoinToERC20) Route() string { return RouterKey }
// Type implements legacytx.LegacyMsg
func (MsgConvertNativeCoinToERC20) Type() string { return TypeMsgConvertNativeCoinToERC20 }
func (MsgConvertCosmosCoinToERC20) Type() string { return TypeMsgConvertCosmosCoinToERC20 }

View File

@ -200,7 +200,7 @@ func TestMsgConvertERC20ToCoin(t *testing.T) {
}
}
func TestConvertNativeCoinToERC20_ValidateBasic(t *testing.T) {
func TestConvertCosmosCoinToERC20_ValidateBasic(t *testing.T) {
validKavaAddr := app.RandomAddress()
validHexAddr, _ := testutil.RandomEvmAccount()
invalidAddr := "not-an-address"
@ -273,7 +273,7 @@ func TestConvertNativeCoinToERC20_ValidateBasic(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
msg := types.NewMsgConvertNativeCoinToERC20(
msg := types.NewMsgConvertCosmosCoinToERC20(
tc.initiator,
tc.receiver,
tc.amount,
@ -285,17 +285,17 @@ func TestConvertNativeCoinToERC20_ValidateBasic(t *testing.T) {
} else {
require.NoError(t, err)
require.Equal(t, "evmutil", msg.Route())
require.Equal(t, "evmutil_convert_native_coin_to_erc20", msg.Type())
require.Equal(t, "evmutil_convert_cosmos_coin_to_erc20", msg.Type())
require.NotPanics(t, func() { _ = msg.GetSignBytes() })
}
})
}
}
func TestConvertNativeCoinToERC20_GetSigners(t *testing.T) {
func TestConvertCosmosCoinToERC20_GetSigners(t *testing.T) {
t.Run("valid", func(t *testing.T) {
initiator := app.RandomAddress()
signers := types.MsgConvertNativeCoinToERC20{
signers := types.MsgConvertCosmosCoinToERC20{
Initiator: initiator.String(),
}.GetSigners()
require.Len(t, signers, 1)
@ -304,7 +304,7 @@ func TestConvertNativeCoinToERC20_GetSigners(t *testing.T) {
t.Run("panics when depositor is invalid", func(t *testing.T) {
require.Panics(t, func() {
types.MsgConvertNativeCoinToERC20{
types.MsgConvertCosmosCoinToERC20{
Initiator: "not-an-address",
}.GetSigners()
})

View File

@ -8,8 +8,8 @@ import (
var (
KeyEnabledConversionPairs = []byte("EnabledConversionPairs")
DefaultConversionPairs = ConversionPairs{}
KeyAllowedNativeDenoms = []byte("AllowedNativeDenoms")
DefaultAllowedNativeDenoms = AllowedNativeCoinERC20Tokens{}
KeyAllowedCosmosDenoms = []byte("AllowedCosmosDenoms")
DefaultAllowedCosmosDenoms = AllowedCosmosCoinERC20Tokens{}
)
// ParamKeyTable for evmutil module.
@ -22,18 +22,18 @@ func ParamKeyTable() paramtypes.KeyTable {
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair(KeyEnabledConversionPairs, &p.EnabledConversionPairs, validateConversionPairs),
paramtypes.NewParamSetPair(KeyAllowedNativeDenoms, &p.AllowedNativeDenoms, validateAllowedNativeCoinERC20Tokens),
paramtypes.NewParamSetPair(KeyAllowedCosmosDenoms, &p.AllowedCosmosDenoms, validateAllowedCosmosCoinERC20Tokens),
}
}
// NewParams returns new evmutil module Params.
func NewParams(
conversionPairs ConversionPairs,
allowedNativeDenoms AllowedNativeCoinERC20Tokens,
allowedCosmosDenoms AllowedCosmosCoinERC20Tokens,
) Params {
return Params{
EnabledConversionPairs: conversionPairs,
AllowedNativeDenoms: allowedNativeDenoms,
AllowedCosmosDenoms: allowedCosmosDenoms,
}
}
@ -41,7 +41,7 @@ func NewParams(
func DefaultParams() Params {
return NewParams(
DefaultConversionPairs,
DefaultAllowedNativeDenoms,
DefaultAllowedCosmosDenoms,
)
}
@ -50,7 +50,7 @@ func (p *Params) Validate() error {
if err := p.EnabledConversionPairs.Validate(); err != nil {
return err
}
if err := p.AllowedNativeDenoms.Validate(); err != nil {
if err := p.AllowedCosmosDenoms.Validate(); err != nil {
return err
}
return nil

View File

@ -34,13 +34,13 @@ func (suite *ParamsTestSuite) TestMarshalYAML() {
"usdc",
),
)
allowedNativeDenoms := types.NewAllowedNativeCoinERC20Tokens(
types.NewAllowedNativeCoinERC20Token("denom", "Sdk Denom!", "DENOM", 6),
allowedCosmosDenoms := types.NewAllowedCosmosCoinERC20Tokens(
types.NewAllowedCosmosCoinERC20Token("denom", "Sdk Denom!", "DENOM", 6),
)
p := types.NewParams(
conversionPairs,
allowedNativeDenoms,
allowedCosmosDenoms,
)
data, err := yaml.Marshal(p)
@ -51,8 +51,8 @@ func (suite *ParamsTestSuite) TestMarshalYAML() {
suite.Require().NoError(err)
_, ok := params["enabled_conversion_pairs"]
suite.Require().True(ok, "enabled_conversion_pairs should exist in yaml")
_, ok = params["allowed_native_denoms"]
suite.Require().True(ok, "allowed_native_denoms should exist in yaml")
_, ok = params["allowed_cosmos_denoms"]
suite.Require().True(ok, "allowed_cosmos_denoms should exist in yaml")
}
func (suite *ParamsTestSuite) TestParamSetPairs_EnabledConversionPairs() {
@ -76,22 +76,22 @@ func (suite *ParamsTestSuite) TestParamSetPairs_EnabledConversionPairs() {
suite.Require().EqualError(paramSetPair.ValidatorFn(struct{}{}), "invalid parameter type: struct {}")
}
func (suite *ParamsTestSuite) TestParamSetPairs_AllowedNativeDenoms() {
suite.Require().Equal([]byte("AllowedNativeDenoms"), types.KeyAllowedNativeDenoms)
func (suite *ParamsTestSuite) TestParamSetPairs_AllowedCosmosDenoms() {
suite.Require().Equal([]byte("AllowedCosmosDenoms"), types.KeyAllowedCosmosDenoms)
defaultParams := types.DefaultParams()
var paramSetPair *paramstypes.ParamSetPair
for _, pair := range defaultParams.ParamSetPairs() {
if bytes.Equal(pair.Key, types.KeyAllowedNativeDenoms) {
if bytes.Equal(pair.Key, types.KeyAllowedCosmosDenoms) {
paramSetPair = &pair
break
}
}
suite.Require().NotNil(paramSetPair)
pairs, ok := paramSetPair.Value.(*types.AllowedNativeCoinERC20Tokens)
pairs, ok := paramSetPair.Value.(*types.AllowedCosmosCoinERC20Tokens)
suite.Require().True(ok)
suite.Require().Equal(pairs, &defaultParams.AllowedNativeDenoms)
suite.Require().Equal(pairs, &defaultParams.AllowedCosmosDenoms)
suite.Require().Nil(paramSetPair.ValidatorFn(*pairs))
suite.Require().EqualError(paramSetPair.ValidatorFn(struct{}{}), "invalid parameter type: struct {}")
@ -114,11 +114,11 @@ func (suite *ParamsTestSuite) TestParams_Validate() {
"kava", // duplicate denom!
),
)
validAllowedNativeDenoms := types.NewAllowedNativeCoinERC20Tokens(
types.NewAllowedNativeCoinERC20Token("hard", "EVM Hard", "HARD", 6),
validAllowedCosmosDenoms := types.NewAllowedCosmosCoinERC20Tokens(
types.NewAllowedCosmosCoinERC20Token("hard", "EVM Hard", "HARD", 6),
)
invalidAllowedNativeDenoms := types.NewAllowedNativeCoinERC20Tokens(
types.NewAllowedNativeCoinERC20Token("", "Invalid Token", "NOPE", 0), // empty sdk denom
invalidAllowedCosmosDenoms := types.NewAllowedCosmosCoinERC20Tokens(
types.NewAllowedCosmosCoinERC20Token("", "Invalid Token", "NOPE", 0), // empty sdk denom
)
testCases := []struct {
@ -128,22 +128,22 @@ func (suite *ParamsTestSuite) TestParams_Validate() {
}{
{
name: "valid - empty",
params: types.NewParams(types.NewConversionPairs(), types.NewAllowedNativeCoinERC20Tokens()),
params: types.NewParams(types.NewConversionPairs(), types.NewAllowedCosmosCoinERC20Tokens()),
expErr: "",
},
{
name: "valid - with data",
params: types.NewParams(validConversionPairs, validAllowedNativeDenoms),
params: types.NewParams(validConversionPairs, validAllowedCosmosDenoms),
expErr: "",
},
{
name: "invalid - invalid conversion pair",
params: types.NewParams(invalidConversionPairs, validAllowedNativeDenoms),
params: types.NewParams(invalidConversionPairs, validAllowedCosmosDenoms),
expErr: "found duplicate",
},
{
name: "invalid - invalid allowed native denoms",
params: types.NewParams(validConversionPairs, invalidAllowedNativeDenoms),
name: "invalid - invalid allowed cosmos denoms",
params: types.NewParams(validConversionPairs, invalidAllowedCosmosDenoms),
expErr: "invalid token",
},
}

View File

@ -236,8 +236,8 @@ func (m *MsgConvertERC20ToCoinResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgConvertERC20ToCoinResponse proto.InternalMessageInfo
// ConvertNativeCoinToERC20 defines a conversion from native sdk.Coin to ERC20.
type MsgConvertNativeCoinToERC20 struct {
// ConvertCosmosCoinToERC20 defines a conversion from cosmos sdk.Coin to ERC20.
type MsgConvertCosmosCoinToERC20 struct {
// Kava bech32 address initiating the conversion.
Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"`
// EVM hex address that will receive the ERC20 tokens.
@ -246,18 +246,18 @@ type MsgConvertNativeCoinToERC20 struct {
Amount *types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
}
func (m *MsgConvertNativeCoinToERC20) Reset() { *m = MsgConvertNativeCoinToERC20{} }
func (m *MsgConvertNativeCoinToERC20) String() string { return proto.CompactTextString(m) }
func (*MsgConvertNativeCoinToERC20) ProtoMessage() {}
func (*MsgConvertNativeCoinToERC20) Descriptor() ([]byte, []int) {
func (m *MsgConvertCosmosCoinToERC20) Reset() { *m = MsgConvertCosmosCoinToERC20{} }
func (m *MsgConvertCosmosCoinToERC20) String() string { return proto.CompactTextString(m) }
func (*MsgConvertCosmosCoinToERC20) ProtoMessage() {}
func (*MsgConvertCosmosCoinToERC20) Descriptor() ([]byte, []int) {
return fileDescriptor_6e82783c6c58f89c, []int{4}
}
func (m *MsgConvertNativeCoinToERC20) XXX_Unmarshal(b []byte) error {
func (m *MsgConvertCosmosCoinToERC20) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgConvertNativeCoinToERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
func (m *MsgConvertCosmosCoinToERC20) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgConvertNativeCoinToERC20.Marshal(b, m, deterministic)
return xxx_messageInfo_MsgConvertCosmosCoinToERC20.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@ -267,55 +267,55 @@ func (m *MsgConvertNativeCoinToERC20) XXX_Marshal(b []byte, deterministic bool)
return b[:n], nil
}
}
func (m *MsgConvertNativeCoinToERC20) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgConvertNativeCoinToERC20.Merge(m, src)
func (m *MsgConvertCosmosCoinToERC20) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgConvertCosmosCoinToERC20.Merge(m, src)
}
func (m *MsgConvertNativeCoinToERC20) XXX_Size() int {
func (m *MsgConvertCosmosCoinToERC20) XXX_Size() int {
return m.Size()
}
func (m *MsgConvertNativeCoinToERC20) XXX_DiscardUnknown() {
xxx_messageInfo_MsgConvertNativeCoinToERC20.DiscardUnknown(m)
func (m *MsgConvertCosmosCoinToERC20) XXX_DiscardUnknown() {
xxx_messageInfo_MsgConvertCosmosCoinToERC20.DiscardUnknown(m)
}
var xxx_messageInfo_MsgConvertNativeCoinToERC20 proto.InternalMessageInfo
var xxx_messageInfo_MsgConvertCosmosCoinToERC20 proto.InternalMessageInfo
func (m *MsgConvertNativeCoinToERC20) GetInitiator() string {
func (m *MsgConvertCosmosCoinToERC20) GetInitiator() string {
if m != nil {
return m.Initiator
}
return ""
}
func (m *MsgConvertNativeCoinToERC20) GetReceiver() string {
func (m *MsgConvertCosmosCoinToERC20) GetReceiver() string {
if m != nil {
return m.Receiver
}
return ""
}
func (m *MsgConvertNativeCoinToERC20) GetAmount() *types.Coin {
func (m *MsgConvertCosmosCoinToERC20) GetAmount() *types.Coin {
if m != nil {
return m.Amount
}
return nil
}
// MsgConvertNativeCoinToERC20Response defines the response value from Msg/MsgConvertNativeCoinToERC20.
type MsgConvertNativeCoinToERC20Response struct {
// MsgConvertCosmosCoinToERC20Response defines the response value from Msg/MsgConvertCosmosCoinToERC20.
type MsgConvertCosmosCoinToERC20Response struct {
}
func (m *MsgConvertNativeCoinToERC20Response) Reset() { *m = MsgConvertNativeCoinToERC20Response{} }
func (m *MsgConvertNativeCoinToERC20Response) String() string { return proto.CompactTextString(m) }
func (*MsgConvertNativeCoinToERC20Response) ProtoMessage() {}
func (*MsgConvertNativeCoinToERC20Response) Descriptor() ([]byte, []int) {
func (m *MsgConvertCosmosCoinToERC20Response) Reset() { *m = MsgConvertCosmosCoinToERC20Response{} }
func (m *MsgConvertCosmosCoinToERC20Response) String() string { return proto.CompactTextString(m) }
func (*MsgConvertCosmosCoinToERC20Response) ProtoMessage() {}
func (*MsgConvertCosmosCoinToERC20Response) Descriptor() ([]byte, []int) {
return fileDescriptor_6e82783c6c58f89c, []int{5}
}
func (m *MsgConvertNativeCoinToERC20Response) XXX_Unmarshal(b []byte) error {
func (m *MsgConvertCosmosCoinToERC20Response) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgConvertNativeCoinToERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
func (m *MsgConvertCosmosCoinToERC20Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgConvertNativeCoinToERC20Response.Marshal(b, m, deterministic)
return xxx_messageInfo_MsgConvertCosmosCoinToERC20Response.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@ -325,64 +325,64 @@ func (m *MsgConvertNativeCoinToERC20Response) XXX_Marshal(b []byte, deterministi
return b[:n], nil
}
}
func (m *MsgConvertNativeCoinToERC20Response) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgConvertNativeCoinToERC20Response.Merge(m, src)
func (m *MsgConvertCosmosCoinToERC20Response) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgConvertCosmosCoinToERC20Response.Merge(m, src)
}
func (m *MsgConvertNativeCoinToERC20Response) XXX_Size() int {
func (m *MsgConvertCosmosCoinToERC20Response) XXX_Size() int {
return m.Size()
}
func (m *MsgConvertNativeCoinToERC20Response) XXX_DiscardUnknown() {
xxx_messageInfo_MsgConvertNativeCoinToERC20Response.DiscardUnknown(m)
func (m *MsgConvertCosmosCoinToERC20Response) XXX_DiscardUnknown() {
xxx_messageInfo_MsgConvertCosmosCoinToERC20Response.DiscardUnknown(m)
}
var xxx_messageInfo_MsgConvertNativeCoinToERC20Response proto.InternalMessageInfo
var xxx_messageInfo_MsgConvertCosmosCoinToERC20Response proto.InternalMessageInfo
func init() {
proto.RegisterType((*MsgConvertCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertCoinToERC20")
proto.RegisterType((*MsgConvertCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertCoinToERC20Response")
proto.RegisterType((*MsgConvertERC20ToCoin)(nil), "kava.evmutil.v1beta1.MsgConvertERC20ToCoin")
proto.RegisterType((*MsgConvertERC20ToCoinResponse)(nil), "kava.evmutil.v1beta1.MsgConvertERC20ToCoinResponse")
proto.RegisterType((*MsgConvertNativeCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20")
proto.RegisterType((*MsgConvertNativeCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertNativeCoinToERC20Response")
proto.RegisterType((*MsgConvertCosmosCoinToERC20)(nil), "kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20")
proto.RegisterType((*MsgConvertCosmosCoinToERC20Response)(nil), "kava.evmutil.v1beta1.MsgConvertCosmosCoinToERC20Response")
}
func init() { proto.RegisterFile("kava/evmutil/v1beta1/tx.proto", fileDescriptor_6e82783c6c58f89c) }
var fileDescriptor_6e82783c6c58f89c = []byte{
// 519 bytes of a gzipped FileDescriptorProto
// 517 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x6b, 0x13, 0x41,
0x14, 0xce, 0x34, 0x52, 0x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 0xdc, 0xd7, 0x77, 0x0e,
0x59, 0x50, 0xe9, 0x1d, 0x5d, 0xff, 0xf6, 0xc0, 0x8f, 0xcc, 0x03, 0x17, 0x99, 0x07, 0x2e, 0x33,
0x0f, 0x5c, 0x67, 0x1e, 0xf8, 0x36, 0xf7, 0x6a, 0x97, 0x73, 0xaf, 0xf6, 0x73, 0xee, 0xd5, 0xde,
0x3f, 0xb7, 0xf6, 0x56, 0x97, 0x69, 0x9f, 0x92, 0x50, 0xe6, 0x27, 0xff, 0xac, 0x7c, 0xe0, 0xf2,
0xf5, 0x0d, 0x37, 0xf2, 0x57, 0x67, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x66, 0xcd,
0xe3, 0xfd, 0x04, 0x00, 0x00,
}
func (this *MsgConvertCoinToERC20) VerboseEqual(that interface{}) error {
@ -619,7 +619,7 @@ func (this *MsgConvertERC20ToCoinResponse) Equal(that interface{}) bool {
}
return true
}
func (this *MsgConvertNativeCoinToERC20) VerboseEqual(that interface{}) error {
func (this *MsgConvertCosmosCoinToERC20) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
return nil
@ -627,22 +627,22 @@ func (this *MsgConvertNativeCoinToERC20) VerboseEqual(that interface{}) error {
return fmt.Errorf("that == nil && this != nil")
}
that1, ok := that.(*MsgConvertNativeCoinToERC20)
that1, ok := that.(*MsgConvertCosmosCoinToERC20)
if !ok {
that2, ok := that.(MsgConvertNativeCoinToERC20)
that2, ok := that.(MsgConvertCosmosCoinToERC20)
if ok {
that1 = &that2
} else {
return fmt.Errorf("that is not of type *MsgConvertNativeCoinToERC20")
return fmt.Errorf("that is not of type *MsgConvertCosmosCoinToERC20")
}
}
if that1 == nil {
if this == nil {
return nil
}
return fmt.Errorf("that is type *MsgConvertNativeCoinToERC20 but is nil && this != nil")
return fmt.Errorf("that is type *MsgConvertCosmosCoinToERC20 but is nil && this != nil")
} else if this == nil {
return fmt.Errorf("that is type *MsgConvertNativeCoinToERC20 but is not nil && this == nil")
return fmt.Errorf("that is type *MsgConvertCosmosCoinToERC20 but is not nil && this == nil")
}
if this.Initiator != that1.Initiator {
return fmt.Errorf("Initiator this(%v) Not Equal that(%v)", this.Initiator, that1.Initiator)
@ -655,14 +655,14 @@ func (this *MsgConvertNativeCoinToERC20) VerboseEqual(that interface{}) error {
}
return nil
}
func (this *MsgConvertNativeCoinToERC20) Equal(that interface{}) bool {
func (this *MsgConvertCosmosCoinToERC20) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*MsgConvertNativeCoinToERC20)
that1, ok := that.(*MsgConvertCosmosCoinToERC20)
if !ok {
that2, ok := that.(MsgConvertNativeCoinToERC20)
that2, ok := that.(MsgConvertCosmosCoinToERC20)
if ok {
that1 = &that2
} else {
@ -685,7 +685,7 @@ func (this *MsgConvertNativeCoinToERC20) Equal(that interface{}) bool {
}
return true
}
func (this *MsgConvertNativeCoinToERC20Response) VerboseEqual(that interface{}) error {
func (this *MsgConvertCosmosCoinToERC20Response) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
return nil
@ -693,33 +693,33 @@ func (this *MsgConvertNativeCoinToERC20Response) VerboseEqual(that interface{})
return fmt.Errorf("that == nil && this != nil")
}
that1, ok := that.(*MsgConvertNativeCoinToERC20Response)
that1, ok := that.(*MsgConvertCosmosCoinToERC20Response)
if !ok {
that2, ok := that.(MsgConvertNativeCoinToERC20Response)
that2, ok := that.(MsgConvertCosmosCoinToERC20Response)
if ok {
that1 = &that2
} else {
return fmt.Errorf("that is not of type *MsgConvertNativeCoinToERC20Response")
return fmt.Errorf("that is not of type *MsgConvertCosmosCoinToERC20Response")
}
}
if that1 == nil {
if this == nil {
return nil
}
return fmt.Errorf("that is type *MsgConvertNativeCoinToERC20Response but is nil && this != nil")
return fmt.Errorf("that is type *MsgConvertCosmosCoinToERC20Response but is nil && this != nil")
} else if this == nil {
return fmt.Errorf("that is type *MsgConvertNativeCoinToERC20Response but is not nil && this == nil")
return fmt.Errorf("that is type *MsgConvertCosmosCoinToERC20Response but is not nil && this == nil")
}
return nil
}
func (this *MsgConvertNativeCoinToERC20Response) Equal(that interface{}) bool {
func (this *MsgConvertCosmosCoinToERC20Response) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*MsgConvertNativeCoinToERC20Response)
that1, ok := that.(*MsgConvertCosmosCoinToERC20Response)
if !ok {
that2, ok := that.(MsgConvertNativeCoinToERC20Response)
that2, ok := that.(MsgConvertCosmosCoinToERC20Response)
if ok {
that1 = &that2
} else {
@ -750,8 +750,8 @@ type MsgClient interface {
ConvertCoinToERC20(ctx context.Context, in *MsgConvertCoinToERC20, opts ...grpc.CallOption) (*MsgConvertCoinToERC20Response, error)
// ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin.
ConvertERC20ToCoin(ctx context.Context, in *MsgConvertERC20ToCoin, opts ...grpc.CallOption) (*MsgConvertERC20ToCoinResponse, error)
// ConvertNativeCoinToERC20 defines a method for converting a native sdk.Coin to an ERC20.
ConvertNativeCoinToERC20(ctx context.Context, in *MsgConvertNativeCoinToERC20, opts ...grpc.CallOption) (*MsgConvertNativeCoinToERC20Response, error)
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
ConvertCosmosCoinToERC20(ctx context.Context, in *MsgConvertCosmosCoinToERC20, opts ...grpc.CallOption) (*MsgConvertCosmosCoinToERC20Response, error)
}
type msgClient struct {
@ -780,9 +780,9 @@ func (c *msgClient) ConvertERC20ToCoin(ctx context.Context, in *MsgConvertERC20T
return out, nil
}
func (c *msgClient) ConvertNativeCoinToERC20(ctx context.Context, in *MsgConvertNativeCoinToERC20, opts ...grpc.CallOption) (*MsgConvertNativeCoinToERC20Response, error) {
out := new(MsgConvertNativeCoinToERC20Response)
err := c.cc.Invoke(ctx, "/kava.evmutil.v1beta1.Msg/ConvertNativeCoinToERC20", in, out, opts...)
func (c *msgClient) ConvertCosmosCoinToERC20(ctx context.Context, in *MsgConvertCosmosCoinToERC20, opts ...grpc.CallOption) (*MsgConvertCosmosCoinToERC20Response, error) {
out := new(MsgConvertCosmosCoinToERC20Response)
err := c.cc.Invoke(ctx, "/kava.evmutil.v1beta1.Msg/ConvertCosmosCoinToERC20", in, out, opts...)
if err != nil {
return nil, err
}
@ -795,8 +795,8 @@ type MsgServer interface {
ConvertCoinToERC20(context.Context, *MsgConvertCoinToERC20) (*MsgConvertCoinToERC20Response, error)
// ConvertERC20ToCoin defines a method for converting Kava ERC20 to sdk.Coin.
ConvertERC20ToCoin(context.Context, *MsgConvertERC20ToCoin) (*MsgConvertERC20ToCoinResponse, error)
// ConvertNativeCoinToERC20 defines a method for converting a native sdk.Coin to an ERC20.
ConvertNativeCoinToERC20(context.Context, *MsgConvertNativeCoinToERC20) (*MsgConvertNativeCoinToERC20Response, error)
// ConvertCosmosCoinToERC20 defines a method for converting a cosmos sdk.Coin to an ERC20.
ConvertCosmosCoinToERC20(context.Context, *MsgConvertCosmosCoinToERC20) (*MsgConvertCosmosCoinToERC20Response, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -809,8 +809,8 @@ func (*UnimplementedMsgServer) ConvertCoinToERC20(ctx context.Context, req *MsgC
func (*UnimplementedMsgServer) ConvertERC20ToCoin(ctx context.Context, req *MsgConvertERC20ToCoin) (*MsgConvertERC20ToCoinResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ConvertERC20ToCoin not implemented")
}
func (*UnimplementedMsgServer) ConvertNativeCoinToERC20(ctx context.Context, req *MsgConvertNativeCoinToERC20) (*MsgConvertNativeCoinToERC20Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method ConvertNativeCoinToERC20 not implemented")
func (*UnimplementedMsgServer) ConvertCosmosCoinToERC20(ctx context.Context, req *MsgConvertCosmosCoinToERC20) (*MsgConvertCosmosCoinToERC20Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method ConvertCosmosCoinToERC20 not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
@ -853,20 +853,20 @@ func _Msg_ConvertERC20ToCoin_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
func _Msg_ConvertNativeCoinToERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgConvertNativeCoinToERC20)
func _Msg_ConvertCosmosCoinToERC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgConvertCosmosCoinToERC20)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ConvertNativeCoinToERC20(ctx, in)
return srv.(MsgServer).ConvertCosmosCoinToERC20(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/kava.evmutil.v1beta1.Msg/ConvertNativeCoinToERC20",
FullMethod: "/kava.evmutil.v1beta1.Msg/ConvertCosmosCoinToERC20",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ConvertNativeCoinToERC20(ctx, req.(*MsgConvertNativeCoinToERC20))
return srv.(MsgServer).ConvertCosmosCoinToERC20(ctx, req.(*MsgConvertCosmosCoinToERC20))
}
return interceptor(ctx, in, info, handler)
}
@ -884,8 +884,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
Handler: _Msg_ConvertERC20ToCoin_Handler,
},
{
MethodName: "ConvertNativeCoinToERC20",
Handler: _Msg_ConvertNativeCoinToERC20_Handler,
MethodName: "ConvertCosmosCoinToERC20",
Handler: _Msg_ConvertCosmosCoinToERC20_Handler,
},
},
Streams: []grpc.StreamDesc{},
@ -1041,7 +1041,7 @@ func (m *MsgConvertERC20ToCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int,
return len(dAtA) - i, nil
}
func (m *MsgConvertNativeCoinToERC20) Marshal() (dAtA []byte, err error) {
func (m *MsgConvertCosmosCoinToERC20) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -1051,12 +1051,12 @@ func (m *MsgConvertNativeCoinToERC20) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *MsgConvertNativeCoinToERC20) MarshalTo(dAtA []byte) (int, error) {
func (m *MsgConvertCosmosCoinToERC20) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgConvertNativeCoinToERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) {
func (m *MsgConvertCosmosCoinToERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@ -1090,7 +1090,7 @@ func (m *MsgConvertNativeCoinToERC20) MarshalToSizedBuffer(dAtA []byte) (int, er
return len(dAtA) - i, nil
}
func (m *MsgConvertNativeCoinToERC20Response) Marshal() (dAtA []byte, err error) {
func (m *MsgConvertCosmosCoinToERC20Response) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -1100,12 +1100,12 @@ func (m *MsgConvertNativeCoinToERC20Response) Marshal() (dAtA []byte, err error)
return dAtA[:n], nil
}
func (m *MsgConvertNativeCoinToERC20Response) MarshalTo(dAtA []byte) (int, error) {
func (m *MsgConvertCosmosCoinToERC20Response) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgConvertNativeCoinToERC20Response) MarshalToSizedBuffer(dAtA []byte) (int, error) {
func (m *MsgConvertCosmosCoinToERC20Response) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@ -1186,7 +1186,7 @@ func (m *MsgConvertERC20ToCoinResponse) Size() (n int) {
return n
}
func (m *MsgConvertNativeCoinToERC20) Size() (n int) {
func (m *MsgConvertCosmosCoinToERC20) Size() (n int) {
if m == nil {
return 0
}
@ -1207,7 +1207,7 @@ func (m *MsgConvertNativeCoinToERC20) Size() (n int) {
return n
}
func (m *MsgConvertNativeCoinToERC20Response) Size() (n int) {
func (m *MsgConvertCosmosCoinToERC20Response) Size() (n int) {
if m == nil {
return 0
}
@ -1652,7 +1652,7 @@ func (m *MsgConvertERC20ToCoinResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgConvertNativeCoinToERC20) Unmarshal(dAtA []byte) error {
func (m *MsgConvertCosmosCoinToERC20) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@ -1675,10 +1675,10 @@ func (m *MsgConvertNativeCoinToERC20) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgConvertNativeCoinToERC20: wiretype end group for non-group")
return fmt.Errorf("proto: MsgConvertCosmosCoinToERC20: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgConvertNativeCoinToERC20: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: MsgConvertCosmosCoinToERC20: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@ -1802,7 +1802,7 @@ func (m *MsgConvertNativeCoinToERC20) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgConvertNativeCoinToERC20Response) Unmarshal(dAtA []byte) error {
func (m *MsgConvertCosmosCoinToERC20Response) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@ -1825,10 +1825,10 @@ func (m *MsgConvertNativeCoinToERC20Response) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgConvertNativeCoinToERC20Response: wiretype end group for non-group")
return fmt.Errorf("proto: MsgConvertCosmosCoinToERC20Response: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgConvertNativeCoinToERC20Response: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: MsgConvertCosmosCoinToERC20Response: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default: