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
Showing only changes of commit 3710f83002 - Show all commits

View File

@ -910,10 +910,16 @@ func (k Keeper) pickProviderAuctionWinners(ctx sdk.Context, auction *auctiontype
totalAmountPaid := auction.WinningPrice.Amount.Mul(math.NewInt(int64(len(auction.WinnerAddresses)))) totalAmountPaid := auction.WinningPrice.Amount.Mul(math.NewInt(int64(len(auction.WinnerAddresses))))
creatorLeftOverAmount := sdk.NewCoin(auction.MaxPrice.Denom, totalLockedAmount.Sub(totalAmountPaid)) creatorLeftOverAmount := sdk.NewCoin(auction.MaxPrice.Denom, totalLockedAmount.Sub(totalAmountPaid))
creatorAddress, err := sdk.AccAddressFromBech32(auction.OwnerAddress)
if err != nil {
k.Logger(ctx).Error(fmt.Sprintf("Invalid creatorAddress address. %v", err))
panic("Invalid creator address.")
}
sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount( sdkErr := k.bankKeeper.SendCoinsFromModuleToAccount(
ctx, ctx,
auctiontypes.ModuleName, auctiontypes.ModuleName,
sdk.AccAddress(auction.OwnerAddress), creatorAddress,
sdk.NewCoins(creatorLeftOverAmount), sdk.NewCoins(creatorLeftOverAmount),
) )
if sdkErr != nil { if sdkErr != nil {