From bed5179ec912da0da7b1ef0cf199051d1272a9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDongLieu=E2=80=9D?= Date: Tue, 5 Nov 2024 10:40:28 +0700 Subject: [PATCH 01/10] mock --- proto/reserve/oracle/tx.proto | 20 +- x/oracle/client/cli/tx.go | 31 ++ x/oracle/keeper/band_oracle.go | 126 ++++++++ x/oracle/module/genesis.go | 1 + x/oracle/types/msgs.go | 9 + x/oracle/types/tx.pb.go | 525 ++++++++++++++++++++++++++++++--- x/vaults/types/params.go | 2 +- x/vaults/types/params.pb.go | 141 +++++---- 8 files changed, 734 insertions(+), 121 deletions(-) diff --git a/proto/reserve/oracle/tx.proto b/proto/reserve/oracle/tx.proto index 206fa0b1..45e06d78 100644 --- a/proto/reserve/oracle/tx.proto +++ b/proto/reserve/oracle/tx.proto @@ -22,6 +22,8 @@ service Msg { rpc UpdateBandParams(MsgUpdateBandParams) returns (MsgUpdateBandParamsResponse); + rpc SetPrice(MsgSetPrice) returns (MsgSetPriceResponse); + rpc UpdateBandOracleRequest(MsgUpdateBandOracleRequestRequest) returns (MsgUpdateBandOracleRequestResponse); rpc DeleteBandOracleRequests(MsgDeleteBandOracleRequests) returns (MsgDeleteBandOracleRequestsResponse); @@ -121,4 +123,20 @@ message MsgUpdateBandOracleRequestParamsRequest { } // MsgUpdateBandOracleRequestParamsResponse define the Msg/UpdateBandOracleRequestParams response type. -message MsgUpdateBandOracleRequestParamsResponse {} \ No newline at end of file +message MsgUpdateBandOracleRequestParamsResponse {} + +message MsgSetPrice{ + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "reserve/x/oracle/MsgSetPrice"; + string denom = 1; + + bytes price = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + + string authority = 3; +} + +message MsgSetPriceResponse {} \ No newline at end of file diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go index fe88f7d0..f0bfd52e 100644 --- a/x/oracle/client/cli/tx.go +++ b/x/oracle/client/cli/tx.go @@ -4,6 +4,7 @@ import ( "fmt" "strconv" + "cosmossdk.io/math" errors "github.com/pkg/errors" "github.com/spf13/cobra" @@ -29,6 +30,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand( NewRequestBandRatesTxCmd(), + NewSetPriceCmd(), ) return cmd @@ -73,3 +75,32 @@ func NewRequestBandRatesTxCmd() *cobra.Command { return cmd } + +func NewSetPriceCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-price [denom] [price]", + Args: cobra.ExactArgs(2), + Short: "set price for denom ", + Long: `set price for denomn. + + Example: + $ onomyd tx mockoracel set-price usdt 1 + `, + + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + price := math.LegacyMustNewDecFromStr(args[1]) + addr := clientCtx.GetFromAddress() + msg := types.NewSetPrice(args[0], addr.String(), price) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index a5efc1c4..46ac4ca7 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -547,3 +547,129 @@ func (k *Keeper) getPreviousRecordIDs(ctx context.Context, clientID uint64) []ui return staleIDs } + +func (k Keeper) SetInitPrice(ctx context.Context) error { + initPrice := []*types.BandPriceState{ + // multiplier = 1000 + { + Symbol: "nomUSD", + Rate: math.NewInt(10000), //1 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + }, + { + Symbol: "nomEUR", + Rate: math.NewInt(10910), //1.091 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), time.Now().Unix()), + }, + { + Symbol: "nomJPY", + Rate: math.NewInt(66), //0.0066 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), time.Now().Unix()), + }, + { + Symbol: "anom", + Rate: math.NewInt(330), //0.03 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.03"), time.Now().Unix()), + }, + { + Symbol: "usdt", + Rate: math.NewInt(10000), //1 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + }, + { + Symbol: "usdc", + Rate: math.NewInt(10000), //1 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + }, + { + Symbol: "eurt", + Rate: math.NewInt(10910), //1.091 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), time.Now().Unix()), + }, + { + Symbol: "jpyt", + Rate: math.NewInt(66), //0.0066 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), time.Now().Unix()), + }, + { + Symbol: "uatom", + Rate: math.NewInt(80000), //8 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), + }, + { + Symbol: "uosmo", + Rate: math.NewInt(4500), //0.45 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), time.Now().Unix()), + }, + { + Symbol: "uusdt", + Rate: math.NewInt(10000), //0.45 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + }, + { + Symbol: "atom", + Rate: math.NewInt(80000), //0.45 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), + }, + { + Symbol: "ibc/E50A183716AB596378047D9688FE648CD3470C4D196FB4C2C8E61989DB48562E", //transfer/channel-10/transfer/channel-7/transfer/channel-143/erc20/tether/usdt + Rate: math.NewInt(10000), + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + }, + { + Symbol: "ibc/BE4C72028781730B9DF0542466EB26DEA6DDD42C32316D774F943151F6010320", // transfer/channel-5/usdt + Rate: math.NewInt(10000), + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + }, + { + Symbol: "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518", //transfer/channel-0/uosmo + Rate: math.NewInt(4500), //0.45 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), time.Now().Unix()), + }, + { + Symbol: "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", //ibc-atom + Rate: math.NewInt(80000), //0.45 + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), + }, + { + Symbol: "ibc/BC599B88586F8C22E408569D7F6FAD40AEBF808A67D2051B86958CBB5F0A16B0", //usdt + Rate: math.NewInt(10000), + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + }, + } + + for _, i := range initPrice { + err := k.SetBandPriceState(ctx, i.Symbol, i) + if err != nil { + return err + } + } + return nil +} + +func (k Keeper) SetPrice(goCtx context.Context, msg *types.MsgSetPrice) (*types.MsgSetPriceResponse, error) { + k.SetBandPriceState(goCtx, msg.Denom, &types.BandPriceState{ + Symbol: msg.Denom, + Rate: math.NewInt(10000).ToLegacyDec().Mul(msg.Price).TruncateInt(), + ResolveTime: uint64(time.Now().Unix()), + PriceState: *types.NewPriceState(msg.Price, time.Now().Unix()), + }) + return &types.MsgSetPriceResponse{}, nil +} diff --git a/x/oracle/module/genesis.go b/x/oracle/module/genesis.go index 5148f5fc..623703bf 100644 --- a/x/oracle/module/genesis.go +++ b/x/oracle/module/genesis.go @@ -21,6 +21,7 @@ func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisSta sdkCtx.Logger().Info("can not set band price state for symbol %s", bandPriceState.Symbol) } } + k.SetInitPrice(ctx) for _, bandOracleRequest := range genState.BandOracleRequests { err := k.SetBandOracleRequest(ctx, *bandOracleRequest) diff --git a/x/oracle/types/msgs.go b/x/oracle/types/msgs.go index d13237dd..c8c61b97 100644 --- a/x/oracle/types/msgs.go +++ b/x/oracle/types/msgs.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + math "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -90,3 +91,11 @@ func (msg MsgRequestBandRates) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } + +func NewSetPrice(denom, authority string, price math.LegacyDec) MsgSetPrice { + return MsgSetPrice{ + Denom: denom, + Price: price, + Authority: authority, + } +} diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index c51977ab..bd84dfae 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -5,6 +5,7 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -516,6 +517,95 @@ func (m *MsgUpdateBandOracleRequestParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateBandOracleRequestParamsResponse proto.InternalMessageInfo +type MsgSetPrice struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` + Authority string `protobuf:"bytes,3,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *MsgSetPrice) Reset() { *m = MsgSetPrice{} } +func (m *MsgSetPrice) String() string { return proto.CompactTextString(m) } +func (*MsgSetPrice) ProtoMessage() {} +func (*MsgSetPrice) Descriptor() ([]byte, []int) { + return fileDescriptor_2ca24ac8eaee815d, []int{12} +} +func (m *MsgSetPrice) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetPrice.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 *MsgSetPrice) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetPrice.Merge(m, src) +} +func (m *MsgSetPrice) XXX_Size() int { + return m.Size() +} +func (m *MsgSetPrice) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetPrice.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetPrice proto.InternalMessageInfo + +func (m *MsgSetPrice) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *MsgSetPrice) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +type MsgSetPriceResponse struct { +} + +func (m *MsgSetPriceResponse) Reset() { *m = MsgSetPriceResponse{} } +func (m *MsgSetPriceResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetPriceResponse) ProtoMessage() {} +func (*MsgSetPriceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2ca24ac8eaee815d, []int{13} +} +func (m *MsgSetPriceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetPriceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetPriceResponse.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 *MsgSetPriceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetPriceResponse.Merge(m, src) +} +func (m *MsgSetPriceResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetPriceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetPriceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetPriceResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "reserve.oracle.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "reserve.oracle.MsgUpdateParamsResponse") @@ -529,58 +619,68 @@ func init() { proto.RegisterType((*MsgDeleteBandOracleRequestsResponse)(nil), "reserve.oracle.MsgDeleteBandOracleRequestsResponse") proto.RegisterType((*MsgUpdateBandOracleRequestParamsRequest)(nil), "reserve.oracle.MsgUpdateBandOracleRequestParamsRequest") proto.RegisterType((*MsgUpdateBandOracleRequestParamsResponse)(nil), "reserve.oracle.MsgUpdateBandOracleRequestParamsResponse") + proto.RegisterType((*MsgSetPrice)(nil), "reserve.oracle.MsgSetPrice") + proto.RegisterType((*MsgSetPriceResponse)(nil), "reserve.oracle.MsgSetPriceResponse") } func init() { proto.RegisterFile("reserve/oracle/tx.proto", fileDescriptor_2ca24ac8eaee815d) } var fileDescriptor_2ca24ac8eaee815d = []byte{ - // 733 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xbd, 0x6f, 0xd3, 0x4e, - 0x18, 0xce, 0xf5, 0x4b, 0xca, 0xdb, 0x9f, 0x7e, 0x14, 0xb7, 0x34, 0xa9, 0x4b, 0x9c, 0x36, 0x2d, - 0x6a, 0x08, 0x10, 0xab, 0xa9, 0x04, 0x34, 0x0b,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x62, - 0x18, 0x0e, 0xa6, 0xf4, 0x85, 0xeb, 0x74, 0x6c, 0x53, 0x0b, 0x43, 0xa5, 0x65, 0x18, 0x61, 0x9d, - 0xf3, 0x03, 0x33, 0xa8, 0x3c, 0x5a, 0x9b, 0xac, 0x8a, 0x22, 0x54, 0x59, 0xfd, 0x46, 0xf6, 0xf0, - 0x67, 0x31, 0xf3, 0xe9, 0xf4, 0xa0, 0x82, 0x34, 0x9e, 0x50, 0xbf, 0xfb, 0xe6, 0xf4, 0xa0, 0x12, - 0x96, 0x7a, 0x77, 0x7a, 0x50, 0x99, 0xe4, 0x78, 0x23, 0xe8, 0x4a, 0x53, 0x90, 0x8b, 0x98, 0x34, - 0x4c, 0xbb, 0xc4, 0xa6, 0xb8, 0xb4, 0x87, 0x60, 0x7c, 0x8d, 0x9a, 0x1a, 0xde, 0xea, 0x61, 0xea, - 0x36, 0x74, 0xdb, 0xd0, 0x74, 0x17, 0x53, 0x69, 0x12, 0x46, 0x28, 0xb6, 0x0d, 0xec, 0x30, 0x36, - 0x1a, 0x7f, 0x93, 0x0a, 0x00, 0x0e, 0x8b, 0x6d, 0x76, 0x0c, 0x1f, 0xf4, 0x90, 0x96, 0xe5, 0x96, - 0x55, 0xa3, 0x5e, 0x7b, 0xbb, 0x5f, 0xcc, 0xfc, 0xde, 0x2f, 0x66, 0x3c, 0x70, 0x3c, 0xc7, 0x43, - 0x26, 0x87, 0xc8, 0xa2, 0xad, 0x4a, 0x05, 0x98, 0x8e, 0x31, 0x07, 0x08, 0xbf, 0x31, 0x84, 0x0c, - 0xbd, 0xe7, 0xbe, 0xa6, 0xe4, 0x2b, 0x30, 0xda, 0xd2, 0x6d, 0xa3, 0x29, 0xe8, 0x2e, 0x47, 0x75, - 0x0f, 0x1b, 0x35, 0x86, 0x3c, 0xed, 0x35, 0x68, 0x05, 0x16, 0x91, 0xa5, 0xf8, 0x09, 0x72, 0x9c, - 0x68, 0x14, 0x2e, 0x67, 0x19, 0x35, 0x07, 0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 0x41, 0xff, 0x76, 0x39, - 0xb3, 0xeb, 0xe6, 0x12, 0x21, 0x86, 0x41, 0xb1, 0x5d, 0x92, 0xf6, 0x8d, 0xb4, 0x87, 0x20, 0x97, - 0xa0, 0xab, 0xb4, 0x98, 0x5a, 0x28, 0x6e, 0x31, 0xc9, 0xb5, 0xcb, 0xa4, 0x70, 0x08, 0xaf, 0x21, - 0x9f, 0x78, 0xb0, 0xe3, 0xb8, 0x24, 0x05, 0xcb, 0x4b, 0x97, 0x08, 0x0e, 0xba, 0x7f, 0x40, 0x50, - 0x48, 0x1d, 0x2c, 0xe9, 0xd1, 0xc5, 0x39, 0x09, 0x27, 0x54, 0x7e, 0x7c, 0xf9, 0x44, 0x06, 0x4a, - 0x1e, 0xde, 0xf3, 0x7e, 0xe2, 0x1b, 0xab, 0x87, 0xc7, 0x0a, 0x3a, 0x3a, 0x56, 0xd0, 0xaf, 0x63, - 0x05, 0xbd, 0x3f, 0x51, 0x32, 0x47, 0x27, 0x4a, 0xe6, 0xc7, 0x89, 0x92, 0x79, 0xa5, 0x9a, 0x1d, - 0x77, 0xa3, 0xd7, 0xaa, 0xb6, 0x89, 0xa5, 0x12, 0x9b, 0x58, 0xbb, 0xfe, 0x95, 0xa4, 0x4d, 0x36, - 0xd5, 0xfe, 0x95, 0x65, 0x27, 0xb8, 0x57, 0xed, 0x76, 0x31, 0x6d, 0x8d, 0xf8, 0x01, 0x4b, 0x7f, - 0x03, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x57, 0xc4, 0x01, 0x76, 0x09, 0x00, 0x00, + // 854 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xbb, 0x4f, 0xdb, 0x5a, + 0x18, 0x8f, 0x79, 0x44, 0x37, 0x07, 0x74, 0x2f, 0xd7, 0x3c, 0x12, 0x1c, 0x92, 0x40, 0xc2, 0x15, + 0xb9, 0xb9, 0x97, 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, 0xe1, + 0xcd, 0x39, 0xf9, 0x86, 0x18, 0xf7, 0xe8, 0xf6, 0x89, 0x04, 0x14, 0x37, 0xb8, 0x6f, 0x7d, 0x05, + 0xd5, 0x56, 0x8f, 0xcf, 0xb3, 0xcc, 0xc9, 0x79, 0x96, 0xf9, 0x71, 0x9e, 0x65, 0xde, 0x5e, 0x64, + 0x63, 0x27, 0x17, 0xd9, 0xd8, 0xb7, 0x8b, 0x6c, 0xec, 0x39, 0xaf, 0xa8, 0xe6, 0x56, 0xbb, 0x59, + 0x96, 0x90, 0xc6, 0x23, 0x1d, 0x69, 0x1d, 0xfb, 0xab, 0x4d, 0x42, 0xdb, 0x7c, 0xd7, 0x05, 0x34, + 0x3b, 0x2d, 0x88, 0x9b, 0x71, 0x3b, 0x60, 0xf1, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x58, + 0xd0, 0x2b, 0x99, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -600,6 +700,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) RequestBandRates(ctx context.Context, in *MsgRequestBandRates, opts ...grpc.CallOption) (*MsgRequestBandRatesResponse, error) UpdateBandParams(ctx context.Context, in *MsgUpdateBandParams, opts ...grpc.CallOption) (*MsgUpdateBandParamsResponse, error) + SetPrice(ctx context.Context, in *MsgSetPrice, opts ...grpc.CallOption) (*MsgSetPriceResponse, error) UpdateBandOracleRequest(ctx context.Context, in *MsgUpdateBandOracleRequestRequest, opts ...grpc.CallOption) (*MsgUpdateBandOracleRequestResponse, error) DeleteBandOracleRequests(ctx context.Context, in *MsgDeleteBandOracleRequests, opts ...grpc.CallOption) (*MsgDeleteBandOracleRequestsResponse, error) UpdateBandOracleRequestParams(ctx context.Context, in *MsgUpdateBandOracleRequestParamsRequest, opts ...grpc.CallOption) (*MsgUpdateBandOracleRequestParamsResponse, error) @@ -640,6 +741,15 @@ func (c *msgClient) UpdateBandParams(ctx context.Context, in *MsgUpdateBandParam return out, nil } +func (c *msgClient) SetPrice(ctx context.Context, in *MsgSetPrice, opts ...grpc.CallOption) (*MsgSetPriceResponse, error) { + out := new(MsgSetPriceResponse) + err := c.cc.Invoke(ctx, "/reserve.oracle.Msg/SetPrice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) UpdateBandOracleRequest(ctx context.Context, in *MsgUpdateBandOracleRequestRequest, opts ...grpc.CallOption) (*MsgUpdateBandOracleRequestResponse, error) { out := new(MsgUpdateBandOracleRequestResponse) err := c.cc.Invoke(ctx, "/reserve.oracle.Msg/UpdateBandOracleRequest", in, out, opts...) @@ -674,6 +784,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) RequestBandRates(context.Context, *MsgRequestBandRates) (*MsgRequestBandRatesResponse, error) UpdateBandParams(context.Context, *MsgUpdateBandParams) (*MsgUpdateBandParamsResponse, error) + SetPrice(context.Context, *MsgSetPrice) (*MsgSetPriceResponse, error) UpdateBandOracleRequest(context.Context, *MsgUpdateBandOracleRequestRequest) (*MsgUpdateBandOracleRequestResponse, error) DeleteBandOracleRequests(context.Context, *MsgDeleteBandOracleRequests) (*MsgDeleteBandOracleRequestsResponse, error) UpdateBandOracleRequestParams(context.Context, *MsgUpdateBandOracleRequestParamsRequest) (*MsgUpdateBandOracleRequestParamsResponse, error) @@ -692,6 +803,9 @@ func (*UnimplementedMsgServer) RequestBandRates(ctx context.Context, req *MsgReq func (*UnimplementedMsgServer) UpdateBandParams(ctx context.Context, req *MsgUpdateBandParams) (*MsgUpdateBandParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateBandParams not implemented") } +func (*UnimplementedMsgServer) SetPrice(ctx context.Context, req *MsgSetPrice) (*MsgSetPriceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetPrice not implemented") +} func (*UnimplementedMsgServer) UpdateBandOracleRequest(ctx context.Context, req *MsgUpdateBandOracleRequestRequest) (*MsgUpdateBandOracleRequestResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateBandOracleRequest not implemented") } @@ -760,6 +874,24 @@ func _Msg_UpdateBandParams_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Msg_SetPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetPrice) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetPrice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.oracle.Msg/SetPrice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetPrice(ctx, req.(*MsgSetPrice)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_UpdateBandOracleRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgUpdateBandOracleRequestRequest) if err := dec(in); err != nil { @@ -830,6 +962,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateBandParams", Handler: _Msg_UpdateBandParams_Handler, }, + { + MethodName: "SetPrice", + Handler: _Msg_SetPrice_Handler, + }, { MethodName: "UpdateBandOracleRequest", Handler: _Msg_UpdateBandOracleRequest_Handler, @@ -1232,6 +1368,76 @@ func (m *MsgUpdateBandOracleRequestParamsResponse) MarshalToSizedBuffer(dAtA []b return len(dAtA) - i, nil } +func (m *MsgSetPrice) 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 *MsgSetPrice) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 0x1a + } + { + size := m.Price.Size() + i -= size + if _, err := m.Price.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetPriceResponse) 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 *MsgSetPriceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetPriceResponse) 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 @@ -1397,6 +1603,34 @@ func (m *MsgUpdateBandOracleRequestParamsResponse) Size() (n int) { return n } +func (m *MsgSetPrice) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Price.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetPriceResponse) 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 } @@ -2428,6 +2662,203 @@ func (m *MsgUpdateBandOracleRequestParamsResponse) Unmarshal(dAtA []byte) error } return nil } +func (m *MsgSetPrice) 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: MsgSetPrice: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetPrice: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", 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 + } + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + 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 + 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 *MsgSetPriceResponse) 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: MsgSetPriceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetPriceResponse: 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 diff --git a/x/vaults/types/params.go b/x/vaults/types/params.go index 9292db53..5f7ab276 100644 --- a/x/vaults/types/params.go +++ b/x/vaults/types/params.go @@ -14,7 +14,7 @@ var ( DefaultMinInitialDebt = math.NewInt(50_000_000) DefaultRecalculateDebtPeriod = time.Hour DefaultLiquidatePeriod = time.Hour - DefaultMintDenom = []string{"nomUSD"} + DefaultMintDenom = []string{"nomUSD", "nomEUR"} KeyMintingFee = []byte("MintingFee") KeyStabilityFee = []byte("StabilityFee") diff --git a/x/vaults/types/params.pb.go b/x/vaults/types/params.pb.go index 7f9c89c8..2600ff0d 100644 --- a/x/vaults/types/params.pb.go +++ b/x/vaults/types/params.pb.go @@ -81,7 +81,6 @@ type Params struct { MinInitialDebt cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=min_initial_debt,json=minInitialDebt,proto3,customtype=cosmossdk.io/math.Int" json:"min_initial_debt"` AllowedMintDenom []string `protobuf:"bytes,2,rep,name=allowed_mint_denom,json=allowedMintDenom,proto3" json:"allowed_mint_denom,omitempty"` ChargingPeriod time.Duration `protobuf:"bytes,3,opt,name=charging_period,json=chargingPeriod,proto3,stdduration" json:"charging_period"` - LiquidatePeriod time.Duration `protobuf:"bytes,4,opt,name=liquidate_period,json=liquidatePeriod,proto3,stdduration" json:"liquidate_period"` } func (m *Params) Reset() { *m = Params{} } @@ -500,77 +499,75 @@ func init() { func init() { proto.RegisterFile("reserve/vaults/params.proto", fileDescriptor_1f12ab0d072f9f7c) } var fileDescriptor_1f12ab0d072f9f7c = []byte{ - // 1107 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x3b, 0x6f, 0x1b, 0x47, - 0x10, 0xe6, 0x91, 0x14, 0x6d, 0x0d, 0x6d, 0x8a, 0xda, 0xc8, 0x0a, 0x4d, 0x21, 0x14, 0xc1, 0x22, - 0x10, 0x84, 0xf8, 0x2e, 0xa6, 0x81, 0xc4, 0x30, 0x92, 0x42, 0x12, 0xa9, 0x80, 0x30, 0xed, 0x48, - 0x27, 0xd9, 0x06, 0x9c, 0x82, 0x58, 0x1e, 0xd7, 0xa7, 0x85, 0xee, 0x6e, 0xa9, 0xbb, 0x25, 0x2d, - 0xfe, 0x83, 0x40, 0x95, 0xcb, 0x34, 0x02, 0xf2, 0x40, 0x80, 0x94, 0x2e, 0xfc, 0x13, 0x52, 0xb8, - 0x34, 0x5c, 0x05, 0x41, 0xe0, 0x04, 0x52, 0xe1, 0x54, 0x69, 0xd3, 0x06, 0xfb, 0x38, 0xea, 0xf4, - 0x48, 0x60, 0x45, 0x0d, 0xc1, 0xdd, 0x9d, 0xf9, 0x76, 0xe6, 0x9b, 0x6f, 0x66, 0x0f, 0xe6, 0x42, - 0x12, 0x91, 0x70, 0x48, 0xac, 0x21, 0x1e, 0x78, 0x3c, 0xb2, 0xfa, 0x38, 0xc4, 0x7e, 0x64, 0xf6, - 0x43, 0xc6, 0x19, 0x2a, 0xe8, 0x43, 0x53, 0x1d, 0x96, 0x67, 0x5c, 0xe6, 0x32, 0x79, 0x64, 0x89, - 0x7f, 0xca, 0xaa, 0x3c, 0x8d, 0x7d, 0x1a, 0x30, 0x4b, 0xfe, 0xea, 0xad, 0x8a, 0xc3, 0x22, 0x9f, - 0x45, 0x56, 0x17, 0x47, 0xc4, 0x1a, 0xde, 0xec, 0x12, 0x8e, 0x6f, 0x5a, 0x0e, 0xa3, 0x81, 0x3e, - 0xbf, 0xae, 0xce, 0x3b, 0x0a, 0x4b, 0x2d, 0x62, 0x57, 0x97, 0x31, 0xd7, 0x23, 0x96, 0x5c, 0x75, - 0x07, 0x4f, 0xac, 0xde, 0x20, 0xc4, 0x9c, 0xb2, 0xd8, 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bd, 0x53, 0xfd, - 0xf3, 0xdb, 0x79, 0x63, 0xef, 0xed, 0xf3, 0xc5, 0xf7, 0x63, 0x5d, 0xec, 0xc6, 0xca, 0x50, 0x9c, - 0xd6, 0xfe, 0xca, 0x02, 0x7a, 0x28, 0x76, 0xee, 0x61, 0x1f, 0xbb, 0x24, 0xd4, 0x54, 0x7f, 0x00, - 0x90, 0xa0, 0x41, 0x92, 0x6c, 0x4f, 0xfa, 0xe3, 0xfc, 0xb7, 0x60, 0x46, 0x54, 0xc2, 0x61, 0x9e, - 0x87, 0x39, 0x09, 0xb1, 0xd7, 0x91, 0x01, 0x95, 0xd2, 0xb2, 0x1a, 0x9f, 0xe8, 0x6a, 0xcc, 0x9d, - 0xae, 0x46, 0x9b, 0xb8, 0xd8, 0x19, 0x35, 0x88, 0x93, 0xa8, 0x49, 0x83, 0x38, 0x2a, 0x7c, 0xe4, - 0xd3, 0x60, 0x65, 0x0c, 0x69, 0x0b, 0x44, 0xe4, 0xc0, 0x74, 0x9c, 0x14, 0x65, 0x81, 0xbe, 0x26, - 0x73, 0xa1, 0x6b, 0x8a, 0x09, 0x40, 0x75, 0xc9, 0x5d, 0xb8, 0xec, 0xe3, 0x5d, 0x25, 0xa8, 0xec, - 0xff, 0x14, 0xd4, 0x25, 0x1f, 0xef, 0x4a, 0x25, 0x7d, 0x05, 0x57, 0x23, 0x8e, 0xbb, 0xd4, 0xa3, - 0x7c, 0xd4, 0x79, 0x42, 0x48, 0x69, 0xe2, 0x42, 0xd1, 0x5e, 0x19, 0x83, 0xad, 0x12, 0x82, 0x5c, - 0x78, 0x2f, 0x49, 0x47, 0x9f, 0x04, 0xd8, 0xe3, 0xa3, 0x52, 0xee, 0x62, 0xbc, 0x27, 0x20, 0xd7, - 0x14, 0x22, 0x7a, 0x04, 0x79, 0x51, 0x6e, 0x21, 0x70, 0x91, 0xc3, 0xa5, 0x0b, 0x5d, 0x00, 0x1a, - 0x6a, 0x95, 0x90, 0xda, 0xcf, 0x06, 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0x33, 0xfe, 0x36, 0x51, 0x0f, 0xef, 0xb3, 0xf1, 0xc3, 0x2b, 0xdd, 0x16, 0xbf, 0x33, - 0x20, 0x9f, 0xe8, 0x0f, 0x34, 0x0b, 0xb9, 0xa5, 0x95, 0xcd, 0xd6, 0xc3, 0x66, 0x31, 0x55, 0x86, - 0xbd, 0xfd, 0xaa, 0x5e, 0xa1, 0x2a, 0xe4, 0xdb, 0xad, 0xf5, 0x07, 0xad, 0xc6, 0xd2, 0x66, 0xeb, - 0xfe, 0x17, 0x45, 0xa3, 0x3c, 0xb5, 0xb7, 0x5f, 0x4d, 0x6e, 0xa1, 0x32, 0x5c, 0xde, 0xb4, 0x97, - 0xee, 0x6f, 0xac, 0x36, 0xed, 0x62, 0xba, 0x7c, 0x65, 0x6f, 0xbf, 0x3a, 0x5e, 0x0b, 0xd4, 0x95, - 0xf6, 0x97, 0x1b, 0xcd, 0x46, 0x31, 0xa3, 0x50, 0xd5, 0x0a, 0x55, 0x00, 0x62, 0x88, 0x66, 0xa3, - 0x98, 0x2d, 0x17, 0xf6, 0xf6, 0xab, 0x89, 0x9d, 0x72, 0xf6, 0xeb, 0x1f, 0x2a, 0xa9, 0xe5, 0xd6, - 0xcb, 0x83, 0x8a, 0xf1, 0xea, 0xa0, 0x62, 0xfc, 0x71, 0x50, 0x31, 0x9e, 0x1d, 0x56, 0x52, 0xaf, - 0x0e, 0x2b, 0xa9, 0x5f, 0x0e, 0x2b, 0xa9, 0xc7, 0x96, 0x4b, 0xf9, 0xd6, 0xa0, 0x6b, 0x3a, 0xcc, - 0xb7, 0x58, 0xc0, 0xfc, 0x91, 0x4c, 0xdb, 0x61, 0x9e, 0x75, 0xea, 0xdb, 0x81, 0x8f, 0xfa, 0x24, - 0xea, 0xe6, 0xa4, 0xc1, 0xad, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x91, 0x71, 0x1a, 0xeb, 0x74, - 0x0a, 0x00, 0x00, + // 1088 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xbb, 0x6f, 0xdb, 0x46, + 0x18, 0x17, 0x25, 0x59, 0x89, 0x3f, 0x25, 0x8a, 0x7c, 0x75, 0x5c, 0x45, 0x46, 0x65, 0x41, 0x43, + 0x61, 0x18, 0x0d, 0xd9, 0x28, 0x40, 0x1b, 0x04, 0xed, 0x60, 0x5b, 0x72, 0x21, 0x44, 0x49, 0x6d, + 0xda, 0x49, 0x80, 0x74, 0x10, 0x4e, 0xe4, 0x85, 0x3e, 0x98, 0xe4, 0xc9, 0xe4, 0x49, 0xb1, 0xfe, + 0x82, 0x16, 0x9e, 0x32, 0x76, 0x31, 0xd0, 0x07, 0x0a, 0x74, 0xcc, 0x90, 0x3f, 0xa1, 0x43, 0xc6, + 0x20, 0x53, 0xd1, 0x21, 0x2d, 0xec, 0x21, 0x9d, 0xba, 0x76, 0x2d, 0xee, 0x41, 0x9b, 0x7e, 0xb4, + 0x48, 0xea, 0x45, 0xd0, 0x7d, 0x8f, 0xdf, 0x7d, 0xdf, 0xef, 0x7b, 0xf0, 0x60, 0x36, 0x22, 0x31, + 0x89, 0x46, 0xc4, 0x1a, 0xe1, 0xa1, 0xcf, 0x63, 0x6b, 0x80, 0x23, 0x1c, 0xc4, 0xe6, 0x20, 0x62, + 0x9c, 0xa1, 0x92, 0x56, 0x9a, 0x4a, 0x59, 0x9d, 0xf6, 0x98, 0xc7, 0xa4, 0xca, 0x12, 0xff, 0x94, + 0x55, 0x75, 0x0a, 0x07, 0x34, 0x64, 0x96, 0xfc, 0xd5, 0xa2, 0x9a, 0xc3, 0xe2, 0x80, 0xc5, 0x56, + 0x1f, 0xc7, 0xc4, 0x1a, 0xdd, 0xe8, 0x13, 0x8e, 0x6f, 0x58, 0x0e, 0xa3, 0xa1, 0xd6, 0x5f, 0x53, + 0xfa, 0x9e, 0xc2, 0x52, 0x87, 0xc4, 0xd5, 0x63, 0xc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 0x23, + 0x79, 0x46, 0xa8, 0xef, 0xee, 0xd3, 0xc3, 0xef, 0xae, 0x74, 0x5b, 0xf8, 0xde, 0x80, 0x62, 0x6a, + 0x3e, 0xd0, 0x0c, 0x14, 0x16, 0x97, 0x37, 0x3a, 0x0f, 0xda, 0xe5, 0x4c, 0x15, 0x76, 0xf7, 0xea, + 0xfa, 0x84, 0xea, 0x50, 0xec, 0x76, 0xd6, 0xee, 0x77, 0x5a, 0x8b, 0x1b, 0x9d, 0x7b, 0x5f, 0x94, + 0x8d, 0xea, 0x95, 0xdd, 0xbd, 0x7a, 0x5a, 0x84, 0xaa, 0x70, 0x71, 0xc3, 0x5e, 0xbc, 0xb7, 0xbe, + 0xd2, 0xb6, 0xcb, 0xd9, 0xea, 0xa5, 0xdd, 0xbd, 0xfa, 0xe1, 0x59, 0xa0, 0x2e, 0x77, 0xbf, 0x5c, + 0x6f, 0xb7, 0xca, 0x39, 0x85, 0xaa, 0x4e, 0xa8, 0x06, 0x90, 0x40, 0xb4, 0x5b, 0xe5, 0x7c, 0xb5, + 0xb4, 0xbb, 0x57, 0x4f, 0x49, 0xaa, 0xf9, 0x6f, 0x7e, 0xac, 0x65, 0x96, 0x3a, 0x2f, 0xf6, 0x6b, + 0xc6, 0xcb, 0xfd, 0x9a, 0xf1, 0xc7, 0x7e, 0xcd, 0x78, 0x7a, 0x50, 0xcb, 0xbc, 0x3c, 0xa8, 0x65, + 0x7e, 0x3d, 0xa8, 0x65, 0x1e, 0x59, 0x1e, 0xe5, 0x9b, 0xc3, 0xbe, 0xe9, 0xb0, 0xc0, 0x62, 0x21, + 0x0b, 0xc6, 0x32, 0x6d, 0x87, 0xf9, 0xd6, 0xa9, 0xb7, 0x03, 0x1f, 0x0f, 0x48, 0xdc, 0x2f, 0x48, + 0x83, 0x9b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x27, 0x38, 0xb9, 0x1f, 0x0a, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { From 17c4a61878c2f1692c35a188f18b82fc7756e96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDongLieu=E2=80=9D?= Date: Tue, 5 Nov 2024 15:15:12 +0700 Subject: [PATCH 02/10] add jpy --- x/vaults/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/vaults/types/params.go b/x/vaults/types/params.go index 5f7ab276..075f514e 100644 --- a/x/vaults/types/params.go +++ b/x/vaults/types/params.go @@ -14,7 +14,7 @@ var ( DefaultMinInitialDebt = math.NewInt(50_000_000) DefaultRecalculateDebtPeriod = time.Hour DefaultLiquidatePeriod = time.Hour - DefaultMintDenom = []string{"nomUSD", "nomEUR"} + DefaultMintDenom = []string{"nomUSD", "nomEUR", "nomJPY"} KeyMintingFee = []byte("MintingFee") KeyStabilityFee = []byte("StabilityFee") From 38e07bcb3cc20efaa57bc66969c6c81d056c39ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDongLieu=E2=80=9D?= Date: Wed, 6 Nov 2024 10:42:23 +0700 Subject: [PATCH 03/10] time blocktime --- x/oracle/keeper/band_oracle.go | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index 46ac4ca7..c4acaac0 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -549,108 +549,109 @@ func (k *Keeper) getPreviousRecordIDs(ctx context.Context, clientID uint64) []ui } func (k Keeper) SetInitPrice(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) initPrice := []*types.BandPriceState{ // multiplier = 1000 { Symbol: "nomUSD", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), }, { Symbol: "nomEUR", Rate: math.NewInt(10910), //1.091 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), time.Now().Unix()), }, { Symbol: "nomJPY", Rate: math.NewInt(66), //0.0066 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), time.Now().Unix()), }, { Symbol: "anom", Rate: math.NewInt(330), //0.03 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.03"), time.Now().Unix()), }, { Symbol: "usdt", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), }, { Symbol: "usdc", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), }, { Symbol: "eurt", Rate: math.NewInt(10910), //1.091 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), time.Now().Unix()), }, { Symbol: "jpyt", Rate: math.NewInt(66), //0.0066 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), time.Now().Unix()), }, { Symbol: "uatom", Rate: math.NewInt(80000), //8 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), }, { Symbol: "uosmo", Rate: math.NewInt(4500), //0.45 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), time.Now().Unix()), }, { Symbol: "uusdt", Rate: math.NewInt(10000), //0.45 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), }, { Symbol: "atom", Rate: math.NewInt(80000), //0.45 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), }, { Symbol: "ibc/E50A183716AB596378047D9688FE648CD3470C4D196FB4C2C8E61989DB48562E", //transfer/channel-10/transfer/channel-7/transfer/channel-143/erc20/tether/usdt Rate: math.NewInt(10000), - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), }, { Symbol: "ibc/BE4C72028781730B9DF0542466EB26DEA6DDD42C32316D774F943151F6010320", // transfer/channel-5/usdt Rate: math.NewInt(10000), - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), }, { Symbol: "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518", //transfer/channel-0/uosmo Rate: math.NewInt(4500), //0.45 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), time.Now().Unix()), }, { Symbol: "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", //ibc-atom Rate: math.NewInt(80000), //0.45 - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), }, { Symbol: "ibc/BC599B88586F8C22E408569D7F6FAD40AEBF808A67D2051B86958CBB5F0A16B0", //usdt Rate: math.NewInt(10000), - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), }, } @@ -665,10 +666,11 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { } func (k Keeper) SetPrice(goCtx context.Context, msg *types.MsgSetPrice) (*types.MsgSetPriceResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(goCtx) k.SetBandPriceState(goCtx, msg.Denom, &types.BandPriceState{ Symbol: msg.Denom, Rate: math.NewInt(10000).ToLegacyDec().Mul(msg.Price).TruncateInt(), - ResolveTime: uint64(time.Now().Unix()), + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(msg.Price, time.Now().Unix()), }) return &types.MsgSetPriceResponse{}, nil From 3e0783012383601800f9f2867d31472443e23f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDongLieu=E2=80=9D?= Date: Wed, 6 Nov 2024 11:04:51 +0700 Subject: [PATCH 04/10] ok --- x/oracle/keeper/band_oracle.go | 36 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index c4acaac0..2442040c 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -556,103 +556,103 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { Symbol: "nomUSD", Rate: math.NewInt(10000), //1 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "nomEUR", Rate: math.NewInt(10910), //1.091 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), sdkCtx.BlockTime().Unix()), }, { Symbol: "nomJPY", Rate: math.NewInt(66), //0.0066 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), sdkCtx.BlockTime().Unix()), }, { Symbol: "anom", Rate: math.NewInt(330), //0.03 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.03"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.03"), sdkCtx.BlockTime().Unix()), }, { Symbol: "usdt", Rate: math.NewInt(10000), //1 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "usdc", Rate: math.NewInt(10000), //1 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "eurt", Rate: math.NewInt(10910), //1.091 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), sdkCtx.BlockTime().Unix()), }, { Symbol: "jpyt", Rate: math.NewInt(66), //0.0066 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), sdkCtx.BlockTime().Unix()), }, { Symbol: "uatom", Rate: math.NewInt(80000), //8 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), }, { Symbol: "uosmo", Rate: math.NewInt(4500), //0.45 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), sdkCtx.BlockTime().Unix()), }, { Symbol: "uusdt", Rate: math.NewInt(10000), //0.45 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "atom", Rate: math.NewInt(80000), //0.45 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/E50A183716AB596378047D9688FE648CD3470C4D196FB4C2C8E61989DB48562E", //transfer/channel-10/transfer/channel-7/transfer/channel-143/erc20/tether/usdt Rate: math.NewInt(10000), ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/BE4C72028781730B9DF0542466EB26DEA6DDD42C32316D774F943151F6010320", // transfer/channel-5/usdt Rate: math.NewInt(10000), ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518", //transfer/channel-0/uosmo Rate: math.NewInt(4500), //0.45 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", //ibc-atom Rate: math.NewInt(80000), //0.45 ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/BC599B88586F8C22E408569D7F6FAD40AEBF808A67D2051B86958CBB5F0A16B0", //usdt Rate: math.NewInt(10000), ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), time.Now().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, } @@ -671,7 +671,7 @@ func (k Keeper) SetPrice(goCtx context.Context, msg *types.MsgSetPrice) (*types. Symbol: msg.Denom, Rate: math.NewInt(10000).ToLegacyDec().Mul(msg.Price).TruncateInt(), ResolveTime: uint64(sdkCtx.BlockTime().Unix()), - PriceState: *types.NewPriceState(msg.Price, time.Now().Unix()), + PriceState: *types.NewPriceState(msg.Price, sdkCtx.BlockTime().Unix()), }) return &types.MsgSetPriceResponse{}, nil } From 70627ef8451374d3fde22df46b925e244456206b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CDongLieu=E2=80=9D?= Date: Fri, 29 Nov 2024 10:50:41 +0700 Subject: [PATCH 05/10] add symbol --- x/oracle/keeper/band_oracle.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index 10ea11d4..98663eb3 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -581,6 +581,24 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, + { + Symbol: "USD", + Rate: math.NewInt(10000), //1 + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), + }, + { + Symbol: "EUR", + Rate: math.NewInt(10000), //1 + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), + }, + { + Symbol: "JPY", + Rate: math.NewInt(10000), //1 + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), + }, { Symbol: "nomEUR", Rate: math.NewInt(10910), //1.091 @@ -605,6 +623,12 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, + { + Symbol: "USDT", + Rate: math.NewInt(10000), //1 + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), + }, { Symbol: "usdc", Rate: math.NewInt(10000), //1 @@ -629,6 +653,12 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { ResolveTime: uint64(sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), }, + { + Symbol: "ATOM", + Rate: math.NewInt(80000), //8 + ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), + }, { Symbol: "uosmo", Rate: math.NewInt(4500), //0.45 From f237fef365dcf1c6c110b561b985e9da3b166b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=C3=B4ng=20Li=E1=BB=81u?= Date: Sat, 7 Dec 2024 18:24:53 +0700 Subject: [PATCH 06/10] updates --- script/proposal-psm.json | 6 ++++-- script/psm-test.sh | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/script/proposal-psm.json b/script/proposal-psm.json index 816b6054..1d451bfb 100644 --- a/script/proposal-psm.json +++ b/script/proposal-psm.json @@ -6,7 +6,8 @@ "limit_total": "100000000000000000000000000000", "fee_in": "0.001000000000000000", "fee_out": "0.001000000000000000", - "oracle_script": "44" + "oracle_script": "44", + "symbol": "USD" }, { "@type": "/reserve.psm.v1.MsgAddStableCoin", @@ -15,7 +16,8 @@ "limit_total": "100000000000000000000000000000", "fee_in": "0.001000000000000000", "fee_out": "0.001000000000000000", - "oracle_script": "44" + "oracle_script": "44", + "symbol": "USD" }], "deposit": "100000000stake", "title": "My proposal", diff --git a/script/psm-test.sh b/script/psm-test.sh index 2823aa36..4fcdfe20 100755 --- a/script/psm-test.sh +++ b/script/psm-test.sh @@ -145,3 +145,10 @@ sleep 7 reserved tx psm swap 1000nomUSD usdc --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake sleep 7 reserved tx psm swap 1000nomUSD usdt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake + +sleep 7 +reserved tx psm swap 999999000nomUSD usdc --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake + + +9999999999999999999999000000000- +998001000 \ No newline at end of file From f195c88e6a4cdbb22f454673623182252d8771bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=C4=90=C3=B4ng?= Date: Wed, 18 Dec 2024 10:45:35 +0700 Subject: [PATCH 07/10] resolve conflicts --- x/oracle/keeper/band_oracle.go | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index e7bed728..39d67af7 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -588,133 +588,133 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { { Symbol: "nomUSD", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: sdkCtx.BlockTime().Unix(), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "USD", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "EUR", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "JPY", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "nomEUR", Rate: math.NewInt(10910), //1.091 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), sdkCtx.BlockTime().Unix()), }, { Symbol: "nomJPY", Rate: math.NewInt(66), //0.0066 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), sdkCtx.BlockTime().Unix()), }, { Symbol: "anom", Rate: math.NewInt(330), //0.03 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.03"), sdkCtx.BlockTime().Unix()), }, { Symbol: "usdt", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "USDT", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "usdc", Rate: math.NewInt(10000), //1 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "eurt", Rate: math.NewInt(10910), //1.091 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), sdkCtx.BlockTime().Unix()), }, { Symbol: "jpyt", Rate: math.NewInt(66), //0.0066 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), sdkCtx.BlockTime().Unix()), }, { Symbol: "uatom", Rate: math.NewInt(80000), //8 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ATOM", Rate: math.NewInt(80000), //8 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), }, { Symbol: "uosmo", Rate: math.NewInt(4500), //0.45 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), sdkCtx.BlockTime().Unix()), }, { Symbol: "uusdt", Rate: math.NewInt(10000), //0.45 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "atom", Rate: math.NewInt(80000), //0.45 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/E50A183716AB596378047D9688FE648CD3470C4D196FB4C2C8E61989DB48562E", //transfer/channel-10/transfer/channel-7/transfer/channel-143/erc20/tether/usdt Rate: math.NewInt(10000), - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/BE4C72028781730B9DF0542466EB26DEA6DDD42C32316D774F943151F6010320", // transfer/channel-5/usdt Rate: math.NewInt(10000), - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518", //transfer/channel-0/uosmo Rate: math.NewInt(4500), //0.45 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.45"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", //ibc-atom Rate: math.NewInt(80000), //0.45 - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("8"), sdkCtx.BlockTime().Unix()), }, { Symbol: "ibc/BC599B88586F8C22E408569D7F6FAD40AEBF808A67D2051B86958CBB5F0A16B0", //usdt Rate: math.NewInt(10000), - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, } @@ -733,7 +733,7 @@ func (k Keeper) SetPrice(goCtx context.Context, msg *types.MsgSetPrice) (*types. k.SetBandPriceState(goCtx, msg.Denom, &types.BandPriceState{ Symbol: msg.Denom, Rate: math.NewInt(10000).ToLegacyDec().Mul(msg.Price).TruncateInt(), - ResolveTime: uint64(sdkCtx.BlockTime().Unix()), + ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(msg.Price, sdkCtx.BlockTime().Unix()), }) return &types.MsgSetPriceResponse{}, nil From 19156ae706c151c35580c61d46df447b0f4356aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=C3=B4ng=20Li=E1=BB=81u?= Date: Thu, 26 Dec 2024 17:28:27 +0700 Subject: [PATCH 08/10] ok --- x/oracle/keeper/band_oracle.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index f81827ca..975bd9c3 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -627,6 +627,12 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.03"), sdkCtx.BlockTime().Unix()), }, + { + Symbol: "NOM", + Rate: math.NewInt(330), //0.03 + ResolveTime: (sdkCtx.BlockTime().Unix()), + PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.03"), sdkCtx.BlockTime().Unix()), + }, { Symbol: "usdt", Rate: math.NewInt(10000), //1 From 67edb0c9ba644587a0cb349cee80e99ba0294e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=C3=B4ng=20Li=E1=BB=81u?= Date: Mon, 30 Dec 2024 15:04:09 +0700 Subject: [PATCH 09/10] updates --- x/oracle/keeper/band_oracle.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index 975bd9c3..4c904eda 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -599,13 +599,13 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { }, { Symbol: "EUR", - Rate: math.NewInt(10000), //1 + Rate: math.NewInt(10910), //1 ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { Symbol: "JPY", - Rate: math.NewInt(10000), //1 + Rate: math.NewInt(66), //1 ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, From f00c766be14b72ae0196b28ad9f163420243c22e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=C3=B4ng=20Li=E1=BB=81u?= Date: Tue, 14 Jan 2025 14:27:40 +0700 Subject: [PATCH 10/10] update --- script/psm-test.sh | 6 +++--- x/oracle/keeper/band_oracle.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/script/psm-test.sh b/script/psm-test.sh index f765886a..a3754bcb 100755 --- a/script/psm-test.sh +++ b/script/psm-test.sh @@ -140,8 +140,8 @@ reserved tx psm swap 100000000000000000000000usdt fxUSD --from validator1 --keyr sleep 7 -reserved tx psm swap 1000000000usdc nomUSD --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +reserved tx psm swap 1000000000usdc fxUSD --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake sleep 7 -reserved tx psm swap 1000nomUSD usdc --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +reserved tx psm swap 1000fxUSD usdc --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake sleep 7 -reserved tx psm swap 1000nomUSD usdt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +reserved tx psm swap 1000fxUSD usdt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index bf2594e1..558dfdd1 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -627,7 +627,7 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { initPrice := []*types.BandPriceState{ // multiplier = 1000 { - Symbol: "nomUSD", + Symbol: "fxUSD", Rate: math.NewInt(10000), //1 ResolveTime: sdkCtx.BlockTime().Unix(), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), @@ -651,13 +651,13 @@ func (k Keeper) SetInitPrice(ctx context.Context) error { PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1"), sdkCtx.BlockTime().Unix()), }, { - Symbol: "nomEUR", + Symbol: "fxEUR", Rate: math.NewInt(10910), //1.091 ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("1.091"), sdkCtx.BlockTime().Unix()), }, { - Symbol: "nomJPY", + Symbol: "fxJPY", Rate: math.NewInt(66), //0.0066 ResolveTime: (sdkCtx.BlockTime().Unix()), PriceState: *types.NewPriceState(math.LegacyMustNewDecFromStr("0.0066"), sdkCtx.BlockTime().Unix()),