From 50434aa330ee724dd51f3c5f5493125a07acfd0a Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Sat, 9 Dec 2023 11:29:22 +0800 Subject: [PATCH 1/7] add CmdUpdateSystemContract cli --- .../client/cli/tx_update_system_contract.go | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 x/fungible/client/cli/tx_update_system_contract.go diff --git a/x/fungible/client/cli/tx_update_system_contract.go b/x/fungible/client/cli/tx_update_system_contract.go new file mode 100644 index 0000000000..87be871b7f --- /dev/null +++ b/x/fungible/client/cli/tx_update_system_contract.go @@ -0,0 +1,39 @@ +package cli + +import ( + "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/zetacore/x/fungible/types" +) + +func CmdUpdateSystemContract() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-system-contract [contractAddress]", + Short: "Broadcast message UpdateSystemContract", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + contractAddress := args[0] + + msg := types.NewMsgUpdateSystemContract( + clientCtx.GetFromAddress().String(), + contractAddress, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} From 69a7dea45abf129ee36d9dce86c46badd5f2cea5 Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Sun, 10 Dec 2023 06:33:31 +0800 Subject: [PATCH 2/7] add fungible module missing cli --- x/fungible/client/cli/tx.go | 4 ++ .../client/cli/tx_update_contract_bytecode.go | 39 +++++++++++++ .../client/cli/tx_update_system_contract.go | 3 - .../cli/tx_update_zrc20_paused_status.go | 56 +++++++++++++++++++ .../cli/tx_update_zrc20_withdraw_fee.go | 43 ++++++++++++++ ...sg_server_update_contract_bytecode_test.go | 36 ++++++------ .../types/message_update_contract_bytecode.go | 10 +++- .../message_update_contract_bytecode_test.go | 10 ++++ .../types/message_update_system_contract.go | 8 ++- .../message_update_zrc20_paused_status.go | 5 ++ ...message_update_zrc20_paused_status_test.go | 13 +++++ 11 files changed, 201 insertions(+), 26 deletions(-) create mode 100644 x/fungible/client/cli/tx_update_contract_bytecode.go create mode 100644 x/fungible/client/cli/tx_update_zrc20_paused_status.go create mode 100644 x/fungible/client/cli/tx_update_zrc20_withdraw_fee.go diff --git a/x/fungible/client/cli/tx.go b/x/fungible/client/cli/tx.go index 9b347fad35..30c4c9f685 100644 --- a/x/fungible/client/cli/tx.go +++ b/x/fungible/client/cli/tx.go @@ -22,6 +22,10 @@ func GetTxCmd() *cobra.Command { CmdDeployFungibleCoinZRC4(), CmdRemoveForeignCoin(), CmdUpdateZRC20LiquidityCap(), + CmdUpdateContractBytecode(), + CmdUpdateSystemContract(), + CmdUpdateZRC20PausedStatus(), + CmdUpdateZRC20WithdrawFee(), ) return cmd diff --git a/x/fungible/client/cli/tx_update_contract_bytecode.go b/x/fungible/client/cli/tx_update_contract_bytecode.go new file mode 100644 index 0000000000..71a22f9a11 --- /dev/null +++ b/x/fungible/client/cli/tx_update_contract_bytecode.go @@ -0,0 +1,39 @@ +package cli + +import ( + "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/zetacore/x/fungible/types" +) + +func CmdUpdateContractBytecode() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-contract-bytecode [contractAddress] [newBytecodeAddress]", + Short: "Broadcast message UpdateContractBytecode", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + contractAddress := args[0] + + newBytecodeAddress := args[1] + + msg := types.NewMsgUpdateContractBytecode( + clientCtx.GetFromAddress().String(), + contractAddress, + newBytecodeAddress, + ) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/fungible/client/cli/tx_update_system_contract.go b/x/fungible/client/cli/tx_update_system_contract.go index 87be871b7f..6b376ef84e 100644 --- a/x/fungible/client/cli/tx_update_system_contract.go +++ b/x/fungible/client/cli/tx_update_system_contract.go @@ -26,9 +26,6 @@ func CmdUpdateSystemContract() *cobra.Command { contractAddress, ) - if err := msg.ValidateBasic(); err != nil { - return err - } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/fungible/client/cli/tx_update_zrc20_paused_status.go b/x/fungible/client/cli/tx_update_zrc20_paused_status.go new file mode 100644 index 0000000000..f1258920c7 --- /dev/null +++ b/x/fungible/client/cli/tx_update_zrc20_paused_status.go @@ -0,0 +1,56 @@ +package cli + +import ( + "strconv" + "strings" + + "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/zetacore/x/fungible/types" + cosmoserrors "cosmossdk.io/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +func CmdUpdateZRC20PausedStatus() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-zrc20-paused-status [contractAddress1, contractAddress2, ...] [pausedStatus]", + Short: "Broadcast message UpdateZRC20PausedStatus", + Example: `zetacored tx fungible update-zrc20-paused-status "0xece40cbB54d65282c4623f141c4a8a0bE7D6AdEc, 0xece40cbB54d65282c4623f141c4a8a0bEjgksncf" 0 `, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + contractAddressList := strings.Split(strings.TrimSpace(args[0]), ",") + + action, err := strconv.ParseUint(args[1], 10, 32) + if err != nil { + return err + } + if (action != 0) && (action != 1) { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid action (%d)", action) + } + + pausedStatus := types.UpdatePausedStatusAction_PAUSE + if action == 1 { + pausedStatus = types.UpdatePausedStatusAction_UNPAUSE + } + + msg := types.NewMsgUpdateZRC20PausedStatus( + clientCtx.GetFromAddress().String(), + contractAddressList, + pausedStatus, + ) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/fungible/client/cli/tx_update_zrc20_withdraw_fee.go b/x/fungible/client/cli/tx_update_zrc20_withdraw_fee.go new file mode 100644 index 0000000000..7a5addc0e2 --- /dev/null +++ b/x/fungible/client/cli/tx_update_zrc20_withdraw_fee.go @@ -0,0 +1,43 @@ +package cli + +import ( + "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/zetacore/x/fungible/types" + sdkmath "cosmossdk.io/math" +) + +func CmdUpdateZRC20WithdrawFee() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-zrc20-withdraw-fee [contractAddress] [newWithdrawFee] [newGasLimit]", + Short: "Broadcast message UpdateZRC20WithdrawFee", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + contractAddress := args[0] + + newWithdrawFee := sdkmath.NewUintFromString(args[1]) + + newGasLimit := sdkmath.NewUintFromString(args[2]) + + msg := types.NewMsgUpdateZRC20WithdrawFee( + clientCtx.GetFromAddress().String(), + contractAddress, + newWithdrawFee, + newGasLimit, + ) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} 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 57f1c8b931..c2088e0b53 100644 --- a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go +++ b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go @@ -96,8 +96,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { // update the bytecode res, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - zrc20, - newCodeAddress, + zrc20.Hex(), + newCodeAddress.Hex(), )) require.NoError(t, err) @@ -137,8 +137,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { require.NoError(t, err) _, err = msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - zrc20, - newCodeAddress, + zrc20.Hex(), + newCodeAddress.Hex(), )) require.NoError(t, err) balance, err = k.BalanceOfZRC4(ctx, zrc20, addr1) @@ -171,8 +171,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { // can update the bytecode of the new connector with the old connector contract _, err = msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - newConnector, - oldConnector, + newConnector.Hex(), + oldConnector.Hex(), )) require.NoError(t, err) }) @@ -183,8 +183,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( sample.AccAddress(), - sample.EthAddress(), - sample.EthAddress(), + sample.EthAddress().Hex(), + sample.EthAddress().Hex(), )) require.ErrorIs(t, err, sdkerrors.ErrUnauthorized) }) @@ -222,8 +222,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - contractAddr, - sample.EthAddress(), + contractAddr.Hex(), + sample.EthAddress().Hex(), )) require.ErrorIs(t, err, types.ErrContractNotFound) @@ -242,8 +242,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { // can't update the bytecode of the wzeta contract _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - wzeta, - sample.EthAddress(), + wzeta.Hex(), + sample.EthAddress().Hex(), )) require.ErrorIs(t, err, types.ErrInvalidContract) }) @@ -263,8 +263,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { // can't update the bytecode of the wzeta contract _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - connector, - sample.EthAddress(), + connector.Hex(), + sample.EthAddress().Hex(), )) require.ErrorIs(t, err, types.ErrSystemContractNotFound) }) @@ -331,8 +331,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - contractAddr, - newBytecodeAddr, + contractAddr.Hex(), + newBytecodeAddr.Hex(), )) require.ErrorIs(t, err, types.ErrContractNotFound) @@ -376,8 +376,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - contractAddr, - newBytecodeAddr, + contractAddr.Hex(), + newBytecodeAddr.Hex(), )) require.ErrorIs(t, err, types.ErrSetBytecode) diff --git a/x/fungible/types/message_update_contract_bytecode.go b/x/fungible/types/message_update_contract_bytecode.go index a8a10cb5bd..817db76b20 100644 --- a/x/fungible/types/message_update_contract_bytecode.go +++ b/x/fungible/types/message_update_contract_bytecode.go @@ -13,12 +13,12 @@ const TypeMsgUpdateContractBytecode = "update_contract_bytecode" var _ sdk.Msg = &MsgUpdateContractBytecode{} func NewMsgUpdateContractBytecode( - creator string, contractAddress ethcommon.Address, newBytecodeAddress ethcommon.Address, + creator string, contractAddress string, newBytecodeAddress string, ) *MsgUpdateContractBytecode { return &MsgUpdateContractBytecode{ Creator: creator, - ContractAddress: contractAddress.Hex(), - NewBytecodeAddress: newBytecodeAddress.Hex(), + ContractAddress: contractAddress, + NewBytecodeAddress: newBytecodeAddress, } } @@ -48,6 +48,10 @@ func (msg *MsgUpdateContractBytecode) ValidateBasic() error { return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } + if msg.ContractAddress == msg.NewBytecodeAddress { + return cosmoserror.Wrapf(sdkerrors.ErrInvalidRequest, "contract address and new bytecode address cannot be the same") + } + // check if the contract address is valid if !ethcommon.IsHexAddress(msg.ContractAddress) { return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress) diff --git a/x/fungible/types/message_update_contract_bytecode_test.go b/x/fungible/types/message_update_contract_bytecode_test.go index 23a1ee2d97..1e4532d4ca 100644 --- a/x/fungible/types/message_update_contract_bytecode_test.go +++ b/x/fungible/types/message_update_contract_bytecode_test.go @@ -9,6 +9,7 @@ import ( ) func TestMsgUpdateContractBytecode_ValidateBasic(t *testing.T) { + sampleAddress := sample.EthAddress().String() tt := []struct { name string msg types.MsgUpdateContractBytecode @@ -50,6 +51,15 @@ func TestMsgUpdateContractBytecode_ValidateBasic(t *testing.T) { }, wantError: true, }, + { + name: "same old contract and new bytecode address", + msg: types.MsgUpdateContractBytecode{ + Creator: sample.AccAddress(), + ContractAddress: sampleAddress, + NewBytecodeAddress: sampleAddress, + }, + wantError: true, + }, } for _, tc := range tt { diff --git a/x/fungible/types/message_update_system_contract.go b/x/fungible/types/message_update_system_contract.go index b6879f2ff6..e7eef7f261 100644 --- a/x/fungible/types/message_update_system_contract.go +++ b/x/fungible/types/message_update_system_contract.go @@ -1,6 +1,7 @@ package types import ( + cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" @@ -41,11 +42,14 @@ func (msg *MsgUpdateSystemContract) GetSignBytes() []byte { func (msg *MsgUpdateSystemContract) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } // check if the system contract address is valid if ethcommon.HexToAddress(msg.NewSystemContractAddress) == (ethcommon.Address{}) { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.NewSystemContractAddress) + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.NewSystemContractAddress) + } + if !ethcommon.IsHexAddress(msg.NewSystemContractAddress) { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.NewSystemContractAddress) } return nil diff --git a/x/fungible/types/message_update_zrc20_paused_status.go b/x/fungible/types/message_update_zrc20_paused_status.go index 9eb1b77bd5..fc74587e34 100644 --- a/x/fungible/types/message_update_zrc20_paused_status.go +++ b/x/fungible/types/message_update_zrc20_paused_status.go @@ -55,10 +55,15 @@ func (msg *MsgUpdateZRC20PausedStatus) ValidateBasic() error { } // check if all zrc20 addresses are valid + found := make(map[string]bool) for _, zrc20 := range msg.Zrc20Addresses { if !ethcommon.IsHexAddress(zrc20) { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", zrc20) } + if found[zrc20] { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "duplicate zrc20 contract address (%s)", zrc20) + } + found[zrc20] = true } return nil } diff --git a/x/fungible/types/message_update_zrc20_paused_status_test.go b/x/fungible/types/message_update_zrc20_paused_status_test.go index 326af3fe96..66e873eeef 100644 --- a/x/fungible/types/message_update_zrc20_paused_status_test.go +++ b/x/fungible/types/message_update_zrc20_paused_status_test.go @@ -9,6 +9,7 @@ import ( ) func TestMMsgUpdateZRC20PausedStatus_ValidateBasic(t *testing.T) { + sampleAddress := sample.EthAddress().String() tt := []struct { name string msg types.MsgUpdateZRC20PausedStatus @@ -75,6 +76,18 @@ func TestMMsgUpdateZRC20PausedStatus_ValidateBasic(t *testing.T) { }, wantErr: true, }, + { + name: "duplicate zrc20 address", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + Zrc20Addresses: []string{ + sampleAddress, + sampleAddress, + }, + Action: types.UpdatePausedStatusAction_PAUSE, + }, + wantErr: true, + }, { name: "invalid action", msg: types.MsgUpdateZRC20PausedStatus{ From 4a55f981cef95210c577cf0c4c27392be617740b Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Sun, 10 Dec 2023 06:57:32 +0800 Subject: [PATCH 3/7] update cli docs --- docs/cli/zetacored/zetacored_tx_fungible.md | 4 ++ ...ed_tx_fungible_update-contract-bytecode.md | 51 +++++++++++++++++ ...ored_tx_fungible_update-system-contract.md | 51 +++++++++++++++++ ..._tx_fungible_update-zrc20-paused-status.md | 57 +++++++++++++++++++ ...d_tx_fungible_update-zrc20-withdraw-fee.md | 51 +++++++++++++++++ 5 files changed, 214 insertions(+) create mode 100644 docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md create mode 100644 docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md create mode 100644 docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md create mode 100644 docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md diff --git a/docs/cli/zetacored/zetacored_tx_fungible.md b/docs/cli/zetacored/zetacored_tx_fungible.md index 0ba5834cd3..e3a0a6ed13 100644 --- a/docs/cli/zetacored/zetacored_tx_fungible.md +++ b/docs/cli/zetacored/zetacored_tx_fungible.md @@ -28,4 +28,8 @@ zetacored tx fungible [flags] * [zetacored tx fungible deploy-fungible-coin-zrc-4](zetacored_tx_fungible_deploy-fungible-coin-zrc-4.md) - Broadcast message DeployFungibleCoinZRC20 * [zetacored tx fungible remove-foreign-coin](zetacored_tx_fungible_remove-foreign-coin.md) - Broadcast message RemoveForeignCoin * [zetacored tx fungible update-zrc20-liquidity-cap](zetacored_tx_fungible_update-zrc20-liquidity-cap.md) - Broadcast message UpdateZRC20LiquidityCap +* [zetacored tx fungible update-zrc20-paused-status](zetacored_tx_fungible_update-zrc20-paused-status.md) - Broadcast message UpdateZRC20PausedStatus +* [zetacored tx fungible update-contract-bytecode](zetacored_tx_fungible_update-contract-bytecode.md) - Broadcast message MsgUpdateContractBytecode +* [zetacored tx fungible update-system-contract](zetacored_tx_fungible_update-system-contract.md) - Broadcast message UpdateSystemContract +* [zetacored tx fungible update-zrc20-withdraw-fee](zetacored_tx_fungible_update-zrc20-withdraw-fee.md) - Broadcast message UpdateZRC20WithdrawFee diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md b/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md new file mode 100644 index 0000000000..6128c6f109 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md @@ -0,0 +1,51 @@ +# tx fungible update-contract-bytecode + +Broadcast message MsgUpdateContractBytecode + +``` +zetacored tx fungible update-contract-bytecode [contractAddress] [newBytecodeAddress] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync") + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-contract-bytecode + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) (default "json") + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data (default "/Users/jjvincent/.zetacored") + --log_format string The logging format (json|plain) (default "plain") + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands \ No newline at end of file diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md b/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md new file mode 100644 index 0000000000..ecd05d6836 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md @@ -0,0 +1,51 @@ +# tx fungible update-system-contract + +Broadcast message UpdateSystemContract + +``` +zetacored tx fungible update-system-contract [contractAddress] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync") + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-system-contract + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) (default "json") + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data (default "/Users/jjvincent/.zetacored") + --log_format string The logging format (json|plain) (default "plain") + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands \ No newline at end of file diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md b/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md new file mode 100644 index 0000000000..72c02a9471 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md @@ -0,0 +1,57 @@ +# tx fungible update-zrc20-paused-status + +Broadcast message UpdateZRC20PausedStatus + +``` +zetacored tx fungible update-zrc20-paused-status [contractAddress1, contractAddress2, ...] [pausedStatus] [flags] +``` + +### Example + +``` +zetacored tx fungible update-zrc20-paused-status "address1,address2" 0 +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync") + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-zrc20-paused-status + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) (default "json") + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data (default "/Users/jjvincent/.zetacored") + --log_format string The logging format (json|plain) (default "plain") + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands \ No newline at end of file diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md b/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md new file mode 100644 index 0000000000..19bed2d3ca --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md @@ -0,0 +1,51 @@ +# tx fungible update-zrc20-withdraw-fee + +Broadcast message UpdateZRC20WithdrawFee + +``` +zetacored tx fungible update-zrc20-withdraw-fee [contractAddress] [newWithdrawFee] [newGasLimit] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync") + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-zrc20-withdraw-fee + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) (default "json") + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data (default "/Users/jjvincent/.zetacored") + --log_format string The logging format (json|plain) (default "plain") + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands \ No newline at end of file From 4d7e58495443d3343a05eae07d70191e0860db4d Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Fri, 22 Dec 2023 22:20:36 +0800 Subject: [PATCH 4/7] modify fungible tx cli docs --- docs/cli/zetacored/zetacored_tx_fungible.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/cli/zetacored/zetacored_tx_fungible.md b/docs/cli/zetacored/zetacored_tx_fungible.md index b468ad29be..0365ebfdf2 100644 --- a/docs/cli/zetacored/zetacored_tx_fungible.md +++ b/docs/cli/zetacored/zetacored_tx_fungible.md @@ -32,7 +32,5 @@ zetacored tx fungible [flags] * [zetacored tx fungible update-system-contract](zetacored_tx_fungible_update-system-contract.md) - Broadcast message UpdateSystemContract * [zetacored tx fungible update-zrc20-liquidity-cap](zetacored_tx_fungible_update-zrc20-liquidity-cap.md) - Broadcast message UpdateZRC20LiquidityCap * [zetacored tx fungible update-zrc20-paused-status](zetacored_tx_fungible_update-zrc20-paused-status.md) - Broadcast message UpdateZRC20PausedStatus -* [zetacored tx fungible update-contract-bytecode](zetacored_tx_fungible_update-contract-bytecode.md) - Broadcast message MsgUpdateContractBytecode -* [zetacored tx fungible update-system-contract](zetacored_tx_fungible_update-system-contract.md) - Broadcast message UpdateSystemContract * [zetacored tx fungible update-zrc20-withdraw-fee](zetacored_tx_fungible_update-zrc20-withdraw-fee.md) - Broadcast message UpdateZRC20WithdrawFee From cee7d06df9a501a56d9cf173eb38dc0438d94b68 Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Wed, 7 Feb 2024 09:41:30 +0800 Subject: [PATCH 5/7] refactor: remove codes that are not related to PR --- .../types/message_update_contract_bytecode.go | 4 ---- .../types/message_update_contract_bytecode_test.go | 10 ---------- x/fungible/types/message_update_system_contract.go | 8 ++------ .../types/message_update_zrc20_paused_status.go | 5 ----- .../message_update_zrc20_paused_status_test.go | 13 ------------- 5 files changed, 2 insertions(+), 38 deletions(-) diff --git a/x/fungible/types/message_update_contract_bytecode.go b/x/fungible/types/message_update_contract_bytecode.go index 581537957e..212526b558 100644 --- a/x/fungible/types/message_update_contract_bytecode.go +++ b/x/fungible/types/message_update_contract_bytecode.go @@ -50,10 +50,6 @@ func (msg *MsgUpdateContractBytecode) ValidateBasic() error { return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } - if msg.ContractAddress == msg.NewCodeHash { - return cosmoserror.Wrapf(sdkerrors.ErrInvalidRequest, "contract address and new bytecode address cannot be the same") - } - // check if the contract address is valid if !ethcommon.IsHexAddress(msg.ContractAddress) { return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress) diff --git a/x/fungible/types/message_update_contract_bytecode_test.go b/x/fungible/types/message_update_contract_bytecode_test.go index 772aff91a0..02e8b3cfdd 100644 --- a/x/fungible/types/message_update_contract_bytecode_test.go +++ b/x/fungible/types/message_update_contract_bytecode_test.go @@ -9,7 +9,6 @@ import ( ) func TestMsgUpdateContractBytecode_ValidateBasic(t *testing.T) { - sampleAddress := sample.EthAddress().String() tt := []struct { name string msg types.MsgUpdateContractBytecode @@ -51,15 +50,6 @@ func TestMsgUpdateContractBytecode_ValidateBasic(t *testing.T) { }, wantError: true, }, - { - name: "same old contract and new bytecode address", - msg: types.MsgUpdateContractBytecode{ - Creator: sample.AccAddress(), - ContractAddress: sampleAddress, - NewCodeHash: sampleAddress, - }, - wantError: true, - }, } for _, tc := range tt { diff --git a/x/fungible/types/message_update_system_contract.go b/x/fungible/types/message_update_system_contract.go index e7eef7f261..b6879f2ff6 100644 --- a/x/fungible/types/message_update_system_contract.go +++ b/x/fungible/types/message_update_system_contract.go @@ -1,7 +1,6 @@ package types import ( - cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" @@ -42,14 +41,11 @@ func (msg *MsgUpdateSystemContract) GetSignBytes() []byte { func (msg *MsgUpdateSystemContract) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } // check if the system contract address is valid if ethcommon.HexToAddress(msg.NewSystemContractAddress) == (ethcommon.Address{}) { - return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.NewSystemContractAddress) - } - if !ethcommon.IsHexAddress(msg.NewSystemContractAddress) { - return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.NewSystemContractAddress) + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.NewSystemContractAddress) } return nil diff --git a/x/fungible/types/message_update_zrc20_paused_status.go b/x/fungible/types/message_update_zrc20_paused_status.go index fc74587e34..9eb1b77bd5 100644 --- a/x/fungible/types/message_update_zrc20_paused_status.go +++ b/x/fungible/types/message_update_zrc20_paused_status.go @@ -55,15 +55,10 @@ func (msg *MsgUpdateZRC20PausedStatus) ValidateBasic() error { } // check if all zrc20 addresses are valid - found := make(map[string]bool) for _, zrc20 := range msg.Zrc20Addresses { if !ethcommon.IsHexAddress(zrc20) { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", zrc20) } - if found[zrc20] { - return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "duplicate zrc20 contract address (%s)", zrc20) - } - found[zrc20] = true } return nil } diff --git a/x/fungible/types/message_update_zrc20_paused_status_test.go b/x/fungible/types/message_update_zrc20_paused_status_test.go index 66e873eeef..326af3fe96 100644 --- a/x/fungible/types/message_update_zrc20_paused_status_test.go +++ b/x/fungible/types/message_update_zrc20_paused_status_test.go @@ -9,7 +9,6 @@ import ( ) func TestMMsgUpdateZRC20PausedStatus_ValidateBasic(t *testing.T) { - sampleAddress := sample.EthAddress().String() tt := []struct { name string msg types.MsgUpdateZRC20PausedStatus @@ -76,18 +75,6 @@ func TestMMsgUpdateZRC20PausedStatus_ValidateBasic(t *testing.T) { }, wantErr: true, }, - { - name: "duplicate zrc20 address", - msg: types.MsgUpdateZRC20PausedStatus{ - Creator: sample.AccAddress(), - Zrc20Addresses: []string{ - sampleAddress, - sampleAddress, - }, - Action: types.UpdatePausedStatusAction_PAUSE, - }, - wantErr: true, - }, { name: "invalid action", msg: types.MsgUpdateZRC20PausedStatus{ From 5c79fcfcd5b7945ebb7f9825a67a36e459785e4f Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Wed, 7 Feb 2024 11:46:32 +0800 Subject: [PATCH 6/7] generate cli docs --- common/common.pb.go | 2 -- docs/cli/zetacored/zetacored_tx_fungible.md | 4 ++-- ...ed_tx_fungible_update-contract-bytecode.md | 14 +++++------ ...ored_tx_fungible_update-system-contract.md | 12 +++++----- ..._tx_fungible_update-zrc20-paused-status.md | 23 ++++++++++--------- ...d_tx_fungible_update-zrc20-withdraw-fee.md | 17 +++++++------- x/crosschain/types/tx.pb.go | 4 ++-- .../cli/tx_update_zrc20_paused_status.go | 10 ++++---- .../cli/tx_update_zrc20_withdraw_fee.go | 4 ++-- 9 files changed, 45 insertions(+), 45 deletions(-) diff --git a/common/common.pb.go b/common/common.pb.go index 76f8d4d9de..658459858a 100644 --- a/common/common.pb.go +++ b/common/common.pb.go @@ -339,7 +339,6 @@ func (m *BlockHeader) GetHeader() HeaderData { type HeaderData struct { // Types that are valid to be assigned to Data: - // // *HeaderData_EthereumHeader // *HeaderData_BitcoinHeader Data isHeaderData_Data `protobuf_oneof:"data"` @@ -425,7 +424,6 @@ func (*HeaderData) XXX_OneofWrappers() []interface{} { type Proof struct { // Types that are valid to be assigned to Proof: - // // *Proof_EthereumProof // *Proof_BitcoinProof Proof isProof_Proof `protobuf_oneof:"proof"` diff --git a/docs/cli/zetacored/zetacored_tx_fungible.md b/docs/cli/zetacored/zetacored_tx_fungible.md index 0365ebfdf2..9073048a57 100644 --- a/docs/cli/zetacored/zetacored_tx_fungible.md +++ b/docs/cli/zetacored/zetacored_tx_fungible.md @@ -31,6 +31,6 @@ zetacored tx fungible [flags] * [zetacored tx fungible update-contract-bytecode](zetacored_tx_fungible_update-contract-bytecode.md) - Broadcast message UpdateContractBytecode * [zetacored tx fungible update-system-contract](zetacored_tx_fungible_update-system-contract.md) - Broadcast message UpdateSystemContract * [zetacored tx fungible update-zrc20-liquidity-cap](zetacored_tx_fungible_update-zrc20-liquidity-cap.md) - Broadcast message UpdateZRC20LiquidityCap -* [zetacored tx fungible update-zrc20-paused-status](zetacored_tx_fungible_update-zrc20-paused-status.md) - Broadcast message UpdateZRC20PausedStatus -* [zetacored tx fungible update-zrc20-withdraw-fee](zetacored_tx_fungible_update-zrc20-withdraw-fee.md) - Broadcast message UpdateZRC20WithdrawFee +* [zetacored tx fungible update-zrc20-paused-status](zetacored_tx_fungible_update-zrc20-paused-status.md) - Broadcast message UpdateZRC20PausedStatus +* [zetacored tx fungible update-zrc20-withdraw-fee](zetacored_tx_fungible_update-zrc20-withdraw-fee.md) - Broadcast message UpdateZRC20WithdrawFee diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md b/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md index 71c2e09bd9..bc97a583b1 100644 --- a/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md @@ -11,7 +11,7 @@ zetacored tx fungible update-contract-bytecode [contract-address] [new-code-hash ``` -a, --account-number uint The account number of the signing account (offline mode only) --aux Generate aux signer data instead of sending a tx - -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync") + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) --fee-granter string Fee granter grants fees for the transaction --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer @@ -22,13 +22,13 @@ zetacored tx fungible update-contract-bytecode [contract-address] [new-code-hash --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) -h, --help help for update-contract-bytecode - --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used --ledger Use a connected Ledger device - --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") + --node string [host]:[port] to tendermint rpc interface for this chain --note string Note to add a description to the transaction (previously --memo) --offline Offline mode (does not allow any online functionality) - -o, --output string Output format (text|json) (default "json") + -o, --output string Output format (text|json) -s, --sequence uint The sequence number of the signing account (offline mode only) --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height @@ -40,9 +40,9 @@ zetacored tx fungible update-contract-bytecode [contract-address] [new-code-hash ``` --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) (default "plain") - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) --trace print out full stack trace on errors ``` diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md b/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md index 283065144c..c9a3e163ec 100644 --- a/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md @@ -22,13 +22,13 @@ zetacored tx fungible update-system-contract [contract-address] [flags] --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) -h, --help help for update-system-contract - --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used --ledger Use a connected Ledger device - --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") + --node string [host]:[port] to tendermint rpc interface for this chain --note string Note to add a description to the transaction (previously --memo) --offline Offline mode (does not allow any online functionality) - -o, --output string Output format (text|json) (default "json") + -o, --output string Output format (text|json) -s, --sequence uint The sequence number of the signing account (offline mode only) --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height @@ -40,9 +40,9 @@ zetacored tx fungible update-system-contract [contract-address] [flags] ``` --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) (default "plain") - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) --trace print out full stack trace on errors ``` diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md b/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md index ea6c15888e..7a26d225df 100644 --- a/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md @@ -6,18 +6,18 @@ Broadcast message UpdateZRC20PausedStatus zetacored tx fungible update-zrc20-paused-status [contractAddress1, contractAddress2, ...] [pausedStatus] [flags] ``` -### Example +### Examples ``` -zetacored tx fungible update-zrc20-paused-status "address1,address2" 0 +zetacored tx fungible update-zrc20-paused-status "0xece40cbB54d65282c4623f141c4a8a0bE7D6AdEc, 0xece40cbB54d65282c4623f141c4a8a0bEjgksncf" 0 ``` - + ### Options ``` -a, --account-number uint The account number of the signing account (offline mode only) --aux Generate aux signer data instead of sending a tx - -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync") + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) --fee-granter string Fee granter grants fees for the transaction --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer @@ -28,13 +28,13 @@ zetacored tx fungible update-zrc20-paused-status "address1,address2" 0 --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) -h, --help help for update-zrc20-paused-status - --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used --ledger Use a connected Ledger device - --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") + --node string [host]:[port] to tendermint rpc interface for this chain --note string Note to add a description to the transaction (previously --memo) --offline Offline mode (does not allow any online functionality) - -o, --output string Output format (text|json) (default "json") + -o, --output string Output format (text|json) -s, --sequence uint The sequence number of the signing account (offline mode only) --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height @@ -46,12 +46,13 @@ zetacored tx fungible update-zrc20-paused-status "address1,address2" 0 ``` --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) (default "plain") - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) --trace print out full stack trace on errors ``` ### SEE ALSO -* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands \ No newline at end of file +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands + diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md b/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md index 17fe645867..dc20a6d00d 100644 --- a/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md @@ -11,7 +11,7 @@ zetacored tx fungible update-zrc20-withdraw-fee [contractAddress] [newWithdrawFe ``` -a, --account-number uint The account number of the signing account (offline mode only) --aux Generate aux signer data instead of sending a tx - -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync") + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) --fee-granter string Fee granter grants fees for the transaction --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer @@ -22,13 +22,13 @@ zetacored tx fungible update-zrc20-withdraw-fee [contractAddress] [newWithdrawFe --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) -h, --help help for update-zrc20-withdraw-fee - --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) (default "os") + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used --ledger Use a connected Ledger device - --node string : to tendermint rpc interface for this chain (default "tcp://localhost:26657") + --node string [host]:[port] to tendermint rpc interface for this chain --note string Note to add a description to the transaction (previously --memo) --offline Offline mode (does not allow any online functionality) - -o, --output string Output format (text|json) (default "json") + -o, --output string Output format (text|json) -s, --sequence uint The sequence number of the signing account (offline mode only) --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height @@ -40,12 +40,13 @@ zetacored tx fungible update-zrc20-withdraw-fee [contractAddress] [newWithdrawFe ``` --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) (default "plain") - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) --trace print out full stack trace on errors ``` ### SEE ALSO -* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands \ No newline at end of file +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands + diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index c784912394..acab4dd991 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -1088,9 +1088,9 @@ type MsgVoteOnObservedInboundTx struct { SenderChainId int64 `protobuf:"varint,3,opt,name=sender_chain_id,json=senderChainId,proto3" json:"sender_chain_id,omitempty"` Receiver string `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"` ReceiverChain int64 `protobuf:"varint,5,opt,name=receiver_chain,json=receiverChain,proto3" json:"receiver_chain,omitempty"` - // string zeta_burnt = 6; + // string zeta_burnt = 6; Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,6,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"` - // string mMint = 7; + // string mMint = 7; Message string `protobuf:"bytes,8,opt,name=message,proto3" json:"message,omitempty"` InTxHash string `protobuf:"bytes,9,opt,name=in_tx_hash,json=inTxHash,proto3" json:"in_tx_hash,omitempty"` InBlockHeight uint64 `protobuf:"varint,10,opt,name=in_block_height,json=inBlockHeight,proto3" json:"in_block_height,omitempty"` diff --git a/x/fungible/client/cli/tx_update_zrc20_paused_status.go b/x/fungible/client/cli/tx_update_zrc20_paused_status.go index f1258920c7..cb29f3cdcf 100644 --- a/x/fungible/client/cli/tx_update_zrc20_paused_status.go +++ b/x/fungible/client/cli/tx_update_zrc20_paused_status.go @@ -4,21 +4,21 @@ import ( "strconv" "strings" + cosmoserrors "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/x/fungible/types" - cosmoserrors "cosmossdk.io/errors" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) func CmdUpdateZRC20PausedStatus() *cobra.Command { cmd := &cobra.Command{ - Use: "update-zrc20-paused-status [contractAddress1, contractAddress2, ...] [pausedStatus]", - Short: "Broadcast message UpdateZRC20PausedStatus", + Use: "update-zrc20-paused-status [contractAddress1, contractAddress2, ...] [pausedStatus]", + Short: "Broadcast message UpdateZRC20PausedStatus", Example: `zetacored tx fungible update-zrc20-paused-status "0xece40cbB54d65282c4623f141c4a8a0bE7D6AdEc, 0xece40cbB54d65282c4623f141c4a8a0bEjgksncf" 0 `, - Args: cobra.ExactArgs(2), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { diff --git a/x/fungible/client/cli/tx_update_zrc20_withdraw_fee.go b/x/fungible/client/cli/tx_update_zrc20_withdraw_fee.go index 7a5addc0e2..647ff6419e 100644 --- a/x/fungible/client/cli/tx_update_zrc20_withdraw_fee.go +++ b/x/fungible/client/cli/tx_update_zrc20_withdraw_fee.go @@ -1,12 +1,12 @@ package cli import ( + 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/zetacore/x/fungible/types" - sdkmath "cosmossdk.io/math" ) func CmdUpdateZRC20WithdrawFee() *cobra.Command { @@ -25,7 +25,7 @@ func CmdUpdateZRC20WithdrawFee() *cobra.Command { newWithdrawFee := sdkmath.NewUintFromString(args[1]) newGasLimit := sdkmath.NewUintFromString(args[2]) - + msg := types.NewMsgUpdateZRC20WithdrawFee( clientCtx.GetFromAddress().String(), contractAddress, From fe98c413c157d7f6a0b999bb529025b3d8e1cd33 Mon Sep 17 00:00:00 2001 From: lukema95 <867273263@qq.com> Date: Wed, 21 Feb 2024 19:31:23 +0800 Subject: [PATCH 7/7] fix generated file error --- common/common.pb.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/common.pb.go b/common/common.pb.go index 658459858a..76f8d4d9de 100644 --- a/common/common.pb.go +++ b/common/common.pb.go @@ -339,6 +339,7 @@ func (m *BlockHeader) GetHeader() HeaderData { type HeaderData struct { // Types that are valid to be assigned to Data: + // // *HeaderData_EthereumHeader // *HeaderData_BitcoinHeader Data isHeaderData_Data `protobuf_oneof:"data"` @@ -424,6 +425,7 @@ func (*HeaderData) XXX_OneofWrappers() []interface{} { type Proof struct { // Types that are valid to be assigned to Proof: + // // *Proof_EthereumProof // *Proof_BitcoinProof Proof isProof_Proof `protobuf_oneof:"proof"`