@@ -6,10 +6,12 @@ import { Test } from "forge-std/Test.sol";
6
6
import { IGraphPayments } from "../../../../contracts/interfaces/IGraphPayments.sol " ;
7
7
import { IPaymentsCollector } from "../../../../contracts/interfaces/IPaymentsCollector.sol " ;
8
8
import { IRecurringCollector } from "../../../../contracts/interfaces/IRecurringCollector.sol " ;
9
+ import { IHorizonStakingTypes } from "../../../../contracts/interfaces/internal/IHorizonStakingTypes.sol " ;
9
10
import { RecurringCollector } from "../../../../contracts/payments/collectors/RecurringCollector.sol " ;
10
11
11
12
import { Bounder } from "../../../unit/utils/Bounder.t.sol " ;
12
13
import { PartialControllerMock } from "../../mocks/PartialControllerMock.t.sol " ;
14
+ import { HorizonStakingMock } from "../../mocks/HorizonStakingMock.t.sol " ;
13
15
import { PaymentsEscrowMock } from "./PaymentsEscrowMock.t.sol " ;
14
16
import { RecurringCollectorHelper } from "./RecurringCollectorHelper.t.sol " ;
15
17
@@ -32,12 +34,15 @@ contract RecurringCollectorSharedTest is Test, Bounder {
32
34
33
35
RecurringCollector internal _recurringCollector;
34
36
PaymentsEscrowMock internal _paymentsEscrow;
37
+ HorizonStakingMock internal _horizonStaking;
35
38
RecurringCollectorHelper internal _recurringCollectorHelper;
36
39
37
40
function setUp () public {
38
41
_paymentsEscrow = new PaymentsEscrowMock ();
39
- PartialControllerMock.Entry[] memory entries = new PartialControllerMock.Entry [](1 );
42
+ _horizonStaking = new HorizonStakingMock ();
43
+ PartialControllerMock.Entry[] memory entries = new PartialControllerMock.Entry [](2 );
40
44
entries[0 ] = PartialControllerMock.Entry ({ name: "PaymentsEscrow " , addr: address (_paymentsEscrow) });
45
+ entries[1 ] = PartialControllerMock.Entry ({ name: "Staking " , addr: address (_horizonStaking) });
41
46
_recurringCollector = new RecurringCollector (
42
47
"RecurringCollector " ,
43
48
"1 " ,
@@ -71,6 +76,9 @@ contract RecurringCollectorSharedTest is Test, Bounder {
71
76
}
72
77
73
78
function _accept (IRecurringCollector.SignedRCA memory _signedRCA ) internal {
79
+ // Set up valid staking provision by default to allow collections to succeed
80
+ _setupValidProvision (_signedRCA.rca.serviceProvider, _signedRCA.rca.dataService);
81
+
74
82
vm.expectEmit (address (_recurringCollector));
75
83
emit IRecurringCollector.AgreementAccepted (
76
84
_signedRCA.rca.dataService,
@@ -88,6 +96,25 @@ contract RecurringCollectorSharedTest is Test, Bounder {
88
96
_recurringCollector.accept (_signedRCA);
89
97
}
90
98
99
+ function _setupValidProvision (address _serviceProvider , address _dataService ) internal {
100
+ _horizonStaking.setProvision (
101
+ _serviceProvider,
102
+ _dataService,
103
+ IHorizonStakingTypes.Provision ({
104
+ tokens: 1000 ether,
105
+ tokensThawing: 0 ,
106
+ sharesThawing: 0 ,
107
+ maxVerifierCut: 100000 , // 10%
108
+ thawingPeriod: 604800 , // 7 days
109
+ createdAt: uint64 (block .timestamp ),
110
+ maxVerifierCutPending: 100000 ,
111
+ thawingPeriodPending: 604800 ,
112
+ lastParametersStagedAt: 0 ,
113
+ thawingNonce: 0
114
+ })
115
+ );
116
+ }
117
+
91
118
function _cancel (
92
119
IRecurringCollector.RecurringCollectionAgreement memory _rca ,
93
120
IRecurringCollector.CancelAgreementBy _by
0 commit comments