From a2edd78f5a929ffbac171cdc9bcf597f85f1bcf6 Mon Sep 17 00:00:00 2001 From: carla Date: Mon, 12 Oct 2020 13:34:57 +0200 Subject: [PATCH] loop: add autoout parameters to cli --- cmd/loop/liquidity.go | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/cmd/loop/liquidity.go b/cmd/loop/liquidity.go index 35e4eb4..a1988e2 100644 --- a/cmd/loop/liquidity.go +++ b/cmd/loop/liquidity.go @@ -224,6 +224,30 @@ var setParamsCommand = cli.Command{ "previously had a failed swap will be " + "included in suggestions.", }, + cli.BoolFlag{ + Name: "autoout", + Usage: "set to true to enable automated dispatch " + + "of loop out swaps, limited to the budget " + + "set by autobudget", + }, + cli.Uint64Flag{ + Name: "autobudget", + Usage: "the maximum amount of fees in satoshis that " + + "automatically dispatched loop out swaps may " + + "spend", + }, + cli.Uint64Flag{ + Name: "budgetstart", + Usage: "the start time for the automated loop " + + "out budget, expressed as a unix timestamp " + + "in seconds", + }, + cli.Uint64Flag{ + Name: "autoinflight", + Usage: "the maximum number of automatically " + + "dispatched swaps that we allow to be in " + + "flight", + }, }, Action: setParams, } @@ -304,6 +328,26 @@ func setParams(ctx *cli.Context) error { flagSet = true } + if ctx.IsSet("autoout") { + params.AutoLoopOut = ctx.Bool("autoout") + flagSet = true + } + + if ctx.IsSet("autobudget") { + params.AutoOutBudgetSat = ctx.Uint64("autobudget") + flagSet = true + } + + if ctx.IsSet("budgetstart") { + params.AutoOutBudgetStartSec = ctx.Uint64("budgetstart") + flagSet = true + } + + if ctx.IsSet("autoinflight") { + params.AutoMaxInFlight = ctx.Uint64("autoinflight") + flagSet = true + } + if !flagSet { return fmt.Errorf("at least one flag required to set params") }