Skip to content

Commit

Permalink
slashing command spec
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimalmadhur committed Jun 7, 2024
1 parent d1d6339 commit 8292d6f
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 0 deletions.
69 changes: 69 additions & 0 deletions pkg/flags/flags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package flags

import "github.com/urfave/cli/v2"

var (
ConfigurationFileFlag = cli.StringFlag{
Name: "configuration-file",
Usage: "Path to the configuration file",
Required: true,
Aliases: []string{"c"},
}

AvsAddressesFlag = cli.StringSliceFlag{
Name: "avs-addresses",
Usage: "Comma separated list of AVS addresses",
Required: false,
Aliases: []string{"a"},
}

OperatorSetsFlag = cli.StringSliceFlag{
Name: "operator-sets",
Usage: "Comma separated list of operator sets",
Required: false,
Aliases: []string{"os"},
}

OperatorSetFlag = cli.StringFlag{
Name: "operator-set",
Usage: "Operator set identifier",
Required: true,
Aliases: []string{"o"},
}

NumberOfDaysFlag = cli.IntFlag{
Name: "number-of-days",
Usage: "Number of days to show rewards for. Negative values to view retroactive rewards.",
Required: false,
DefaultText: "21",
Aliases: []string{"n"},
}

DryRunFlag = cli.BoolFlag{
Name: "dry-run",
Usage: "Dry run the command",
Required: false,
Aliases: []string{"d"},
}

BroadcastFlag = cli.BoolFlag{
Name: "broadcast",
Usage: "Broadcast the transaction",
Required: false,
Aliases: []string{"b"},
}

AllocationPercentageFlag = cli.StringFlag{
Name: "allocation-percentage",
Usage: "Allocation to update",
Required: true,
Aliases: []string{"a"},
}

StakeSourceFlag = cli.StringFlag{
Name: "stake-source",
Usage: "The source of stake in case of allocation. The destination of stake if deallocation. Options are 'slashable', 'nonslashable' or 'both'. ",
Required: true,
Aliases: []string{"s"},
}
)
3 changes: 3 additions & 0 deletions pkg/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pkg
import (
"github.com/Layr-Labs/eigenlayer-cli/pkg/operator"
"github.com/Layr-Labs/eigenlayer-cli/pkg/utils"

"github.com/urfave/cli/v2"
)

Expand All @@ -16,6 +17,8 @@ func OperatorCmd(p utils.Prompter) *cli.Command {
operator.RegisterCmd(p),
operator.StatusCmd(p),
operator.UpdateCmd(p),
operator.StakeAllocationCmd(p),
operator.RewardsCmd(p),
},
}

Expand Down
19 changes: 19 additions & 0 deletions pkg/operator/rewards.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package operator

import (
"github.com/Layr-Labs/eigenlayer-cli/pkg/operator/rewards"
"github.com/Layr-Labs/eigenlayer-cli/pkg/utils"

"github.com/urfave/cli/v2"
)

func RewardsCmd(p utils.Prompter) *cli.Command {
return &cli.Command{
Name: "rewards",
Usage: "Rewards commands",
Hidden: true,
Subcommands: []*cli.Command{
rewards.ShowCmd(p),
},
}
}
32 changes: 32 additions & 0 deletions pkg/operator/rewards/show.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package rewards

import (
"fmt"

"github.com/Layr-Labs/eigenlayer-cli/pkg/flags"
"github.com/Layr-Labs/eigenlayer-cli/pkg/telemetry"
"github.com/Layr-Labs/eigenlayer-cli/pkg/utils"

"github.com/urfave/cli/v2"
)

func ShowCmd(p utils.Prompter) *cli.Command {
return &cli.Command{
Name: "show",
Aliases: []string{"s"},
Usage: "Show rewards",
After: telemetry.AfterRunAction(),
Action: showRewards,
Flags: []cli.Flag{
&flags.ConfigurationFileFlag,
&flags.NumberOfDaysFlag,
&flags.OperatorSetsFlag,
&flags.AvsAddressesFlag,
},
}
}

func showRewards(cCtx *cli.Context) error {
fmt.Println("unimplemented")
return nil
}
20 changes: 20 additions & 0 deletions pkg/operator/stakeallocation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package operator

import (
"github.com/Layr-Labs/eigenlayer-cli/pkg/operator/stakeallocation"
"github.com/Layr-Labs/eigenlayer-cli/pkg/utils"

"github.com/urfave/cli/v2"
)

func StakeAllocationCmd(p utils.Prompter) *cli.Command {
return &cli.Command{
Name: "stake-allocation",
Usage: "Stake allocation commands",
Hidden: true,
Subcommands: []*cli.Command{
stakeallocation.ShowCmd(p),
stakeallocation.UpdateCmd(p),
},
}
}
34 changes: 34 additions & 0 deletions pkg/operator/stakeallocation/show.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package stakeallocation

import (
"fmt"

"github.com/Layr-Labs/eigenlayer-cli/pkg/flags"
"github.com/Layr-Labs/eigenlayer-cli/pkg/telemetry"
"github.com/Layr-Labs/eigenlayer-cli/pkg/utils"

"github.com/urfave/cli/v2"
)

func ShowCmd(p utils.Prompter) *cli.Command {
return &cli.Command{
Name: "show",
Aliases: []string{"s"},
Usage: "Show stake allocation",
Description: `
Show the stake allocation for the operator
`,
Action: showStakeAllocation,
After: telemetry.AfterRunAction(),
Flags: []cli.Flag{
&flags.ConfigurationFileFlag,
&flags.AvsAddressesFlag,
&flags.OperatorSetsFlag,
},
}
}

func showStakeAllocation(ctx *cli.Context) error {
fmt.Println("unimplemented")
return nil
}
38 changes: 38 additions & 0 deletions pkg/operator/stakeallocation/update.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package stakeallocation

import (
"fmt"

"github.com/Layr-Labs/eigenlayer-cli/pkg/flags"
"github.com/Layr-Labs/eigenlayer-cli/pkg/telemetry"
"github.com/Layr-Labs/eigenlayer-cli/pkg/utils"
"github.com/urfave/cli/v2"
)

func UpdateCmd(p utils.Prompter) *cli.Command {
return &cli.Command{
Name: "update",
Aliases: []string{"u"},
Usage: "Update stake allocation",
Description: `
Update the stake allocation for the operator
`,
Action: func(context *cli.Context) error {
return updateStakeAllocation(context, p)
},
After: telemetry.AfterRunAction(),
Flags: []cli.Flag{
&flags.ConfigurationFileFlag,
&flags.OperatorSetFlag,
&flags.DryRunFlag,
&flags.BroadcastFlag,
&flags.AllocationPercentageFlag,
&flags.StakeSourceFlag,
},
}
}

func updateStakeAllocation(ctx *cli.Context, p utils.Prompter) error {
fmt.Println("unimplemented")
return nil
}

0 comments on commit 8292d6f

Please sign in to comment.