@@ -350,6 +350,23 @@ var setParamsCommand = cli.Command{
350350 Usage : "the target size of total local balance in " +
351351 "satoshis, used by easy autoloop." ,
352352 },
353+ cli.BoolFlag {
354+ Name : "asset_easyautoloop" ,
355+ Usage : "set to true to enable asset easy autoloop, which " +
356+ "will automatically dispatch asset swaps in order " +
357+ "to meet the target local balance." ,
358+ },
359+ cli.StringFlag {
360+ Name : "asset_id" ,
361+ Usage : "If set to a valid asset ID, the easyautoloop " +
362+ "and localbalancesat flags will be set for the " +
363+ "specified asset." ,
364+ },
365+ cli.Uint64Flag {
366+ Name : "asset_localbalance" ,
367+ Usage : "the target size of total local balance in " +
368+ "asset units, used by asset easy autoloop." ,
369+ },
353370 },
354371 Action : setParams ,
355372}
@@ -515,14 +532,48 @@ func setParams(ctx *cli.Context) error {
515532 flagSet = true
516533 }
517534
535+ // If we are setting easy autoloop parameters, we need to ensure that
536+ // the asset ID is set, and that we have a valid entry in our params
537+ // map.
538+ if ctx .IsSet ("asset_id" ) {
539+ if params .EasyAssetParams == nil {
540+ params .EasyAssetParams = make (
541+ map [string ]* looprpc.EasyAssetAutoloopParams ,
542+ )
543+ }
544+ if _ , ok := params .EasyAssetParams [ctx .String ("asset_id" )]; ! ok { //nolint:lll
545+ params .EasyAssetParams [ctx .String ("asset_id" )] =
546+ & looprpc.EasyAssetAutoloopParams {}
547+ }
548+ }
549+
518550 if ctx .IsSet ("easyautoloop" ) {
519551 params .EasyAutoloop = ctx .Bool ("easyautoloop" )
520552 flagSet = true
521553 }
522554
523555 if ctx .IsSet ("localbalancesat" ) {
524- params .EasyAutoloopLocalTargetSat =
525- ctx .Uint64 ("localbalancesat" )
556+ params .EasyAutoloopLocalTargetSat = ctx .Uint64 ("localbalancesat" )
557+ flagSet = true
558+ }
559+
560+ if ctx .IsSet ("asset_easyautoloop" ) {
561+ if ! ctx .IsSet ("asset_id" ) {
562+ return fmt .Errorf ("asset_id must be set to use " +
563+ "asset_easyautoloop" )
564+ }
565+ params .EasyAssetParams [ctx .String ("asset_id" )].
566+ Enabled = ctx .Bool ("asset_easyautoloop" )
567+ flagSet = true
568+ }
569+
570+ if ctx .IsSet ("asset_localbalance" ) {
571+ if ! ctx .IsSet ("asset_id" ) {
572+ return fmt .Errorf ("asset_id must be set to use " +
573+ "asset_localbalance" )
574+ }
575+ params .EasyAssetParams [ctx .String ("asset_id" )].
576+ LocalTargetAssetAmt = ctx .Uint64 ("asset_localbalance" )
526577 flagSet = true
527578 }
528579
0 commit comments