Skip to content

Commit 375c78f

Browse files
committed
chore: add request type to thaw request events
Signed-off-by: Tomás Migone <[email protected]>
1 parent c5ca097 commit 375c78f

File tree

4 files changed

+46
-14
lines changed

4 files changed

+46
-14
lines changed

packages/horizon/contracts/interfaces/internal/IHorizonStakingMain.sol

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ interface IHorizonStakingMain {
244244
/**
245245
* @notice Emitted when a thaw request is created.
246246
* @dev Can be emitted by the service provider when thawing stake or by the delegator when undelegating.
247+
* @param requestType The type of thaw request
247248
* @param serviceProvider The address of the service provider
248249
* @param verifier The address of the verifier
249250
* @param owner The address of the owner of the thaw request.
@@ -252,23 +253,26 @@ interface IHorizonStakingMain {
252253
* @param thawRequestId The ID of the thaw request
253254
*/
254255
event ThawRequestCreated(
256+
IHorizonStakingTypes.ThawRequestType indexed requestType,
255257
address indexed serviceProvider,
256258
address indexed verifier,
257-
address indexed owner,
259+
address owner,
258260
uint256 shares,
259261
uint64 thawingUntil,
260262
bytes32 thawRequestId
261263
);
262264

263265
/**
264266
* @notice Emitted when a thaw request is fulfilled, meaning the stake is released.
267+
* @param requestType The type of thaw request
265268
* @param thawRequestId The ID of the thaw request
266269
* @param tokens The amount of tokens being released
267270
* @param shares The amount of shares being released
268271
* @param thawingUntil The timestamp until the stake has thawed
269272
* @param valid Whether the thaw request was valid at the time of fulfillment
270273
*/
271274
event ThawRequestFulfilled(
275+
IHorizonStakingTypes.ThawRequestType indexed requestType,
272276
bytes32 indexed thawRequestId,
273277
uint256 tokens,
274278
uint256 shares,
@@ -286,12 +290,12 @@ interface IHorizonStakingMain {
286290
* @param requestType The type of thaw request
287291
*/
288292
event ThawRequestsFulfilled(
293+
IHorizonStakingTypes.ThawRequestType indexed requestType,
289294
address indexed serviceProvider,
290295
address indexed verifier,
291-
address indexed owner,
296+
address owner,
292297
uint256 thawRequestsFulfilled,
293-
uint256 tokens,
294-
IHorizonStakingTypes.ThawRequestType requestType
298+
uint256 tokens
295299
);
296300

297301
// -- Events: governance --

packages/horizon/contracts/staking/HorizonStaking.sol

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,15 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
10321032
if (thawRequestList.count != 0) _getThawRequest(_requestType, thawRequestList.tail).next = thawRequestId;
10331033
thawRequestList.addTail(thawRequestId);
10341034

1035-
emit ThawRequestCreated(_serviceProvider, _verifier, _owner, _shares, _thawingUntil, thawRequestId);
1035+
emit ThawRequestCreated(
1036+
_requestType,
1037+
_serviceProvider,
1038+
_verifier,
1039+
_owner,
1040+
_shares,
1041+
_thawingUntil,
1042+
thawRequestId
1043+
);
10361044
return thawRequestId;
10371045
}
10381046

@@ -1058,12 +1066,12 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
10581066
TraverseThawRequestsResults memory results = _traverseThawRequests(_params, thawRequestList);
10591067

10601068
emit ThawRequestsFulfilled(
1069+
_params.requestType,
10611070
_params.serviceProvider,
10621071
_params.verifier,
10631072
_params.owner,
10641073
results.requestsFulfilled,
1065-
results.tokensThawed,
1066-
_params.requestType
1074+
results.tokensThawed
10671075
);
10681076

10691077
return (results.tokensThawed, results.tokensThawing, results.sharesThawing);
@@ -1149,6 +1157,7 @@ contract HorizonStaking is HorizonStakingBase, IHorizonStakingMain {
11491157
tokensThawed = tokensThawed + tokens;
11501158
}
11511159
emit ThawRequestFulfilled(
1160+
requestType,
11521161
_thawRequestId,
11531162
tokens,
11541163
thawRequest.shares,

packages/horizon/hardhat.config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,24 @@ import '@nomicfoundation/hardhat-ignition-ethers'
77
import 'hardhat-storage-layout'
88
import 'hardhat-contract-sizer'
99
import 'hardhat-secure-accounts'
10+
import { HardhatUserConfig } from 'hardhat/types'
1011

1112
// Skip importing hardhat-graph-protocol when building the project, it has circular dependency
1213
if (process.env.BUILD_RUN !== 'true') {
1314
require('hardhat-graph-protocol')
1415
}
1516

16-
export default hardhatBaseConfig
17+
const config: HardhatUserConfig = {
18+
...hardhatBaseConfig,
19+
solidity: {
20+
version: '0.8.27',
21+
settings: {
22+
optimizer: {
23+
enabled: true,
24+
runs: 70,
25+
},
26+
},
27+
},
28+
}
29+
30+
export default config

packages/horizon/test/shared/horizon-staking/HorizonStakingShared.t.sol

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
417417
// thaw
418418
vm.expectEmit(address(staking));
419419
emit IHorizonStakingMain.ThawRequestCreated(
420+
IHorizonStakingTypes.ThawRequestType.Provision,
420421
serviceProvider,
421422
verifier,
422423
serviceProvider,
@@ -491,6 +492,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
491492
ThawRequest memory thawRequest = calcValues.thawRequestsFulfilledList[i];
492493
vm.expectEmit(address(staking));
493494
emit IHorizonStakingMain.ThawRequestFulfilled(
495+
params.thawRequestType,
494496
calcValues.thawRequestsFulfilledListIds[i],
495497
calcValues.thawRequestsFulfilledListTokens[i],
496498
thawRequest.shares,
@@ -500,12 +502,12 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
500502
}
501503
vm.expectEmit(address(staking));
502504
emit IHorizonStakingMain.ThawRequestsFulfilled(
505+
IHorizonStakingTypes.ThawRequestType.Provision,
503506
serviceProvider,
504507
verifier,
505508
serviceProvider,
506509
calcValues.thawRequestsFulfilledList.length,
507-
calcValues.tokensThawed,
508-
IHorizonStakingTypes.ThawRequestType.Provision
510+
calcValues.tokensThawed
509511
);
510512
vm.expectEmit(address(staking));
511513
emit IHorizonStakingMain.TokensDeprovisioned(serviceProvider, verifier, calcValues.tokensThawed);
@@ -605,6 +607,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
605607
ThawRequest memory thawRequest = calcValues.thawRequestsFulfilledList[i];
606608
vm.expectEmit(address(staking));
607609
emit IHorizonStakingMain.ThawRequestFulfilled(
610+
params.thawRequestType,
608611
calcValues.thawRequestsFulfilledListIds[i],
609612
calcValues.thawRequestsFulfilledListTokens[i],
610613
thawRequest.shares,
@@ -614,12 +617,12 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
614617
}
615618
vm.expectEmit(address(staking));
616619
emit IHorizonStakingMain.ThawRequestsFulfilled(
620+
IHorizonStakingTypes.ThawRequestType.Provision,
617621
serviceProvider,
618622
verifier,
619623
serviceProvider,
620624
calcValues.thawRequestsFulfilledList.length,
621-
calcValues.tokensThawed,
622-
IHorizonStakingTypes.ThawRequestType.Provision
625+
calcValues.tokensThawed
623626
);
624627
vm.expectEmit(address(staking));
625628
emit IHorizonStakingMain.TokensDeprovisioned(serviceProvider, verifier, calcValues.tokensThawed);
@@ -968,6 +971,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
968971
// undelegate
969972
vm.expectEmit();
970973
emit IHorizonStakingMain.ThawRequestCreated(
974+
thawRequestType,
971975
serviceProvider,
972976
verifier,
973977
beneficiary,
@@ -1118,6 +1122,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
11181122
ThawRequest memory thawRequest = calcValues.thawRequestsFulfilledList[i];
11191123
vm.expectEmit(address(staking));
11201124
emit IHorizonStakingMain.ThawRequestFulfilled(
1125+
params.thawRequestType,
11211126
calcValues.thawRequestsFulfilledListIds[i],
11221127
calcValues.thawRequestsFulfilledListTokens[i],
11231128
thawRequest.shares,
@@ -1127,12 +1132,12 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
11271132
}
11281133
vm.expectEmit(address(staking));
11291134
emit IHorizonStakingMain.ThawRequestsFulfilled(
1135+
params.thawRequestType,
11301136
params.serviceProvider,
11311137
params.verifier,
11321138
msgSender,
11331139
calcValues.thawRequestsFulfilledList.length,
1134-
calcValues.tokensThawed,
1135-
params.thawRequestType
1140+
calcValues.tokensThawed
11361141
);
11371142
if (calcValues.tokensThawed != 0) {
11381143
vm.expectEmit();

0 commit comments

Comments
 (0)