@@ -162,4 +162,76 @@ contract HorizonStakingThawTest is HorizonStakingTest {
162
162
);
163
163
vm.assertEq (thawedTokens, thawAmount * thawSteps);
164
164
}
165
+
166
+ function testThaw_GetThawedTokens_AfterProvisionFullySlashed (
167
+ uint256 amount ,
168
+ uint64 thawingPeriod ,
169
+ uint256 thawAmount
170
+ ) public useIndexer useProvision (amount, 0 , thawingPeriod) {
171
+ // thaw some funds so there are some shares thawing and tokens thawing
172
+ thawAmount = bound (thawAmount, 1 , amount);
173
+ _thaw (users.indexer, subgraphDataServiceAddress, thawAmount);
174
+
175
+ // skip to after the thawing period has passed
176
+ skip (thawingPeriod + 1 );
177
+
178
+ // slash all of it
179
+ resetPrank (subgraphDataServiceAddress);
180
+ _slash (users.indexer, subgraphDataServiceAddress, amount, 0 );
181
+
182
+ // get the thawed tokens - should be zero now as the pool was reset
183
+ uint256 thawedTokens = staking.getThawedTokens (
184
+ ThawRequestType.Provision,
185
+ users.indexer,
186
+ subgraphDataServiceAddress,
187
+ users.indexer
188
+ );
189
+ vm.assertEq (thawedTokens, 0 );
190
+ }
191
+
192
+ function testThaw_GetThawedTokens_AfterRecoveringProvision (
193
+ uint256 amount ,
194
+ uint64 thawingPeriod ,
195
+ uint256 thawAmount
196
+ ) public useIndexer useProvision (amount, 0 , thawingPeriod) {
197
+ // thaw some funds so there are some shares thawing and tokens thawing
198
+ thawAmount = bound (thawAmount, 1 , amount);
199
+ _thaw (users.indexer, subgraphDataServiceAddress, thawAmount);
200
+
201
+ // skip to after the thawing period has passed
202
+ skip (thawingPeriod + 1 );
203
+
204
+ // slash all of it
205
+ resetPrank (subgraphDataServiceAddress);
206
+ _slash (users.indexer, subgraphDataServiceAddress, amount, 0 );
207
+
208
+ // get the thawed tokens - should be zero now as the pool was reset
209
+ uint256 thawedTokens = staking.getThawedTokens (
210
+ ThawRequestType.Provision,
211
+ users.indexer,
212
+ subgraphDataServiceAddress,
213
+ users.indexer
214
+ );
215
+ vm.assertEq (thawedTokens, 0 );
216
+
217
+ // put some funds back in
218
+ resetPrank (users.indexer);
219
+ _stake (amount);
220
+ _addToProvision (users.indexer, subgraphDataServiceAddress, amount);
221
+
222
+ // thaw some more funds
223
+ _thaw (users.indexer, subgraphDataServiceAddress, thawAmount);
224
+
225
+ // skip to after the thawing period has passed
226
+ skip (block .timestamp + thawingPeriod + 1 );
227
+
228
+ // get the thawed tokens - should be the amount we thawed
229
+ thawedTokens = staking.getThawedTokens (
230
+ ThawRequestType.Provision,
231
+ users.indexer,
232
+ subgraphDataServiceAddress,
233
+ users.indexer
234
+ );
235
+ vm.assertEq (thawedTokens, thawAmount);
236
+ }
165
237
}
0 commit comments