Skip to content

Commit

Permalink
cmd: add easy autoloop asset flags
Browse files Browse the repository at this point in the history
  • Loading branch information
sputn1ck committed Feb 18, 2025
1 parent ae44437 commit 60c3a87
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions cmd/loop/liquidity.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ var setParamsCommand = cli.Command{
Usage: "the target size of total local balance in " +
"satoshis, used by easy autoloop.",
},
cli.StringFlag{
Name: "asset_id",
Usage: "If set to a valid asset ID, the easyautoloop " +
"and localbalancesat flags will be set for the " +
"specified asset.",
},
},
Action: setParams,
}
Expand Down Expand Up @@ -515,14 +521,34 @@ func setParams(ctx *cli.Context) error {
flagSet = true
}

// If we are setting easy autoloop parameters, we need to ensure that
// the asset ID is set, and that we have a valid entry in our params
// map.
if ctx.IsSet(ctx.String("asset_id")) {
if _, ok := params.EasyAssetParams[ctx.String("asset_id")]; !ok { //nolint:lll
params.EasyAssetParams[ctx.String("asset_id")] =
&looprpc.EasyAssetParams{}
}
}

if ctx.IsSet("easyautoloop") {
params.EasyAutoloop = ctx.Bool("easyautoloop")
if ctx.IsSet("asset_id") {
params.EasyAssetParams[ctx.String("asset_id")].
EasyAutoloop = ctx.Bool("easyautoloop")

Check failure on line 537 in cmd/loop/liquidity.go

View workflow job for this annotation

GitHub Actions / run unit tests

params.EasyAssetParams[ctx.String("asset_id")].EasyAutoloop undefined (type *looprpc.EasyAssetParams has no field or method EasyAutoloop)

Check failure on line 537 in cmd/loop/liquidity.go

View workflow job for this annotation

GitHub Actions / build and lint code

params.EasyAssetParams[ctx.String("asset_id")].EasyAutoloop undefined (type *looprpc.EasyAssetParams has no field or method EasyAutoloop)
} else {
params.EasyAutoloop = ctx.Bool("easyautoloop")
}
flagSet = true
}

if ctx.IsSet("localbalancesat") {
params.EasyAutoloopLocalTargetSat =
ctx.Uint64("localbalancesat")
if ctx.IsSet("asset_id") {
params.EasyAssetParams[ctx.String("asset_id")].
EasyAutoloopLocalTargetSat = ctx.Uint64("localbalancesat")

Check failure on line 547 in cmd/loop/liquidity.go

View workflow job for this annotation

GitHub Actions / run unit tests

params.EasyAssetParams[ctx.String("asset_id")].EasyAutoloopLocalTargetSat undefined (type *looprpc.EasyAssetParams has no field or method EasyAutoloopLocalTargetSat)

Check failure on line 547 in cmd/loop/liquidity.go

View workflow job for this annotation

GitHub Actions / build and lint code

params.EasyAssetParams[ctx.String("asset_id")].EasyAutoloopLocalTargetSat undefined (type *looprpc.EasyAssetParams has no field or method EasyAutoloopLocalTargetSat)
} else {
params.EasyAutoloopLocalTargetSat =
ctx.Uint64("localbalancesat")
}
flagSet = true
}

Expand Down

0 comments on commit 60c3a87

Please sign in to comment.