-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add missing cli for fungible module (#1426)
* add CmdUpdateSystemContract cli * add fungible module missing cli * update cli docs * modify fungible tx cli docs * refactor: remove codes that are not related to PR * generate cli docs * fix generated file error --------- Co-authored-by: Charlie Chen <[email protected]> Co-authored-by: Lucas Bertrand <[email protected]>
- Loading branch information
1 parent
e93afab
commit 15f2b4d
Showing
8 changed files
with
214 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-paused-status.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# tx fungible update-zrc20-paused-status | ||
|
||
Broadcast message UpdateZRC20PausedStatus | ||
|
||
``` | ||
zetacored tx fungible update-zrc20-paused-status [contractAddress1, contractAddress2, ...] [pausedStatus] [flags] | ||
``` | ||
|
||
### Examples | ||
|
||
``` | ||
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) | ||
--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) | ||
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used | ||
--ledger Use a connected Ledger device | ||
--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) | ||
-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 | ||
--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 | ||
|
52 changes: 52 additions & 0 deletions
52
docs/cli/zetacored/zetacored_tx_fungible_update-zrc20-withdraw-fee.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# 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) | ||
--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) | ||
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used | ||
--ledger Use a connected Ledger device | ||
--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) | ||
-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 | ||
--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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package cli | ||
|
||
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" | ||
) | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
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" | ||
) | ||
|
||
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 | ||
} |