diff --git a/x/lending/keeper/msg_server.go b/x/lending/keeper/msg_server.go index 9822f1b..8c8a37b 100644 --- a/x/lending/keeper/msg_server.go +++ b/x/lending/keeper/msg_server.go @@ -13,7 +13,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sideprotocol/side/crypto/adaptor" - dlc "github.com/sideprotocol/side/x/dlc/types" "github.com/sideprotocol/side/x/lending/types" ) @@ -31,7 +30,11 @@ func (m msgServer) Apply(goCtx context.Context, msg *types.MsgApply) (*types.Msg // return nil, errb // } - event := dlc.DLCPriceEvent{} // need to integrate with dlc module + if !m.dlcKeeper.HasEvent(ctx, msg.EventId) { + return nil, types.ErrInvalidPriceEvent + } + + event := m.dlcKeeper.GetEvent(ctx, msg.EventId) if event.HasTriggered { return nil, types.ErrInvalidPriceEvent } diff --git a/x/lending/types/expected_keepers.go b/x/lending/types/expected_keepers.go index cdde53c..99057b6 100644 --- a/x/lending/types/expected_keepers.go +++ b/x/lending/types/expected_keepers.go @@ -51,6 +51,7 @@ type AuctionKeeper interface { // DLCKeeper defines the expected DLC keeper interface type DLCKeeper interface { + HasEvent(ctx sdk.Context, id uint64) bool GetEvent(ctx sdk.Context, id uint64) *dlctypes.DLCPriceEvent GetAttestationByEvent(ctx sdk.Context, eventId uint64) *dlctypes.DLCAttestation