diff --git a/docs/band_price_source.md b/docs/band_price_source.md
index b9fb3081..3bfe747d 100644
--- a/docs/band_price_source.md
+++ b/docs/band_price_source.md
@@ -78,3 +78,13 @@ Create channel
```bash
rly tx channel {$PATH_NAME} --src-port wasm.$price_feed --dst-port oracle --order unordered --version bandchain-1 --home $relayer_home --override
```
+
+## Register handle epoch for price feed contract
+
+Currently, the price feed contract only allow to call handle epoch via SudoMsg. Therefore, we need to register price feed contract to the chain.
+
+```bash
+meshconsumerd tx meshsecurity submit-proposal set-price-feed $price_feed --title "Title" --summary "Summary" --from $addr --keyring-backend test --home=$home --node $node --chain-id $chainid -y --deposit 10000000stake
+```
+
+After submitting proposal, we vote for the proposal to pass. Meshsecurity module will automatically set the handle_epoch task for price feed contract.
\ No newline at end of file
diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index dcd66663..ac8f77bc 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -26,6 +26,8 @@
- [ValidatorAddress](#osmosis.meshsecurity.v1beta1.ValidatorAddress)
- [osmosis/meshsecurity/v1beta1/tx.proto](#osmosis/meshsecurity/v1beta1/tx.proto)
+ - [MsgSetPriceFeedContract](#osmosis.meshsecurity.v1beta1.MsgSetPriceFeedContract)
+ - [MsgSetPriceFeedContractResponse](#osmosis.meshsecurity.v1beta1.MsgSetPriceFeedContractResponse)
- [MsgSetVirtualStakingMaxCap](#osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCap)
- [MsgSetVirtualStakingMaxCapResponse](#osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCapResponse)
@@ -287,6 +289,33 @@ ValidatorAddress payload data to be used with the scheduler
+
+
+### MsgSetPriceFeedContract
+MsgSetPriceFeedContract sets the price feed contract to the chain
+to trigger handle epoch task
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `authority` | [string](#string) | | Authority is the address that controls the module (defaults to x/gov unless overwritten). |
+| `contract` | [string](#string) | | Contract is the address of the price feed smart contract. |
+
+
+
+
+
+
+
+
+### MsgSetPriceFeedContractResponse
+MsgSetPriceFeedContractResponse returns result data.
+
+
+
+
+
+
### MsgSetVirtualStakingMaxCap
@@ -329,6 +358,7 @@ Msg defines the wasm Msg service.
| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `SetVirtualStakingMaxCap` | [MsgSetVirtualStakingMaxCap](#osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCap) | [MsgSetVirtualStakingMaxCapResponse](#osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCapResponse) | SetVirtualStakingMaxCap creates or updates a maximum cap limit for virtual staking coins | |
+| `SetPriceFeedContract` | [MsgSetPriceFeedContract](#osmosis.meshsecurity.v1beta1.MsgSetPriceFeedContract) | [MsgSetPriceFeedContractResponse](#osmosis.meshsecurity.v1beta1.MsgSetPriceFeedContractResponse) | SetPriceFeedContract sets the price feed contract to the chain to trigger handle epoch task | |
diff --git a/proto/osmosis/meshsecurity/v1beta1/tx.proto b/proto/osmosis/meshsecurity/v1beta1/tx.proto
index 90434bb1..99f88966 100644
--- a/proto/osmosis/meshsecurity/v1beta1/tx.proto
+++ b/proto/osmosis/meshsecurity/v1beta1/tx.proto
@@ -15,6 +15,10 @@ service Msg {
// staking coins
rpc SetVirtualStakingMaxCap(MsgSetVirtualStakingMaxCap)
returns (MsgSetVirtualStakingMaxCapResponse);
+ // SetPriceFeedContract sets the price feed contract to the chain
+ // to trigger handle epoch task
+ rpc SetPriceFeedContract(MsgSetPriceFeedContract)
+ returns (MsgSetPriceFeedContractResponse);
}
// MsgSetVirtualStakingMaxCap creates or updates a maximum cap limit for virtual
@@ -37,3 +41,20 @@ message MsgSetVirtualStakingMaxCap {
// MsgSetVirtualStakingMaxCap returns result data.
message MsgSetVirtualStakingMaxCapResponse {}
+
+// MsgSetPriceFeedContract sets the price feed contract to the chain
+// to trigger handle epoch task
+message MsgSetPriceFeedContract {
+ option (amino.name) = "meshsecurity/MsgSetPriceFeedContract";
+ option (cosmos.msg.v1.signer) = "authority";
+
+ // Authority is the address that controls the module (defaults to x/gov unless
+ // overwritten).
+ string authority = 1;
+
+ // Contract is the address of the price feed smart contract.
+ string contract = 2;
+}
+
+// MsgSetPriceFeedContractResponse returns result data.
+message MsgSetPriceFeedContractResponse {}
diff --git a/scripts/mesh/testibc/rly.sh b/scripts/mesh/testibc/rly.sh
index 5ee649a5..4a98b673 100755
--- a/scripts/mesh/testibc/rly.sh
+++ b/scripts/mesh/testibc/rly.sh
@@ -33,6 +33,5 @@ rly tx channel demo --src-port wasm.$converter --dst-port wasm.$ext_staking --or
sleep 5
-echo "abcxyz"
-# screen -S relayer -t relayer -d -m rly start demo
+screen -S relayer -t relayer -d -m rly start demo
sleep 5
\ No newline at end of file
diff --git a/scripts/mesh/testibc/rly_band.sh b/scripts/mesh/testibc/rly_band.sh
index ecdbd12a..b31c77de 100755
--- a/scripts/mesh/testibc/rly_band.sh
+++ b/scripts/mesh/testibc/rly_band.sh
@@ -53,6 +53,7 @@ init_band_price_feed=$(cat < /dev/null && shellcheck "$0"
echo "DEV-only: copy from local built instead of downloading"
-for contract in mesh_external_staking mesh_converter mesh_native_staking mesh_native_staking_proxy mesh_osmosis_price_provider mesh_remote_price_feed mesh_simple_price_feed \
+for contract in mesh_external_staking mesh_converter mesh_native_staking mesh_native_staking_proxy mesh_band_price_feed mesh_osmosis_price_feed mesh_simple_price_feed \
mesh_vault mesh_virtual_staking ; do
cp -f ../../../mesh-security/artifacts/${contract}-aarch64.wasm .
gzip -fk ${contract}-aarch64.wasm
diff --git a/tests/testdata/mesh_band_price_feed.wasm.gz b/tests/testdata/mesh_band_price_feed.wasm.gz
index 357ec578..02fd3079 100644
Binary files a/tests/testdata/mesh_band_price_feed.wasm.gz and b/tests/testdata/mesh_band_price_feed.wasm.gz differ
diff --git a/tests/testdata/mesh_converter.wasm.gz b/tests/testdata/mesh_converter.wasm.gz
index 85925eaf..c8b2bbc6 100644
Binary files a/tests/testdata/mesh_converter.wasm.gz and b/tests/testdata/mesh_converter.wasm.gz differ
diff --git a/tests/testdata/mesh_external_staking.wasm.gz b/tests/testdata/mesh_external_staking.wasm.gz
index 292a1bc6..b34429c5 100644
Binary files a/tests/testdata/mesh_external_staking.wasm.gz and b/tests/testdata/mesh_external_staking.wasm.gz differ
diff --git a/tests/testdata/mesh_native_staking.wasm.gz b/tests/testdata/mesh_native_staking.wasm.gz
index 4ad4a956..7ce89f3c 100644
Binary files a/tests/testdata/mesh_native_staking.wasm.gz and b/tests/testdata/mesh_native_staking.wasm.gz differ
diff --git a/tests/testdata/mesh_native_staking_proxy.wasm.gz b/tests/testdata/mesh_native_staking_proxy.wasm.gz
index 4a272fcd..f574acf1 100644
Binary files a/tests/testdata/mesh_native_staking_proxy.wasm.gz and b/tests/testdata/mesh_native_staking_proxy.wasm.gz differ
diff --git a/tests/testdata/mesh_osmosis_price_feed.wasm.gz b/tests/testdata/mesh_osmosis_price_feed.wasm.gz
index 2250359b..91195bab 100644
Binary files a/tests/testdata/mesh_osmosis_price_feed.wasm.gz and b/tests/testdata/mesh_osmosis_price_feed.wasm.gz differ
diff --git a/tests/testdata/mesh_simple_price_feed.wasm.gz b/tests/testdata/mesh_simple_price_feed.wasm.gz
index 6f99efaa..a40dedcf 100644
Binary files a/tests/testdata/mesh_simple_price_feed.wasm.gz and b/tests/testdata/mesh_simple_price_feed.wasm.gz differ
diff --git a/tests/testdata/mesh_vault.wasm.gz b/tests/testdata/mesh_vault.wasm.gz
index 2a6e5725..811d2c03 100644
Binary files a/tests/testdata/mesh_vault.wasm.gz and b/tests/testdata/mesh_vault.wasm.gz differ
diff --git a/tests/testdata/mesh_virtual_staking.wasm.gz b/tests/testdata/mesh_virtual_staking.wasm.gz
index 0bc19308..3f25e1b1 100644
Binary files a/tests/testdata/mesh_virtual_staking.wasm.gz and b/tests/testdata/mesh_virtual_staking.wasm.gz differ
diff --git a/tests/testdata/version.txt b/tests/testdata/version.txt
index 66a6ad6a..10142f3f 100644
--- a/tests/testdata/version.txt
+++ b/tests/testdata/version.txt
@@ -1 +1 @@
-da560f398b59d3a7430efbc1e71cbb0bcf62ad7a
+44c6e65b581a08b5994a86792978f34ce9c51d5d
diff --git a/x/meshsecurity/client/cli/gov_tx.go b/x/meshsecurity/client/cli/gov_tx.go
index 22186946..2c660ee5 100644
--- a/x/meshsecurity/client/cli/gov_tx.go
+++ b/x/meshsecurity/client/cli/gov_tx.go
@@ -33,6 +33,7 @@ func SubmitProposalCmd() *cobra.Command {
}
cmd.AddCommand(
ProposalSetVirtualStakingMaxCapCmd(),
+ ProposalSetPriceFeedContractCmd(),
)
return cmd
}
@@ -86,6 +87,55 @@ $ %s tx meshsecurity submit-proposal set-virtual-staking-max-cap %s1l94ptufswr6v
return cmd
}
+func ProposalSetPriceFeedContractCmd() *cobra.Command {
+ bech32Prefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
+ cmd := &cobra.Command{
+ Use: "set-price-feed [contract_addr_bech32] --title [text] --summary [text] --authority [address]",
+ Short: "Submit a set virtual staking max cap proposal",
+ Args: cobra.ExactArgs(1),
+ Long: strings.TrimSpace(
+ fmt.Sprintf(`Submit a proposal to set price feed contract to chain.
+
+Example:
+$ %s tx meshsecurity submit-proposal set-price-feed %s1l94ptufswr6v7qntax4m7nvn3jgf6k4gn2rknq --title "a title" --summary "a summary" --authority %s
+`, version.AppName, bech32Prefix, DefaultGovAuthority.String())),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ clientCtx, proposalTitle, summary, metadata, deposit, err := getProposalInfo(cmd)
+ if err != nil {
+ return err
+ }
+ authority, err := cmd.Flags().GetString(flagAuthority)
+ if err != nil {
+ return fmt.Errorf("authority: %s", err)
+ }
+
+ if len(authority) == 0 {
+ return errors.New("authority address is required")
+ }
+
+ src, err := parseSetPriceFeedContractArgs(args, authority)
+ if err != nil {
+ return err
+ }
+
+ proposalMsg, err := v1.NewMsgSubmitProposal([]sdk.Msg{&src}, deposit, clientCtx.GetFromAddress().String(), metadata, proposalTitle, summary)
+ if err != nil {
+ return err
+ }
+ if err = proposalMsg.ValidateBasic(); err != nil {
+ return err
+ }
+
+ return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposalMsg)
+ },
+ SilenceUsage: true,
+ }
+
+ // proposal flags
+ addCommonProposalFlags(cmd)
+ return cmd
+}
+
func parseSetVirtualStakingMaxCapArgs(args []string, authority string) (types.MsgSetVirtualStakingMaxCap, error) {
maxCap, err := sdk.ParseCoinNormalized(args[1])
if err != nil {
@@ -100,6 +150,14 @@ func parseSetVirtualStakingMaxCapArgs(args []string, authority string) (types.Ms
return msg, nil
}
+func parseSetPriceFeedContractArgs(args []string, authority string) (types.MsgSetPriceFeedContract, error) {
+ msg := types.MsgSetPriceFeedContract{
+ Authority: authority,
+ Contract: args[0],
+ }
+ return msg, nil
+}
+
func addCommonProposalFlags(cmd *cobra.Command) {
flags.AddTxFlagsToCmd(cmd)
cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
diff --git a/x/meshsecurity/keeper/msg_server.go b/x/meshsecurity/keeper/msg_server.go
index 1d81decb..412b5a12 100644
--- a/x/meshsecurity/keeper/msg_server.go
+++ b/x/meshsecurity/keeper/msg_server.go
@@ -42,10 +42,35 @@ func (m msgServer) SetVirtualStakingMaxCap(goCtx context.Context, req *types.Msg
return nil, err
}
if !m.k.HasScheduledTask(ctx, types.SchedulerTaskHandleEpoch, acc, true) {
- if err := m.k.ScheduleRegularRebalanceTask(ctx, acc); err != nil {
+ if err := m.k.ScheduleRegularHandleEpochTask(ctx, acc); err != nil {
return nil, errorsmod.Wrap(err, "schedule regular rebalance task")
}
return &types.MsgSetVirtualStakingMaxCapResponse{}, nil
}
return &types.MsgSetVirtualStakingMaxCapResponse{}, nil
}
+
+// SetPriceFeedContract sets the price feed contract to the chain to trigger handle epoch task
+func (m msgServer) SetPriceFeedContract(goCtx context.Context, req *types.MsgSetPriceFeedContract) (*types.MsgSetPriceFeedContractResponse, error) {
+ if err := req.ValidateBasic(); err != nil {
+ return nil, err
+ }
+
+ if authority := m.k.GetAuthority(); authority != req.Authority {
+ return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", authority, req.Authority)
+ }
+
+ acc, err := sdk.AccAddressFromBech32(req.Contract)
+ if err != nil {
+ return nil, errorsmod.Wrap(err, "contract")
+ }
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ if !m.k.HasScheduledTask(ctx, types.SchedulerTaskHandleEpoch, acc, true) {
+ if err := m.k.ScheduleRegularHandleEpochTask(ctx, acc); err != nil {
+ return nil, errorsmod.Wrap(err, "schedule regular rebalance task")
+ }
+ return &types.MsgSetPriceFeedContractResponse{}, nil
+ } else {
+ return nil, types.ErrDuplicate
+ }
+}
diff --git a/x/meshsecurity/keeper/msg_server_test.go b/x/meshsecurity/keeper/msg_server_test.go
index 74bd70e8..c56107d4 100644
--- a/x/meshsecurity/keeper/msg_server_test.go
+++ b/x/meshsecurity/keeper/msg_server_test.go
@@ -89,3 +89,76 @@ func TestSetVirtualStakingMaxCap(t *testing.T) {
})
}
}
+
+func TestSetPriceFeedContract(t *testing.T) {
+ pCtx, keepers := CreateDefaultTestInput(t)
+ k := keepers.MeshKeeper
+ myContract := sdk.AccAddress(rand.Bytes(32))
+ denom := keepers.StakingKeeper.BondDenom(pCtx)
+ myAmount := sdk.NewInt64Coin(denom, 123)
+
+ k.wasm = MockWasmKeeper{HasContractInfoFn: func(ctx sdk.Context, contractAddress sdk.AccAddress) bool {
+ return contractAddress.Equals(myContract)
+ }}
+ m := NewMsgServer(k)
+
+ specs := map[string]struct {
+ src types.MsgSetPriceFeedContract
+ setup func(ctx sdk.Context)
+ expErr bool
+ expLimit sdk.Coin
+ expSchedule func(t *testing.T, ctx sdk.Context)
+ }{
+ "limit stored with scheduler for existing contract": {
+ setup: func(ctx sdk.Context) {},
+ src: types.MsgSetPriceFeedContract{
+ Authority: k.GetAuthority(),
+ Contract: myContract.String(),
+ },
+ expLimit: myAmount,
+ expSchedule: func(t *testing.T, ctx sdk.Context) {
+ assert.True(t, k.HasScheduledTask(ctx, types.SchedulerTaskHandleEpoch, myContract, true))
+ },
+ },
+ "fails for non existing contract": {
+ setup: func(ctx sdk.Context) {},
+ src: types.MsgSetPriceFeedContract{
+ Authority: k.GetAuthority(),
+ Contract: sdk.AccAddress(rand.Bytes(32)).String(),
+ },
+ expErr: true,
+ },
+ "unauthorized rejected": {
+ setup: func(ctx sdk.Context) {},
+ src: types.MsgSetPriceFeedContract{
+ Authority: myContract.String(),
+ Contract: myContract.String(),
+ },
+ expErr: true,
+ },
+ "invalid data rejected": {
+ setup: func(ctx sdk.Context) {},
+ src: types.MsgSetPriceFeedContract{},
+ expErr: true,
+ },
+ }
+ for name, spec := range specs {
+ t.Run(name, func(t *testing.T) {
+ ctx, _ := pCtx.CacheContext()
+ spec.setup(ctx)
+
+ // when
+ gotRsp, gotErr := m.SetPriceFeedContract(sdk.WrapSDKContext(ctx), &spec.src)
+
+ // then
+ if spec.expErr {
+ require.Error(t, gotErr)
+ return
+ }
+ require.NoError(t, gotErr)
+ assert.NotNil(t, gotRsp)
+ // and scheduled
+ spec.expSchedule(t, ctx)
+ })
+ }
+}
diff --git a/x/meshsecurity/keeper/scheduler.go b/x/meshsecurity/keeper/scheduler.go
index 194058c2..6fe4ec6d 100644
--- a/x/meshsecurity/keeper/scheduler.go
+++ b/x/meshsecurity/keeper/scheduler.go
@@ -13,8 +13,8 @@ import (
"github.com/osmosis-labs/mesh-security-sdk/x/meshsecurity/types"
)
-// ScheduleRegularRebalanceTask schedule a rebalance task for the given virtual staking contract using params defined epoch length
-func (k Keeper) ScheduleRegularRebalanceTask(ctx sdk.Context, contract sdk.AccAddress) error {
+// ScheduleRegularHandleEpochTask schedule a handle epoch task for the given virtual staking contract using params defined epoch length
+func (k Keeper) ScheduleRegularHandleEpochTask(ctx sdk.Context, contract sdk.AccAddress) error {
if !k.wasm.HasContractInfo(ctx, contract) {
return types.ErrUnknown.Wrapf("contract: %s", contract.String())
}
diff --git a/x/meshsecurity/types/codec.go b/x/meshsecurity/types/codec.go
index da67291d..5ff9673d 100644
--- a/x/meshsecurity/types/codec.go
+++ b/x/meshsecurity/types/codec.go
@@ -11,6 +11,7 @@ import (
// RegisterLegacyAminoCodec register types with legacy amino
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgSetVirtualStakingMaxCap{}, "meshsecurity/MsgSetVirtualStakingMaxCap", nil)
+ cdc.RegisterConcrete(&MsgSetPriceFeedContract{}, "meshsecurity/MsgSetPriceFeedContract", nil)
}
// RegisterInterfaces register types with interface registry
@@ -18,6 +19,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgSetVirtualStakingMaxCap{},
+ &MsgSetPriceFeedContract{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
diff --git a/x/meshsecurity/types/errors.go b/x/meshsecurity/types/errors.go
index da76a5a1..b96160ff 100644
--- a/x/meshsecurity/types/errors.go
+++ b/x/meshsecurity/types/errors.go
@@ -9,4 +9,5 @@ var (
ErrMaxCapExceeded = errorsmod.Register(ModuleName, 2, "max cap exceeded")
ErrUnsupported = errorsmod.Register(ModuleName, 3, "unsupported")
ErrUnknown = errorsmod.Register(ModuleName, 4, "unknown")
+ ErrDuplicate = errorsmod.Register(ModuleName, 5, "contract duplicated")
)
diff --git a/x/meshsecurity/types/tx.go b/x/meshsecurity/types/tx.go
index 33b1056e..688b29a2 100644
--- a/x/meshsecurity/types/tx.go
+++ b/x/meshsecurity/types/tx.go
@@ -12,7 +12,7 @@ func (msg MsgSetVirtualStakingMaxCap) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}
-// GetSigners returns the expected signers for MsgSoftwareUpgrade.
+// GetSigners returns the expected signers for MsgSetVirtualStakingMaxCap.
func (msg MsgSetVirtualStakingMaxCap) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
return []sdk.AccAddress{addr}
@@ -31,3 +31,25 @@ func (msg MsgSetVirtualStakingMaxCap) ValidateBasic() error {
}
return nil
}
+
+// GetSignBytes implements the LegacyMsg interface.
+func (msg MsgSetPriceFeedContract) GetSignBytes() []byte {
+ return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
+}
+
+// GetSigners returns the expected signers for MsgSetPriceFeedContract.
+func (msg MsgSetPriceFeedContract) GetSigners() []sdk.AccAddress {
+ addr, _ := sdk.AccAddressFromBech32(msg.Authority)
+ return []sdk.AccAddress{addr}
+}
+
+// ValidateBasic validate basic constraints
+func (msg MsgSetPriceFeedContract) ValidateBasic() error {
+ if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
+ return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", err)
+ }
+ if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
+ return errorsmod.Wrap(err, "contract")
+ }
+ return nil
+}
diff --git a/x/meshsecurity/types/tx.pb.go b/x/meshsecurity/types/tx.pb.go
index 1372d1b9..4763b3e5 100644
--- a/x/meshsecurity/types/tx.pb.go
+++ b/x/meshsecurity/types/tx.pb.go
@@ -114,9 +114,91 @@ func (m *MsgSetVirtualStakingMaxCapResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgSetVirtualStakingMaxCapResponse proto.InternalMessageInfo
+// MsgSetPriceFeedContract sets the price feed contract to the chain
+// to trigger handle epoch task
+type MsgSetPriceFeedContract struct {
+ // Authority is the address that controls the module (defaults to x/gov unless
+ // overwritten).
+ Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
+ // Contract is the address of the price feed smart contract.
+ Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"`
+}
+
+func (m *MsgSetPriceFeedContract) Reset() { *m = MsgSetPriceFeedContract{} }
+func (m *MsgSetPriceFeedContract) String() string { return proto.CompactTextString(m) }
+func (*MsgSetPriceFeedContract) ProtoMessage() {}
+func (*MsgSetPriceFeedContract) Descriptor() ([]byte, []int) {
+ return fileDescriptor_ca993316ec9770c4, []int{2}
+}
+func (m *MsgSetPriceFeedContract) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *MsgSetPriceFeedContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgSetPriceFeedContract.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 *MsgSetPriceFeedContract) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgSetPriceFeedContract.Merge(m, src)
+}
+func (m *MsgSetPriceFeedContract) XXX_Size() int {
+ return m.Size()
+}
+func (m *MsgSetPriceFeedContract) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgSetPriceFeedContract.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgSetPriceFeedContract proto.InternalMessageInfo
+
+// MsgSetPriceFeedContractResponse returns result data.
+type MsgSetPriceFeedContractResponse struct {
+}
+
+func (m *MsgSetPriceFeedContractResponse) Reset() { *m = MsgSetPriceFeedContractResponse{} }
+func (m *MsgSetPriceFeedContractResponse) String() string { return proto.CompactTextString(m) }
+func (*MsgSetPriceFeedContractResponse) ProtoMessage() {}
+func (*MsgSetPriceFeedContractResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_ca993316ec9770c4, []int{3}
+}
+func (m *MsgSetPriceFeedContractResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *MsgSetPriceFeedContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgSetPriceFeedContractResponse.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 *MsgSetPriceFeedContractResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgSetPriceFeedContractResponse.Merge(m, src)
+}
+func (m *MsgSetPriceFeedContractResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *MsgSetPriceFeedContractResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgSetPriceFeedContractResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgSetPriceFeedContractResponse proto.InternalMessageInfo
+
func init() {
proto.RegisterType((*MsgSetVirtualStakingMaxCap)(nil), "osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCap")
proto.RegisterType((*MsgSetVirtualStakingMaxCapResponse)(nil), "osmosis.meshsecurity.v1beta1.MsgSetVirtualStakingMaxCapResponse")
+ proto.RegisterType((*MsgSetPriceFeedContract)(nil), "osmosis.meshsecurity.v1beta1.MsgSetPriceFeedContract")
+ proto.RegisterType((*MsgSetPriceFeedContractResponse)(nil), "osmosis.meshsecurity.v1beta1.MsgSetPriceFeedContractResponse")
}
func init() {
@@ -124,7 +206,7 @@ func init() {
}
var fileDescriptor_ca993316ec9770c4 = []byte{
- // 378 bytes of a gzipped FileDescriptorProto
+ // 439 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcd, 0x2f, 0xce, 0xcd,
0x2f, 0xce, 0x2c, 0xd6, 0xcf, 0x4d, 0x2d, 0xce, 0x28, 0x4e, 0x4d, 0x2e, 0x2d, 0xca, 0x2c, 0xa9,
0xd4, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f,
@@ -141,14 +223,18 @@ var fileDescriptor_ca993316ec9770c4 = []byte{
0x1f, 0xea, 0x39, 0xe7, 0x67, 0xe6, 0x39, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0xc4, 0x96, 0x0b,
0xb6, 0xd3, 0xca, 0xaa, 0xe9, 0xf9, 0x06, 0x2d, 0x84, 0x2d, 0x5d, 0xcf, 0x37, 0x68, 0xa9, 0xa3,
0x04, 0x22, 0x6e, 0xf7, 0x2a, 0xa9, 0x70, 0x29, 0xe1, 0x96, 0x0d, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf,
- 0x2b, 0x4e, 0x35, 0x9a, 0xcb, 0xc8, 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0x34, 0x95, 0x91, 0x4b, 0x1c,
- 0x97, 0xcf, 0x2d, 0xf4, 0xf0, 0xc5, 0x8c, 0x1e, 0x6e, 0x5b, 0xa4, 0x1c, 0xc8, 0xd5, 0x09, 0x73,
- 0x9f, 0x53, 0xcc, 0x89, 0x87, 0x72, 0x0c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8,
- 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7,
- 0x10, 0x65, 0x97, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xb5, 0x49,
- 0x37, 0x27, 0x31, 0x09, 0x92, 0xd2, 0x74, 0x61, 0xf6, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0x57, 0xa0,
- 0xa6, 0xbe, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0xcc, 0x1b, 0x03, 0x02, 0x00, 0x00,
- 0xff, 0xff, 0x7a, 0xbb, 0x3f, 0x0f, 0xa2, 0x02, 0x00, 0x00,
+ 0x2b, 0x4e, 0x55, 0xea, 0x61, 0xe4, 0x12, 0x87, 0x28, 0x0b, 0x28, 0xca, 0x4c, 0x4e, 0x75, 0x4b,
+ 0x4d, 0x4d, 0x71, 0x86, 0xb9, 0x9b, 0x6c, 0x1f, 0x5b, 0x99, 0x63, 0xba, 0x5b, 0x05, 0x8b, 0xbb,
+ 0x31, 0xac, 0x54, 0x52, 0xe4, 0x92, 0xc7, 0x21, 0x05, 0x73, 0xb1, 0xd1, 0x1a, 0x26, 0x2e, 0x66,
+ 0xdf, 0xe2, 0x74, 0xa1, 0xa9, 0x8c, 0x5c, 0xe2, 0xb8, 0xe2, 0xca, 0x42, 0x0f, 0x5f, 0x5a, 0xd2,
+ 0xc3, 0x1d, 0x2e, 0x52, 0x0e, 0xe4, 0xea, 0x84, 0xb9, 0x4f, 0xa8, 0x87, 0x91, 0x4b, 0x04, 0x6b,
+ 0x70, 0x9a, 0x12, 0x63, 0x34, 0x86, 0x36, 0x29, 0x5b, 0xb2, 0xb4, 0xc1, 0x9c, 0xe3, 0x14, 0x73,
+ 0xe2, 0xa1, 0x1c, 0xc3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7,
+ 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xd9, 0xa5,
+ 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xad, 0xd1, 0xcd, 0x49, 0x4c,
+ 0x82, 0x64, 0x55, 0x5d, 0x98, 0x65, 0xba, 0xc5, 0x29, 0xd9, 0xfa, 0x15, 0xa8, 0xd9, 0xb7, 0xa4,
+ 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x9c, 0x75, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x34,
+ 0x74, 0xe2, 0x9a, 0xe3, 0x03, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -166,6 +252,9 @@ type MsgClient interface {
// SetVirtualStakingMaxCap creates or updates a maximum cap limit for virtual
// staking coins
SetVirtualStakingMaxCap(ctx context.Context, in *MsgSetVirtualStakingMaxCap, opts ...grpc.CallOption) (*MsgSetVirtualStakingMaxCapResponse, error)
+ // SetPriceFeedContract sets the price feed contract to the chain
+ // to trigger handle epoch task
+ SetPriceFeedContract(ctx context.Context, in *MsgSetPriceFeedContract, opts ...grpc.CallOption) (*MsgSetPriceFeedContractResponse, error)
}
type msgClient struct {
@@ -185,11 +274,23 @@ func (c *msgClient) SetVirtualStakingMaxCap(ctx context.Context, in *MsgSetVirtu
return out, nil
}
+func (c *msgClient) SetPriceFeedContract(ctx context.Context, in *MsgSetPriceFeedContract, opts ...grpc.CallOption) (*MsgSetPriceFeedContractResponse, error) {
+ out := new(MsgSetPriceFeedContractResponse)
+ err := c.cc.Invoke(ctx, "/osmosis.meshsecurity.v1beta1.Msg/SetPriceFeedContract", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// MsgServer is the server API for Msg service.
type MsgServer interface {
// SetVirtualStakingMaxCap creates or updates a maximum cap limit for virtual
// staking coins
SetVirtualStakingMaxCap(context.Context, *MsgSetVirtualStakingMaxCap) (*MsgSetVirtualStakingMaxCapResponse, error)
+ // SetPriceFeedContract sets the price feed contract to the chain
+ // to trigger handle epoch task
+ SetPriceFeedContract(context.Context, *MsgSetPriceFeedContract) (*MsgSetPriceFeedContractResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@@ -199,6 +300,9 @@ type UnimplementedMsgServer struct {
func (*UnimplementedMsgServer) SetVirtualStakingMaxCap(ctx context.Context, req *MsgSetVirtualStakingMaxCap) (*MsgSetVirtualStakingMaxCapResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetVirtualStakingMaxCap not implemented")
}
+func (*UnimplementedMsgServer) SetPriceFeedContract(ctx context.Context, req *MsgSetPriceFeedContract) (*MsgSetPriceFeedContractResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SetPriceFeedContract not implemented")
+}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@@ -222,6 +326,24 @@ func _Msg_SetVirtualStakingMaxCap_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
+func _Msg_SetPriceFeedContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MsgSetPriceFeedContract)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(MsgServer).SetPriceFeedContract(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/osmosis.meshsecurity.v1beta1.Msg/SetPriceFeedContract",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(MsgServer).SetPriceFeedContract(ctx, req.(*MsgSetPriceFeedContract))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "osmosis.meshsecurity.v1beta1.Msg",
HandlerType: (*MsgServer)(nil),
@@ -230,6 +352,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "SetVirtualStakingMaxCap",
Handler: _Msg_SetVirtualStakingMaxCap_Handler,
},
+ {
+ MethodName: "SetPriceFeedContract",
+ Handler: _Msg_SetPriceFeedContract_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "osmosis/meshsecurity/v1beta1/tx.proto",
@@ -305,6 +431,66 @@ func (m *MsgSetVirtualStakingMaxCapResponse) MarshalToSizedBuffer(dAtA []byte) (
return len(dAtA) - i, nil
}
+func (m *MsgSetPriceFeedContract) 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 *MsgSetPriceFeedContract) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgSetPriceFeedContract) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Contract) > 0 {
+ i -= len(m.Contract)
+ copy(dAtA[i:], m.Contract)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Contract)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if len(m.Authority) > 0 {
+ i -= len(m.Authority)
+ copy(dAtA[i:], m.Authority)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *MsgSetPriceFeedContractResponse) 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 *MsgSetPriceFeedContractResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgSetPriceFeedContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ return len(dAtA) - i, nil
+}
+
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@@ -344,6 +530,32 @@ func (m *MsgSetVirtualStakingMaxCapResponse) Size() (n int) {
return n
}
+func (m *MsgSetPriceFeedContract) 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 = len(m.Contract)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ return n
+}
+
+func (m *MsgSetPriceFeedContractResponse) 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
}
@@ -547,6 +759,170 @@ func (m *MsgSetVirtualStakingMaxCapResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *MsgSetPriceFeedContract) 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: MsgSetPriceFeedContract: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgSetPriceFeedContract: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Contract", 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.Contract = string(dAtA[iNdEx:postIndex])
+ 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 *MsgSetPriceFeedContractResponse) 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: MsgSetPriceFeedContractResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgSetPriceFeedContractResponse: 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 skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0