diff --git a/app/app.go b/app/app.go index 546c0b89f..504631a51 100644 --- a/app/app.go +++ b/app/app.go @@ -573,6 +573,7 @@ func New( app.keys[collectortypes.StoreKey], app.keys[collectortypes.MemStoreKey], &app.assetKeeper, + &app.auctionKeeper, app.GetSubspace(collectortypes.ModuleName), app.bankKeeper, ) diff --git a/x/collector/expected/keeper.go b/x/collector/expected/keeper.go index 31d5bc0d2..e23e8ee3f 100644 --- a/x/collector/expected/keeper.go +++ b/x/collector/expected/keeper.go @@ -2,6 +2,7 @@ package expected import ( "github.com/comdex-official/comdex/x/asset/types" + auctiontypes "github.com/comdex-official/comdex/x/auction/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -22,3 +23,7 @@ type AssetKeeper interface { GetAsset(ctx sdk.Context, id uint64) (types.Asset, bool) GetMintGenesisTokenData(ctx sdk.Context, appId, assetId uint64) (mintData types.MintGenesisToken, found bool) } + +type AuctionKeeper interface { + GetAuctionParams(ctx sdk.Context, AppId uint64) (asset auctiontypes.AuctionParams, found bool) +} diff --git a/x/collector/keeper/alias.go b/x/collector/keeper/alias.go index 58a2c1302..4b58e670c 100644 --- a/x/collector/keeper/alias.go +++ b/x/collector/keeper/alias.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/comdex-official/comdex/x/asset/types" + auctiontypes "github.com/comdex-official/comdex/x/auction/types" ) func (k *Keeper) HasAssetForDenom(ctx sdk.Context, id string) bool { return k.asset.HasAssetForDenom(ctx, id) @@ -33,4 +34,8 @@ func (k *Keeper) SendCoinFromModuleToModule(ctx sdk.Context, senderModule, recip func (k *Keeper) GetMintGenesisTokenData(ctx sdk.Context, appId, assetId uint64) (mintData types.MintGenesisToken, found bool) { return k.asset.GetMintGenesisTokenData(ctx,appId, assetId) +} + +func (k *Keeper) GetAuctionParams(ctx sdk.Context, AppId uint64) (asset auctiontypes.AuctionParams, found bool) { + return k.auction.GetAuctionParams(ctx,AppId) } \ No newline at end of file diff --git a/x/collector/keeper/collector.go b/x/collector/keeper/collector.go index f329b1942..65fd91efd 100644 --- a/x/collector/keeper/collector.go +++ b/x/collector/keeper/collector.go @@ -329,6 +329,10 @@ func (k *Keeper) SetAuctionMappingForApp(ctx sdk.Context, records ...types.Colle if !found { return types.ErrorAppDoesNotExist } + _, found1 := k.GetAuctionParams(ctx, msg.AppId) + if !found1{ + return types.ErrorAuctionParmsNotSet + } var collectorAuctionLookup types.CollectorAuctionLookupTable collectorAuctionLookup.AppId = msg.AppId collectorAuctionLookup.AssetIdToAuctionLookup = msg.AssetIdToAuctionLookup diff --git a/x/collector/keeper/keeper.go b/x/collector/keeper/keeper.go index a9c7523e4..a48d52dec 100644 --- a/x/collector/keeper/keeper.go +++ b/x/collector/keeper/keeper.go @@ -18,6 +18,7 @@ type ( storeKey sdk.StoreKey memKey sdk.StoreKey asset expected.AssetKeeper + auction expected.AuctionKeeper paramStore paramtypes.Subspace bank expected.BankKeeper } @@ -28,6 +29,7 @@ func NewKeeper( storeKey, memKey sdk.StoreKey, asset expected.AssetKeeper, + auction expected.AuctionKeeper, ps paramtypes.Subspace, bank expected.BankKeeper, @@ -43,6 +45,7 @@ func NewKeeper( storeKey: storeKey, memKey: memKey, asset: asset, + auction: auction, paramStore: ps, bank: bank, } diff --git a/x/collector/types/errors.go b/x/collector/types/errors.go index 0339c639d..87b28de65 100644 --- a/x/collector/types/errors.go +++ b/x/collector/types/errors.go @@ -17,4 +17,5 @@ var ( ErrorRequestedAmtExceedsCollectedFee = sdkerrors.Register(ModuleName, 407, "Requested Amt Exceeds CollectedFee") ErrorAppDoesNotExist = sdkerrors.Register(ModuleName, 408, "app does not exist") ErrorAssetNotAddedForGenesisMinting = sdkerrors.Register(ModuleName, 409, "Asset Not Added For Genesis Minting") + ErrorAuctionParmsNotSet = sdkerrors.Register(ModuleName, 410, "Auction Parms Not Set") ) \ No newline at end of file