diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index 0a9d8e6..37d5886 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -17,6 +17,10 @@ - [Query](#babylonlabs.babylon.v1beta1.Query) - [babylonlabs/babylon/v1beta1/tx.proto](#babylonlabs/babylon/v1beta1/tx.proto) + - [MsgInstantiateBabylonContracts](#babylonlabs.babylon.v1beta1.MsgInstantiateBabylonContracts) + - [MsgInstantiateBabylonContractsResponse](#babylonlabs.babylon.v1beta1.MsgInstantiateBabylonContractsResponse) + - [MsgStoreBabylonContractCodes](#babylonlabs.babylon.v1beta1.MsgStoreBabylonContractCodes) + - [MsgStoreBabylonContractCodesResponse](#babylonlabs.babylon.v1beta1.MsgStoreBabylonContractCodesResponse) - [MsgUpdateParams](#babylonlabs.babylon.v1beta1.MsgUpdateParams) - [MsgUpdateParamsResponse](#babylonlabs.babylon.v1beta1.MsgUpdateParamsResponse) @@ -41,6 +45,9 @@ Params defines the parameters for the x/babylon module. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | +| `babylon_contract_code_id` | [uint64](#uint64) | | babylon_contract_code_id is the code ID of the Babylon contract | +| `btc_staking_contract_code_id` | [uint64](#uint64) | | btc_staking_contract_code_id is the code ID of the BTC staking contract | +| `btc_finality_contract_code_id` | [uint64](#uint64) | | btc_finality_contract_code_id is the code ID of the BTC finality contract | | `babylon_contract_address` | [string](#string) | | babylon_contract_address is the address of the Babylon contract | | `btc_staking_contract_address` | [string](#string) | | btc_staking_contract_address is the address of the BTC staking contract | | `btc_finality_contract_address` | [string](#string) | | btc_finality_contract_address is the address of the BTC finality contract | @@ -151,6 +158,64 @@ Query provides defines the gRPC querier service + + +### MsgInstantiateBabylonContracts +MsgInstantiateBabylonContracts is the Msg/InstantiateBabylonContracts request +type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `signer` | [string](#string) | | signer is the address who submits the message. | +| `init_msg` | [bytes](#bytes) | | init_msg is the instantiation message for the Babylon contract. | + + + + + + + + +### MsgInstantiateBabylonContractsResponse +MsgInstantiateBabylonContractsResponse is the Msg/InstantiateBabylonContracts +response type. + + + + + + + + +### MsgStoreBabylonContractCodes +MsgStoreBabylonContractCodes is the Msg/StoreBabylonContractCodes request +type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `signer` | [string](#string) | | signer is the address who submits the message. | +| `babylon_contract_code` | [bytes](#bytes) | | babylon_contract_code is the bytecode for the Babylon contract. WASMByteCode can be raw or gzip compressed | +| `btc_staking_contract_code` | [bytes](#bytes) | | btc_staking_contract_code is the bytecode for the BTC staking contract. WASMByteCode can be raw or gzip compressed | +| `btc_finality_contract_code` | [bytes](#bytes) | | btc_finality_contract_code is the bytecode for the BTC finality contract. WASMByteCode can be raw or gzip compressed | + + + + + + + + +### MsgStoreBabylonContractCodesResponse +MsgStoreBabylonContractCodesResponse is the Msg/StoreBabylonContractCodes +response type. + + + + + + ### MsgUpdateParams @@ -193,6 +258,8 @@ Msg defines the wasm Msg service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `StoreBabylonContractCodes` | [MsgStoreBabylonContractCodes](#babylonlabs.babylon.v1beta1.MsgStoreBabylonContractCodes) | [MsgStoreBabylonContractCodesResponse](#babylonlabs.babylon.v1beta1.MsgStoreBabylonContractCodesResponse) | StoreBabylonContractCodes defines an operation for storing the Babylon contract codes. | | +| `InstantiateBabylonContracts` | [MsgInstantiateBabylonContracts](#babylonlabs.babylon.v1beta1.MsgInstantiateBabylonContracts) | [MsgInstantiateBabylonContractsResponse](#babylonlabs.babylon.v1beta1.MsgInstantiateBabylonContractsResponse) | InstantiateBabylonContracts defines an operation for instantiating the Babylon contracts. | | | `UpdateParams` | [MsgUpdateParams](#babylonlabs.babylon.v1beta1.MsgUpdateParams) | [MsgUpdateParamsResponse](#babylonlabs.babylon.v1beta1.MsgUpdateParamsResponse) | UpdateParams defines a (governance) operation for updating the x/auth module parameters. The authority defaults to the x/gov module account. | | diff --git a/proto/babylonlabs/babylon/v1beta1/babylon.proto b/proto/babylonlabs/babylon/v1beta1/babylon.proto index 37cdeb3..640bf2e 100644 --- a/proto/babylonlabs/babylon/v1beta1/babylon.proto +++ b/proto/babylonlabs/babylon/v1beta1/babylon.proto @@ -12,16 +12,22 @@ option (gogoproto.equal_all) = false; message Params { option (gogoproto.equal) = true; + // babylon_contract_code_id is the code ID of the Babylon contract + uint64 babylon_contract_code_id = 1; + // btc_staking_contract_code_id is the code ID of the BTC staking contract + uint64 btc_staking_contract_code_id = 2; + // btc_finality_contract_code_id is the code ID of the BTC finality contract + uint64 btc_finality_contract_code_id = 3; // babylon_contract_address is the address of the Babylon contract - string babylon_contract_address = 1 + string babylon_contract_address = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // btc_staking_contract_address is the address of the BTC staking contract - string btc_staking_contract_address = 2 + string btc_staking_contract_address = 5 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // btc_finality_contract_address is the address of the BTC finality contract - string btc_finality_contract_address = 3 - [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + string btc_finality_contract_address = 6 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // max_gas_begin_blocker defines the maximum gas that can be spent in a // contract sudo callback - uint32 max_gas_begin_blocker = 4; + uint32 max_gas_begin_blocker = 7; } diff --git a/proto/babylonlabs/babylon/v1beta1/tx.proto b/proto/babylonlabs/babylon/v1beta1/tx.proto index 7d6a7da..77fe22f 100644 --- a/proto/babylonlabs/babylon/v1beta1/tx.proto +++ b/proto/babylonlabs/babylon/v1beta1/tx.proto @@ -13,11 +13,58 @@ option (gogoproto.goproto_getters_all) = false; service Msg { option (cosmos.msg.v1.service) = true; + // StoreBabylonContractCodes defines an operation for storing the Babylon + // contract codes. + rpc StoreBabylonContractCodes(MsgStoreBabylonContractCodes) + returns (MsgStoreBabylonContractCodesResponse); + + // InstantiateBabylonContracts defines an operation for instantiating the + // Babylon contracts. + rpc InstantiateBabylonContracts(MsgInstantiateBabylonContracts) + returns (MsgInstantiateBabylonContractsResponse); + // UpdateParams defines a (governance) operation for updating the x/auth // module parameters. The authority defaults to the x/gov module account. rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } +// MsgStoreBabylonContractCodes is the Msg/StoreBabylonContractCodes request +// type. +message MsgStoreBabylonContractCodes { + option (cosmos.msg.v1.signer) = "signer"; + + // signer is the address who submits the message. + string signer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // babylon_contract_code is the bytecode for the Babylon contract. + // WASMByteCode can be raw or gzip compressed + bytes babylon_contract_code = 2; + // btc_staking_contract_code is the bytecode for the BTC staking contract. + // WASMByteCode can be raw or gzip compressed + bytes btc_staking_contract_code = 3; + // btc_finality_contract_code is the bytecode for the BTC finality contract. + // WASMByteCode can be raw or gzip compressed + bytes btc_finality_contract_code = 4; +} + +// MsgStoreBabylonContractCodesResponse is the Msg/StoreBabylonContractCodes +// response type. +message MsgStoreBabylonContractCodesResponse {} + +// MsgInstantiateBabylonContracts is the Msg/InstantiateBabylonContracts request +// type. +message MsgInstantiateBabylonContracts { + option (cosmos.msg.v1.signer) = "signer"; + + // signer is the address who submits the message. + string signer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // init_msg is the instantiation message for the Babylon contract. + bytes init_msg = 2; +} + +// MsgInstantiateBabylonContractsResponse is the Msg/InstantiateBabylonContracts +// response type. +message MsgInstantiateBabylonContractsResponse {} + // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; diff --git a/x/babylon/keeper/msg_server.go b/x/babylon/keeper/msg_server.go index 7e34f5f..c7e280a 100644 --- a/x/babylon/keeper/msg_server.go +++ b/x/babylon/keeper/msg_server.go @@ -20,6 +20,60 @@ func NewMsgServer(k *Keeper) *msgServer { return &msgServer{k: k} } +func (ms msgServer) StoreBabylonContractCodes(goCtx context.Context, req *types.MsgStoreBabylonContractCodes) (*types.MsgStoreBabylonContractCodesResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + params := ms.k.GetParams(ctx) + + // only the authority can override the contract codes + if params.IsCodeStored() && req.Signer != ms.k.authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "only authority can override stored codes; expected %s, got %s", ms.k.authority, req.Signer) + } + + // store the contract codes + babylonContractCodeID, btcStakingContractCodeID, btcFinalityContractCodeID, err := ms.k.StoreBabylonContractCodes(ctx, req.BabylonContractCode, req.BtcStakingContractCode, req.BtcFinalityContractCode) + if err != nil { + return nil, err + } + + // update params + params.BabylonContractCodeId = babylonContractCodeID + params.BtcStakingContractCodeId = btcStakingContractCodeID + params.BtcFinalityContractCodeId = btcFinalityContractCodeID + if err := ms.k.SetParams(ctx, params); err != nil { + panic(err) + } + + return &types.MsgStoreBabylonContractCodesResponse{}, nil +} + +func (ms msgServer) InstantiateBabylonContracts(goCtx context.Context, req *types.MsgInstantiateBabylonContracts) (*types.MsgInstantiateBabylonContractsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + params := ms.k.GetParams(ctx) + + // only the authority can override the instantiated contracts + if params.IsContractInstantiated() && req.Signer != ms.k.authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "only authority can override instantiated contracts; expected %s, got %s", ms.k.authority, req.Signer) + } + + // instantiate the contracts + babylonContractAddr, btcStakingContractAddr, btcFinalityContractAddr, err := ms.k.InstantiateBabylonContracts(ctx, req.InitMsg) + if err != nil { + return nil, err + } + + // update params + params.BabylonContractAddress = babylonContractAddr + params.BtcStakingContractAddress = btcStakingContractAddr + params.BtcFinalityContractAddress = btcFinalityContractAddr + if err := ms.k.SetParams(ctx, params); err != nil { + panic(err) + } + + return &types.MsgInstantiateBabylonContractsResponse{}, nil +} + // UpdateParams updates the params. func (ms msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if ms.k.authority != req.Authority { diff --git a/x/babylon/keeper/wasm.go b/x/babylon/keeper/wasm.go index 3e316d9..6b5aa0d 100644 --- a/x/babylon/keeper/wasm.go +++ b/x/babylon/keeper/wasm.go @@ -7,12 +7,92 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" "github.com/babylonlabs-io/babylon-sdk/x/babylon/contract" + types "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" sdk "github.com/cosmos/cosmos-sdk/types" ) -func (k Keeper) StoreBabylonContracts(ctx sdk.Context) error { - return nil +// StoreBabylonContractCodes stores the Babylon contract codes +func (k Keeper) StoreBabylonContractCodes( + ctx sdk.Context, + babylonContractCode []byte, + btcStakingContractCode []byte, + btcFinalityContractCode []byte, +) (uint64, uint64, uint64, error) { + contractKeeper := wasmkeeper.NewGovPermissionKeeper(k.wasm) + instantiateConfig := wasmtypes.AccessConfig{ + Permission: wasmtypes.AccessTypeAnyOfAddresses, + Addresses: []string{k.authority}, + } + + // gov address + govAddr, err := sdk.AccAddressFromBech32(k.authority) + if err != nil { + panic(err) + } + + // store Babylon contract + babylonContractCodeID, _, err := contractKeeper.Create(ctx, govAddr, babylonContractCode, &instantiateConfig) + if err != nil { + return 0, 0, 0, err + } + // store BTC staking contract + btcStakingContractCodeID, _, err := contractKeeper.Create(ctx, govAddr, btcStakingContractCode, &instantiateConfig) + if err != nil { + return 0, 0, 0, err + } + // store BTC finality contract + btcFinalityContractCodeID, _, err := contractKeeper.Create(ctx, govAddr, btcFinalityContractCode, &instantiateConfig) + if err != nil { + return 0, 0, 0, err + } + + return babylonContractCodeID, btcStakingContractCodeID, btcFinalityContractCodeID, nil +} + +func (k Keeper) InstantiateBabylonContracts(ctx sdk.Context, initMsg []byte) (string, string, string, error) { + contractKeeper := wasmkeeper.NewGovPermissionKeeper(k.wasm) + + // get params + params := k.GetParams(ctx) + + // check that the contract codes are stored + if !params.IsCodeStored() { + return "", "", "", types.ErrInvalid.Wrapf("Babylon contract code ID is not set") + } + + // gov address + govAddr, err := sdk.AccAddressFromBech32(k.authority) + if err != nil { + panic(err) + } + + // instantiate Babylon contract + babylonContractAddr, _, err := contractKeeper.Instantiate(ctx, params.BabylonContractCodeId, govAddr, govAddr, initMsg, "Babylon contract", nil) + if err != nil { + return "", "", "", err + } + + // get contract addresses + res, err := k.wasm.QuerySmart(ctx, babylonContractAddr, []byte(`"config":{}`)) + if err != nil { + return "", "", "", err + } + var config types.BabylonContractConfig + err = json.Unmarshal(res, &config) + if err != nil { + return "", "", "", err + } + if len(config.BTCStaking) == 0 { + return "", "", "", errorsmod.Wrap(types.ErrInvalid, "failed to instantiate BTC staking contract") + } + if len(config.BTCFinality) == 0 { + return "", "", "", errorsmod.Wrap(types.ErrInvalid, "failed to instantiate BTC finality contract") + } + + return babylonContractAddr.String(), config.BTCStaking, config.BTCFinality, nil } func (k Keeper) getBTCStakingContractAddr(ctx sdk.Context) sdk.AccAddress { diff --git a/x/babylon/types/babylon.go b/x/babylon/types/babylon.go new file mode 100644 index 0000000..45cd09b --- /dev/null +++ b/x/babylon/types/babylon.go @@ -0,0 +1,55 @@ +package types + +// Config represents the configuration for the Babylon contract +type BabylonContractConfig struct { + Network string `json:"network"` + BabylonTag []byte `json:"babylon_tag"` + BTCConfirmationDepth uint32 `json:"btc_confirmation_depth"` + CheckpointFinalizationTimeout uint32 `json:"checkpoint_finalization_timeout"` + // NotifyCosmosZone indicates whether to send Cosmos zone messages notifying BTC-finalised headers. + // NOTE: if set to true, then the Cosmos zone needs to integrate the corresponding message + // handler as well + NotifyCosmosZone bool `json:"notify_cosmos_zone"` + // BTCStaking stores a BTC staking contract used for BTC re-staking if set + BTCStaking string `json:"btc_staking,omitempty"` + // BTCFinality stores a BTC finality contract used for BTC finality on the Consumer if set + BTCFinality string `json:"btc_finality,omitempty"` + // ConsumerName represents the name of the Consumer + ConsumerName string `json:"consumer_name,omitempty"` + // ConsumerDescription represents the description of the Consumer + ConsumerDescription string `json:"consumer_description,omitempty"` +} + +type BabylonContractInitMsg struct { + // Network represents the Bitcoin network (mainnet, testnet, etc.) + Network string `json:"network"` + // BabylonTag is a string encoding four bytes used for identification / tagging of the Babylon zone. + // NOTE: this is a hex string, not raw bytes + BabylonTag string `json:"babylon_tag"` + // BTCConfirmationDepth is the number of confirmations required for BTC headers + BTCConfirmationDepth uint32 `json:"btc_confirmation_depth"` + // CheckpointFinalizationTimeout is the timeout period for checkpoint finalization + CheckpointFinalizationTimeout uint32 `json:"checkpoint_finalization_timeout"` + // NotifyCosmosZone indicates whether to send Cosmos zone messages notifying BTC-finalised headers. + // NOTE: If set to true, then the Cosmos zone needs to integrate the corresponding message handler + // as well + NotifyCosmosZone bool `json:"notify_cosmos_zone"` + // BTCStakingCodeID is the code ID for the BTC staking contract, if set + BTCStakingCodeID *uint64 `json:"btc_staking_code_id,omitempty"` + // BTCStakingMsg is the instantiation message for the BTC staking contract. + // This message is opaque to the Babylon contract, and depends on the specific staking contract + // being instantiated + BTCStakingMsg []byte `json:"btc_staking_msg,omitempty"` + // BTCFinalityCodeID is the code ID for the BTC finality contract, if set + BTCFinalityCodeID *uint64 `json:"btc_finality_code_id,omitempty"` + // BTCFinalityMsg is the instantiation message for the BTC finality contract. + // This message is opaque to the Babylon contract, and depends on the specific finality contract + // being instantiated + BTCFinalityMsg []byte `json:"btc_finality_msg,omitempty"` + // Admin is the Wasm migration / upgrade admin of the BTC staking contract and the BTC finality contract + Admin string `json:"admin,omitempty"` + // ConsumerName represents the name of the Consumer + ConsumerName string `json:"consumer_name,omitempty"` + // ConsumerDescription represents the description of the Consumer + ConsumerDescription string `json:"consumer_description,omitempty"` +} diff --git a/x/babylon/types/babylon.pb.go b/x/babylon/types/babylon.pb.go index a9ee6a8..02c6ec7 100644 --- a/x/babylon/types/babylon.pb.go +++ b/x/babylon/types/babylon.pb.go @@ -26,15 +26,21 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the x/babylon module. type Params struct { + // babylon_contract_code_id is the code ID of the Babylon contract + BabylonContractCodeId uint64 `protobuf:"varint,1,opt,name=babylon_contract_code_id,json=babylonContractCodeId,proto3" json:"babylon_contract_code_id,omitempty"` + // btc_staking_contract_code_id is the code ID of the BTC staking contract + BtcStakingContractCodeId uint64 `protobuf:"varint,2,opt,name=btc_staking_contract_code_id,json=btcStakingContractCodeId,proto3" json:"btc_staking_contract_code_id,omitempty"` + // btc_finality_contract_code_id is the code ID of the BTC finality contract + BtcFinalityContractCodeId uint64 `protobuf:"varint,3,opt,name=btc_finality_contract_code_id,json=btcFinalityContractCodeId,proto3" json:"btc_finality_contract_code_id,omitempty"` // babylon_contract_address is the address of the Babylon contract - BabylonContractAddress string `protobuf:"bytes,1,opt,name=babylon_contract_address,json=babylonContractAddress,proto3" json:"babylon_contract_address,omitempty"` + BabylonContractAddress string `protobuf:"bytes,4,opt,name=babylon_contract_address,json=babylonContractAddress,proto3" json:"babylon_contract_address,omitempty"` // btc_staking_contract_address is the address of the BTC staking contract - BtcStakingContractAddress string `protobuf:"bytes,2,opt,name=btc_staking_contract_address,json=btcStakingContractAddress,proto3" json:"btc_staking_contract_address,omitempty"` + BtcStakingContractAddress string `protobuf:"bytes,5,opt,name=btc_staking_contract_address,json=btcStakingContractAddress,proto3" json:"btc_staking_contract_address,omitempty"` // btc_finality_contract_address is the address of the BTC finality contract - BtcFinalityContractAddress string `protobuf:"bytes,3,opt,name=btc_finality_contract_address,json=btcFinalityContractAddress,proto3" json:"btc_finality_contract_address,omitempty"` + BtcFinalityContractAddress string `protobuf:"bytes,6,opt,name=btc_finality_contract_address,json=btcFinalityContractAddress,proto3" json:"btc_finality_contract_address,omitempty"` // max_gas_begin_blocker defines the maximum gas that can be spent in a // contract sudo callback - MaxGasBeginBlocker uint32 `protobuf:"varint,4,opt,name=max_gas_begin_blocker,json=maxGasBeginBlocker,proto3" json:"max_gas_begin_blocker,omitempty"` + MaxGasBeginBlocker uint32 `protobuf:"varint,7,opt,name=max_gas_begin_blocker,json=maxGasBeginBlocker,proto3" json:"max_gas_begin_blocker,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -79,29 +85,32 @@ func init() { } var fileDescriptor_9eb75d1c9a41f85f = []byte{ - // 339 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xb1, 0x4e, 0x32, 0x41, - 0x14, 0x85, 0x77, 0xf8, 0x09, 0xc9, 0xbf, 0x89, 0xcd, 0x06, 0xcd, 0x82, 0x3a, 0x12, 0x2b, 0x2c, - 0x60, 0x43, 0x8c, 0x8d, 0x9d, 0x6b, 0xa2, 0xad, 0x81, 0xc2, 0xa8, 0xc5, 0xe4, 0xce, 0xb0, 0x8e, - 0x13, 0x76, 0x77, 0xc8, 0xce, 0x68, 0xe0, 0x2d, 0x7c, 0x04, 0x4b, 0x1f, 0xc0, 0x87, 0xa0, 0x31, - 0x21, 0x56, 0x96, 0xba, 0x34, 0x3e, 0x86, 0x81, 0x99, 0x35, 0x04, 0x0a, 0xba, 0x7b, 0xee, 0x39, - 0xe7, 0x6b, 0xee, 0x75, 0x8f, 0x28, 0xd0, 0x71, 0x2c, 0xd3, 0x18, 0xa8, 0x0a, 0xec, 0x1c, 0x3c, - 0x75, 0x68, 0xa4, 0xa1, 0x53, 0xe8, 0xf6, 0x30, 0x93, 0x5a, 0x7a, 0xbb, 0x4b, 0xd1, 0x76, 0x61, - 0xd9, 0x68, 0xbd, 0xc6, 0xa4, 0x4a, 0xa4, 0x22, 0x8b, 0x68, 0x60, 0x84, 0xe9, 0xd5, 0xab, 0x5c, - 0x72, 0x69, 0xf6, 0xf3, 0xc9, 0x6c, 0x0f, 0xdf, 0x4b, 0x6e, 0xe5, 0x0a, 0x32, 0x48, 0x94, 0xd7, - 0x75, 0x7d, 0x8b, 0x23, 0x4c, 0xa6, 0x3a, 0x03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xe1, 0x4c, 0x30, 0x2a, - 0x02, 0x00, 0x00, + // 395 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0x4a, 0xeb, 0x40, + 0x18, 0xc5, 0x33, 0xf7, 0xe6, 0xf6, 0x72, 0x03, 0x77, 0x13, 0xda, 0x4b, 0xda, 0xab, 0x63, 0x71, + 0x55, 0x17, 0x6d, 0x28, 0x22, 0x82, 0x0b, 0xd1, 0x14, 0x14, 0x77, 0x92, 0x2e, 0x44, 0x5d, 0x0c, + 0x33, 0x93, 0x18, 0x87, 0x26, 0x99, 0x92, 0x19, 0xa5, 0x7d, 0x03, 0x97, 0x3e, 0x82, 0x4b, 0x1f, + 0xc0, 0x87, 0xe8, 0xb2, 0xb8, 0x72, 0xa9, 0xe9, 0xc6, 0xc7, 0x90, 0x26, 0x13, 0x29, 0xfd, 0x43, + 0x77, 0xf3, 0xcd, 0x39, 0xe7, 0xc7, 0x9c, 0xe1, 0x33, 0x76, 0x08, 0x26, 0xc3, 0x90, 0xc7, 0x21, + 0x26, 0xc2, 0x56, 0x67, 0xfb, 0xbe, 0x4d, 0x7c, 0x89, 0xdb, 0xc5, 0xdc, 0xea, 0x27, 0x5c, 0x72, + 0xf3, 0xff, 0x8c, 0xb5, 0x55, 0x48, 0xca, 0x5a, 0xab, 0x52, 0x2e, 0x22, 0x2e, 0x50, 0x66, 0xb5, + 0xf3, 0x21, 0xcf, 0xd5, 0xca, 0x01, 0x0f, 0x78, 0x7e, 0x3f, 0x3d, 0xe5, 0xb7, 0xdb, 0x0f, 0xba, + 0x51, 0x3a, 0xc7, 0x09, 0x8e, 0x84, 0xb9, 0x6f, 0x58, 0x0a, 0x87, 0x28, 0x8f, 0x65, 0x82, 0xa9, + 0x44, 0x94, 0x7b, 0x3e, 0x62, 0x9e, 0x05, 0xea, 0xa0, 0xa1, 0xbb, 0x15, 0xa5, 0x77, 0x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xa2, 0x3c, 0xb2, 0x67, 0xb6, 0xb0, 0xc9, 0x78, 0x31, 0x36, 0x85, 0xd7, + 0xb3, 0x07, 0xdf, 0x1b, 0x2c, 0x87, 0x7d, 0x5f, 0x90, 0x52, 0xb6, 0x6a, 0xbb, 0x5f, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xdf, 0x0d, 0xd0, 0x9d, 0xe5, 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -123,6 +132,15 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } + if this.BabylonContractCodeId != that1.BabylonContractCodeId { + return false + } + if this.BtcStakingContractCodeId != that1.BtcStakingContractCodeId { + return false + } + if this.BtcFinalityContractCodeId != that1.BtcFinalityContractCodeId { + return false + } if this.BabylonContractAddress != that1.BabylonContractAddress { return false } @@ -160,28 +178,43 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.MaxGasBeginBlocker != 0 { i = encodeVarintBabylon(dAtA, i, uint64(m.MaxGasBeginBlocker)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x38 } if len(m.BtcFinalityContractAddress) > 0 { i -= len(m.BtcFinalityContractAddress) copy(dAtA[i:], m.BtcFinalityContractAddress) i = encodeVarintBabylon(dAtA, i, uint64(len(m.BtcFinalityContractAddress))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x32 } if len(m.BtcStakingContractAddress) > 0 { i -= len(m.BtcStakingContractAddress) copy(dAtA[i:], m.BtcStakingContractAddress) i = encodeVarintBabylon(dAtA, i, uint64(len(m.BtcStakingContractAddress))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x2a } if len(m.BabylonContractAddress) > 0 { i -= len(m.BabylonContractAddress) copy(dAtA[i:], m.BabylonContractAddress) i = encodeVarintBabylon(dAtA, i, uint64(len(m.BabylonContractAddress))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x22 + } + if m.BtcFinalityContractCodeId != 0 { + i = encodeVarintBabylon(dAtA, i, uint64(m.BtcFinalityContractCodeId)) + i-- + dAtA[i] = 0x18 + } + if m.BtcStakingContractCodeId != 0 { + i = encodeVarintBabylon(dAtA, i, uint64(m.BtcStakingContractCodeId)) + i-- + dAtA[i] = 0x10 + } + if m.BabylonContractCodeId != 0 { + i = encodeVarintBabylon(dAtA, i, uint64(m.BabylonContractCodeId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -203,6 +236,15 @@ func (m *Params) Size() (n int) { } var l int _ = l + if m.BabylonContractCodeId != 0 { + n += 1 + sovBabylon(uint64(m.BabylonContractCodeId)) + } + if m.BtcStakingContractCodeId != 0 { + n += 1 + sovBabylon(uint64(m.BtcStakingContractCodeId)) + } + if m.BtcFinalityContractCodeId != 0 { + n += 1 + sovBabylon(uint64(m.BtcFinalityContractCodeId)) + } l = len(m.BabylonContractAddress) if l > 0 { n += 1 + l + sovBabylon(uint64(l)) @@ -257,6 +299,63 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BabylonContractCodeId", wireType) + } + m.BabylonContractCodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBabylon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BabylonContractCodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcStakingContractCodeId", wireType) + } + m.BtcStakingContractCodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBabylon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BtcStakingContractCodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcFinalityContractCodeId", wireType) + } + m.BtcFinalityContractCodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBabylon + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BtcFinalityContractCodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BabylonContractAddress", wireType) } @@ -288,7 +387,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.BabylonContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BtcStakingContractAddress", wireType) } @@ -320,7 +419,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.BtcStakingContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BtcFinalityContractAddress", wireType) } @@ -352,7 +451,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.BtcFinalityContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MaxGasBeginBlocker", wireType) } diff --git a/x/babylon/types/params.go b/x/babylon/types/params.go index db35b2c..51faf32 100644 --- a/x/babylon/types/params.go +++ b/x/babylon/types/params.go @@ -14,3 +14,16 @@ func (p Params) ValidateBasic() error { } return nil } + +func (p Params) IsCodeStored() bool { + return p.BabylonContractCodeId != 0 && + p.BtcStakingContractCodeId != 0 && + p.BtcFinalityContractCodeId != 0 +} + +func (p Params) IsContractInstantiated() bool { + return p.IsCodeStored() && + len(p.BabylonContractAddress) > 0 && + len(p.BtcStakingContractAddress) > 0 && + len(p.BtcFinalityContractAddress) > 0 +} diff --git a/x/babylon/types/tx.pb.go b/x/babylon/types/tx.pb.go index 54d9cac..78b525a 100644 --- a/x/babylon/types/tx.pb.go +++ b/x/babylon/types/tx.pb.go @@ -30,6 +30,175 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgStoreBabylonContractCodes is the Msg/StoreBabylonContractCodes request +// type. +type MsgStoreBabylonContractCodes struct { + // signer is the address who submits the message. + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // babylon_contract_code is the bytecode for the Babylon contract. + // WASMByteCode can be raw or gzip compressed + BabylonContractCode []byte `protobuf:"bytes,2,opt,name=babylon_contract_code,json=babylonContractCode,proto3" json:"babylon_contract_code,omitempty"` + // btc_staking_contract_code is the bytecode for the BTC staking contract. + // WASMByteCode can be raw or gzip compressed + BtcStakingContractCode []byte `protobuf:"bytes,3,opt,name=btc_staking_contract_code,json=btcStakingContractCode,proto3" json:"btc_staking_contract_code,omitempty"` + // btc_finality_contract_code is the bytecode for the BTC finality contract. + // WASMByteCode can be raw or gzip compressed + BtcFinalityContractCode []byte `protobuf:"bytes,4,opt,name=btc_finality_contract_code,json=btcFinalityContractCode,proto3" json:"btc_finality_contract_code,omitempty"` +} + +func (m *MsgStoreBabylonContractCodes) Reset() { *m = MsgStoreBabylonContractCodes{} } +func (m *MsgStoreBabylonContractCodes) String() string { return proto.CompactTextString(m) } +func (*MsgStoreBabylonContractCodes) ProtoMessage() {} +func (*MsgStoreBabylonContractCodes) Descriptor() ([]byte, []int) { + return fileDescriptor_406c9f025b2f9448, []int{0} +} +func (m *MsgStoreBabylonContractCodes) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStoreBabylonContractCodes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStoreBabylonContractCodes.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 *MsgStoreBabylonContractCodes) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStoreBabylonContractCodes.Merge(m, src) +} +func (m *MsgStoreBabylonContractCodes) XXX_Size() int { + return m.Size() +} +func (m *MsgStoreBabylonContractCodes) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStoreBabylonContractCodes.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStoreBabylonContractCodes proto.InternalMessageInfo + +// MsgStoreBabylonContractCodesResponse is the Msg/StoreBabylonContractCodes +// response type. +type MsgStoreBabylonContractCodesResponse struct { +} + +func (m *MsgStoreBabylonContractCodesResponse) Reset() { *m = MsgStoreBabylonContractCodesResponse{} } +func (m *MsgStoreBabylonContractCodesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgStoreBabylonContractCodesResponse) ProtoMessage() {} +func (*MsgStoreBabylonContractCodesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_406c9f025b2f9448, []int{1} +} +func (m *MsgStoreBabylonContractCodesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStoreBabylonContractCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStoreBabylonContractCodesResponse.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 *MsgStoreBabylonContractCodesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStoreBabylonContractCodesResponse.Merge(m, src) +} +func (m *MsgStoreBabylonContractCodesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgStoreBabylonContractCodesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStoreBabylonContractCodesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStoreBabylonContractCodesResponse proto.InternalMessageInfo + +// MsgInstantiateBabylonContracts is the Msg/InstantiateBabylonContracts request +// type. +type MsgInstantiateBabylonContracts struct { + // signer is the address who submits the message. + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // init_msg is the instantiation message for the Babylon contract. + InitMsg []byte `protobuf:"bytes,2,opt,name=init_msg,json=initMsg,proto3" json:"init_msg,omitempty"` +} + +func (m *MsgInstantiateBabylonContracts) Reset() { *m = MsgInstantiateBabylonContracts{} } +func (m *MsgInstantiateBabylonContracts) String() string { return proto.CompactTextString(m) } +func (*MsgInstantiateBabylonContracts) ProtoMessage() {} +func (*MsgInstantiateBabylonContracts) Descriptor() ([]byte, []int) { + return fileDescriptor_406c9f025b2f9448, []int{2} +} +func (m *MsgInstantiateBabylonContracts) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInstantiateBabylonContracts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInstantiateBabylonContracts.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 *MsgInstantiateBabylonContracts) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInstantiateBabylonContracts.Merge(m, src) +} +func (m *MsgInstantiateBabylonContracts) XXX_Size() int { + return m.Size() +} +func (m *MsgInstantiateBabylonContracts) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInstantiateBabylonContracts.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInstantiateBabylonContracts proto.InternalMessageInfo + +// MsgInstantiateBabylonContractsResponse is the Msg/InstantiateBabylonContracts +// response type. +type MsgInstantiateBabylonContractsResponse struct { +} + +func (m *MsgInstantiateBabylonContractsResponse) Reset() { + *m = MsgInstantiateBabylonContractsResponse{} +} +func (m *MsgInstantiateBabylonContractsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgInstantiateBabylonContractsResponse) ProtoMessage() {} +func (*MsgInstantiateBabylonContractsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_406c9f025b2f9448, []int{3} +} +func (m *MsgInstantiateBabylonContractsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInstantiateBabylonContractsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInstantiateBabylonContractsResponse.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 *MsgInstantiateBabylonContractsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInstantiateBabylonContractsResponse.Merge(m, src) +} +func (m *MsgInstantiateBabylonContractsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgInstantiateBabylonContractsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInstantiateBabylonContractsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInstantiateBabylonContractsResponse proto.InternalMessageInfo + // MsgUpdateParams is the Msg/UpdateParams request type. type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless @@ -45,7 +214,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_406c9f025b2f9448, []int{0} + return fileDescriptor_406c9f025b2f9448, []int{4} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -83,7 +252,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_406c9f025b2f9448, []int{1} + return fileDescriptor_406c9f025b2f9448, []int{5} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -113,6 +282,10 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*MsgStoreBabylonContractCodes)(nil), "babylonlabs.babylon.v1beta1.MsgStoreBabylonContractCodes") + proto.RegisterType((*MsgStoreBabylonContractCodesResponse)(nil), "babylonlabs.babylon.v1beta1.MsgStoreBabylonContractCodesResponse") + proto.RegisterType((*MsgInstantiateBabylonContracts)(nil), "babylonlabs.babylon.v1beta1.MsgInstantiateBabylonContracts") + proto.RegisterType((*MsgInstantiateBabylonContractsResponse)(nil), "babylonlabs.babylon.v1beta1.MsgInstantiateBabylonContractsResponse") proto.RegisterType((*MsgUpdateParams)(nil), "babylonlabs.babylon.v1beta1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "babylonlabs.babylon.v1beta1.MsgUpdateParamsResponse") } @@ -122,29 +295,42 @@ func init() { } var fileDescriptor_406c9f025b2f9448 = []byte{ - // 337 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xcb, 0x49, 0x4c, 0x2a, 0xd6, 0x87, 0xb2, 0xf5, 0xcb, 0x0c, 0x93, 0x52, 0x4b, - 0x12, 0x0d, 0xf5, 0x4b, 0x2a, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0xa4, 0x91, 0x54, 0xe9, - 0x41, 0xd9, 0x7a, 0x50, 0x55, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x75, 0xfa, 0x20, 0x16, - 0x44, 0x8b, 0x94, 0x78, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0xb1, 0x7e, 0x6e, 0x71, 0xba, 0x7e, 0x99, - 0x21, 0x88, 0x82, 0x4a, 0x48, 0x42, 0x24, 0xe2, 0x21, 0x3a, 0x20, 0x1c, 0xa8, 0x94, 0x26, 0x3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0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x4c, 0xd3, 0x33, - 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x91, 0x2c, 0xd1, 0xcd, 0xcc, 0x87, 0x71, - 0x75, 0x8b, 0x53, 0xb2, 0xf5, 0x2b, 0xe0, 0x31, 0x54, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, - 0x8e, 0x18, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x42, 0xc9, 0x7e, 0x52, 0x02, 0x00, - 0x00, + // 551 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xc7, 0xb3, 0x4d, 0x8d, 0x76, 0x5a, 0x14, 0xd6, 0x6a, 0x92, 0xad, 0xac, 0x25, 0x96, 0x12, + 0x8b, 0xd9, 0x35, 0xf1, 0x07, 0xb4, 0x3d, 0x25, 0x01, 0xc1, 0x43, 0x40, 0x12, 0xbc, 0x78, 0x09, + 0xb3, 0x3f, 0x9c, 0x0e, 0x4d, 0x66, 0xc2, 0xbe, 0xd7, 0xd2, 0x78, 0x12, 0x6f, 0xde, 0xbc, 0x0a, + 0x82, 0xff, 0x42, 0x0f, 0x9e, 0x3d, 0xe7, 0x58, 0x3c, 0x79, 0x12, 0x4d, 0x0e, 0xfd, 0x37, 0x24, + 0xbb, 0xb3, 0x69, 0x12, 0x71, 0x83, 0xf5, 0xb4, 0x33, 0xbc, 0xef, 0xe7, 0x7d, 0xbf, 0x3b, 0xf3, + 0x18, 0xb2, 0xe5, 0x50, 0xa7, 0xdf, 0x91, 0xa2, 0x43, 0x1d, 0xb0, 0xd5, 0xda, 0x3e, 0x2e, 0x3b, + 0x3e, 0xd2, 0xb2, 0x8d, 0x27, 0x56, 0x2f, 0x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xd4, 0x60, 0x68, 0x6a, 0x67, 0x43, 0x53, 0xfb, 0x39, 0x34, 0xb5, 0x0f, 0x23, + 0x33, 0x75, 0x36, 0x32, 0x53, 0xdf, 0x47, 0x66, 0xea, 0xd5, 0x13, 0xc6, 0xf1, 0xe0, 0xc8, 0xb1, + 0x5c, 0xd9, 0xb5, 0xa7, 0x4c, 0x4a, 0x5c, 0xc6, 0xdb, 0x12, 0x78, 0x87, 0xf6, 0xc9, 0xe4, 0xe5, + 0xc2, 0x7e, 0xcf, 0x07, 0x27, 0x13, 0x3e, 0x58, 0x8f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x53, + 0x29, 0x66, 0x64, 0x6a, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -159,6 +345,12 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // StoreBabylonContractCodes defines an operation for storing the Babylon + // contract codes. + StoreBabylonContractCodes(ctx context.Context, in *MsgStoreBabylonContractCodes, opts ...grpc.CallOption) (*MsgStoreBabylonContractCodesResponse, error) + // InstantiateBabylonContracts defines an operation for instantiating the + // Babylon contracts. + InstantiateBabylonContracts(ctx context.Context, in *MsgInstantiateBabylonContracts, opts ...grpc.CallOption) (*MsgInstantiateBabylonContractsResponse, error) // UpdateParams defines a (governance) operation for updating the x/auth // module parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) @@ -172,6 +364,24 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) StoreBabylonContractCodes(ctx context.Context, in *MsgStoreBabylonContractCodes, opts ...grpc.CallOption) (*MsgStoreBabylonContractCodesResponse, error) { + out := new(MsgStoreBabylonContractCodesResponse) + err := c.cc.Invoke(ctx, "/babylonlabs.babylon.v1beta1.Msg/StoreBabylonContractCodes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) InstantiateBabylonContracts(ctx context.Context, in *MsgInstantiateBabylonContracts, opts ...grpc.CallOption) (*MsgInstantiateBabylonContractsResponse, error) { + out := new(MsgInstantiateBabylonContractsResponse) + err := c.cc.Invoke(ctx, "/babylonlabs.babylon.v1beta1.Msg/InstantiateBabylonContracts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { out := new(MsgUpdateParamsResponse) err := c.cc.Invoke(ctx, "/babylonlabs.babylon.v1beta1.Msg/UpdateParams", in, out, opts...) @@ -183,6 +393,12 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts // MsgServer is the server API for Msg service. type MsgServer interface { + // StoreBabylonContractCodes defines an operation for storing the Babylon + // contract codes. + StoreBabylonContractCodes(context.Context, *MsgStoreBabylonContractCodes) (*MsgStoreBabylonContractCodesResponse, error) + // InstantiateBabylonContracts defines an operation for instantiating the + // Babylon contracts. + InstantiateBabylonContracts(context.Context, *MsgInstantiateBabylonContracts) (*MsgInstantiateBabylonContractsResponse, error) // UpdateParams defines a (governance) operation for updating the x/auth // module parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) @@ -192,6 +408,12 @@ type MsgServer interface { type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) StoreBabylonContractCodes(ctx context.Context, req *MsgStoreBabylonContractCodes) (*MsgStoreBabylonContractCodesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StoreBabylonContractCodes not implemented") +} +func (*UnimplementedMsgServer) InstantiateBabylonContracts(ctx context.Context, req *MsgInstantiateBabylonContracts) (*MsgInstantiateBabylonContractsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InstantiateBabylonContracts not implemented") +} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -200,6 +422,42 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_StoreBabylonContractCodes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgStoreBabylonContractCodes) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).StoreBabylonContractCodes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylonlabs.babylon.v1beta1.Msg/StoreBabylonContractCodes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).StoreBabylonContractCodes(ctx, req.(*MsgStoreBabylonContractCodes)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_InstantiateBabylonContracts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgInstantiateBabylonContracts) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).InstantiateBabylonContracts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylonlabs.babylon.v1beta1.Msg/InstantiateBabylonContracts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).InstantiateBabylonContracts(ctx, req.(*MsgInstantiateBabylonContracts)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateParams) if err := dec(in); err != nil { @@ -222,6 +480,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylonlabs.babylon.v1beta1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "StoreBabylonContractCodes", + Handler: _Msg_StoreBabylonContractCodes_Handler, + }, + { + MethodName: "InstantiateBabylonContracts", + Handler: _Msg_InstantiateBabylonContracts_Handler, + }, { MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, @@ -231,6 +497,140 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "babylonlabs/babylon/v1beta1/tx.proto", } +func (m *MsgStoreBabylonContractCodes) 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 *MsgStoreBabylonContractCodes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStoreBabylonContractCodes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BtcFinalityContractCode) > 0 { + i -= len(m.BtcFinalityContractCode) + copy(dAtA[i:], m.BtcFinalityContractCode) + i = encodeVarintTx(dAtA, i, uint64(len(m.BtcFinalityContractCode))) + i-- + dAtA[i] = 0x22 + } + if len(m.BtcStakingContractCode) > 0 { + i -= len(m.BtcStakingContractCode) + copy(dAtA[i:], m.BtcStakingContractCode) + i = encodeVarintTx(dAtA, i, uint64(len(m.BtcStakingContractCode))) + i-- + dAtA[i] = 0x1a + } + if len(m.BabylonContractCode) > 0 { + i -= len(m.BabylonContractCode) + copy(dAtA[i:], m.BabylonContractCode) + i = encodeVarintTx(dAtA, i, uint64(len(m.BabylonContractCode))) + i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgStoreBabylonContractCodesResponse) 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 *MsgStoreBabylonContractCodesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStoreBabylonContractCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgInstantiateBabylonContracts) 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 *MsgInstantiateBabylonContracts) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInstantiateBabylonContracts) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.InitMsg) > 0 { + i -= len(m.InitMsg) + copy(dAtA[i:], m.InitMsg) + i = encodeVarintTx(dAtA, i, uint64(len(m.InitMsg))) + i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgInstantiateBabylonContractsResponse) 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 *MsgInstantiateBabylonContractsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInstantiateBabylonContractsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -305,22 +705,32 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgUpdateParams) Size() (n int) { +func (m *MsgStoreBabylonContractCodes) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Authority) + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BabylonContractCode) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BtcStakingContractCode) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BtcFinalityContractCode) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgUpdateParamsResponse) Size() (n int) { +func (m *MsgStoreBabylonContractCodesResponse) Size() (n int) { if m == nil { return 0 } @@ -329,12 +739,462 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *MsgInstantiateBabylonContracts) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.InitMsg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n } -func sozTx(x uint64) (n int) { + +func (m *MsgInstantiateBabylonContractsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *MsgStoreBabylonContractCodes) 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: MsgStoreBabylonContractCodes: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStoreBabylonContractCodes: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BabylonContractCode", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BabylonContractCode = append(m.BabylonContractCode[:0], dAtA[iNdEx:postIndex]...) + if m.BabylonContractCode == nil { + m.BabylonContractCode = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcStakingContractCode", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BtcStakingContractCode = append(m.BtcStakingContractCode[:0], dAtA[iNdEx:postIndex]...) + if m.BtcStakingContractCode == nil { + m.BtcStakingContractCode = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcFinalityContractCode", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BtcFinalityContractCode = append(m.BtcFinalityContractCode[:0], dAtA[iNdEx:postIndex]...) + if m.BtcFinalityContractCode == nil { + m.BtcFinalityContractCode = []byte{} + } + 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 *MsgStoreBabylonContractCodesResponse) 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: MsgStoreBabylonContractCodesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStoreBabylonContractCodesResponse: 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 *MsgInstantiateBabylonContracts) 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: MsgInstantiateBabylonContracts: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateBabylonContracts: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitMsg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitMsg = append(m.InitMsg[:0], dAtA[iNdEx:postIndex]...) + if m.InitMsg == nil { + m.InitMsg = []byte{} + } + 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 *MsgInstantiateBabylonContractsResponse) 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: MsgInstantiateBabylonContractsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateBabylonContractsResponse: 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 *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0