Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: convert resources to resources offer #93

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

import (
"sort"

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

type ResourcesOffer []ResourceOffer
Expand Down Expand Up @@ -36,3 +38,16 @@

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,
})
}

Check warning on line 50 in go/node/market/v1beta4/bid.go

View check run for this annotation

Codecov / codecov/patch

go/node/market/v1beta4/bid.go#L42-L50

Added lines #L42 - L50 were not covered by tests

return res

Check warning on line 52 in go/node/market/v1beta4/bid.go

View check run for this annotation

Codecov / codecov/patch

go/node/market/v1beta4/bid.go#L52

Added line #L52 was not covered by tests
}
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 @@
)

// 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 {

Check warning on line 25 in go/node/market/v1beta4/msgs.go

View check run for this annotation

Codecov / codecov/patch

go/node/market/v1beta4/msgs.go#L25

Added line #L25 was not covered by tests
return &MsgCreateBid{
Order: id,
Provider: provider.String(),
Price: price,
Deposit: deposit,
Order: id,
Provider: provider.String(),
Price: price,
Deposit: deposit,
ResourcesOffer: roffer,

Check warning on line 31 in go/node/market/v1beta4/msgs.go

View check run for this annotation

Codecov / codecov/patch

go/node/market/v1beta4/msgs.go#L27-L31

Added lines #L27 - L31 were not covered by tests
}
}

Expand Down