Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: MsgUpdateZRC20 into MsgPauseZrc20 and MsgUnPauseZRC20 #2262

Merged
merged 17 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* [2210](https://github.com/zeta-chain/node/pull/2210) - removed uncessary panics in the zetaclientd process
* [2205](https://github.com/zeta-chain/node/pull/2205) - remove deprecated variables pre-v17
* [2226](https://github.com/zeta-chain/node/pull/2226) - improve Go formatting with imports standardization and max line length to 120
* [2262](https://github.com/zeta-chain/node/pull/2262) - refactor MsgUpdateZRC20 into MsgPauseZrc20 and MsgUnPauseZRC20

### Tests

Expand Down
3 changes: 2 additions & 1 deletion docs/cli/zetacored/zetacored_tx_fungible.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ zetacored tx fungible [flags]
* [zetacored tx](zetacored_tx.md) - Transactions subcommands
* [zetacored tx fungible deploy-fungible-coin-zrc-4](zetacored_tx_fungible_deploy-fungible-coin-zrc-4.md) - Broadcast message DeployFungibleCoinZRC20
* [zetacored tx fungible deploy-system-contracts](zetacored_tx_fungible_deploy-system-contracts.md) - Broadcast message SystemContracts
* [zetacored tx fungible pause-zrc20](zetacored_tx_fungible_pause-zrc20.md) - Broadcast message PauseZRC20
* [zetacored tx fungible remove-foreign-coin](zetacored_tx_fungible_remove-foreign-coin.md) - Broadcast message RemoveForeignCoin
* [zetacored tx fungible unpause-zrc20](zetacored_tx_fungible_unpause-zrc20.md) - Broadcast message UnpauseZRC20
* [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

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# tx fungible update-zrc20-paused-status
# tx fungible pause-zrc20

Broadcast message UpdateZRC20PausedStatus
Broadcast message PauseZRC20

```
zetacored tx fungible update-zrc20-paused-status [contractAddress1, contractAddress2, ...] [pausedStatus] [flags]
zetacored tx fungible pause-zrc20 [contractAddress1, contractAddress2, ...] [flags]
```

### Examples

```
zetacored tx fungible update-zrc20-paused-status "0xece40cbB54d65282c4623f141c4a8a0bE7D6AdEc, 0xece40cbB54d65282c4623f141c4a8a0bEjgksncf" 0
zetacored tx fungible pause-zrc20 "0xece40cbB54d65282c4623f141c4a8a0bE7D6AdEc, 0xece40cbB54d65282c4623f141c4a8a0bEjgksncf"
```

### Options
Expand All @@ -28,7 +28,7 @@ zetacored tx fungible update-zrc20-paused-status "0xece40cbB54d65282c4623f141c4a
--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
-h, --help help for pause-zrc20
--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
Expand Down
59 changes: 59 additions & 0 deletions docs/cli/zetacored/zetacored_tx_fungible_unpause-zrc20.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# tx fungible unpause-zrc20

Broadcast message UnpauseZRC20

```
zetacored tx fungible unpause-zrc20 [contractAddress1, contractAddress2, ...] [flags]
```

### Examples

```
zetacored tx fungible unpause-zrc20 "0xece40cbB54d65282c4623f141c4a8a0bE7D6AdEc, 0xece40cbB54d65282c4623f141c4a8a0bEjgksncf"
```

### 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)
--chain-id string The network chain ID
--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 unpause-zrc20
--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

```
--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)
--log_no_color Disable colored logs
--trace print out full stack trace on errors
```

### SEE ALSO

* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands

12 changes: 4 additions & 8 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57395,16 +57395,18 @@ definitions:
type: string
systemContract:
type: string
fungibleMsgPauseZRC20Response:
type: object
fungibleMsgRemoveForeignCoinResponse:
type: object
fungibleMsgUnpauseZRC20Response:
type: object
fungibleMsgUpdateContractBytecodeResponse:
type: object
fungibleMsgUpdateSystemContractResponse:
type: object
fungibleMsgUpdateZRC20LiquidityCapResponse:
type: object
fungibleMsgUpdateZRC20PausedStatusResponse:
type: object
fungibleMsgUpdateZRC20WithdrawFeeResponse:
type: object
fungibleQueryAllForeignCoinsResponse:
Expand Down Expand Up @@ -57459,12 +57461,6 @@ definitions:
type: string
connector_zevm:
type: string
fungibleUpdatePausedStatusAction:
type: string
enum:
- PAUSE
- UNPAUSE
default: PAUSE
googlerpcStatus:
type: object
properties:
Expand Down
4 changes: 4 additions & 0 deletions docs/releases/v17_breaking_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@
* `/zeta-chain/crosschain/inTxHashToCctxData/{hash}` endpoint is now `/zeta-chain/crosschain/inboundHashToCctxData/{hash}`
* `InTxHashToCctxAll` has been renamed to `InboundHashToCctxAll`
* `/zeta-chain/crosschain/inTxHashToCctx` endpoint is now `/zeta-chain/crosschain/inboundHashToCctx`

* `MsgUpdateZRC20` has been removed, and replaced with `MsgPauseZRC20` and `MsgUnpauseZRC20` messages.
* `MsgPauseZRC20` message pauses a ZRC20 token and can be triggered via `PolicyType_groupEmergency`
* `MsgUnpauseZRC20` message unpauses a ZRC20 token and can be triggered via `PolicyType_groupOperational`
35 changes: 22 additions & 13 deletions docs/spec/fungible/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,32 +102,41 @@ message MsgUpdateZRC20WithdrawFee {
}
```

## MsgUpdateZRC20PausedStatus
## MsgUpdateZRC20LiquidityCap

UpdateZRC20PausedStatus updates the paused status of a ZRC20
The list of ZRC20s are either paused or unpaused
UpdateZRC20LiquidityCap updates the liquidity cap for a ZRC20 token.

Authorized: admin policy group 1 (pausing), group 2 (pausing & unpausing)
Authorized: admin policy group 2.

```proto
message MsgUpdateZRC20PausedStatus {
message MsgUpdateZRC20LiquidityCap {
string creator = 1;
string zrc20_addresses = 2;
UpdatePausedStatusAction action = 3;
string zrc20_address = 2;
string liquidity_cap = 3;
}
```

## MsgUpdateZRC20LiquidityCap
## MsgPauseZRC20

UpdateZRC20LiquidityCap updates the liquidity cap for a ZRC20 token.
PauseZRC20 pauses a list of ZRC20 tokens
Authorized: admin policy group groupEmergency.

Authorized: admin policy group 2.
```proto
message MsgPauseZRC20 {
string creator = 1;
string zrc20_addresses = 2;
}
```

## MsgUnpauseZRC20

UnpauseZRC20 unpauses the ZRC20 token
Authorized: admin policy group groupOperational.

```proto
message MsgUpdateZRC20LiquidityCap {
message MsgUnpauseZRC20 {
string creator = 1;
string zrc20_address = 2;
string liquidity_cap = 3;
string zrc20_addresses = 2;
}
```

10 changes: 4 additions & 6 deletions e2e/e2etests/test_pause_zrc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) {

// Pause ETH ZRC20
r.Logger.Info("Pausing ETH")
msg := fungibletypes.NewMsgUpdateZRC20PausedStatus(
msgPause := fungibletypes.NewMsgPauseZRC20(
r.ZetaTxServer.GetAccountAddress(0),
[]string{r.ETHZRC20Addr.Hex()},
fungibletypes.UpdatePausedStatusAction_PAUSE,
)
res, err := r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg)
res, err := r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msgPause)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -129,12 +128,11 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) {

// Unpause ETH ZRC20
r.Logger.Info("Unpausing ETH")
msg = fungibletypes.NewMsgUpdateZRC20PausedStatus(
msgUnpause := fungibletypes.NewMsgUnpauseZRC20(
r.ZetaTxServer.GetAccountAddress(0),
[]string{r.ETHZRC20Addr.Hex()},
fungibletypes.UpdatePausedStatusAction_UNPAUSE,
)
res, err = r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg)
res, err = r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msgUnpause)
if err != nil {
panic(err)
}
Expand Down
11 changes: 8 additions & 3 deletions proto/zetachain/zetacore/fungible/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,16 @@ message EventZRC20WithdrawFeeUpdated {
string new_gas_limit = 9;
}

message EventZRC20PausedStatusUpdated {
message EventZRC20Paused {
string msg_type_url = 1;
repeated string zrc20_addresses = 2;
UpdatePausedStatusAction action = 3;
string signer = 4;
string signer = 3;
}

message EventZRC20UnPaused {
kingpinXD marked this conversation as resolved.
Show resolved Hide resolved
string msg_type_url = 1;
repeated string zrc20_addresses = 2;
string signer = 3;
}

message EventSystemContractsDeployed {
Expand Down
31 changes: 16 additions & 15 deletions proto/zetachain/zetacore/fungible/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ service Msg {
returns (MsgUpdateContractBytecodeResponse);
rpc UpdateZRC20WithdrawFee(MsgUpdateZRC20WithdrawFee)
returns (MsgUpdateZRC20WithdrawFeeResponse);
rpc UpdateZRC20PausedStatus(MsgUpdateZRC20PausedStatus)
returns (MsgUpdateZRC20PausedStatusResponse);
rpc UpdateZRC20LiquidityCap(MsgUpdateZRC20LiquidityCap)
returns (MsgUpdateZRC20LiquidityCapResponse);
rpc PauseZRC20(MsgPauseZRC20) returns (MsgPauseZRC20Response);
rpc UnpauseZRC20(MsgUnpauseZRC20) returns (MsgUnpauseZRC20Response);
}

message MsgDeploySystemContracts { string creator = 1; }
Expand Down Expand Up @@ -86,19 +86,6 @@ message MsgUpdateContractBytecode {

message MsgUpdateContractBytecodeResponse {}

enum UpdatePausedStatusAction {
PAUSE = 0;
UNPAUSE = 1;
}

message MsgUpdateZRC20PausedStatus {
string creator = 1;
repeated string zrc20_addresses = 2;
UpdatePausedStatusAction action = 3;
}

message MsgUpdateZRC20PausedStatusResponse {}

message MsgUpdateZRC20LiquidityCap {
string creator = 1;
string zrc20_address = 2;
Expand All @@ -109,3 +96,17 @@ message MsgUpdateZRC20LiquidityCap {
}

message MsgUpdateZRC20LiquidityCapResponse {}

message MsgPauseZRC20 {
string creator = 1;
repeated string zrc20_addresses = 2;
}

message MsgPauseZRC20Response {}

message MsgUnpauseZRC20 {
string creator = 1;
repeated string zrc20_addresses = 2;
}

message MsgUnpauseZRC20Response {}
52 changes: 40 additions & 12 deletions typescript/zetachain/zetacore/fungible/events_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import type { CoinType } from "../pkg/coin/coin_pb.js";
import type { UpdatePausedStatusAction } from "./tx_pb.js";

/**
* @generated from message zetachain.zetacore.fungible.EventSystemContractUpdated
Expand Down Expand Up @@ -176,9 +175,9 @@ export declare class EventZRC20WithdrawFeeUpdated extends Message<EventZRC20With
}

/**
* @generated from message zetachain.zetacore.fungible.EventZRC20PausedStatusUpdated
* @generated from message zetachain.zetacore.fungible.EventZRC20Paused
*/
export declare class EventZRC20PausedStatusUpdated extends Message<EventZRC20PausedStatusUpdated> {
export declare class EventZRC20Paused extends Message<EventZRC20Paused> {
/**
* @generated from field: string msg_type_url = 1;
*/
Expand All @@ -190,28 +189,57 @@ export declare class EventZRC20PausedStatusUpdated extends Message<EventZRC20Pau
zrc20Addresses: string[];

/**
* @generated from field: zetachain.zetacore.fungible.UpdatePausedStatusAction action = 3;
* @generated from field: string signer = 3;
*/
action: UpdatePausedStatusAction;
signer: string;

constructor(data?: PartialMessage<EventZRC20Paused>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.fungible.EventZRC20Paused";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EventZRC20Paused;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EventZRC20Paused;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EventZRC20Paused;

static equals(a: EventZRC20Paused | PlainMessage<EventZRC20Paused> | undefined, b: EventZRC20Paused | PlainMessage<EventZRC20Paused> | undefined): boolean;
}

/**
* @generated from message zetachain.zetacore.fungible.EventZRC20UnPaused
*/
export declare class EventZRC20UnPaused extends Message<EventZRC20UnPaused> {
/**
* @generated from field: string signer = 4;
* @generated from field: string msg_type_url = 1;
*/
msgTypeUrl: string;

/**
* @generated from field: repeated string zrc20_addresses = 2;
*/
zrc20Addresses: string[];

/**
* @generated from field: string signer = 3;
*/
signer: string;

constructor(data?: PartialMessage<EventZRC20PausedStatusUpdated>);
constructor(data?: PartialMessage<EventZRC20UnPaused>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.fungible.EventZRC20PausedStatusUpdated";
static readonly typeName = "zetachain.zetacore.fungible.EventZRC20UnPaused";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EventZRC20PausedStatusUpdated;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EventZRC20UnPaused;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EventZRC20PausedStatusUpdated;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EventZRC20UnPaused;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EventZRC20PausedStatusUpdated;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EventZRC20UnPaused;

static equals(a: EventZRC20PausedStatusUpdated | PlainMessage<EventZRC20PausedStatusUpdated> | undefined, b: EventZRC20PausedStatusUpdated | PlainMessage<EventZRC20PausedStatusUpdated> | undefined): boolean;
static equals(a: EventZRC20UnPaused | PlainMessage<EventZRC20UnPaused> | undefined, b: EventZRC20UnPaused | PlainMessage<EventZRC20UnPaused> | undefined): boolean;
}

/**
Expand Down
Loading
Loading