11package allocations
22
33import (
4+ "fmt"
45 "sort"
56
67 "github.com/Layr-Labs/eigenlayer-cli/pkg/internal/common"
@@ -51,7 +52,7 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
5152 }
5253
5354 // Temp to test modify allocations
54- config .delegationManagerAddress = gethcommon .HexToAddress ("0xD9DFF502e91aE5887399C8ca11a0708dc1ee1cbf " )
55+ config .delegationManagerAddress = gethcommon .HexToAddress ("0xec91e43612896E7D45736cE751bea6dbf1BBEdB5 " )
5556
5657 elReader , err := elcontracts .NewReaderFromConfig (
5758 elcontracts.Config {
@@ -77,7 +78,7 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
7778 logger .Debugf ("Allocatable magnitude for strategy %v: %d" , strategyAddress , allocatableMagnitude )
7879 }
7980
80- opSet , slashableMagnitudes , err := elReader .GetCurrentSlashableMagnitudes (
81+ opSets , slashableMagnitudes , err := elReader .GetCurrentSlashableMagnitudes (
8182 & bind.CallOpts {Context : ctx },
8283 config .operatorAddress ,
8384 config .strategyAddresses ,
@@ -89,7 +90,7 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
8990 slashableMagnitudeHolders := make (SlashableMagnitudeHolders , 0 )
9091 for i , strategyAddress := range config .strategyAddresses {
9192 slashableMagnitude := slashableMagnitudes [i ]
92- for j , opSet := range opSet {
93+ for j , opSet := range opSets {
9394 slashableMagnitudeHolders = append (slashableMagnitudeHolders , SlashableMagnitudesHolder {
9495 StrategyAddress : strategyAddress ,
9596 AVSAddress : opSet .Avs ,
@@ -99,6 +100,79 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
99100 }
100101 }
101102
103+ // Get Pending allocations
104+ pendingAllocationsDetails := make (AllocationDetailsHolder , 0 )
105+ for _ , strategyAddress := range config .strategyAddresses {
106+ pendingAllocations , timestamps , err := elReader .GetPendingAllocations (
107+ & bind.CallOpts {Context : ctx },
108+ config .operatorAddress ,
109+ strategyAddress ,
110+ opSets ,
111+ )
112+ if err != nil {
113+ return eigenSdkUtils .WrapError ("failed to get pending allocations" , err )
114+ }
115+ for i , opSet := range opSets {
116+ pendingAllocation := pendingAllocations [i ]
117+ timestamp := timestamps [i ]
118+ if pendingAllocation == 0 && timestamp == 0 {
119+ continue
120+ }
121+ pendingAllocationsDetails = append (pendingAllocationsDetails , AllocationDetails {
122+ StrategyAddress : strategyAddress ,
123+ AVSAddress : opSet .Avs ,
124+ OperatorSetId : opSet .OperatorSetId ,
125+ Allocation : pendingAllocation ,
126+ Timestamp : timestamp ,
127+ })
128+ }
129+ }
130+
131+ pendingDeallocationsDetails := make (AllocationDetailsHolder , 0 )
132+ for _ , strategyAddress := range config .strategyAddresses {
133+ pendingDeallocations , err := elReader .GetPendingDeallocations (
134+ & bind.CallOpts {Context : ctx },
135+ config .operatorAddress ,
136+ strategyAddress ,
137+ opSets ,
138+ )
139+ if err != nil {
140+ return eigenSdkUtils .WrapError ("failed to get pending deallocations" , err )
141+ }
142+ for i , opSet := range opSets {
143+ pendingAllocation := pendingDeallocations [i ]
144+ if pendingAllocation .MagnitudeDiff == 0 && pendingAllocation .CompletableTimestamp == 0 {
145+ continue
146+ }
147+ pendingDeallocationsDetails = append (pendingDeallocationsDetails , AllocationDetails {
148+ StrategyAddress : strategyAddress ,
149+ AVSAddress : opSet .Avs ,
150+ OperatorSetId : opSet .OperatorSetId ,
151+ Allocation : pendingAllocation .MagnitudeDiff ,
152+ Timestamp : pendingAllocation .CompletableTimestamp ,
153+ })
154+ }
155+ }
156+
157+ fmt .Println ()
158+ fmt .Println ("------------------Pending Allocations---------------------" )
159+ if config .outputType == string (common .OutputType_Json ) {
160+ pendingAllocationsDetails .PrintJSON ()
161+ } else {
162+ pendingAllocationsDetails .PrintPretty ()
163+ }
164+ fmt .Println ()
165+
166+ fmt .Println ()
167+ fmt .Println ("------------------Pending Deallocations---------------------" )
168+ if config .outputType == string (common .OutputType_Json ) {
169+ pendingDeallocationsDetails .PrintJSON ()
170+ } else {
171+ pendingDeallocationsDetails .PrintPretty ()
172+ }
173+ fmt .Println ()
174+
175+ fmt .Println ("------------------Current Slashable Magnitudes---------------------" )
102176 if config .outputType == string (common .OutputType_Json ) {
103177 slashableMagnitudeHolders .PrintJSON ()
104178 } else {
@@ -119,7 +193,7 @@ func readAndValidateShowConfig(cCtx *cli.Context, logger *logging.Logger) (*show
119193 outputType := cCtx .String (flags .OutputTypeFlag .Name )
120194
121195 chainId := utils .NetworkNameToChainId (network )
122- delegationManagerAddress , err := utils .GetDelegationManagerAddress (chainId )
196+ delegationManagerAddress , err := common .GetDelegationManagerAddress (chainId )
123197 if err != nil {
124198 return nil , err
125199 }
0 commit comments