diff --git a/changelog.md b/changelog.md index 9a5e228c3b..4c48e24d25 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,10 @@ # CHANGELOG -## unreleased +## Unreleased + +### Features + +* [3353](https://github.com/zeta-chain/node/pull/3353) - add liquidity cap parameter to ZRC20 creation ### Refactor diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index 3182bec082..84dbd423d6 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -211,6 +211,7 @@ message MsgWhitelistERC20 { string symbol = 5; uint32 decimals = 6; int64 gas_limit = 7; + string liquidity_cap = 8; } ``` diff --git a/docs/spec/fungible/messages.md b/docs/spec/fungible/messages.md index ce624844ea..97130725ce 100644 --- a/docs/spec/fungible/messages.md +++ b/docs/spec/fungible/messages.md @@ -43,6 +43,7 @@ message MsgDeployFungibleCoinZRC20 { string symbol = 6; pkg.coin.CoinType coin_type = 7; int64 gas_limit = 8; + string liquidity_cap = 9; } ``` diff --git a/e2e/e2etests/test_migrate_chain_support.go b/e2e/e2etests/test_migrate_chain_support.go index 1dbeb88582..5c05e36866 100644 --- a/e2e/e2etests/test_migrate_chain_support.go +++ b/e2e/e2etests/test_migrate_chain_support.go @@ -7,6 +7,7 @@ import ( "os/exec" "time" + sdkmath "cosmossdk.io/math" "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" @@ -79,6 +80,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { "sETH", coin.CoinType_Gas, 100000, + nil, ), ) require.NoError(r, err) @@ -165,6 +167,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { "USDT", 18, 100000, + sdkmath.NewUintFromString("100000000000000000000000000"), )) require.NoError(r, err) diff --git a/e2e/e2etests/test_solana_whitelist_spl.go b/e2e/e2etests/test_solana_whitelist_spl.go index edf605d855..7ad11c088c 100644 --- a/e2e/e2etests/test_solana_whitelist_spl.go +++ b/e2e/e2etests/test_solana_whitelist_spl.go @@ -1,6 +1,7 @@ package e2etests import ( + sdkmath "cosmossdk.io/math" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" "github.com/stretchr/testify/require" @@ -45,6 +46,7 @@ func TestSolanaWhitelistSPL(r *runner.E2ERunner, _ []string) { "TESTSPL", 6, 100000, + sdkmath.NewUintFromString("100000000000000000000000000"), )) require.NoError(r, err) diff --git a/e2e/e2etests/test_whitelist_erc20.go b/e2e/e2etests/test_whitelist_erc20.go index a375a2863f..dd77e601d1 100644 --- a/e2e/e2etests/test_whitelist_erc20.go +++ b/e2e/e2etests/test_whitelist_erc20.go @@ -3,6 +3,7 @@ package e2etests import ( "math/big" + sdkmath "cosmossdk.io/math" "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" @@ -40,6 +41,7 @@ func TestWhitelistERC20(r *runner.E2ERunner, _ []string) { "NEWERC20", 6, 100000, + sdkmath.NewUintFromString("100000000000000000000000000"), )) require.NoError(r, err) diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index e83d6a0d71..5d055c8d42 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -443,6 +443,7 @@ func (zts ZetaTxServer) DeployZRC20s( "gETH", coin.CoinType_Gas, 100000, + nil, ), fungibletypes.NewMsgDeployFungibleCoinZRC20( deployerAddr, @@ -453,6 +454,7 @@ func (zts ZetaTxServer) DeployZRC20s( "tBTC", coin.CoinType_Gas, 100000, + nil, ), fungibletypes.NewMsgDeployFungibleCoinZRC20( deployerAddr, @@ -463,6 +465,7 @@ func (zts ZetaTxServer) DeployZRC20s( "SOL", coin.CoinType_Gas, 100000, + nil, ), fungibletypes.NewMsgDeployFungibleCoinZRC20( deployerAddr, @@ -473,6 +476,7 @@ func (zts ZetaTxServer) DeployZRC20s( "TON", coin.CoinType_Gas, 100_000, + nil, ), fungibletypes.NewMsgDeployFungibleCoinZRC20( deployerAddr, @@ -483,6 +487,7 @@ func (zts ZetaTxServer) DeployZRC20s( "USDT", coin.CoinType_ERC20, 100000, + nil, ), } @@ -496,6 +501,7 @@ func (zts ZetaTxServer) DeployZRC20s( "USDT", coin.CoinType_ERC20, 100000, + nil, )) } diff --git a/precompiles/bank/method_test.go b/precompiles/bank/method_test.go index 46a33a740e..69d6ee0e9b 100644 --- a/precompiles/bank/method_test.go +++ b/precompiles/bank/method_test.go @@ -4,6 +4,8 @@ import ( "math/big" "testing" + sdkmath "cosmossdk.io/math" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts/abi" @@ -17,6 +19,7 @@ import ( "github.com/zeta-chain/ethermint/x/evm/statedb" "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/pkg/contracts/erc1967proxy" + "github.com/zeta-chain/node/pkg/ptr" precompiletypes "github.com/zeta-chain/node/precompiles/types" "github.com/zeta-chain/node/testutil/keeper" "github.com/zeta-chain/node/testutil/sample" @@ -634,6 +637,7 @@ func setupGasCoin( symbol, 8, nil, + ptr.Ptr(sdkmath.NewUintFromString("100000000000000000000000000")), ) require.NoError(t, err) assertContractDeployment(t, *evmk, ctx, addr) diff --git a/precompiles/staking/staking_test.go b/precompiles/staking/staking_test.go index 0d35b73132..712e84985c 100644 --- a/precompiles/staking/staking_test.go +++ b/precompiles/staking/staking_test.go @@ -28,6 +28,7 @@ import ( "github.com/zeta-chain/node/cmd/zetacored/config" "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/pkg/contracts/erc1967proxy" + "github.com/zeta-chain/node/pkg/ptr" "github.com/zeta-chain/node/precompiles/prototype" "github.com/zeta-chain/node/testutil/keeper" "github.com/zeta-chain/node/testutil/sample" @@ -508,6 +509,7 @@ func setupGasCoin( symbol, 8, nil, + ptr.Ptr(math.NewUintFromString("100000000000000000000000000")), ) require.NoError(t, err) assertContractDeployment(t, *evmk, ctx, addr) diff --git a/proto/zetachain/zetacore/crosschain/tx.proto b/proto/zetachain/zetacore/crosschain/tx.proto index d4b9af05cf..c7e46e6184 100644 --- a/proto/zetachain/zetacore/crosschain/tx.proto +++ b/proto/zetachain/zetacore/crosschain/tx.proto @@ -81,6 +81,10 @@ message MsgWhitelistERC20 { string symbol = 5; uint32 decimals = 6; int64 gas_limit = 7; + string liquidity_cap = 8 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", + (gogoproto.nullable) = false + ]; } message MsgWhitelistERC20Response { diff --git a/proto/zetachain/zetacore/fungible/tx.proto b/proto/zetachain/zetacore/fungible/tx.proto index 69be3bf7a4..8f43092a32 100644 --- a/proto/zetachain/zetacore/fungible/tx.proto +++ b/proto/zetachain/zetacore/fungible/tx.proto @@ -69,6 +69,8 @@ message MsgDeployFungibleCoinZRC20 { string symbol = 6; pkg.coin.CoinType coin_type = 7; int64 gas_limit = 8; + string liquidity_cap = 9 + [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint" ]; } message MsgDeployFungibleCoinZRC20Response { string address = 1; } diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index 9ad11dc606..f63aefd014 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -14,6 +14,8 @@ import ( fungibletypes "github.com/zeta-chain/node/x/fungible/types" + math "cosmossdk.io/math" + mock "github.com/stretchr/testify/mock" types "github.com/cosmos/cosmos-sdk/types" @@ -120,9 +122,9 @@ func (_m *CrosschainFungibleKeeper) CallZRC20Burn(ctx types.Context, sender comm return r0 } -// DeployZRC20Contract provides a mock function with given fields: ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit -func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name string, symbol string, decimals uint8, chainID int64, coinType coin.CoinType, erc20Contract string, gasLimit *big.Int) (common.Address, error) { - ret := _m.Called(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) +// DeployZRC20Contract provides a mock function with given fields: ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit, liquidityCap +func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name string, symbol string, decimals uint8, chainID int64, coinType coin.CoinType, erc20Contract string, gasLimit *big.Int, liquidityCap *math.Uint) (common.Address, error) { + ret := _m.Called(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit, liquidityCap) if len(ret) == 0 { panic("no return value specified for DeployZRC20Contract") @@ -130,19 +132,19 @@ func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name var r0 common.Address var r1 error - if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int) (common.Address, error)); ok { - return rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) + if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int, *math.Uint) (common.Address, error)); ok { + return rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit, liquidityCap) } - if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int) common.Address); ok { - r0 = rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) + if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int, *math.Uint) common.Address); ok { + r0 = rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit, liquidityCap) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(common.Address) } } - if rf, ok := ret.Get(1).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int) error); ok { - r1 = rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) + if rf, ok := ret.Get(1).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int, *math.Uint) error); ok { + r1 = rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit, liquidityCap) } else { r1 = ret.Error(1) } diff --git a/typescript/zetachain/zetacore/crosschain/tx_pb.d.ts b/typescript/zetachain/zetacore/crosschain/tx_pb.d.ts index 0db06c03e2..abcea09cfb 100644 --- a/typescript/zetachain/zetacore/crosschain/tx_pb.d.ts +++ b/typescript/zetachain/zetacore/crosschain/tx_pb.d.ts @@ -229,6 +229,11 @@ export declare class MsgWhitelistERC20 extends Message { */ gasLimit: bigint; + /** + * @generated from field: string liquidity_cap = 8; + */ + liquidityCap: string; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/typescript/zetachain/zetacore/fungible/tx_pb.d.ts b/typescript/zetachain/zetacore/fungible/tx_pb.d.ts index 3dd44cae9f..7b8d6f5ab7 100644 --- a/typescript/zetachain/zetacore/fungible/tx_pb.d.ts +++ b/typescript/zetachain/zetacore/fungible/tx_pb.d.ts @@ -227,6 +227,11 @@ export declare class MsgDeployFungibleCoinZRC20 extends Message); static readonly runtime: typeof proto3; diff --git a/x/crosschain/client/cli/cli_whitelist_erc20.go b/x/crosschain/client/cli/cli_whitelist_erc20.go index 111b07c23d..8b717c697f 100644 --- a/x/crosschain/client/cli/cli_whitelist_erc20.go +++ b/x/crosschain/client/cli/cli_whitelist_erc20.go @@ -4,6 +4,7 @@ import ( "fmt" "strconv" + sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -14,9 +15,9 @@ import ( func CmdWhitelistERC20() *cobra.Command { cmd := &cobra.Command{ - Use: "whitelist-erc20 [erc20Address] [chainID] [name] [symbol] [decimals] [gasLimit]", + Use: "whitelist-erc20 [erc20Address] [chainID] [name] [symbol] [decimals] [gasLimit] [liquidityCap]", Short: "Add a new erc20 token to whitelist", - Args: cobra.ExactArgs(6), + Args: cobra.ExactArgs(7), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -44,6 +45,8 @@ func CmdWhitelistERC20() *cobra.Command { return err } + liquidityCap := sdkmath.NewUintFromString(args[6]) + msg := types.NewMsgWhitelistERC20( clientCtx.GetFromAddress().String(), erc20Address, @@ -53,6 +56,7 @@ func CmdWhitelistERC20() *cobra.Command { // #nosec G115 always in range uint32(decimals), gasLimit, + liquidityCap, ) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20.go b/x/crosschain/keeper/msg_server_whitelist_erc20.go index 155bf06770..37e3bec50a 100644 --- a/x/crosschain/keeper/msg_server_whitelist_erc20.go +++ b/x/crosschain/keeper/msg_server_whitelist_erc20.go @@ -11,6 +11,7 @@ import ( "github.com/gagliardetto/solana-go" "github.com/zeta-chain/node/pkg/coin" + "github.com/zeta-chain/node/pkg/ptr" authoritytypes "github.com/zeta-chain/node/x/authority/types" "github.com/zeta-chain/node/x/crosschain/types" fungibletypes "github.com/zeta-chain/node/x/fungible/types" @@ -98,6 +99,7 @@ func (k msgServer) WhitelistERC20( coin.CoinType_ERC20, msg.Erc20Address, big.NewInt(msg.GasLimit), + ptr.Ptr(msg.LiquidityCap), ) if err != nil { return nil, errorsmod.Wrapf( @@ -172,7 +174,8 @@ func (k msgServer) WhitelistERC20( Symbol: msg.Symbol, CoinType: coin.CoinType_ERC20, // #nosec G115 always positive - GasLimit: uint64(msg.GasLimit), + GasLimit: uint64(msg.GasLimit), + LiquidityCap: msg.LiquidityCap, } k.fungibleKeeper.SetForeignCoins(ctx, foreignCoin) k.SaveCCTXUpdate(ctx, cctx, tss.TssPubkey) diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20_test.go b/x/crosschain/keeper/msg_server_whitelist_erc20_test.go index 1b2c03710c..82f9c3a598 100644 --- a/x/crosschain/keeper/msg_server_whitelist_erc20_test.go +++ b/x/crosschain/keeper/msg_server_whitelist_erc20_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "fmt" "testing" @@ -80,6 +81,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "FOO", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) res, err := msgServer.WhitelistERC20(ctx, &msg) @@ -94,6 +96,12 @@ func TestKeeper_WhitelistERC20(t *testing.T) { require.True(t, found) require.EqualValues(t, "foo", fc.Name) require.EqualValues(t, tt.tokenAddress, fc.Asset) + require.EqualValues( + t, + uint64(1000), + fc.LiquidityCap.Uint64(), + fmt.Sprintf("%d != %d", 1000, fc.LiquidityCap.Uint64()), + ) cctx, found := k.GetCrossChainTx(ctx, cctxIndex) require.True(t, found) require.EqualValues( @@ -115,6 +123,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "BAR", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msgNew, nil) @@ -145,6 +154,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "FOO", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, authoritytypes.ErrUnauthorized) _, err := msgServer.WhitelistERC20(ctx, &msg) @@ -170,6 +180,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "FOO", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) @@ -199,6 +210,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "FOO", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) @@ -228,6 +240,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "FOO", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) @@ -261,6 +274,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "FOO", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) _, err := msgServer.WhitelistERC20(ctx, &msg) @@ -288,6 +302,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "FOO", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) _, err := msgServer.WhitelistERC20(ctx, &msg) @@ -316,6 +331,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { Symbol: "FOO", Decimals: 18, GasLimit: 100000, + LiquidityCap: sdkmath.NewUint(1000), } keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) _, err := msgServer.WhitelistERC20(ctx, &msg) diff --git a/x/crosschain/keeper/utils_test.go b/x/crosschain/keeper/utils_test.go index 89612a91c1..82bd73a0f3 100644 --- a/x/crosschain/keeper/utils_test.go +++ b/x/crosschain/keeper/utils_test.go @@ -5,6 +5,7 @@ import ( "math/big" "testing" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/ethereum/go-ethereum/common" @@ -12,6 +13,7 @@ import ( evmkeeper "github.com/zeta-chain/ethermint/x/evm/keeper" "github.com/zeta-chain/node/pkg/contracts/erc1967proxy" "github.com/zeta-chain/node/pkg/contracts/uniswap/v2-periphery/contracts/uniswapv2router02.sol" + "github.com/zeta-chain/node/pkg/ptr" fungibletypes "github.com/zeta-chain/node/x/fungible/types" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" @@ -166,6 +168,7 @@ func setupGasCoin( symbol, 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.NoError(t, err) assertContractDeployment(t, evmk, ctx, addr) @@ -192,6 +195,7 @@ func deployZRC20( 0, assetAddress, big.NewInt(21_000), + ptr.Ptr(sdkmath.NewUint(1000)), ) require.NoError(t, err) assertContractDeployment(t, evmk, ctx, addr) diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index c949c19990..04767b5704 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( "context" "math/big" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -202,6 +203,7 @@ type FungibleKeeper interface { coinType coin.CoinType, erc20Contract string, gasLimit *big.Int, + liquidityCap *sdkmath.Uint, ) (ethcommon.Address, error) FundGasStabilityPool(ctx sdk.Context, chainID int64, amount *big.Int) error WithdrawFromGasStabilityPool(ctx sdk.Context, chainID int64, amount *big.Int) error diff --git a/x/crosschain/types/message_whitelist_erc20.go b/x/crosschain/types/message_whitelist_erc20.go index be5ca0e9ca..0b49409cf9 100644 --- a/x/crosschain/types/message_whitelist_erc20.go +++ b/x/crosschain/types/message_whitelist_erc20.go @@ -2,6 +2,7 @@ package types import ( cosmoserrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/pkg/errors" @@ -15,8 +16,15 @@ const TypeMsgWhitelistERC20 = "whitelist_erc20" var _ sdk.Msg = &MsgWhitelistERC20{} func NewMsgWhitelistERC20( - creator string, erc20Address string, chainID int64, name string, - symbol string, decimals uint32, gasLimit int64) *MsgWhitelistERC20 { + creator string, + erc20Address string, + chainID int64, + name string, + symbol string, + decimals uint32, + gasLimit int64, + liquidityCap sdkmath.Uint, +) *MsgWhitelistERC20 { return &MsgWhitelistERC20{ Creator: creator, Erc20Address: erc20Address, @@ -25,6 +33,7 @@ func NewMsgWhitelistERC20( Symbol: symbol, Decimals: decimals, GasLimit: gasLimit, + LiquidityCap: liquidityCap, } } @@ -63,6 +72,10 @@ func (msg *MsgWhitelistERC20) ValidateBasic() error { if msg.GasLimit <= 0 { return cosmoserrors.Wrapf(types.ErrInvalidGasLimit, "invalid gas limit (%d)", msg.GasLimit) } + if msg.LiquidityCap.IsNil() { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "liquidity cap is nil") + } + return nil } diff --git a/x/crosschain/types/message_whitelist_erc20_test.go b/x/crosschain/types/message_whitelist_erc20_test.go index 4af25c215f..49af33763c 100644 --- a/x/crosschain/types/message_whitelist_erc20_test.go +++ b/x/crosschain/types/message_whitelist_erc20_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,6 +29,7 @@ func TestMsgWhitelistERC20_ValidateBasic(t *testing.T) { "symbol", 6, 10, + sdkmath.NewUint(100), ), error: true, }, @@ -41,6 +43,7 @@ func TestMsgWhitelistERC20_ValidateBasic(t *testing.T) { "symbol", 6, 10, + sdkmath.NewUint(100), ), error: true, }, @@ -54,6 +57,7 @@ func TestMsgWhitelistERC20_ValidateBasic(t *testing.T) { "symbol", 130, 10, + sdkmath.NewUint(100), ), error: true, }, @@ -67,6 +71,7 @@ func TestMsgWhitelistERC20_ValidateBasic(t *testing.T) { "symbol", 6, -10, + sdkmath.NewUint(100), ), error: true, }, @@ -80,9 +85,23 @@ func TestMsgWhitelistERC20_ValidateBasic(t *testing.T) { "symbol", 6, 10, + sdkmath.NewUint(100), ), error: true, }, + { + name: "invalid liquidity cap", + msg: &types.MsgWhitelistERC20{ + Creator: sample.AccAddress(), + Erc20Address: "0x5a4f260A7D716c859A2736151cB38b9c58C32c64", + ChainId: 1, + Name: "name", + Symbol: "symbol", + Decimals: 6, + GasLimit: 10, + }, + error: true, + }, { name: "valid message with evm asset address", msg: types.NewMsgWhitelistERC20( @@ -93,6 +112,7 @@ func TestMsgWhitelistERC20_ValidateBasic(t *testing.T) { "symbol", 6, 10, + sdkmath.NewUint(100), ), error: false, }, @@ -106,6 +126,7 @@ func TestMsgWhitelistERC20_ValidateBasic(t *testing.T) { "symbol", 6, 10, + sdkmath.NewUint(100), ), error: false, }, diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index bd4c1845ac..0a0a2c6a6e 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -342,13 +342,14 @@ var xxx_messageInfo_MsgAddInboundTrackerResponse proto.InternalMessageInfo // TODO: https://github.com/zeta-chain/node/issues/3083 type MsgWhitelistERC20 struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Erc20Address string `protobuf:"bytes,2,opt,name=erc20_address,json=erc20Address,proto3" json:"erc20_address,omitempty"` - ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Symbol string `protobuf:"bytes,5,opt,name=symbol,proto3" json:"symbol,omitempty"` - Decimals uint32 `protobuf:"varint,6,opt,name=decimals,proto3" json:"decimals,omitempty"` - GasLimit int64 `protobuf:"varint,7,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Erc20Address string `protobuf:"bytes,2,opt,name=erc20_address,json=erc20Address,proto3" json:"erc20_address,omitempty"` + ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,5,opt,name=symbol,proto3" json:"symbol,omitempty"` + Decimals uint32 `protobuf:"varint,6,opt,name=decimals,proto3" json:"decimals,omitempty"` + GasLimit int64 `protobuf:"varint,7,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + LiquidityCap github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,8,opt,name=liquidity_cap,json=liquidityCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"liquidity_cap"` } func (m *MsgWhitelistERC20) Reset() { *m = MsgWhitelistERC20{} } @@ -1740,123 +1741,124 @@ func init() { } var fileDescriptor_15f0860550897740 = []byte{ - // 1848 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0x4b, 0x6f, 0x1b, 0xc9, - 0x11, 0xf6, 0xd8, 0x12, 0x45, 0x16, 0x25, 0x59, 0x6e, 0xcb, 0x36, 0x3d, 0x5a, 0xc9, 0x32, 0x1d, - 0x3b, 0xc2, 0xc2, 0x22, 0x1d, 0x7a, 0xe3, 0x6c, 0xbc, 0xc1, 0x6e, 0x2c, 0xee, 0x5a, 0x2b, 0xc0, - 0xb4, 0x85, 0x59, 0x79, 0xf3, 0xb8, 0x0c, 0x86, 0x33, 0xad, 0xd1, 0x40, 0xe4, 0x34, 0x31, 0xdd, - 0xe4, 0x52, 0x46, 0x80, 0x04, 0x01, 0x02, 0xe4, 0x98, 0x04, 0x39, 0xed, 0x3d, 0x87, 0xe4, 0x47, - 0xe4, 0xbc, 0x47, 0x23, 0xa7, 0x20, 0x07, 0x23, 0xb0, 0x0f, 0xb9, 0x06, 0xb9, 0x06, 0x01, 0x82, - 0xae, 0xee, 0x19, 0x91, 0xc3, 0xa7, 0x28, 0x04, 0xb9, 0x88, 0xdd, 0xd5, 0xf5, 0x55, 0x57, 0x55, - 0x57, 0x75, 0x57, 0x8d, 0xe0, 0xde, 0x2b, 0x2a, 0x1c, 0xf7, 0xc8, 0x09, 0xc2, 0x32, 0x8e, 0x58, - 0x44, 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 0xfe, 0x64, 0x5a, 0x07, 0x8c, 0x10, 0x60, 0xee, 0x9e, - 0x53, 0x40, 0xac, 0xeb, 0xce, 0xee, 0x37, 0x6f, 0x37, 0x8c, 0xd7, 0x6f, 0x37, 0x8c, 0xbf, 0xbf, - 0xdd, 0x30, 0x7e, 0xf3, 0x6e, 0xe3, 0xc2, 0xeb, 0x77, 0x1b, 0x17, 0xfe, 0xfa, 0x6e, 0xe3, 0xc2, - 0x4f, 0xb7, 0x7b, 0x0a, 0x19, 0xb9, 0xc5, 0xb6, 0xfa, 0x77, 0x44, 0xc8, 0x3c, 0x5a, 0xee, 0xf6, - 0xfd, 0xd7, 0x46, 0xd6, 0x34, 0xf5, 0x0c, 0xb6, 0x22, 0x0f, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, - 0x84, 0xba, 0x82, 0x4a, 0xe3, 0x19, 0x00, 0x00, + // 1872 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcd, 0x6f, 0xdb, 0xc8, + 0x15, 0x0f, 0x13, 0x5b, 0x96, 0x9e, 0x6c, 0xc7, 0x61, 0x9c, 0x84, 0xa1, 0xd7, 0x8e, 0xa3, 0x34, + 0xa9, 0xb1, 0x88, 0xa5, 0x54, 0xd9, 0xa6, 0xdb, 0x6c, 0xb1, 0xdb, 0x58, 0xbb, 0xf1, 0x1a, 0x88, + 0x12, 0x83, 0xeb, 0x6c, 0x3f, 0x2e, 0x04, 0x45, 0x8e, 0x69, 0xc2, 0x12, 0x87, 0xe5, 0x8c, 0xb4, + 0x72, 0x50, 0xa0, 0x45, 0x81, 0x02, 0x3d, 0xb6, 0x45, 0x4f, 0x7b, 0x2f, 0xd0, 0xf6, 0x8f, 0xe8, + 0x79, 0x8f, 0x7b, 0x2c, 0x7a, 0x08, 0x8a, 0xe4, 0xd0, 0x6b, 0xd1, 0x6b, 0x51, 0xa0, 0x98, 0x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0x18, 0x0f, 0xa7, 0xb9, 0xbd, 0x19, 0xd0, 0x34, 0x29, + 0x68, 0x64, 0x49, 0xa1, 0xff, 0x41, 0x83, 0xeb, 0x23, 0xea, 0x89, 0xf7, 0xa7, 0xf5, 0x6e, 0x16, + 0x69, 0xfe, 0x70, 0x56, 0x64, 0xaa, 0xd6, 0x97, 0x1a, 0x18, 0x23, 0x8b, 0x84, 0xc7, 0x53, 0x3b, + 0x7d, 0x00, 0x6b, 0xee, 0xcc, 0x8e, 0x4d, 0x95, 0xfb, 0xb3, 0x06, 0xeb, 0xe3, 0x5f, 0xe2, 0x8f, + 0xa6, 0x35, 0xc0, 0x08, 0x01, 0xe6, 0xee, 0x39, 0x05, 0x24, 0xba, 0xee, 0xec, 0x7e, 0xf5, 0x66, + 0x43, 0xfb, 0xfa, 0xcd, 0x86, 0xf6, 0x8f, 0x37, 0x1b, 0xda, 0x6f, 0xdf, 0x6e, 0x5c, 0xf8, 0xfa, + 0xed, 0xc6, 0x85, 0xbf, 0xbd, 0xdd, 0xb8, 0xf0, 0xd3, 0xed, 0x9e, 0x42, 0x46, 0x6c, 0xb1, 0x2d, + 0xff, 0xc9, 0x11, 0x52, 0x8f, 0x54, 0xba, 0x7d, 0xff, 0x0b, 0x12, 0x35, 0x4d, 0x23, 0x87, 0xad, + 0xc8, 0xc3, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x90, 0x07, 0x8e, 0x41, 0x39, 0x1a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2649,6 +2651,16 @@ func (m *MsgWhitelistERC20) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.LiquidityCap.Size() + i -= size + if _, err := m.LiquidityCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 if m.GasLimit != 0 { i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) i-- @@ -3773,6 +3785,8 @@ func (m *MsgWhitelistERC20) Size() (n int) { if m.GasLimit != 0 { n += 1 + sovTx(uint64(m.GasLimit)) } + l = m.LiquidityCap.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -5047,6 +5061,40 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { break } } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidityCap", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidityCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go index c61f3dd74a..21099dda4d 100644 --- a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go +++ b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go @@ -3,20 +3,22 @@ package cli import ( "strconv" + sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" "github.com/zeta-chain/node/pkg/coin" + "github.com/zeta-chain/node/pkg/ptr" "github.com/zeta-chain/node/x/fungible/types" ) func CmdDeployFungibleCoinZRC4() *cobra.Command { cmd := &cobra.Command{ - Use: "deploy-fungible-coin-zrc-4 [erc-20] [foreign-chain] [decimals] [name] [symbol] [coin-type] [gas-limit]", + Use: "deploy-fungible-coin-zrc-4 [erc-20] [foreign-chain] [decimals] [name] [symbol] [coin-type] [gas-limit] [liquidity-cap]", Short: "Broadcast message DeployFungibleCoinZRC20", - Args: cobra.ExactArgs(7), + Args: cobra.ExactArgs(8), RunE: func(cmd *cobra.Command, args []string) (err error) { argERC20 := args[0] argForeignChain, err := strconv.ParseInt(args[1], 10, 32) @@ -37,6 +39,7 @@ func CmdDeployFungibleCoinZRC4() *cobra.Command { if err != nil { return err } + argLiquidityCap := sdkmath.NewUintFromString(args[7]) clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -52,6 +55,7 @@ func CmdDeployFungibleCoinZRC4() *cobra.Command { argSymbol, coin.CoinType(argCoinType), argGasLimit, + ptr.Ptr(argLiquidityCap), ) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index 3616c63f97..88f4eb679e 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -9,6 +9,7 @@ import ( "strconv" cosmoserrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" tmbytes "github.com/cometbft/cometbft/libs/bytes" tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -30,6 +31,7 @@ import ( "github.com/zeta-chain/node/pkg/coin" "github.com/zeta-chain/node/pkg/contracts/uniswap/v2-core/contracts/uniswapv2factory.sol" "github.com/zeta-chain/node/pkg/contracts/uniswap/v2-periphery/contracts/uniswapv2router02.sol" + "github.com/zeta-chain/node/pkg/ptr" "github.com/zeta-chain/node/server/config" "github.com/zeta-chain/node/x/fungible/types" observertypes "github.com/zeta-chain/node/x/observer/types" @@ -105,6 +107,7 @@ func (k Keeper) DeployZRC20Contract( coinType coin.CoinType, erc20Contract string, gasLimit *big.Int, + liquidityCap *sdkmath.Uint, ) (common.Address, error) { chain, found := chains.GetChainFromChainID(chainID, k.GetAuthorityKeeper().GetAdditionalChainList(ctx)) if !found { @@ -162,7 +165,10 @@ func (k Keeper) DeployZRC20Contract( newCoin.Zrc20ContractAddress = contractAddr.Hex() newCoin.ForeignChainId = chain.ChainId newCoin.GasLimit = gasLimit.Uint64() - newCoin.LiquidityCap = sdk.NewUint(types.DefaultLiquidityCap).MulUint64(uint64(newCoin.Decimals)) + if liquidityCap == nil { + liquidityCap = ptr.Ptr(sdk.NewUint(types.DefaultLiquidityCap).MulUint64(uint64(newCoin.Decimals))) + } + newCoin.LiquidityCap = *liquidityCap k.SetForeignCoins(ctx, newCoin) return contractAddr, nil diff --git a/x/fungible/keeper/evm_test.go b/x/fungible/keeper/evm_test.go index 82b32ae1f8..d300d8d654 100644 --- a/x/fungible/keeper/evm_test.go +++ b/x/fungible/keeper/evm_test.go @@ -6,6 +6,8 @@ import ( "math/big" "testing" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -24,6 +26,7 @@ import ( "github.com/zeta-chain/node/e2e/utils" "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/pkg/coin" + "github.com/zeta-chain/node/pkg/ptr" "github.com/zeta-chain/node/server/config" "github.com/zeta-chain/node/testutil/contracts" keepertest "github.com/zeta-chain/node/testutil/keeper" @@ -236,6 +239,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { coin.CoinType_Gas, "foobar", big.NewInt(1000), + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -256,6 +260,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { coin.CoinType_Gas, "foobar", big.NewInt(1000), + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -281,6 +286,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { coin.CoinType_Gas, "foobar", big.NewInt(1000), + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -302,6 +308,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { coin.CoinType_Gas, "foobar", big.NewInt(1000), + ptr.Ptr(sdkmath.NewUint(2000)), ) require.NoError(t, err) assertContractDeployment(t, sdkk.EvmKeeper, ctx, addr) @@ -316,7 +323,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { require.Equal(t, "bar", foreignCoins.Symbol) require.Equal(t, coin.CoinType_Gas, foreignCoins.CoinType) require.Equal(t, uint64(1000), foreignCoins.GasLimit) - require.True(t, foreignCoins.LiquidityCap.Equal(sdk.NewUint(types.DefaultLiquidityCap).MulUint64(8))) + require.Equal(t, uint64(2000), foreignCoins.LiquidityCap.Uint64()) // can get the zrc20 data zrc20Data, err := k.QueryZRC20Data(ctx, addr) @@ -363,6 +370,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { coin.CoinType_Gas, "foobar", big.NewInt(1000), + ptr.Ptr(sdkmath.NewUint(2000)), ) require.NoError(t, err) assertContractDeployment(t, sdkk.EvmKeeper, ctx, addr) @@ -377,6 +385,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { require.Equal(t, "bar", foreignCoins.Symbol) require.Equal(t, coin.CoinType_Gas, foreignCoins.CoinType) require.Equal(t, uint64(1000), foreignCoins.GasLimit) + require.Equal(t, uint64(2000), foreignCoins.LiquidityCap.Uint64()) // can get the zrc20 data zrc20Data, err := k.QueryZRC20Data(ctx, addr) @@ -401,6 +410,32 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { require.NotNil(t, newBalance) require.Equal(t, amount.Int64(), newBalance.Int64()) }) + + t.Run("can deploy the zrc20 contract with default liquidity cap", func(t *testing.T) { + k, ctx, sdkk, _ := keepertest.FungibleKeeper(t) + _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + + chainID := getValidChainID(t) + deploySystemContracts(t, ctx, k, sdkk.EvmKeeper) + + addr, err := k.DeployZRC20Contract( + ctx, + "foo", + "bar", + 8, + chainID, + coin.CoinType_Gas, + "foobar", + big.NewInt(1000), + nil, + ) + require.NoError(t, err) + assertContractDeployment(t, sdkk.EvmKeeper, ctx, addr) + + foreignCoins, found := k.GetForeignCoins(ctx, addr.Hex()) + require.True(t, found) + require.Greater(t, foreignCoins.LiquidityCap.Uint64(), uint64(0)) + }) } func TestKeeper_DeploySystemContracts(t *testing.T) { diff --git a/x/fungible/keeper/gas_coin_and_pool.go b/x/fungible/keeper/gas_coin_and_pool.go index 01ea739e43..70a18297ef 100644 --- a/x/fungible/keeper/gas_coin_and_pool.go +++ b/x/fungible/keeper/gas_coin_and_pool.go @@ -4,6 +4,7 @@ import ( "math/big" cosmoserrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/protocol-contracts/pkg/systemcontract.sol" @@ -26,6 +27,7 @@ func (k Keeper) SetupChainGasCoinAndPool( symbol string, decimals uint8, gasLimit *big.Int, + liquidityCap *sdkmath.Uint, ) (ethcommon.Address, error) { // additional on-chain static chain information additionalChains := k.GetAuthorityKeeper().GetAdditionalChainList(ctx) @@ -60,6 +62,7 @@ func (k Keeper) SetupChainGasCoinAndPool( coin.CoinType_Gas, "", transferGasLimit, + liquidityCap, ) if err != nil { return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to DeployZRC20Contract") diff --git a/x/fungible/keeper/gas_coin_and_pool_test.go b/x/fungible/keeper/gas_coin_and_pool_test.go index c7b02ef499..836c3fc375 100644 --- a/x/fungible/keeper/gas_coin_and_pool_test.go +++ b/x/fungible/keeper/gas_coin_and_pool_test.go @@ -6,6 +6,8 @@ import ( "math/big" "testing" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/ethereum/go-ethereum/common" @@ -17,6 +19,7 @@ import ( "github.com/zeta-chain/protocol-contracts/pkg/systemcontract.sol" "github.com/zeta-chain/node/cmd/zetacored/config" + "github.com/zeta-chain/node/pkg/ptr" keepertest "github.com/zeta-chain/node/testutil/keeper" "github.com/zeta-chain/node/testutil/sample" fungiblekeeper "github.com/zeta-chain/node/x/fungible/keeper" @@ -40,6 +43,7 @@ func setupGasCoin( symbol, 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.NoError(t, err) assertContractDeployment(t, evmk, ctx, addr) @@ -72,6 +76,7 @@ func deployZRC20( 0, assetAddress, big.NewInt(21_000), + ptr.Ptr(sdkmath.NewUint(1000)), ) require.NoError(t, err) assertContractDeployment(t, evmk, ctx, addr) @@ -183,6 +188,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -207,6 +213,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -235,6 +242,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -266,6 +274,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -298,6 +307,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -331,6 +341,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -371,6 +382,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -414,6 +426,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) @@ -457,6 +470,7 @@ func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { "test", 8, nil, + ptr.Ptr(sdkmath.NewUint(1000)), ) require.Error(t, err) require.Empty(t, addr) diff --git a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go index bd0918afd3..d2de51f54d 100644 --- a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go +++ b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go @@ -58,6 +58,7 @@ func (k msgServer) DeployFungibleCoinZRC20( msg.Symbol, uint8(msg.Decimals), big.NewInt(msg.GasLimit), + msg.LiquidityCap, ) if err != nil { return nil, cosmoserrors.Wrapf(err, "failed to setupChainGasCoinAndPool") @@ -73,6 +74,7 @@ func (k msgServer) DeployFungibleCoinZRC20( msg.CoinType, msg.ERC20, big.NewInt(msg.GasLimit), + msg.LiquidityCap, ) if err != nil { return nil, err diff --git a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go index c849736883..7ad8840a4a 100644 --- a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go +++ b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go @@ -4,11 +4,14 @@ import ( "math/big" "testing" + sdkmath "cosmossdk.io/math" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "github.com/zeta-chain/node/pkg/coin" + "github.com/zeta-chain/node/pkg/ptr" keepertest "github.com/zeta-chain/node/testutil/keeper" "github.com/zeta-chain/node/testutil/sample" authoritytypes "github.com/zeta-chain/node/x/authority/types" @@ -40,6 +43,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { "foo", coin.CoinType_Gas, 1000000, + ptr.Ptr(sdkmath.NewUint(1000)), ) keepertest.MockCheckAuthorization(&authorityMock.Mock, msg, nil) keepertest.MockGetChainListEmpty(&authorityMock.Mock) @@ -73,6 +77,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { "bar", coin.CoinType_ERC20, 2000000, + ptr.Ptr(sdkmath.NewUint(1000)), ) keepertest.MockCheckAuthorization(&authorityMock.Mock, msg, nil) res, err = msgServer.DeployFungibleCoinZRC20(ctx, msg) @@ -82,7 +87,8 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { foreignCoin, found = k.GetForeignCoins(ctx, res.Address) require.True(t, found) - require.Equal(t, foreignCoin.CoinType, coin.CoinType_ERC20) + require.Equal(t, coin.CoinType_ERC20, foreignCoin.CoinType) + require.Equal(t, uint64(1000), foreignCoin.LiquidityCap.Uint64()) require.Contains(t, foreignCoin.Name, "bar") // check gas limit @@ -118,6 +124,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { "foo", coin.CoinType_Gas, 1000000, + ptr.Ptr(sdkmath.NewUint(1000)), ) keepertest.MockCheckAuthorization(&authorityMock.Mock, msg, authoritytypes.ErrUnauthorized) _, err := keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, msg) @@ -142,6 +149,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { "foo", coin.CoinType_Gas, 1000000, + ptr.Ptr(sdkmath.NewUint(1000)), ) deploySystemContracts(t, ctx, k, sdkk.EvmKeeper) @@ -173,6 +181,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { "foo", coin.CoinType_Gas, 1000000, + ptr.Ptr(sdkmath.NewUint(1000)), ) keepertest.MockCheckAuthorization(&authorityMock.Mock, msg, nil) keepertest.MockGetChainListEmpty(&authorityMock.Mock) @@ -203,6 +212,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { "foo", coin.CoinType_Gas, 1000000, + ptr.Ptr(sdkmath.NewUint(1000)), ) keepertest.MockCheckAuthorization(&authorityMock.Mock, deployMsg, nil) keepertest.MockGetChainListEmpty(&authorityMock.Mock) diff --git a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go index a863b24a82..36fe3ac891 100644 --- a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go +++ b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go @@ -5,6 +5,8 @@ import ( "math/big" "testing" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" @@ -14,6 +16,7 @@ import ( "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/pkg/coin" + "github.com/zeta-chain/node/pkg/ptr" keepertest "github.com/zeta-chain/node/testutil/keeper" "github.com/zeta-chain/node/testutil/sample" authoritytypes "github.com/zeta-chain/node/x/authority/types" @@ -92,6 +95,7 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { coin.CoinType_ERC20, "beta", big.NewInt(90_000), + ptr.Ptr(sdkmath.NewUint(1000)), ) require.NoError(t, err) codeHash := codeHashFromAddress(t, ctx, k, newCodeAddress.Hex()) @@ -138,6 +142,7 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { coin.CoinType_ERC20, "gamma", big.NewInt(90_000), + ptr.Ptr(sdkmath.NewUint(1000)), ) codeHash = codeHashFromAddress(t, ctx, k, newCodeAddress.Hex()) require.NoError(t, err) diff --git a/x/fungible/types/message_deploy_fungible_coin_zrc20.go b/x/fungible/types/message_deploy_fungible_coin_zrc20.go index 01193b8ec7..965097bd13 100644 --- a/x/fungible/types/message_deploy_fungible_coin_zrc20.go +++ b/x/fungible/types/message_deploy_fungible_coin_zrc20.go @@ -2,6 +2,7 @@ package types import ( cosmoserrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -21,6 +22,7 @@ func NewMsgDeployFungibleCoinZRC20( symbol string, coinType coin.CoinType, gasLimit int64, + liquidityCap *sdkmath.Uint, ) *MsgDeployFungibleCoinZRC20 { return &MsgDeployFungibleCoinZRC20{ Creator: creator, @@ -31,6 +33,7 @@ func NewMsgDeployFungibleCoinZRC20( Symbol: symbol, CoinType: coinType, GasLimit: gasLimit, + LiquidityCap: liquidityCap, } } @@ -63,9 +66,12 @@ func (msg *MsgDeployFungibleCoinZRC20) ValidateBasic() error { if msg.GasLimit < 0 { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidGasLimit, "invalid gas limit") } - if msg.Decimals > 77 { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "decimals must be less than 78") } + if msg.LiquidityCap != nil && msg.LiquidityCap.IsNil() { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "liquidity cap is nil") + } + return nil } diff --git a/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go b/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go index 0de8e2da8b..86784bec64 100644 --- a/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go +++ b/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go @@ -3,12 +3,15 @@ package types_test import ( "testing" + sdkmath "cosmossdk.io/math" + cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/node/pkg/coin" + "github.com/zeta-chain/node/pkg/ptr" "github.com/zeta-chain/node/testutil/sample" "github.com/zeta-chain/node/x/fungible/types" ) @@ -30,6 +33,7 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { "test", coin.CoinType_ERC20, 10, + ptr.Ptr(sdkmath.NewUint(1000)), ), err: sdkerrors.ErrInvalidAddress, }, @@ -44,6 +48,7 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { "test", coin.CoinType_ERC20, -1, + ptr.Ptr(sdkmath.NewUint(1000)), ), err: sdkerrors.ErrInvalidGasLimit, }, @@ -58,9 +63,38 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { "test", coin.CoinType_ERC20, 10, + ptr.Ptr(sdkmath.NewUint(1000)), ), err: cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "decimals must be less than 78"), }, + { + name: "nil liquidity cap", + msg: &types.MsgDeployFungibleCoinZRC20{ + Creator: sample.AccAddress(), + ERC20: "test erc20", + ForeignChainId: 1, + Decimals: 6, + Name: "test", + Symbol: "test", + CoinType: coin.CoinType_ERC20, + GasLimit: 10, + }, + }, + { + name: "nil liquidity cap inner", + msg: &types.MsgDeployFungibleCoinZRC20{ + Creator: sample.AccAddress(), + ERC20: "test erc20", + ForeignChainId: 1, + Decimals: 6, + Name: "test", + Symbol: "test", + CoinType: coin.CoinType_ERC20, + GasLimit: 10, + LiquidityCap: &sdkmath.Uint{}, + }, + err: cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "liquidity cap is nil"), + }, { name: "valid message", msg: types.NewMsgDeployFungibleCoinZRC20( @@ -72,6 +106,7 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { "test", coin.CoinType_ERC20, 10, + ptr.Ptr(sdkmath.NewUint(1000)), ), }, } diff --git a/x/fungible/types/tx.pb.go b/x/fungible/types/tx.pb.go index fbffdb97b3..ab2452c99d 100644 --- a/x/fungible/types/tx.pb.go +++ b/x/fungible/types/tx.pb.go @@ -329,14 +329,15 @@ func (m *MsgUpdateSystemContractResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateSystemContractResponse proto.InternalMessageInfo type MsgDeployFungibleCoinZRC20 struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ERC20 string `protobuf:"bytes,2,opt,name=ERC20,proto3" json:"ERC20,omitempty"` - ForeignChainId int64 `protobuf:"varint,3,opt,name=foreign_chain_id,json=foreignChainId,proto3" json:"foreign_chain_id,omitempty"` - Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"` - Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` - Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"` - CoinType coin.CoinType `protobuf:"varint,7,opt,name=coin_type,json=coinType,proto3,enum=zetachain.zetacore.pkg.coin.CoinType" json:"coin_type,omitempty"` - GasLimit int64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ERC20 string `protobuf:"bytes,2,opt,name=ERC20,proto3" json:"ERC20,omitempty"` + ForeignChainId int64 `protobuf:"varint,3,opt,name=foreign_chain_id,json=foreignChainId,proto3" json:"foreign_chain_id,omitempty"` + Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"` + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"` + CoinType coin.CoinType `protobuf:"varint,7,opt,name=coin_type,json=coinType,proto3,enum=zetachain.zetacore.pkg.coin.CoinType" json:"coin_type,omitempty"` + GasLimit int64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + LiquidityCap *github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,9,opt,name=liquidity_cap,json=liquidityCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"liquidity_cap,omitempty"` } func (m *MsgDeployFungibleCoinZRC20) Reset() { *m = MsgDeployFungibleCoinZRC20{} } @@ -1037,73 +1038,74 @@ func init() { } var fileDescriptor_7bea9688d1d01113 = []byte{ - // 1052 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x17, 0x35, 0xed, 0xf8, 0xef, 0x7e, 0x96, 0xed, 0x6f, 0xa0, 0xc4, 0x34, 0x1d, 0xc8, 0x09, 0xe3, - 0x26, 0x6e, 0xda, 0x48, 0xa9, 0xea, 0x34, 0x28, 0xd0, 0x24, 0xa8, 0x55, 0x3b, 0x2d, 0x10, 0x01, - 0x05, 0x63, 0xa7, 0xa8, 0x37, 0xc4, 0x98, 0x1c, 0x53, 0x84, 0xa5, 0x19, 0x96, 0x43, 0x55, 0x51, - 0x76, 0x05, 0xba, 0x0a, 0x50, 0x20, 0x40, 0x1f, 0xa0, 0xcf, 0xd0, 0xb7, 0xc8, 0x32, 0xcb, 0xa2, - 0x28, 0x82, 0xc2, 0xde, 0xf5, 0x29, 0x8a, 0x19, 0xfe, 0x84, 0x94, 0x44, 0x49, 0x56, 0xba, 0xb1, - 0x39, 0xa3, 0x7b, 0xce, 0x9c, 0xb9, 0x73, 0xef, 0x19, 0x12, 0xb6, 0x5e, 0x90, 0x00, 0x5b, 0x0d, - 0xec, 0xd2, 0x8a, 0x7c, 0x62, 0x3e, 0xa9, 0x9c, 0xb4, 0xa9, 0xe3, 0x1e, 0x37, 0x49, 0x25, 0x78, - 0x5e, 0xf6, 0x7c, 0x16, 0x30, 0xb4, 0x91, 0x44, 0x95, 0xe3, 0xa8, 0x72, 0x1c, 0xa5, 0x15, 0x1d, - 0xe6, 0x30, 0x19, 0x57, 0x11, 0x4f, 0x21, 0x44, 0xbb, 0x39, 0x80, 0xd8, 0x3b, 0x75, 0x2a, 0x16, - 0x73, 0xa9, 0xfc, 0x13, 0xc6, 0xe9, 0x3b, 0xa0, 0xd6, 0xb9, 0xf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8, 0x17, 0xa7, 0x3d, 0x9c, 0x0c, 0x37, 0x40, 0x52, 0xdf, - 0xfb, 0xd6, 0x98, 0x92, 0x7a, 0x71, 0xe3, 0x4a, 0xca, 0x7b, 0xa7, 0x91, 0xc5, 0x9c, 0x67, 0xda, - 0xf7, 0x2f, 0xc0, 0x9d, 0x06, 0x8e, 0x2e, 0xe6, 0x11, 0x9e, 0x8b, 0x9a, 0x00, 0x29, 0xc3, 0xbd, - 0x3d, 0x8a, 0xee, 0x5d, 0xac, 0x56, 0x1d, 0x3f, 0x36, 0x59, 0xcd, 0x87, 0xa5, 0x8c, 0xe3, 0x7e, - 0x3c, 0x52, 0x7e, 0x2a, 0x5a, 0xdb, 0xb9, 0x48, 0x74, 0xb2, 0xa6, 0x30, 0xb5, 0xc1, 0xae, 0x7b, - 0x6f, 0xbc, 0xe4, 0xf5, 0xc0, 0x46, 0x9b, 0xda, 0x50, 0xb3, 0xdd, 0xdd, 0x7b, 0x7d, 0x56, 0x52, - 0xde, 0x9c, 0x95, 0x94, 0xbf, 0xcf, 0x4a, 0xca, 0xab, 0xf3, 0xd2, 0xd4, 0x9b, 0xf3, 0xd2, 0xd4, - 0x1f, 0xe7, 0xa5, 0xa9, 0xa3, 0x8f, 0x52, 0x97, 0xab, 0x20, 0xbe, 0x13, 0x7e, 0x70, 0x51, 0x66, - 0x93, 0xca, 0xf3, 0xd4, 0x77, 0x9c, 0xb8, 0x65, 0x8f, 0xe7, 0xe4, 0x07, 0xd7, 0xa7, 0xff, 0x06, - 0x00, 0x00, 0xff, 0xff, 0x17, 0x9a, 0xd9, 0x4c, 0xf3, 0x0d, 0x00, 0x00, + // 1063 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0xdb, 0x36, + 0x14, 0x8e, 0xe2, 0xe6, 0xd7, 0x5b, 0x9c, 0x64, 0x84, 0xdb, 0x28, 0x4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 0xe6, + 0xad, 0xf8, 0x09, 0xad, 0xc3, 0xc2, 0x3b, 0x45, 0xcc, 0x0b, 0xba, 0xf3, 0x4e, 0x7c, 0xba, 0xe8, + 0x09, 0xe4, 0x1b, 0xee, 0x4f, 0x2d, 0xd7, 0x76, 0xc3, 0x8e, 0x69, 0x61, 0x5f, 0x5d, 0x10, 0x92, + 0xb9, 0x75, 0x1e, 0xb9, 0x2c, 0x4a, 0x84, 0x2a, 0xf6, 0xf5, 0x07, 0xa0, 0x67, 0x97, 0x5c, 0x9a, + 0x83, 0x0a, 0x73, 0xdd, 0x73, 0x8e, 0x4b, 0x1f, 0x0f, 0xf5, 0x03, 0x28, 0xd4, 0x98, 0x63, 0x90, + 0x26, 0xfd, 0x99, 0xec, 0xc5, 0x55, 0xa5, 0xae, 0xf7, 0x9e, 0x6d, 0xa7, 0x17, 0xe1, 0xf2, 0x20, + 0x58, 0x29, 0x95, 0x5f, 0x95, 0x44, 0xcf, 0x77, 0x85, 0xb4, 0xd3, 0x09, 0x89, 0x45, 0xed, 0x61, + 0x3d, 0xff, 0x29, 0xac, 0x64, 0x28, 0x77, 0xd9, 0x4a, 0x0b, 0x16, 0xe9, 0x51, 0x7b, 0x72, 0x40, + 0xb3, 0x8e, 0x59, 0x3d, 0x36, 0x33, 0xde, 0x6d, 0x55, 0x6a, 0x93, 0xef, 0x30, 0xab, 0xa7, 0xba, + 0xad, 0x97, 0x85, 0xe4, 0xfa, 0x87, 0x22, 0x64, 0x9d, 0xe8, 0xc9, 0xc7, 0x89, 0x13, 0x78, 0x5f, + 0x83, 0xda, 0xef, 0x95, 0x44, 0x6e, 0x32, 0x17, 0x49, 0xcb, 0x62, 0x53, 0xc8, 0x22, 0x83, 0xb2, + 0xdc, 0x99, 0x01, 0xf9, 0x1a, 0x73, 0x9e, 0xe0, 0x16, 0x23, 0xa3, 0x5a, 0xf4, 0x06, 0x2c, 0xa7, + 0xf6, 0x42, 0xf8, 0x6e, 0x72, 0xdc, 0xcd, 0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, 0x4c, + 0x1c, 0x2d, 0xe6, 0x11, 0x9e, 0x8b, 0x1a, 0x00, 0x09, 0xc3, 0xbd, 0x39, 0x0a, 0xee, 0x5d, 0xac, + 0x56, 0x19, 0x3f, 0x56, 0xae, 0x16, 0xc0, 0x62, 0xca, 0x71, 0x3f, 0x1b, 0x49, 0x3f, 0x11, 0xad, + 0x6d, 0x9f, 0x27, 0x5a, 0xae, 0xc9, 0x4d, 0x6d, 0xb0, 0xeb, 0xde, 0x1d, 0xaf, 0x78, 0x3d, 0x69, + 0xa3, 0x4d, 0x6d, 0xa8, 0xd9, 0xee, 0xec, 0xbe, 0x3e, 0x2d, 0x2a, 0x6f, 0x4e, 0x8b, 0xca, 0x3f, + 0xa7, 0x45, 0xe5, 0xd5, 0x59, 0x71, 0xea, 0xcd, 0x59, 0x71, 0xea, 0xcf, 0xb3, 0xe2, 0xd4, 0xe1, + 0xad, 0xc4, 0xcb, 0x95, 0x03, 0xdf, 0x8e, 0x3e, 0xe1, 0x3c, 0x6a, 0x93, 0xf2, 0xf3, 0xc4, 0x97, + 0x21, 0x7f, 0xcb, 0x1e, 0xcd, 0x8a, 0x4f, 0xb8, 0x2f, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x99, + 0xff, 0x97, 0x6b, 0x45, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1758,6 +1760,18 @@ func (m *MsgDeployFungibleCoinZRC20) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l + if m.LiquidityCap != nil { + { + size := m.LiquidityCap.Size() + i -= size + if _, err := m.LiquidityCap.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } if m.GasLimit != 0 { i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) i-- @@ -2363,6 +2377,10 @@ func (m *MsgDeployFungibleCoinZRC20) Size() (n int) { if m.GasLimit != 0 { n += 1 + sovTx(uint64(m.GasLimit)) } + if m.LiquidityCap != nil { + l = m.LiquidityCap.Size() + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -3472,6 +3490,42 @@ func (m *MsgDeployFungibleCoinZRC20) Unmarshal(dAtA []byte) error { break } } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidityCap", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Uint + m.LiquidityCap = &v + if err := m.LiquidityCap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])