From 64a8d53a2e4e0c64d9af2441df27422caa1d7ee0 Mon Sep 17 00:00:00 2001 From: brewmaster012 <88689859+brewmaster012@users.noreply.github.com> Date: Thu, 10 Aug 2023 12:40:18 -0500 Subject: [PATCH] feat: msg update withdraw fee (#929) * make smoketest work * smoketest: add test for context in depositAndCall * add missing files * add Update System Contract Address msg and smoketest * fix linter complaints * fix openapi * fix gosec complaint and CI config * fix linter config * fix generated file check fail * try fix CI config * address PR comments * add typed events * migrate one more event to typed event * cleanup fixme * update protocol-contract package to latest main branch * Update x/fungible/keeper/evm.go Co-authored-by: Lucas Bertrand * PR comments address: error types * re-generate go.sum * add msg & handler for MsgUpdateZRC20WithdrawFee * add smoketest for this * rename protobuf field * add missing file * fix linter complaints --------- Co-authored-by: brewmaster012 <> Co-authored-by: Lucas Bertrand --- docs/openapi/openapi.swagger.yaml | 2 + docs/spec/fungible/messages.md | 12 +- proto/fungible/events.proto | 10 + proto/fungible/tx.proto | 15 +- .../begin_blocker_deploy_system_contracts.go | 5 +- ...blocker_deploy_system_contracts_privnet.go | 19 +- ...blocker_deploy_system_contracts_testnet.go | 6 +- .../msg_server_update_system_contract.go | 2 +- .../msg_server_update_zrc20_withdraw_fee.go | 84 +++ x/fungible/module.go | 11 +- x/fungible/types/events.pb.go | 503 ++++++++++++++++- .../message_update_zrc20_withdraw_fee.go | 53 ++ x/fungible/types/tx.pb.go | 510 ++++++++++++++++-- 13 files changed, 1160 insertions(+), 72 deletions(-) create mode 100644 x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go create mode 100644 x/fungible/types/message_update_zrc20_withdraw_fee.go diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 3d0420ddd5..91cd4b5280 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -50409,6 +50409,8 @@ definitions: type: object fungibleMsgUpdateSystemContractResponse: type: object + fungibleMsgUpdateZRC20WithdrawFeeResponse: + type: object fungibleQueryAllForeignCoinsResponse: type: object properties: diff --git a/docs/spec/fungible/messages.md b/docs/spec/fungible/messages.md index a826ee951b..38fc61784b 100644 --- a/docs/spec/fungible/messages.md +++ b/docs/spec/fungible/messages.md @@ -52,7 +52,17 @@ message MsgRemoveForeignCoin { ```proto message MsgUpdateSystemContract { string creator = 1; - string newSystemContractAddress = 2; + string new_system_contract_address = 2; +} +``` + +## MsgUpdateZRC20WithdrawFee + +```proto +message MsgUpdateZRC20WithdrawFee { + string creator = 1; + string zrc20_address = 2; + string new_withdraw_fee = 6; } ``` diff --git a/proto/fungible/events.proto b/proto/fungible/events.proto index d823e1a42b..0c0ff5664b 100644 --- a/proto/fungible/events.proto +++ b/proto/fungible/events.proto @@ -23,4 +23,14 @@ message EventZRC20Deployed { common.CoinType coin_type = 7; string erc20 = 8; int64 gasLimit = 9; +} + +message EventZRC20WithdrawFeeUpdated { + string msg_type_url = 1; + int64 chain_id = 2; + common.CoinType coin_type = 3; + string zrc20_address = 4; + string old_withdraw_fee = 5; + string new_withdraw_fee = 6; + string signer = 7; } \ No newline at end of file diff --git a/proto/fungible/tx.proto b/proto/fungible/tx.proto index 8752a3019b..42a25b7e8b 100644 --- a/proto/fungible/tx.proto +++ b/proto/fungible/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package zetachain.zetacore.fungible; import "common/common.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/fungible/types"; @@ -10,11 +11,23 @@ service Msg { rpc DeployFungibleCoinZRC20(MsgDeployFungibleCoinZRC20) returns (MsgDeployFungibleCoinZRC20Response); rpc RemoveForeignCoin(MsgRemoveForeignCoin) returns (MsgRemoveForeignCoinResponse); rpc UpdateSystemContract(MsgUpdateSystemContract) returns (MsgUpdateSystemContractResponse); + rpc UpdateZRC20WithdrawFee(MsgUpdateZRC20WithdrawFee) returns (MsgUpdateZRC20WithdrawFeeResponse); } +message MsgUpdateZRC20WithdrawFee { + string creator = 1; + string zrc20_address = 2; // zrc20 address + string new_withdraw_fee = 6 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", + (gogoproto.nullable) = false + ]; +} + +message MsgUpdateZRC20WithdrawFeeResponse {} + message MsgUpdateSystemContract { string creator = 1; - string newSystemContractAddress = 2; + string new_system_contract_address = 2; } message MsgUpdateSystemContractResponse {} diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts.go index 0d51b62b7d..1c36e56a65 100644 --- a/x/fungible/keeper/begin_blocker_deploy_system_contracts.go +++ b/x/fungible/keeper/begin_blocker_deploy_system_contracts.go @@ -10,6 +10,9 @@ import ( func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error { return nil } -func (k Keeper) UpdateSystemContractAddress(goCtx context.Context) error { +func (k Keeper) TestUpdateSystemContractAddress(goCtx context.Context) error { + return nil +} +func (k Keeper) TestUpdateZRC20WithdrawFee(goCtx context.Context) error { return nil } diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go index 06902c3a0f..361ea09926 100644 --- a/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go +++ b/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go @@ -110,7 +110,7 @@ func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error { return nil } -func (k Keeper) UpdateSystemContractAddress(goCtx context.Context) error { +func (k Keeper) TestUpdateSystemContractAddress(goCtx context.Context) error { ctx := sdk.UnwrapSDKContext(goCtx) wzeta, err := k.GetWZetaContractAddress(ctx) @@ -135,3 +135,20 @@ func (k Keeper) UpdateSystemContractAddress(goCtx context.Context) error { _, err = k.UpdateSystemContract(ctx, msg) return err } + +func (k Keeper) TestUpdateZRC20WithdrawFee(goCtx context.Context) error { + ctx := sdk.UnwrapSDKContext(goCtx) + + foreignCoins := k.GetAllForeignCoins(ctx) + creator := k.zetaobserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_deploy_fungible_coin) + + for _, foreignCoin := range foreignCoins { + msg := types.NewMsgUpdateZRC20WithdrawFee(creator, foreignCoin.Zrc20ContractAddress, sdk.NewUint(uint64(foreignCoin.ForeignChainId))) + _, err := k.UpdateZRC20WithdrawFee(ctx, msg) + if err != nil { + return err + } + } + + return nil +} diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts_testnet.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts_testnet.go index 7ee8a152fd..7249103aed 100644 --- a/x/fungible/keeper/begin_blocker_deploy_system_contracts_testnet.go +++ b/x/fungible/keeper/begin_blocker_deploy_system_contracts_testnet.go @@ -97,6 +97,10 @@ func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error { return nil } -func (k Keeper) UpdateSystemContractAddress(goCtx context.Context) error { +func (k Keeper) TestUpdateSystemContractAddress(goCtx context.Context) error { + return nil +} + +func (k Keeper) TestUpdateZRC20WithdrawFee(goCtx context.Context) error { return nil } diff --git a/x/fungible/keeper/msg_server_update_system_contract.go b/x/fungible/keeper/msg_server_update_system_contract.go index 8ae6a7352d..a586819d2e 100644 --- a/x/fungible/keeper/msg_server_update_system_contract.go +++ b/x/fungible/keeper/msg_server_update_system_contract.go @@ -64,7 +64,6 @@ func (k Keeper) UpdateSystemContract(goCtx context.Context, msg *types.MsgUpdate oldSystemContractAddress := sys.SystemContract sys.SystemContract = newSystemContractAddr.Hex() k.SetSystemContract(ctx, sys) - commit() err = ctx.EventManager().EmitTypedEvent( &types.EventSystemContractUpdated{ MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateSystemContract{}), @@ -77,5 +76,6 @@ func (k Keeper) UpdateSystemContract(goCtx context.Context, msg *types.MsgUpdate k.Logger(ctx).Error("failed to emit event", "error", err.Error()) return nil, sdkerrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error()) } + commit() return &types.MsgUpdateSystemContractResponse{}, nil } diff --git a/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go new file mode 100644 index 0000000000..0d85cb917a --- /dev/null +++ b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go @@ -0,0 +1,84 @@ +package keeper + +import ( + "context" + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" + "github.com/zeta-chain/zetacore/x/fungible/types" + zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func (k Keeper) UpdateZRC20WithdrawFee(goCtx context.Context, msg *types.MsgUpdateZRC20WithdrawFee) (*types.MsgUpdateZRC20WithdrawFeeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + if msg.Creator != k.zetaobserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin) { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account") + } + zrc20Addr := ethcommon.HexToAddress(msg.Zrc20Address) + if zrc20Addr == (ethcommon.Address{}) { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", msg.Zrc20Address) + } + + // update contracts + zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi() + if err != nil { + return nil, sdkerrors.Wrapf(types.ErrABIGet, "failed to get zrc20 abi") + } + + foreignCoins := k.GetAllForeignCoins(ctx) + found := false + var coin types.ForeignCoins + for _, fcoin := range foreignCoins { + coinZRC20Addr := ethcommon.HexToAddress(fcoin.Zrc20ContractAddress) + if coinZRC20Addr == (ethcommon.Address{}) { + k.Logger(ctx).Error("invalid zrc20 contract address", "address", fcoin.Zrc20ContractAddress) + continue + } + if coinZRC20Addr == zrc20Addr { + coin = fcoin + found = true + break + } + } + + if !found { + return nil, sdkerrors.Wrapf(types.ErrInvalidAddress, "no foreign coin match requested zrc20 address (%s)", msg.Zrc20Address) + } + + res, err := k.CallEVM(ctx, *zrc20ABI, types.ModuleAddressEVM, zrc20Addr, BigIntZero, nil, false, "PROTOCOL_FLAT_FEE") + if err != nil { + return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract PROTOCOL_FLAT_FEE method (%s)", err.Error()) + } + unpacked, err := zrc20ABI.Unpack("PROTOCOL_FLAT_FEE", res.Ret) + if err != nil || len(unpacked) == 0 { + return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to unpack zrc20 contract PROTOCOL_FLAT_FEE method (%s)", err.Error()) + } + oldWithdrawFee, ok := unpacked[0].(*big.Int) + if !ok { + return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to interpret the returned unpacked zrc20 contract PROTOCOL_FLAT_FEE method; ret %x", res.Ret) + } + + tmpCtx, commit := ctx.CacheContext() + _, err = k.CallEVM(tmpCtx, *zrc20ABI, types.ModuleAddressEVM, zrc20Addr, BigIntZero, nil, true, "updateProtocolFlatFee", msg.NewWithdrawFee.BigInt()) + + err = ctx.EventManager().EmitTypedEvent( + &types.EventZRC20WithdrawFeeUpdated{ + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateZRC20WithdrawFee{}), + ChainId: coin.ForeignChainId, + CoinType: coin.CoinType, + Zrc20Address: zrc20Addr.Hex(), + OldWithdrawFee: oldWithdrawFee.String(), + NewWithdrawFee: msg.NewWithdrawFee.BigInt().String(), + Signer: msg.Creator, + }, + ) + if err != nil { + k.Logger(ctx).Error("failed to emit event", "error", err.Error()) + return nil, sdkerrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error()) + } + commit() + return &types.MsgUpdateZRC20WithdrawFeeResponse{}, nil +} diff --git a/x/fungible/module.go b/x/fungible/module.go index 7c388293ca..2a4e2334dd 100644 --- a/x/fungible/module.go +++ b/x/fungible/module.go @@ -179,14 +179,23 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { ctx.Logger().Error("Unable To deploy contracts", "err", err.Error()) } } + if ctx.BlockHeight() == 20 { - err := am.keeper.UpdateSystemContractAddress(sdk.WrapSDKContext(ctx)) + err := am.keeper.TestUpdateSystemContractAddress(sdk.WrapSDKContext(ctx)) if err != nil { ctx.Logger().Error("Unable To update system contracts", "err", err.Error()) } else { ctx.Logger().Info("System contract updated") } } + if ctx.BlockHeight() == 25 { + err := am.keeper.TestUpdateZRC20WithdrawFee(sdk.WrapSDKContext(ctx)) + if err != nil { + ctx.Logger().Error("Unable To update zrc20 withdraw fee", "err", err.Error()) + } else { + ctx.Logger().Info("zrc20 withdraw fee updated") + } + } } // EndBlock executes all ABCI EndBlock logic respective to the fungible module. It diff --git a/x/fungible/types/events.pb.go b/x/fungible/types/events.pb.go index 30ef20b4ac..0f4e8d2ad7 100644 --- a/x/fungible/types/events.pb.go +++ b/x/fungible/types/events.pb.go @@ -201,41 +201,139 @@ func (m *EventZRC20Deployed) GetGasLimit() int64 { return 0 } +type EventZRC20WithdrawFeeUpdated struct { + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + CoinType common.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` + Zrc20Address string `protobuf:"bytes,4,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"` + OldWithdrawFee string `protobuf:"bytes,5,opt,name=old_withdraw_fee,json=oldWithdrawFee,proto3" json:"old_withdraw_fee,omitempty"` + NewWithdrawFee string `protobuf:"bytes,6,opt,name=new_withdraw_fee,json=newWithdrawFee,proto3" json:"new_withdraw_fee,omitempty"` + Signer string `protobuf:"bytes,7,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *EventZRC20WithdrawFeeUpdated) Reset() { *m = EventZRC20WithdrawFeeUpdated{} } +func (m *EventZRC20WithdrawFeeUpdated) String() string { return proto.CompactTextString(m) } +func (*EventZRC20WithdrawFeeUpdated) ProtoMessage() {} +func (*EventZRC20WithdrawFeeUpdated) Descriptor() ([]byte, []int) { + return fileDescriptor_858e6494730deffd, []int{2} +} +func (m *EventZRC20WithdrawFeeUpdated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventZRC20WithdrawFeeUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventZRC20WithdrawFeeUpdated.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventZRC20WithdrawFeeUpdated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventZRC20WithdrawFeeUpdated.Merge(m, src) +} +func (m *EventZRC20WithdrawFeeUpdated) XXX_Size() int { + return m.Size() +} +func (m *EventZRC20WithdrawFeeUpdated) XXX_DiscardUnknown() { + xxx_messageInfo_EventZRC20WithdrawFeeUpdated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventZRC20WithdrawFeeUpdated proto.InternalMessageInfo + +func (m *EventZRC20WithdrawFeeUpdated) GetMsgTypeUrl() string { + if m != nil { + return m.MsgTypeUrl + } + return "" +} + +func (m *EventZRC20WithdrawFeeUpdated) GetChainId() int64 { + if m != nil { + return m.ChainId + } + return 0 +} + +func (m *EventZRC20WithdrawFeeUpdated) GetCoinType() common.CoinType { + if m != nil { + return m.CoinType + } + return common.CoinType_Zeta +} + +func (m *EventZRC20WithdrawFeeUpdated) GetZrc20Address() string { + if m != nil { + return m.Zrc20Address + } + return "" +} + +func (m *EventZRC20WithdrawFeeUpdated) GetOldWithdrawFee() string { + if m != nil { + return m.OldWithdrawFee + } + return "" +} + +func (m *EventZRC20WithdrawFeeUpdated) GetNewWithdrawFee() string { + if m != nil { + return m.NewWithdrawFee + } + return "" +} + +func (m *EventZRC20WithdrawFeeUpdated) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + func init() { proto.RegisterType((*EventSystemContractUpdated)(nil), "zetachain.zetacore.fungible.EventSystemContractUpdated") proto.RegisterType((*EventZRC20Deployed)(nil), "zetachain.zetacore.fungible.EventZRC20Deployed") + proto.RegisterType((*EventZRC20WithdrawFeeUpdated)(nil), "zetachain.zetacore.fungible.EventZRC20WithdrawFeeUpdated") } func init() { proto.RegisterFile("fungible/events.proto", fileDescriptor_858e6494730deffd) } var fileDescriptor_858e6494730deffd = []byte{ - // 401 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcd, 0x8e, 0xd3, 0x30, - 0x14, 0x85, 0xeb, 0xf9, 0x29, 0x53, 0x0b, 0x21, 0x64, 0x0a, 0xb2, 0x8a, 0x14, 0x55, 0xb3, 0xea, - 0x66, 0xea, 0xaa, 0x3c, 0x01, 0x14, 0x16, 0x48, 0xac, 0x0a, 0xb3, 0x99, 0x4d, 0xe4, 0x24, 0x17, - 0x8f, 0x25, 0xff, 0x44, 0xb6, 0xcb, 0x10, 0x9e, 0x02, 0x5e, 0x87, 0x27, 0x60, 0x39, 0x4b, 0x96, - 0xa8, 0x7d, 0x11, 0x64, 0x3b, 0xe9, 0x02, 0x36, 0xb3, 0xca, 0x39, 0xc9, 0x3d, 0xf7, 0x7e, 0xb1, - 0x2f, 0x7e, 0xfe, 0x79, 0x67, 0x84, 0xac, 0x14, 0x30, 0xf8, 0x02, 0x26, 0xf8, 0x65, 0xeb, 0x6c, - 0xb0, 0xe4, 0xe5, 0x37, 0x08, 0xbc, 0xbe, 0xe5, 0xd2, 0x2c, 0x93, 0xb2, 0x0e, 0x96, 0x43, 0xe5, - 0xec, 0x59, 0x6d, 0xb5, 0xb6, 0x86, 0xe5, 0x47, 0x4e, 0xcc, 0xa6, 0xc2,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 0xb2, 0xbf, 0xa7, 0x8d, 0x95, 0x26, 0x12, 0xc6, 0xb1, 0x59, 0x45, 0x50, 0x70, 0xf5, 0x7a, 0x45, - 0x2f, 0x32, 0x68, 0x32, 0x71, 0x80, 0xe0, 0xfe, 0x83, 0xd4, 0x32, 0xd0, 0x49, 0x1e, 0x30, 0xf8, - 0x37, 0xef, 0x7f, 0xed, 0x0b, 0x74, 0xbf, 0x2f, 0xd0, 0x9f, 0x7d, 0x81, 0xbe, 0x1f, 0x8a, 0xd1, - 0xfd, 0xa1, 0x18, 0xfd, 0x3e, 0x14, 0xa3, 0x1b, 0x26, 0x64, 0xb8, 0xdd, 0x55, 0x71, 0x1a, 0x8b, - 0x3b, 0x73, 0x95, 0xfe, 0x9a, 0x0d, 0xeb, 0xc3, 0xbe, 0xb2, 0xe3, 0xaa, 0x45, 0x3a, 0x5f, 0x8d, - 0xd3, 0x8a, 0xbc, 0xfa, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x76, 0x5f, 0x9d, 0x91, 0x83, 0x02, 0x00, - 0x00, + // 496 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4d, 0x6e, 0xd3, 0x40, + 0x14, 0xc7, 0xe3, 0xa4, 0xcd, 0xc7, 0xa8, 0x54, 0x95, 0x09, 0xc8, 0x04, 0x64, 0x45, 0x61, 0x93, + 0x4d, 0xe3, 0x28, 0x9c, 0x00, 0x02, 0x48, 0x95, 0x58, 0x05, 0x2a, 0xa4, 0x6e, 0x2c, 0xc7, 0xf3, + 0xea, 0x8c, 0xe4, 0x99, 0xb1, 0x66, 0x26, 0x18, 0xf7, 0x14, 0xb0, 0xe6, 0x26, 0x9c, 0x80, 0x65, + 0x97, 0x2c, 0x51, 0x72, 0x11, 0x34, 0x1f, 0x4e, 0x53, 0x58, 0x34, 0x2b, 0xbf, 0xff, 0xf8, 0xbd, + 0x99, 0xdf, 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0x1b, 0xb7, 0xdb, 0xb0, + 0xf1, 0x7b, 0x1b, 0x36, 0xae, 0xa2, 0x8c, 0xa8, 0xd5, 0x7a, 0xa9, 0x93, 0x89, 0xf4, 0x46, 0x9d, + 0x9b, 0x94, 0xa3, 0x7a, 0xb9, 0xa2, 0xaf, 0xd1, 0x6e, 0x11, 0x75, 0xf2, 0x72, 0xd9, 0x36, 0x0b, + 0xf4, 0xea, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4a, 0x2c, 0x4b, 0xbc, 0xa1, 0x03, 0x00, 0x00, } func (m *EventSystemContractUpdated) Marshal() (dAtA []byte, err error) { @@ -369,6 +467,74 @@ func (m *EventZRC20Deployed) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventZRC20WithdrawFeeUpdated) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventZRC20WithdrawFeeUpdated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventZRC20WithdrawFeeUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x3a + } + if len(m.NewWithdrawFee) > 0 { + i -= len(m.NewWithdrawFee) + copy(dAtA[i:], m.NewWithdrawFee) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewWithdrawFee))) + i-- + dAtA[i] = 0x32 + } + if len(m.OldWithdrawFee) > 0 { + i -= len(m.OldWithdrawFee) + copy(dAtA[i:], m.OldWithdrawFee) + i = encodeVarintEvents(dAtA, i, uint64(len(m.OldWithdrawFee))) + i-- + dAtA[i] = 0x2a + } + if len(m.Zrc20Address) > 0 { + i -= len(m.Zrc20Address) + copy(dAtA[i:], m.Zrc20Address) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Zrc20Address))) + i-- + dAtA[i] = 0x22 + } + if m.CoinType != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.CoinType)) + i-- + dAtA[i] = 0x18 + } + if m.ChainId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x10 + } + if len(m.MsgTypeUrl) > 0 { + i -= len(m.MsgTypeUrl) + copy(dAtA[i:], m.MsgTypeUrl) + i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -447,6 +613,41 @@ func (m *EventZRC20Deployed) Size() (n int) { return n } +func (m *EventZRC20WithdrawFeeUpdated) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MsgTypeUrl) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.ChainId != 0 { + n += 1 + sovEvents(uint64(m.ChainId)) + } + if m.CoinType != 0 { + n += 1 + sovEvents(uint64(m.CoinType)) + } + l = len(m.Zrc20Address) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.OldWithdrawFee) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.NewWithdrawFee) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -930,6 +1131,254 @@ func (m *EventZRC20Deployed) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventZRC20WithdrawFeeUpdated) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventZRC20WithdrawFeeUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventZRC20WithdrawFeeUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MsgTypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType) + } + m.CoinType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CoinType |= common.CoinType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Zrc20Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OldWithdrawFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OldWithdrawFee = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewWithdrawFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewWithdrawFee = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/fungible/types/message_update_zrc20_withdraw_fee.go b/x/fungible/types/message_update_zrc20_withdraw_fee.go new file mode 100644 index 0000000000..f661003a18 --- /dev/null +++ b/x/fungible/types/message_update_zrc20_withdraw_fee.go @@ -0,0 +1,53 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ethcommon "github.com/ethereum/go-ethereum/common" +) + +const TypeMsgUpdateZRC20WithdrawFee = "update_zrc20_withdraw_fee" + +var _ sdk.Msg = &MsgUpdateZRC20WithdrawFee{} + +func NewMsgUpdateZRC20WithdrawFee(creator string, zrc20 string, newFee sdk.Uint) *MsgUpdateZRC20WithdrawFee { + return &MsgUpdateZRC20WithdrawFee{ + Creator: creator, + Zrc20Address: zrc20, + NewWithdrawFee: newFee, + } +} + +func (msg *MsgUpdateZRC20WithdrawFee) Route() string { + return RouterKey +} + +func (msg *MsgUpdateZRC20WithdrawFee) Type() string { + return TypeMsgUpdateSystemContract +} + +func (msg *MsgUpdateZRC20WithdrawFee) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateZRC20WithdrawFee) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateZRC20WithdrawFee) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + // check if the system contract address is valid + if ethcommon.HexToAddress(msg.Zrc20Address) == (ethcommon.Address{}) { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.Zrc20Address) + } + + return nil +} diff --git a/x/fungible/types/tx.pb.go b/x/fungible/types/tx.pb.go index 16669e7968..e439aa1548 100644 --- a/x/fungible/types/tx.pb.go +++ b/x/fungible/types/tx.pb.go @@ -10,6 +10,8 @@ import ( math "math" math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" common "github.com/zeta-chain/zetacore/common" @@ -29,16 +31,105 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type MsgUpdateZRC20WithdrawFee struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Zrc20Address string `protobuf:"bytes,2,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"` + NewWithdrawFee github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,6,opt,name=new_withdraw_fee,json=newWithdrawFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"new_withdraw_fee"` +} + +func (m *MsgUpdateZRC20WithdrawFee) Reset() { *m = MsgUpdateZRC20WithdrawFee{} } +func (m *MsgUpdateZRC20WithdrawFee) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateZRC20WithdrawFee) ProtoMessage() {} +func (*MsgUpdateZRC20WithdrawFee) Descriptor() ([]byte, []int) { + return fileDescriptor_197fdedece277fa0, []int{0} +} +func (m *MsgUpdateZRC20WithdrawFee) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateZRC20WithdrawFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateZRC20WithdrawFee.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateZRC20WithdrawFee) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateZRC20WithdrawFee.Merge(m, src) +} +func (m *MsgUpdateZRC20WithdrawFee) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateZRC20WithdrawFee) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateZRC20WithdrawFee.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateZRC20WithdrawFee proto.InternalMessageInfo + +func (m *MsgUpdateZRC20WithdrawFee) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateZRC20WithdrawFee) GetZrc20Address() string { + if m != nil { + return m.Zrc20Address + } + return "" +} + +type MsgUpdateZRC20WithdrawFeeResponse struct { +} + +func (m *MsgUpdateZRC20WithdrawFeeResponse) Reset() { *m = MsgUpdateZRC20WithdrawFeeResponse{} } +func (m *MsgUpdateZRC20WithdrawFeeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateZRC20WithdrawFeeResponse) ProtoMessage() {} +func (*MsgUpdateZRC20WithdrawFeeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_197fdedece277fa0, []int{1} +} +func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateZRC20WithdrawFeeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateZRC20WithdrawFeeResponse.Merge(m, src) +} +func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateZRC20WithdrawFeeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateZRC20WithdrawFeeResponse proto.InternalMessageInfo + type MsgUpdateSystemContract struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - NewSystemContractAddress string `protobuf:"bytes,2,opt,name=newSystemContractAddress,proto3" json:"newSystemContractAddress,omitempty"` + NewSystemContractAddress string `protobuf:"bytes,2,opt,name=new_system_contract_address,json=newSystemContractAddress,proto3" json:"new_system_contract_address,omitempty"` } func (m *MsgUpdateSystemContract) Reset() { *m = MsgUpdateSystemContract{} } func (m *MsgUpdateSystemContract) String() string { return proto.CompactTextString(m) } func (*MsgUpdateSystemContract) ProtoMessage() {} func (*MsgUpdateSystemContract) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{0} + return fileDescriptor_197fdedece277fa0, []int{2} } func (m *MsgUpdateSystemContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -88,7 +179,7 @@ func (m *MsgUpdateSystemContractResponse) Reset() { *m = MsgUpdateSystem func (m *MsgUpdateSystemContractResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateSystemContractResponse) ProtoMessage() {} func (*MsgUpdateSystemContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{1} + return fileDescriptor_197fdedece277fa0, []int{3} } func (m *MsgUpdateSystemContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -132,7 +223,7 @@ func (m *MsgDeployFungibleCoinZRC20) Reset() { *m = MsgDeployFungibleCoi func (m *MsgDeployFungibleCoinZRC20) String() string { return proto.CompactTextString(m) } func (*MsgDeployFungibleCoinZRC20) ProtoMessage() {} func (*MsgDeployFungibleCoinZRC20) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{2} + return fileDescriptor_197fdedece277fa0, []int{4} } func (m *MsgDeployFungibleCoinZRC20) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -224,7 +315,7 @@ func (m *MsgDeployFungibleCoinZRC20Response) Reset() { *m = MsgDeployFun func (m *MsgDeployFungibleCoinZRC20Response) String() string { return proto.CompactTextString(m) } func (*MsgDeployFungibleCoinZRC20Response) ProtoMessage() {} func (*MsgDeployFungibleCoinZRC20Response) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{3} + return fileDescriptor_197fdedece277fa0, []int{5} } func (m *MsgDeployFungibleCoinZRC20Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -262,7 +353,7 @@ func (m *MsgRemoveForeignCoin) Reset() { *m = MsgRemoveForeignCoin{} } func (m *MsgRemoveForeignCoin) String() string { return proto.CompactTextString(m) } func (*MsgRemoveForeignCoin) ProtoMessage() {} func (*MsgRemoveForeignCoin) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{4} + return fileDescriptor_197fdedece277fa0, []int{6} } func (m *MsgRemoveForeignCoin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -312,7 +403,7 @@ func (m *MsgRemoveForeignCoinResponse) Reset() { *m = MsgRemoveForeignCo func (m *MsgRemoveForeignCoinResponse) String() string { return proto.CompactTextString(m) } func (*MsgRemoveForeignCoinResponse) ProtoMessage() {} func (*MsgRemoveForeignCoinResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{5} + return fileDescriptor_197fdedece277fa0, []int{7} } func (m *MsgRemoveForeignCoinResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -342,6 +433,8 @@ func (m *MsgRemoveForeignCoinResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveForeignCoinResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*MsgUpdateZRC20WithdrawFee)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFee") + proto.RegisterType((*MsgUpdateZRC20WithdrawFeeResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFeeResponse") proto.RegisterType((*MsgUpdateSystemContract)(nil), "zetachain.zetacore.fungible.MsgUpdateSystemContract") proto.RegisterType((*MsgUpdateSystemContractResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateSystemContractResponse") proto.RegisterType((*MsgDeployFungibleCoinZRC20)(nil), "zetachain.zetacore.fungible.MsgDeployFungibleCoinZRC20") @@ -353,37 +446,46 @@ func init() { func init() { proto.RegisterFile("fungible/tx.proto", fileDescriptor_197fdedece277fa0) } var fileDescriptor_197fdedece277fa0 = []byte{ - // 479 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xcd, 0x26, 0x6d, 0x1a, 0x46, 0x80, 0xe8, 0x12, 0xd1, 0x95, 0x41, 0x26, 0x58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 0x1a, 0x7e, 0x10, 0xe8, 0x2f, 0xbd, 0x44, - 0x4f, 0x2f, 0xea, 0xb9, 0x0c, 0x65, 0xbc, 0x5c, 0x07, 0x55, 0x89, 0x79, 0xf3, 0xee, 0xcf, 0xcc, - 0x24, 0x27, 0x33, 0x93, 0xfc, 0x9b, 0x99, 0xe4, 0xe7, 0xdc, 0x6c, 0x9d, 0xcc, 0xcd, 0xd6, 0xdf, - 0xb9, 0xd9, 0xda, 0x77, 0x42, 0xae, 0x0f, 0x8f, 0x26, 0xf9, 0x91, 0x74, 0xf2, 0xbe, 0x0f, 0x0b, - 0x0a, 0xa7, 0xa2, 0x70, 0x8e, 0x9d, 0xd3, 0x37, 0x25, 0x4b, 0x50, 0x4d, 0xba, 0xc5, 0x2b, 0xf1, - 0xe4, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x92, 0x4c, 0x3f, 0x6c, 0x04, 0x00, 0x00, + // 613 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x4f, 0x13, 0x51, + 0x10, 0xef, 0xe3, 0xdb, 0x09, 0x10, 0x78, 0x36, 0xb0, 0x2e, 0x66, 0x29, 0x8b, 0x89, 0x3d, 0xc8, + 0x2e, 0x56, 0xa3, 0x31, 0xf1, 0x23, 0x52, 0x24, 0x31, 0xb1, 0x97, 0x55, 0x62, 0xe4, 0xd2, 0x6c, + 0xb7, 0xc3, 0xf2, 0x62, 0xf7, 0xbd, 0x66, 0xdf, 0xc3, 0x52, 0x6e, 0x7a, 0xf4, 0x44, 0xe2, 0xdf, + 0xe2, 0xd9, 0x2b, 0x47, 0x8e, 0xc6, 0x03, 0x31, 0xf0, 0x8f, 0x98, 0xfd, 0x04, 0x81, 0x16, 0xed, + 0x69, 0x67, 0x66, 0xe7, 0x37, 0xf3, 0xfb, 0xcd, 0xec, 0x0e, 0xcc, 0x6e, 0x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, 0x32, 0x35, 0x43, 0x67, 0x6a, + 0x4c, 0x03, 0x6e, 0x5f, 0x55, 0x25, 0xeb, 0x52, 0xf9, 0x31, 0x02, 0xc3, 0x35, 0xe9, 0xd3, 0x6f, + 0x04, 0xe6, 0x7b, 0x6d, 0xe5, 0xb1, 0xd5, 0xe7, 0x8f, 0xb3, 0x7a, 0x4b, 0xd1, 0x5f, 0x0c, 0x08, + 0xcc, 0xd8, 0xd1, 0xcf, 0x04, 0x66, 0x2f, 0x4f, 0xe0, 0xfe, 0x75, 0x65, 0x2f, 0x41, 0xf4, 0x27, + 0xff, 0x0d, 0xc9, 0x39, 0x7c, 0x25, 0x50, 0xbc, 0xf2, 0x3f, 0x7a, 0x78, 0x5d, 0xcd, 0xab, 0x50, + 0xfa, 0xd3, 0x41, 0x50, 0x39, 0x99, 0x03, 0x02, 0x73, 0x3d, 0x0e, 0xd6, 0xa3, 0x7f, 0x2b, 0x7c, + 0x11, 0xa7, 0x3f, 0x1f, 0x0c, 0x97, 0x51, 0x5a, 0x7b, 0x7d, 0x78, 0x62, 0x90, 0xa3, 0x13, 0x83, + 0xfc, 0x3e, 0x31, 0xc8, 0xc1, 0xa9, 0x51, 0x38, 0x3a, 0x35, 0x0a, 0x3f, 0x4f, 0x8d, 0xc2, 0x96, + 0x7d, 0xee, 0xc2, 0x45, 0x95, 0x57, 0xe2, 0x26, 0x76, 0xd6, 0xc4, 0xde, 0xb3, 0xcf, 0x8e, 0x7b, + 0x74, 0xee, 0x1a, 0x63, 0xf1, 0x61, 0x7e, 0xf0, 0x27, 0x00, 0x00, 0xff, 0xff, 0x31, 0x41, 0xaf, + 0x74, 0xf5, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -401,6 +503,7 @@ type MsgClient interface { DeployFungibleCoinZRC20(ctx context.Context, in *MsgDeployFungibleCoinZRC20, opts ...grpc.CallOption) (*MsgDeployFungibleCoinZRC20Response, error) RemoveForeignCoin(ctx context.Context, in *MsgRemoveForeignCoin, opts ...grpc.CallOption) (*MsgRemoveForeignCoinResponse, error) UpdateSystemContract(ctx context.Context, in *MsgUpdateSystemContract, opts ...grpc.CallOption) (*MsgUpdateSystemContractResponse, error) + UpdateZRC20WithdrawFee(ctx context.Context, in *MsgUpdateZRC20WithdrawFee, opts ...grpc.CallOption) (*MsgUpdateZRC20WithdrawFeeResponse, error) } type msgClient struct { @@ -438,11 +541,21 @@ func (c *msgClient) UpdateSystemContract(ctx context.Context, in *MsgUpdateSyste return out, nil } +func (c *msgClient) UpdateZRC20WithdrawFee(ctx context.Context, in *MsgUpdateZRC20WithdrawFee, opts ...grpc.CallOption) (*MsgUpdateZRC20WithdrawFeeResponse, error) { + out := new(MsgUpdateZRC20WithdrawFeeResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/UpdateZRC20WithdrawFee", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { DeployFungibleCoinZRC20(context.Context, *MsgDeployFungibleCoinZRC20) (*MsgDeployFungibleCoinZRC20Response, error) RemoveForeignCoin(context.Context, *MsgRemoveForeignCoin) (*MsgRemoveForeignCoinResponse, error) UpdateSystemContract(context.Context, *MsgUpdateSystemContract) (*MsgUpdateSystemContractResponse, error) + UpdateZRC20WithdrawFee(context.Context, *MsgUpdateZRC20WithdrawFee) (*MsgUpdateZRC20WithdrawFeeResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -458,6 +571,9 @@ func (*UnimplementedMsgServer) RemoveForeignCoin(ctx context.Context, req *MsgRe func (*UnimplementedMsgServer) UpdateSystemContract(ctx context.Context, req *MsgUpdateSystemContract) (*MsgUpdateSystemContractResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateSystemContract not implemented") } +func (*UnimplementedMsgServer) UpdateZRC20WithdrawFee(ctx context.Context, req *MsgUpdateZRC20WithdrawFee) (*MsgUpdateZRC20WithdrawFeeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateZRC20WithdrawFee not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -517,6 +633,24 @@ func _Msg_UpdateSystemContract_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Msg_UpdateZRC20WithdrawFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateZRC20WithdrawFee) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateZRC20WithdrawFee(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.fungible.Msg/UpdateZRC20WithdrawFee", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateZRC20WithdrawFee(ctx, req.(*MsgUpdateZRC20WithdrawFee)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.fungible.Msg", HandlerType: (*MsgServer)(nil), @@ -533,11 +667,85 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateSystemContract", Handler: _Msg_UpdateSystemContract_Handler, }, + { + MethodName: "UpdateZRC20WithdrawFee", + Handler: _Msg_UpdateZRC20WithdrawFee_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "fungible/tx.proto", } +func (m *MsgUpdateZRC20WithdrawFee) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateZRC20WithdrawFee) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateZRC20WithdrawFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.NewWithdrawFee.Size() + i -= size + if _, err := m.NewWithdrawFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if len(m.Zrc20Address) > 0 { + i -= len(m.Zrc20Address) + copy(dAtA[i:], m.Zrc20Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Zrc20Address))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateZRC20WithdrawFeeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateZRC20WithdrawFeeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateZRC20WithdrawFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgUpdateSystemContract) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -765,6 +973,34 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *MsgUpdateZRC20WithdrawFee) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Zrc20Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.NewWithdrawFee.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateZRC20WithdrawFeeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgUpdateSystemContract) Size() (n int) { if m == nil { return 0 @@ -870,6 +1106,204 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *MsgUpdateZRC20WithdrawFee) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFee: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFee: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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 + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", 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 + } + m.Zrc20Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewWithdrawFee", 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.NewWithdrawFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateZRC20WithdrawFeeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFeeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFeeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgUpdateSystemContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0