tendermint / spn

A blockchain to launch blockchains.
Other
112 stars 43 forks source link

Emit event for auction creation related to an existing campaign #823

Closed lumtis closed 2 years ago

lumtis commented 2 years ago

Is your feature request related to a problem? Please describe. Emit an event upon auction creation if this auction is related to a campaign in the campaign module

This solution allows emitting information that can be reused by a backend solution to list auctions of a campaign instead of relying on a non-efficient query

Describe the solution you'd like Create a new event

type CampaignAuctionCreated struct {
  campaignID uint64
  auctionID uint64
  coordinatorAddress string
}

Register hooks from the campaign modules into auction creations

The event is emitted in the hooks logic if the selling coin is a voucher and the auction creator is the coordinator of the campaign

campaignID := getCampaignIDFromVoucher(auction.SellingCoin)
if campaignID
  if auction.auctioneer == getCoordinator(campaignID)
    emit(...)

Describe alternatives you've considered

lumtis commented 2 years ago

Require accessing auctionID. Created an issue for it https://github.com/tendermint/fundraising/issues/182