1
1
package allocations
2
2
3
3
import (
4
+ "fmt"
4
5
"sort"
5
6
6
7
"github.com/Layr-Labs/eigenlayer-cli/pkg/internal/common"
@@ -51,7 +52,7 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
51
52
}
52
53
53
54
// Temp to test modify allocations
54
- config .delegationManagerAddress = gethcommon .HexToAddress ("0xD9DFF502e91aE5887399C8ca11a0708dc1ee1cbf " )
55
+ config .delegationManagerAddress = gethcommon .HexToAddress ("0xec91e43612896E7D45736cE751bea6dbf1BBEdB5 " )
55
56
56
57
elReader , err := elcontracts .NewReaderFromConfig (
57
58
elcontracts.Config {
@@ -77,7 +78,7 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
77
78
logger .Debugf ("Allocatable magnitude for strategy %v: %d" , strategyAddress , allocatableMagnitude )
78
79
}
79
80
80
- opSet , slashableMagnitudes , err := elReader .GetCurrentSlashableMagnitudes (
81
+ opSets , slashableMagnitudes , err := elReader .GetCurrentSlashableMagnitudes (
81
82
& bind.CallOpts {Context : ctx },
82
83
config .operatorAddress ,
83
84
config .strategyAddresses ,
@@ -89,7 +90,7 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
89
90
slashableMagnitudeHolders := make (SlashableMagnitudeHolders , 0 )
90
91
for i , strategyAddress := range config .strategyAddresses {
91
92
slashableMagnitude := slashableMagnitudes [i ]
92
- for j , opSet := range opSet {
93
+ for j , opSet := range opSets {
93
94
slashableMagnitudeHolders = append (slashableMagnitudeHolders , SlashableMagnitudesHolder {
94
95
StrategyAddress : strategyAddress ,
95
96
AVSAddress : opSet .Avs ,
@@ -99,6 +100,79 @@ func showAction(cCtx *cli.Context, p utils.Prompter) error {
99
100
}
100
101
}
101
102
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---------------------" )
102
176
if config .outputType == string (common .OutputType_Json ) {
103
177
slashableMagnitudeHolders .PrintJSON ()
104
178
} else {
@@ -119,7 +193,7 @@ func readAndValidateShowConfig(cCtx *cli.Context, logger *logging.Logger) (*show
119
193
outputType := cCtx .String (flags .OutputTypeFlag .Name )
120
194
121
195
chainId := utils .NetworkNameToChainId (network )
122
- delegationManagerAddress , err := utils .GetDelegationManagerAddress (chainId )
196
+ delegationManagerAddress , err := common .GetDelegationManagerAddress (chainId )
123
197
if err != nil {
124
198
return nil , err
125
199
}
0 commit comments