Skip to content

Commit

Permalink
cmd: add auction type param for orders
Browse files Browse the repository at this point in the history
  • Loading branch information
positiveblue committed Oct 4, 2022
1 parent fe2ca72 commit 17bdb49
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmd/pool/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const (
channelTypePeerDependent = "legacy"
channelTypeScriptEnforced = "script-enforced"

auctionTypeInboundLiquidity = "inbound"
auctionTypeOutboundLiquidity = "outbound"

defaultMaxBatchFeeRateSatPerVByte = 100

defaultConfirmationConstraints = 1
Expand Down Expand Up @@ -129,6 +132,13 @@ var sharedFlags = []cli.Flag{
channelTypePeerDependent,
channelTypeScriptEnforced),
},
cli.StringFlag{
Name: "auction_type",
Usage: fmt.Sprintf("the auction market where this offer "+
"must be considered in during the matching (%q, %q)",
auctionTypeInboundLiquidity,
auctionTypeOutboundLiquidity),
},
cli.StringSliceFlag{
Name: "allowed_node_id",
Usage: "the list of nodes this order is allowed to match " +
Expand Down Expand Up @@ -287,12 +297,26 @@ func parseCommonParams(ctx *cli.Context, blockDuration uint32) (*poolrpc.Order,
break
case channelTypePeerDependent:
params.ChannelType = auctioneerrpc.OrderChannelType_ORDER_CHANNEL_TYPE_PEER_DEPENDENT

case channelTypeScriptEnforced:
params.ChannelType = auctioneerrpc.OrderChannelType_ORDER_CHANNEL_TYPE_SCRIPT_ENFORCED

default:
return nil, fmt.Errorf("unknown channel type %q", channelType)
}

auctionType := ctx.String("auction_type")
switch auctionType {
case auctionTypeInboundLiquidity:
params.AuctionType = auctioneerrpc.AuctionType_AUCTION_TYPE_BTC_INBOUND_LIQUIDITY

case auctionTypeOutboundLiquidity:
params.AuctionType = auctioneerrpc.AuctionType_AUCTION_TYPE_BTC_OUTBOUND_LIQUIDITY

default:
return nil, fmt.Errorf("unknown auction type %q", channelType)
}

// Get the list of node ids this order is allowed/not allowed to match
// with.
allowedNodeIDs, err := parseNodePubKeySlice(ctx, "allowed_node_id")
Expand Down

0 comments on commit 17bdb49

Please sign in to comment.