Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auction check added in collector #219

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ func New(
app.keys[collectortypes.StoreKey],
app.keys[collectortypes.MemStoreKey],
&app.assetKeeper,
&app.auctionKeeper,
app.GetSubspace(collectortypes.ModuleName),
app.bankKeeper,
)
Expand Down
5 changes: 5 additions & 0 deletions x/collector/expected/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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)
}
5 changes: 5 additions & 0 deletions x/collector/keeper/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
4 changes: 4 additions & 0 deletions x/collector/keeper/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions x/collector/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type (
storeKey sdk.StoreKey
memKey sdk.StoreKey
asset expected.AssetKeeper
auction expected.AuctionKeeper
paramStore paramtypes.Subspace
bank expected.BankKeeper
}
Expand All @@ -28,6 +29,7 @@ func NewKeeper(
storeKey,
memKey sdk.StoreKey,
asset expected.AssetKeeper,
auction expected.AuctionKeeper,
ps paramtypes.Subspace,
bank expected.BankKeeper,

Expand All @@ -43,6 +45,7 @@ func NewKeeper(
storeKey: storeKey,
memKey: memKey,
asset: asset,
auction: auction,
paramStore: ps,
bank: bank,
}
Expand Down
1 change: 1 addition & 0 deletions x/collector/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)