Add service provider auctions #59

Merged
nabarun merged 29 commits from deep-stack/laconicd:iv-service-provider-auction into main 2024-09-25 12:38:50 +00:00
2 changed files with 12 additions and 8 deletions
Showing only changes of commit 0defde75ee - Show all commits

View File

@ -224,13 +224,17 @@ func (k Keeper) PaginatedListRecords(ctx sdk.Context, pagination *query.PageRequ
} }
} else { } else {
var err error var err error
records, pageResp, err = query.CollectionPaginate(ctx, k.Records, pagination, func(key string, value registrytypes.Record) (registrytypes.Record, error) { records, pageResp, err = query.CollectionPaginate(
if err := k.populateRecordNames(ctx, &value); err != nil { ctx,
return registrytypes.Record{}, err k.Records,
} pagination,
func(key string, value registrytypes.Record) (registrytypes.Record, error) {
if err := k.populateRecordNames(ctx, &value); err != nil {
return registrytypes.Record{}, err
}
return value, nil return value, nil
}) })
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }

View File

@ -94,9 +94,9 @@ func (rk RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionId string
} }
if auctionObj.Status == auctiontypes.AuctionStatusCompleted { if auctionObj.Status == auctiontypes.AuctionStatusCompleted {
if auctionObj.WinnerAddress != "" { if len(auctionObj.WinnerAddresses) == 1 {
// Mark authority owner and change status to active. // Mark authority owner and change status to active.
authority.OwnerAddress = auctionObj.WinnerAddress authority.OwnerAddress = auctionObj.WinnerAddresses[0]
authority.Status = registrytypes.AuthorityActive authority.Status = registrytypes.AuthorityActive
// Reset bond id if required, as owner has changed. // Reset bond id if required, as owner has changed.