Skip to content

Commit

Permalink
feat: convert resources to resources offer (#93)
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian authored Nov 15, 2023
1 parent daf7934 commit ec2d8fa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
15 changes: 15 additions & 0 deletions go/node/market/v1beta4/bid.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package v1beta4

import (
"sort"

"github.com/akash-network/akash-api/go/node/deployment/v1beta3"
)

type ResourcesOffer []ResourceOffer
Expand Down Expand Up @@ -36,3 +38,16 @@ func (s ResourcesOffer) Dup() ResourcesOffer {

return s
}

func ResourceOfferFromRU(ru v1beta3.ResourceUnits) ResourcesOffer {
res := make(ResourcesOffer, 0, len(ru))

for _, r := range ru {
res = append(res, ResourceOffer{
Resources: r.Resources,
Count: r.Count,
})
}

return res
}
11 changes: 6 additions & 5 deletions go/node/market/v1beta4/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ var (
)

// NewMsgCreateBid creates a new MsgCreateBid instance
func NewMsgCreateBid(id OrderID, provider sdk.AccAddress, price sdk.DecCoin, deposit sdk.Coin) *MsgCreateBid {
func NewMsgCreateBid(id OrderID, provider sdk.AccAddress, price sdk.DecCoin, deposit sdk.Coin, roffer ResourcesOffer) *MsgCreateBid {
return &MsgCreateBid{
Order: id,
Provider: provider.String(),
Price: price,
Deposit: deposit,
Order: id,
Provider: provider.String(),
Price: price,
Deposit: deposit,
ResourcesOffer: roffer,
}
}

Expand Down

0 comments on commit ec2d8fa

Please sign in to comment.