diff --git a/app/app.go b/app/app.go index c25aaacc5..643f6dbcd 100644 --- a/app/app.go +++ b/app/app.go @@ -165,6 +165,7 @@ import ( cwasm "github.com/comdex-official/comdex/app/wasm" + mv5 "github.com/comdex-official/comdex/app/upgrades/mainnet/v5" tv1_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v1_0_0" tv2_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v2_0_0" tv3_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v3_0_0" @@ -1287,8 +1288,8 @@ func upgradeHandlers(upgradeInfo storetypes.UpgradeInfo, a *App, storeUpgrades * }, } - // prepare store for main net upgrade v5.0.0 - /*case upgradeInfo.Name == mv5.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height): + // prepare store for main net upgrade v5.0.0 + case upgradeInfo.Name == mv5.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height): storeUpgrades = &storetypes.StoreUpgrades{ Added: []string{ assettypes.ModuleName, @@ -1308,7 +1309,7 @@ func upgradeHandlers(upgradeInfo storetypes.UpgradeInfo, a *App, storeUpgrades * icahosttypes.StoreKey, authz.ModuleName, }, - }*/ + } } return storeUpgrades diff --git a/app/upgrades/mainnet/v5/upgrades.go b/app/upgrades/mainnet/v5/upgrades.go index bc83faa5f..4b9842255 100644 --- a/app/upgrades/mainnet/v5/upgrades.go +++ b/app/upgrades/mainnet/v5/upgrades.go @@ -51,15 +51,15 @@ func InitializeStates( } assets := []assettypes.Asset{ - {Name: "ATOM", Denom: "uatom", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: true}, - {Name: "CMDX", Denom: "ucmdx", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: true}, - {Name: "CMST", Denom: "ucmst", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: false}, - {Name: "OSMO", Denom: "uosmo", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: true}, - {Name: "CATOM", Denom: "ucatom", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: false}, - {Name: "CCMDX", Denom: "uccmdx", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: false}, - {Name: "CCMST", Denom: "uccmst", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: false}, - {Name: "COSMO", Denom: "ucosmo", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: false}, - {Name: "HARBOR", Denom: "uharbor", Decimals: sdk.NewInt(1000000), IsOnChain: true, IsOraclePriceRequired: false}, + {Name: "ATOM", Denom: "uatom", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: true, IsCdpMintable: false}, + {Name: "CMDX", Denom: "ucmdx", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: true, IsCdpMintable: false}, + {Name: "CMST", Denom: "ucmst", Decimals: sdk.NewInt(1000000), IsOnChain: true, IsOraclePriceRequired: true, IsCdpMintable: true}, + {Name: "OSMO", Denom: "uosmo", Decimals: sdk.NewInt(1000000), IsOnChain: false, IsOraclePriceRequired: true, IsCdpMintable: false}, + {Name: "CATOM", Denom: "ucatom", Decimals: sdk.NewInt(1000000), IsOnChain: true, IsOraclePriceRequired: false, IsCdpMintable: true}, + {Name: "CCMDX", Denom: "uccmdx", Decimals: sdk.NewInt(1000000), IsOnChain: true, IsOraclePriceRequired: false, IsCdpMintable: true}, + {Name: "CCMST", Denom: "uccmst", Decimals: sdk.NewInt(1000000), IsOnChain: true, IsOraclePriceRequired: false, IsCdpMintable: true}, + {Name: "COSMO", Denom: "ucosmo", Decimals: sdk.NewInt(1000000), IsOnChain: true, IsOraclePriceRequired: false, IsCdpMintable: true}, + {Name: "HARBOR", Denom: "uharbor", Decimals: sdk.NewInt(1000000), IsOnChain: true, IsOraclePriceRequired: false, IsCdpMintable: false}, } for _, asset := range assets { diff --git a/proto/comdex/auction/v1beta1/genesis.proto b/proto/comdex/auction/v1beta1/genesis.proto index d860e12a8..5362180cb 100644 --- a/proto/comdex/auction/v1beta1/genesis.proto +++ b/proto/comdex/auction/v1beta1/genesis.proto @@ -19,6 +19,8 @@ message GenesisState { [ (gogoproto.moretags) = "yaml:\"protocolStatistics\"", (gogoproto.nullable) = false ]; repeated AuctionParams auctionParams = 5 [ (gogoproto.moretags) = "yaml:\"auctionParams\"", (gogoproto.nullable) = false ]; - Params params = 6 [(gogoproto.nullable) = false]; - uint64 UserBiddingID = 7 ; + repeated DutchAuction dutchLendAuction = 6 + [ (gogoproto.moretags) = "yaml:\"dutchLendAuction\"", (gogoproto.nullable) = false ]; + Params params = 7 [(gogoproto.nullable) = false]; + uint64 UserBiddingID = 8 ; } diff --git a/proto/comdex/vault/v1beta1/genesis.proto b/proto/comdex/vault/v1beta1/genesis.proto index 2f9045775..00a135b8e 100644 --- a/proto/comdex/vault/v1beta1/genesis.proto +++ b/proto/comdex/vault/v1beta1/genesis.proto @@ -26,4 +26,5 @@ message GenesisState { (gogoproto.moretags) = "yaml:\"userVaultAssetMapping\"", (gogoproto.nullable) = false ]; + uint64 lengthOfVaults = 5 [ (gogoproto.moretags) = "yaml:\"lengthOfVaults\""]; } diff --git a/x/auction/genesis.go b/x/auction/genesis.go index 5ff4bc559..fa916d05b 100644 --- a/x/auction/genesis.go +++ b/x/auction/genesis.go @@ -10,26 +10,18 @@ import ( func InitGenesis(ctx sdk.Context, k keeper.Keeper, state *types.GenesisState) { k.SetParams(ctx, state.Params) var auctionID uint64 + var lendAuctionID uint64 for _, item := range state.SurplusAuction { - err := k.SetSurplusAuction(ctx, item) - if err != nil { - return - } + k.SetGenSurplusAuction(ctx, item) } for _, item := range state.DebtAuction { - err := k.SetDebtAuction(ctx, item) - if err != nil { - return - } + k.SetGenDebtAuction(ctx, item) } for _, item := range state.DutchAuction { - err := k.SetDutchAuction(ctx, item) - if err != nil { - return - } + k.SetGenDutchAuction(ctx, item) auctionID = item.AuctionId } @@ -37,12 +29,18 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, state *types.GenesisState) { k.SetUserBiddingID(ctx, state.UserBiddingID) for _, item := range state.ProtocolStatistics { - k.SetProtocolStatistics(ctx, item.AppId, item.AssetId, sdk.Int(item.Loss)) + k.SetGenProtocolStatistics(ctx, item.AppId, item.AssetId, item.Loss) } for _, item := range state.AuctionParams { k.SetAuctionParams(ctx, item) } + + for _, item := range state.DutchAuction { + k.SetGenLendDutchLendAuction(ctx, item) + lendAuctionID = item.AuctionId + } + k.SetLendAuctionID(ctx,lendAuctionID) } func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { @@ -52,6 +50,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { k.GetAllDutchAuctions(ctx), k.GetAllProtocolStat(ctx), k.GetAllAuctionParams(ctx), + k.GetDutchLendAuctions(ctx,3), k.GetParams(ctx), k.GetUserBiddingID(ctx), ) diff --git a/x/auction/keeper/genesis_store.go b/x/auction/keeper/genesis_store.go new file mode 100644 index 000000000..fa4ff3312 --- /dev/null +++ b/x/auction/keeper/genesis_store.go @@ -0,0 +1,57 @@ +package keeper + +import ( + auctiontypes "github.com/comdex-official/comdex/x/auction/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k Keeper) SetGenSurplusAuction(ctx sdk.Context, auction auctiontypes.SurplusAuction) { + var ( + store = k.Store(ctx) + key = auctiontypes.AuctionKey(auction.AppId, "surplus", auction.AuctionId) + value = k.cdc.MustMarshal(&auction) + ) + store.Set(key, value) +} + +func (k Keeper) SetGenDebtAuction(ctx sdk.Context, auction auctiontypes.DebtAuction) { + var ( + store = k.Store(ctx) + key = auctiontypes.AuctionKey(auction.AppId, "debt", auction.AuctionId) + value = k.cdc.MustMarshal(&auction) + ) + store.Set(key, value) +} + +func (k Keeper) SetGenDutchAuction(ctx sdk.Context, auction auctiontypes.DutchAuction) { + var ( + store = k.Store(ctx) + key = auctiontypes.AuctionKey(auction.AppId, "dutch", auction.AuctionId) + value = k.cdc.MustMarshal(&auction) + ) + + store.Set(key, value) +} + +func (k Keeper) SetGenProtocolStatistics(ctx sdk.Context, appID, assetID uint64, amount sdk.Dec) { + var ( + store = k.Store(ctx) + key = auctiontypes.ProtocolStatisticsKey(appID, assetID) + ) + var stats auctiontypes.ProtocolStatistics + stats.AppId = appID + stats.AssetId = assetID + stats.Loss = amount + value := k.cdc.MustMarshal(&stats) + store.Set(key, value) +} + +func (k Keeper) SetGenLendDutchLendAuction(ctx sdk.Context, auction auctiontypes.DutchAuction) { + var ( + store = k.Store(ctx) + key = auctiontypes.LendAuctionKey(auction.AppId, "dutch", auction.AuctionId) + value = k.cdc.MustMarshal(&auction) + ) + + store.Set(key, value) +} diff --git a/x/auction/keeper/query_server.go b/x/auction/keeper/query_server.go index afc2fe7cf..b2c46fbff 100644 --- a/x/auction/keeper/query_server.go +++ b/x/auction/keeper/query_server.go @@ -502,18 +502,40 @@ func (q QueryServer) QueryDutchLendBiddings(c context.Context, req *types.QueryD } var ( - ctx = sdk.UnwrapSDKContext(c) - item []types.DutchBiddings + ctx = sdk.UnwrapSDKContext(c) + key []byte + items []types.DutchBiddings ) if req.History { - item = q.GetHistoryDutchLendUserBiddings(ctx, req.Bidder, req.AppId) + key = types.HistoryLendUserAuctionTypeKey(req.Bidder, req.AppId, types.DutchString) } else { - item = q.GetDutchLendUserBiddings(ctx, req.Bidder, req.AppId) + key = types.LendUserAuctionTypeKey(req.Bidder, req.AppId, types.DutchString) + } + + pagination, err := query.FilteredPaginate( + prefix.NewStore(q.Store(ctx), key), + req.Pagination, + func(_, value []byte, accumulate bool) (bool, error) { + var item types.DutchBiddings + if err := q.cdc.Unmarshal(value, &item); err != nil { + return false, err + } + + if accumulate { + items = append(items, item) + } + + return true, nil + }, + ) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) } return &types.QueryDutchLendBiddingsResponse{ - Bidder: req.Bidder, - Biddings: item, + Bidder: req.Bidder, + Biddings: items, + Pagination: pagination, }, nil } diff --git a/x/auction/types/genesis.go b/x/auction/types/genesis.go index eb8b0a796..0cf545558 100644 --- a/x/auction/types/genesis.go +++ b/x/auction/types/genesis.go @@ -1,12 +1,13 @@ package types -func NewGenesisState(surplusAuction []SurplusAuction, debtAuction []DebtAuction, dutchAuction []DutchAuction, protocolStatistics []ProtocolStatistics, auctionParams []AuctionParams, params Params, userBiddingID uint64) *GenesisState { +func NewGenesisState(surplusAuction []SurplusAuction, debtAuction []DebtAuction, dutchAuction []DutchAuction, protocolStatistics []ProtocolStatistics, auctionParams []AuctionParams, dutchLendAuction []DutchAuction, params Params, userBiddingID uint64) *GenesisState { return &GenesisState{ SurplusAuction: surplusAuction, DebtAuction: debtAuction, DutchAuction: dutchAuction, ProtocolStatistics: protocolStatistics, AuctionParams: auctionParams, + DutchLendAuction: dutchLendAuction, Params: params, UserBiddingID: userBiddingID, } @@ -20,6 +21,7 @@ func DefaultGenesisState() *GenesisState { []DutchAuction{}, []ProtocolStatistics{}, []AuctionParams{}, + []DutchAuction{}, DefaultParams(), UserBiddingID, ) diff --git a/x/auction/types/genesis.pb.go b/x/auction/types/genesis.pb.go index 1d9e045a8..99082bc32 100644 --- a/x/auction/types/genesis.pb.go +++ b/x/auction/types/genesis.pb.go @@ -29,8 +29,9 @@ type GenesisState struct { DutchAuction []DutchAuction `protobuf:"bytes,3,rep,name=dutchAuction,proto3" json:"dutchAuction" yaml:"dutchAuction"` ProtocolStatistics []ProtocolStatistics `protobuf:"bytes,4,rep,name=protocolStatistics,proto3" json:"protocolStatistics" yaml:"protocolStatistics"` AuctionParams []AuctionParams `protobuf:"bytes,5,rep,name=auctionParams,proto3" json:"auctionParams" yaml:"auctionParams"` - Params Params `protobuf:"bytes,6,opt,name=params,proto3" json:"params"` - UserBiddingID uint64 `protobuf:"varint,7,opt,name=UserBiddingID,proto3" json:"UserBiddingID,omitempty"` + DutchLendAuction []DutchAuction `protobuf:"bytes,6,rep,name=dutchLendAuction,proto3" json:"dutchLendAuction" yaml:"dutchLendAuction"` + Params Params `protobuf:"bytes,7,opt,name=params,proto3" json:"params"` + UserBiddingID uint64 `protobuf:"varint,8,opt,name=UserBiddingID,proto3" json:"UserBiddingID,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -101,6 +102,13 @@ func (m *GenesisState) GetAuctionParams() []AuctionParams { return nil } +func (m *GenesisState) GetDutchLendAuction() []DutchAuction { + if m != nil { + return m.DutchLendAuction + } + return nil +} + func (m *GenesisState) GetParams() Params { if m != nil { return m.Params @@ -124,34 +132,36 @@ func init() { } var fileDescriptor_49088f171dd3086d = []byte{ - // 425 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xb1, 0x8e, 0xd3, 0x30, - 0x18, 0x80, 0x13, 0xae, 0x57, 0x24, 0xf7, 0x8e, 0xc1, 0x1c, 0x28, 0x04, 0xc8, 0x95, 0x5c, 0x0f, - 0x55, 0x48, 0x24, 0xea, 0xb1, 0x21, 0x96, 0x8b, 0x2a, 0x21, 0xc4, 0x52, 0xa5, 0x62, 0x61, 0x73, - 0x12, 0x37, 0xb5, 0x94, 0xd4, 0x51, 0xec, 0x20, 0x3a, 0xf0, 0x0e, 0x2c, 0xbc, 0x53, 0xc7, 0x8e, - 0x4c, 0x15, 0x6a, 0xdf, 0x80, 0x27, 0x40, 0xb1, 0x5d, 0x35, 0xa1, 0xf5, 0xd6, 0x26, 0x9f, 0xbf, - 0x2f, 0xfe, 0xf5, 0x83, 0x41, 0x4c, 0xf3, 0x04, 0x7f, 0xf7, 0x51, 0x15, 0x73, 0x42, 0x17, 0xfe, - 0xb7, 0x51, 0x84, 0x39, 0x1a, 0xf9, 0x29, 0x5e, 0x60, 0x46, 0x98, 0x57, 0x94, 0x94, 0x53, 0xf8, - 0x54, 0x52, 0x9e, 0xa2, 0x3c, 0x45, 0xd9, 0x57, 0x29, 0x4d, 0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x7c, 0xdf, 0x84, 0x83, 0x17, 0x2a, 0x7a, 0x25, 0xa3, 0x2d, 0x93, 0x1b, 0xb6, 0xcd, 0xf0, - 0x03, 0xe8, 0xca, 0x85, 0xb4, 0xba, 0x7d, 0x73, 0xd8, 0xbb, 0x73, 0xb4, 0xb7, 0x93, 0xf2, 0x4e, - 0x2d, 0x0f, 0xd5, 0x19, 0x38, 0x00, 0x97, 0x5f, 0x18, 0x2e, 0x03, 0xb9, 0x87, 0x9f, 0xc6, 0xd6, - 0xc3, 0xbe, 0x39, 0xec, 0x84, 0xed, 0x87, 0xc1, 0xe7, 0xd5, 0xd6, 0x31, 0xd7, 0x5b, 0xc7, 0xfc, - 0xb3, 0x75, 0xcc, 0x9f, 0x3b, 0xc7, 0x58, 0xef, 0x1c, 0xe3, 0xf7, 0xce, 0x31, 0xbe, 0x8e, 0x52, - 0xc2, 0xe7, 0x55, 0x54, 0x37, 0x7d, 0xd9, 0x7d, 0x4b, 0x67, 0x33, 0x12, 0x13, 0x94, 0xa9, 0xff, - 0xfe, 0x61, 0xeb, 0xf9, 0xb2, 0xc0, 0x2c, 0xea, 0x8a, 0x79, 0xbd, 0xfb, 0x17, 0x00, 0x00, 0xff, - 0xff, 0x51, 0x21, 0x0b, 0xb7, 0xb3, 0x03, 0x00, 0x00, + // 455 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4f, 0x6f, 0xd3, 0x30, + 0x1c, 0x86, 0x1b, 0x56, 0x0a, 0x72, 0x37, 0x84, 0xcc, 0x80, 0x50, 0x20, 0x2d, 0x5e, 0x87, 0x2a, + 0x24, 0x12, 0x75, 0xdc, 0x10, 0x97, 0x45, 0x93, 0x10, 0x82, 0xc3, 0xe4, 0x89, 0x0b, 0x37, 0x27, + 0xf1, 0x32, 0x4b, 0x4d, 0x1c, 0x62, 0x07, 0xb1, 0x03, 0x77, 0x8e, 0x7c, 0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8b, 0x19, 0x59, 0x98, 0xfb, 0xe0, 0xfa, 0xa0, + 0xc9, 0xf3, 0x82, 0x8a, 0x68, 0xa0, 0x7e, 0xd1, 0x9b, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf3, + 0xf6, 0xde, 0xc2, 0x26, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -177,7 +187,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.UserBiddingID != 0 { i = encodeVarintGenesis(dAtA, i, uint64(m.UserBiddingID)) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x40 } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) @@ -188,7 +198,21 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x3a + if len(m.DutchLendAuction) > 0 { + for iNdEx := len(m.DutchLendAuction) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DutchLendAuction[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } if len(m.AuctionParams) > 0 { for iNdEx := len(m.AuctionParams) - 1; iNdEx >= 0; iNdEx-- { { @@ -309,6 +333,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.DutchLendAuction) > 0 { + for _, e := range m.DutchLendAuction { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) if m.UserBiddingID != 0 { @@ -523,6 +553,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DutchLendAuction", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DutchLendAuction = append(m.DutchLendAuction, DutchAuction{}) + if err := m.DutchLendAuction[len(m.DutchLendAuction)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } @@ -555,7 +619,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field UserBiddingID", wireType) } diff --git a/x/collector/genesis.go b/x/collector/genesis.go index c88e27083..bb164586d 100644 --- a/x/collector/genesis.go +++ b/x/collector/genesis.go @@ -29,10 +29,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, state *types.GenesisState) { } for _, item := range state.CollectorAuctionLookupTable { - err := k.SetAuctionMappingForApp(ctx, item) - if err != nil { - return - } + k.SetGenAuctionMappingForApp(ctx, item) } for _, item := range state.AppToDenomsMapping { diff --git a/x/collector/keeper/collector.go b/x/collector/keeper/collector.go index ee83e03b4..e7db7ba4a 100644 --- a/x/collector/keeper/collector.go +++ b/x/collector/keeper/collector.go @@ -842,3 +842,13 @@ func (k Keeper) WasmMsgGetSurplusFund(ctx sdk.Context, appID, assetID uint64, ad } return nil } + +func (k Keeper) SetGenAuctionMappingForApp(ctx sdk.Context, record types.AppAssetIdToAuctionLookupTable) { + var ( + store = ctx.KVStore(k.storeKey) + key = types.AppIDToAuctionMappingKey(record.AppId, record.AssetId) + value = k.cdc.MustMarshal(&record) + ) + + store.Set(key, value) +} diff --git a/x/liquidation/genesis.go b/x/liquidation/genesis.go index 6afb4c49c..5ccb1d8a5 100644 --- a/x/liquidation/genesis.go +++ b/x/liquidation/genesis.go @@ -9,14 +9,18 @@ import ( func InitGenesis(ctx sdk.Context, k keeper.Keeper, state *types.GenesisState) { k.SetParams(ctx, state.Params) + var lockedVaultID uint64 for _, item := range state.LockedVault { k.SetLockedVault(ctx, item) + lockedVaultID = lockedVaultID + 1 } for _, item := range state.WhitelistedApps { k.SetAppIDForLiquidation(ctx, item) } + + k.SetLockedVaultID(ctx, lockedVaultID) } func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { diff --git a/x/rewards/keeper/rewards.go b/x/rewards/keeper/rewards.go index 91a3fcd91..254d0ca11 100644 --- a/x/rewards/keeper/rewards.go +++ b/x/rewards/keeper/rewards.go @@ -557,12 +557,12 @@ func (k Keeper) CalculateLockerRewards(ctx sdk.Context, appID, assetID, lockerID // take bh from lsr rewards, err = k.CalculationOfRewards(ctx, NetBalance, collectorLookup.LockerSavingRate, collectorBTime) if err != nil { - return nil + return err } } else { rewards, err = k.CalculationOfRewards(ctx, NetBalance, collectorLookup.LockerSavingRate, lockerBlockTime) if err != nil { - return nil + return err } } lockerData, _ := k.locker.GetLocker(ctx, lockerID) @@ -589,14 +589,14 @@ func (k Keeper) CalculateLockerRewards(ctx sdk.Context, appID, assetID, lockerID // } err = k.collector.DecreaseNetFeeCollectedData(ctx, appID, lockerData.AssetDepositId, newReward) if err != nil { - return nil + return err } assetData, _ := k.asset.GetAsset(ctx, assetID) if newReward.GT(sdk.ZeroInt()) { err = k.bank.SendCoinsFromModuleToModule(ctx, collectortypes.ModuleName, lockertypes.ModuleName, sdk.NewCoins(sdk.NewCoin(assetData.Denom, newReward))) if err != nil { - return nil + return err } } lockerRewardsMapping, found := k.locker.GetLockerTotalRewardsByAssetAppWise(ctx, appID, lockerData.AssetDepositId) @@ -607,13 +607,13 @@ func (k Keeper) CalculateLockerRewards(ctx sdk.Context, appID, assetID, lockerID lockerReward.TotalRewards = newReward err = k.locker.SetLockerTotalRewardsByAssetAppWise(ctx, lockerReward) if err != nil { - return nil + return err } } else { lockerRewardsMapping.TotalRewards = lockerRewardsMapping.TotalRewards.Add(newReward) err = k.locker.SetLockerTotalRewardsByAssetAppWise(ctx, lockerRewardsMapping) if err != nil { - return nil + return err } } // updating user rewards data diff --git a/x/vault/genesis.go b/x/vault/genesis.go index b93c31fcb..8cef616a8 100644 --- a/x/vault/genesis.go +++ b/x/vault/genesis.go @@ -36,6 +36,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, state *types.GenesisState) { } k.SetIDForVault(ctx, vaultID) k.SetIDForStableVault(ctx, stableVaultID) + k.SetLengthOfVault(ctx, state.LengthOfVaults) } func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { @@ -44,5 +45,6 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { k.GetStableMintVaults(ctx), k.GetAllAppExtendedPairVaultMapping(ctx), k.GetAllUserVaultExtendedPairMapping(ctx), + k.GetLengthOfVault(ctx), ) } diff --git a/x/vault/types/genesis.go b/x/vault/types/genesis.go index 7363eafbb..5267ff7a6 100644 --- a/x/vault/types/genesis.go +++ b/x/vault/types/genesis.go @@ -1,20 +1,23 @@ package types -func NewGenesisState(vaults []Vault, stableMintVault []StableMintVault, appExtendedPairVaultMapping []AppExtendedPairVaultMappingData, userVaultAssetMapping []OwnerAppExtendedPairVaultMappingData) *GenesisState { +func NewGenesisState(vaults []Vault, stableMintVault []StableMintVault, appExtendedPairVaultMapping []AppExtendedPairVaultMappingData, userVaultAssetMapping []OwnerAppExtendedPairVaultMappingData, lengthOfvaults uint64) *GenesisState { return &GenesisState{ Vaults: vaults, StableMintVault: stableMintVault, AppExtendedPairVaultMapping: appExtendedPairVaultMapping, UserVaultAssetMapping: userVaultAssetMapping, + LengthOfVaults: lengthOfvaults, } } func DefaultGenesisState() *GenesisState { + var length uint64 return NewGenesisState( []Vault{}, []StableMintVault{}, []AppExtendedPairVaultMappingData{}, []OwnerAppExtendedPairVaultMappingData{}, + length, ) } diff --git a/x/vault/types/genesis.pb.go b/x/vault/types/genesis.pb.go index 9462ffb0a..b409b5df8 100644 --- a/x/vault/types/genesis.pb.go +++ b/x/vault/types/genesis.pb.go @@ -28,6 +28,7 @@ type GenesisState struct { StableMintVault []StableMintVault `protobuf:"bytes,2,rep,name=stableMintVault,proto3" json:"stableMintVault" yaml:"stableMintVault"` AppExtendedPairVaultMapping []AppExtendedPairVaultMappingData `protobuf:"bytes,3,rep,name=appExtendedPairVaultMapping,proto3" json:"appExtendedPairVaultMapping" yaml:"appExtendedPairVaultMapping"` UserVaultAssetMapping []OwnerAppExtendedPairVaultMappingData `protobuf:"bytes,4,rep,name=userVaultAssetMapping,proto3" json:"userVaultAssetMapping" yaml:"userVaultAssetMapping"` + LengthOfVaults uint64 `protobuf:"varint,5,opt,name=lengthOfVaults,proto3" json:"lengthOfVaults,omitempty" yaml:"lengthOfVaults"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -72,31 +73,33 @@ func init() { } var fileDescriptor_00ed468466e13f8a = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x41, 0x4a, 0xf3, 0x40, - 0x18, 0x86, 0x93, 0xbf, 0xa5, 0x8b, 0xfc, 0x8a, 0x10, 0xaa, 0x94, 0x56, 0x26, 0x65, 0x50, 0x10, - 0xc1, 0x84, 0x2a, 0x6e, 0xba, 0x6b, 0x50, 0x5c, 0x15, 0x35, 0x15, 0x17, 0xee, 0x26, 0xed, 0x34, - 0x0e, 0xa4, 0x99, 0xd0, 0x99, 0xd6, 0xf6, 0x16, 0x2e, 0xc4, 0x0b, 0xb8, 0xf1, 0x28, 0x5d, 0x76, - 0xe9, 0x2a, 0x68, 0x7a, 0x83, 0x9e, 0x40, 0x32, 0x13, 0x05, 0xc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cc, 0x6d, 0xa0, 0xb4, 0x59, 0xd3, 0x03, 0xbd, 0x75, 0x16, 0xe6, 0xb3, 0x6e, 0x6c, 0x8f, 0x18, - 0x96, 0x3f, 0x5b, 0x8c, 0xe1, 0x6f, 0xbf, 0xa2, 0xf0, 0x6b, 0xaa, 0xfd, 0x2e, 0x1f, 0x22, 0x3c, - 0xfc, 0x4b, 0x72, 0x2f, 0x97, 0xdc, 0x95, 0x92, 0xca, 0x1a, 0xe8, 0xa9, 0xeb, 0xdd, 0xeb, 0xd9, - 0x07, 0xd0, 0x5e, 0x53, 0xa0, 0xcd, 0x52, 0xa0, 0xcf, 0x53, 0xa0, 0xbf, 0xa7, 0x40, 0x7f, 0x5c, - 0x00, 0x6d, 0xbe, 0x00, 0xda, 0xdb, 0x02, 0x68, 0x77, 0x4e, 0x40, 0xf8, 0xfd, 0xc8, 0xcf, 0x04, - 0x1d, 0x29, 0x79, 0x44, 0xfb, 0x7d, 0xd2, 0x25, 0x28, 0xcc, 0x67, 0xe7, 0xeb, 0xee, 0xf8, 0x34, - 0xc6, 0xcc, 0x2f, 0x89, 0x83, 0x3b, 0xf9, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x98, 0xb6, 0xe9, 0xbb, - 0xe4, 0x02, 0x00, 0x00, + // 404 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0x4e, 0xea, 0x40, + 0x14, 0xc6, 0xdb, 0x0b, 0x97, 0x45, 0xef, 0x1f, 0x93, 0x06, 0x4c, 0x05, 0x33, 0x25, 0x13, 0x4d, + 0x88, 0x89, 0x6d, 0xd0, 0xb8, 0x61, 0x47, 0xa3, 0x71, 0x45, 0xd0, 0x62, 0x5c, 0xb8, 0x9b, 0xc2, + 0x50, 0x9a, 0x94, 0xb6, 0x61, 0x06, 0x84, 0xb7, 0x70, 0xe5, 0x0b, 0xb8, 0xf1, 0x51, 0x58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, 0x1c, 0x73, 0x3f, 0x13, 0xbb, 0x37, 0xbf, 0x1f, 0x3c, 0x47, 0x14, + 0x59, 0x47, 0x59, 0x1a, 0xc8, 0xd3, 0x6c, 0xf1, 0x81, 0xf6, 0xb6, 0x14, 0xea, 0xa3, 0xac, 0x94, + 0xc6, 0x04, 0xf3, 0x9f, 0x4d, 0x42, 0xf0, 0x57, 0xbe, 0x3c, 0xcb, 0xd7, 0x10, 0xe7, 0x6b, 0xdf, + 0x07, 0x78, 0xf4, 0x53, 0xc8, 0x83, 0x2c, 0xe4, 0x3e, 0x0f, 0x29, 0xb4, 0x81, 0xb6, 0xd8, 0x5e, + 0x6d, 0x2a, 0xff, 0x7d, 0x1c, 0xb8, 0x74, 0xd0, 0xee, 0xf3, 0xa7, 0xd5, 0x7e, 0x57, 0xe5, 0x5a, + 0xde, 0xda, 0x5b, 0xc5, 0x7a, 0x89, 0x03, 0xd7, 0xfb, 0xd0, 0xde, 0x18, 0xb0, 0xae, 0xe7, 0xef, + 0x40, 0x7a, 0x4e, 0x80, 0x34, 0x4f, 0x80, 0xbc, 0x48, 0x80, 0xfc, 0x96, 0x00, 0xf9, 0x61, 0x09, + 0xa4, 0xc5, 0x12, 0x48, 0xaf, 0x4b, 0x20, 0xdd, 0x99, 0xae, 0x47, 0x07, 0x63, 0x27, 0xdd, 0xd1, + 0xe4, 0x7b, 0x1e, 0x87, 0xfd, 0xbe, 0xd7, 0xf5, 0x90, 0x9f, 0xd5, 0xe6, 0xe7, 0xe9, 0xd2, 0x59, + 0x84, 0x89, 0x53, 0x60, 0x37, 0x7b, 0xfa, 0x11, 0x00, 0x00, 0xff, 0xff, 0x43, 0xaa, 0xf1, 0xcc, + 0x27, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -119,6 +122,11 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.LengthOfVaults != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.LengthOfVaults)) + i-- + dAtA[i] = 0x28 + } if len(m.UserVaultAssetMapping) > 0 { for iNdEx := len(m.UserVaultAssetMapping) - 1; iNdEx >= 0; iNdEx-- { { @@ -219,6 +227,9 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if m.LengthOfVaults != 0 { + n += 1 + sovGenesis(uint64(m.LengthOfVaults)) + } return n } @@ -393,6 +404,25 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LengthOfVaults", wireType) + } + m.LengthOfVaults = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LengthOfVaults |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:])