Skip to content

Commit 2bfd7e0

Browse files
committed
fix: add some missing interface details
Signed-off-by: Tomás Migone <[email protected]>
1 parent 0f7080d commit 2bfd7e0

File tree

15 files changed

+107
-26
lines changed

15 files changed

+107
-26
lines changed

packages/horizon/tasks/test/ownership.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ task('test:transfer-ownership', 'Transfer ownership of protocol contracts to a n
3030
const graphProxyAdmin = graph.horizon.contracts.GraphProxyAdmin
3131

3232
// Get current owners
33-
const controllerGovernor = await controller.governor()
33+
const controllerGovernor = await controller.getGovernor()
3434
const proxyAdminGovernor = await graphProxyAdmin.governor()
3535

3636
console.log(`Current Controller governor: ${controllerGovernor}`)
@@ -49,7 +49,7 @@ task('test:transfer-ownership', 'Transfer ownership of protocol contracts to a n
4949

5050
// Accept ownership of Controller
5151
await controller.connect(newGovernor).acceptOwnership()
52-
console.log(`New Controller governor: ${await controller.governor()}`)
52+
console.log(`New Controller governor: ${await controller.getGovernor()}`)
5353

5454
console.log('\n--- STEP 2: Transfer ownership of GraphProxyAdmin ---')
5555

packages/horizon/test/integration/during-transition-period/operator.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { generatePOI } from '@graphprotocol/toolshed'
2-
import type { HorizonStakingExtension } from '@graphprotocol/toolshed/deployments'
32
import { getEventData } from '@graphprotocol/toolshed/hardhat'
43
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
54
import { expect } from 'chai'
@@ -70,7 +69,7 @@ describe('Operator', () => {
7069
const idleStakeBefore = await horizonStaking.getIdleStake(indexer.address)
7170

7271
// Close allocation
73-
const tx = await (horizonStaking as HorizonStakingExtension).connect(operator).closeAllocation(allocationID, poi)
72+
const tx = await horizonStaking.connect(operator).closeAllocation(allocationID, poi)
7473
const eventData = await getEventData(
7574
tx,
7675
'event HorizonRewardsAssigned(address indexed indexer, address indexed allocationID, uint256 amount)',

packages/horizon/test/integration/during-transition-period/permissionless.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { generatePOI } from '@graphprotocol/toolshed'
2-
import type { HorizonStakingExtension } from '@graphprotocol/toolshed/deployments'
32
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
43
import { expect } from 'chai'
54
import hre from 'hardhat'
@@ -56,7 +55,7 @@ describe('Permissionless', () => {
5655

5756
// Close allocation
5857
const poi = generatePOI('poi')
59-
await (horizonStaking as HorizonStakingExtension).connect(anySigner).closeAllocation(allocationID, poi)
58+
await horizonStaking.connect(anySigner).closeAllocation(allocationID, poi)
6059

6160
// Get indexer's idle stake after closing allocation
6261
const idleStakeAfter = await horizonStaking.getIdleStake(indexer.address)

packages/horizon/test/integration/during-transition-period/service-provider.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { generatePOI, ONE_MILLION } from '@graphprotocol/toolshed'
2-
import type { HorizonStakingExtension } from '@graphprotocol/toolshed/deployments'
32
import { getEventData, setGRTBalance } from '@graphprotocol/toolshed/hardhat'
43
import type { HardhatEthersSigner } from '@nomicfoundation/hardhat-ethers/signers'
54
import { expect } from 'chai'
@@ -14,7 +13,6 @@ describe('Service Provider', () => {
1413
const graph = hre.graph()
1514
const { stake, collect } = graph.horizon.actions
1615
const horizonStaking = graph.horizon.contracts.HorizonStaking
17-
const horizonStakingExtension = horizonStaking as HorizonStakingExtension
1816
const graphToken = graph.horizon.contracts.L2GraphToken
1917

2018
// Subgraph service address is not set for integration tests
@@ -257,7 +255,7 @@ describe('Service Provider', () => {
257255
const idleStakeBefore = await horizonStaking.getIdleStake(indexer.address)
258256

259257
// Close allocation
260-
const tx = await horizonStakingExtension.connect(indexer).closeAllocation(allocationID, poi)
258+
const tx = await horizonStaking.connect(indexer).closeAllocation(allocationID, poi)
261259
const eventData = await getEventData(
262260
tx,
263261
'event HorizonRewardsAssigned(address indexed indexer, address indexed allocationID, uint256 amount)',
@@ -332,7 +330,7 @@ describe('Service Provider', () => {
332330
}
333331

334332
// Close allocation
335-
await horizonStakingExtension.connect(indexer).closeAllocation(allocationID, poi)
333+
await horizonStaking.connect(indexer).closeAllocation(allocationID, poi)
336334

337335
// Tokens to collect
338336
const tokensToCollect = ethers.parseEther('1000')
@@ -407,7 +405,7 @@ describe('Service Provider', () => {
407405
const balanceBefore = await graphToken.balanceOf(rewardsDestination)
408406

409407
// Close allocation
410-
const tx = await horizonStakingExtension.connect(indexer).closeAllocation(allocationID, poi)
408+
const tx = await horizonStaking.connect(indexer).closeAllocation(allocationID, poi)
411409
const eventData = await getEventData(
412410
tx,
413411
'event HorizonRewardsAssigned(address indexed indexer, address indexed allocationID, uint256 amount)',
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
pragma solidity ^0.7.6 || 0.8.27;
3+
4+
/**
5+
* @title IGoverned
6+
* @dev Interface for the Governed contract.
7+
*/
8+
interface IGoverned {
9+
// -- State getters --
10+
11+
function governor() external view returns (address);
12+
13+
function pendingGovernor() external view returns (address);
14+
15+
// -- External functions --
16+
17+
/**
18+
* @notice Admin function to begin change of governor.
19+
* @param _newGovernor Address of new `governor`
20+
*/
21+
function transferOwnership(address _newGovernor) external;
22+
23+
/**
24+
* @notice Admin function for pending governor to accept role and update governor.
25+
*/
26+
function acceptOwnership() external;
27+
28+
// -- Events --
29+
30+
event NewPendingOwnership(address indexed from, address indexed to);
31+
32+
event NewOwnership(address indexed from, address indexed to);
33+
}

packages/interfaces/contracts/contracts/upgrades/IGraphProxyAdmin.sol

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
pragma solidity 0.8.27;
44

55
import { IGraphProxy } from "./IGraphProxy.sol";
6+
import { IGoverned } from "../governance/IGoverned.sol";
67

78
/**
89
* @title IGraphProxyAdmin
9-
* @dev Empty interface to allow the GraphProxyAdmin contract to be used
10-
* in the GraphDirectory contract.
10+
* @dev GraphProxyAdmin contract interface
11+
* @dev Note that this interface is not used by the contract implementation, just used for types and abi generation
1112
* @custom:security-contact Please email [email protected] if you find any
1213
* bugs. We may have an active bug bounty program.
1314
*/
14-
interface IGraphProxyAdmin {
15+
interface IGraphProxyAdmin is IGoverned {
1516
function getProxyImplementation(IGraphProxy proxy) external view returns (address);
1617

1718
function getProxyPendingImplementation(IGraphProxy proxy) external view returns (address);
@@ -29,4 +30,7 @@ interface IGraphProxyAdmin {
2930
function acceptProxy(IGraphProxy proxy) external;
3031

3132
function acceptProxyAndCall(IGraphProxy proxy, bytes calldata data) external;
33+
34+
// storage
35+
function governor() external view returns (address);
3236
}

packages/interfaces/contracts/horizon/IAuthorizable.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ interface IAuthorizable {
9292
*/
9393
error AuthorizableSignerStillThawing(uint256 currentTimestamp, uint256 thawEndTimestamp);
9494

95+
/**
96+
* @notice The period after which a signer can be revoked after thawing
97+
* @return The period in seconds
98+
*/
99+
function REVOKE_AUTHORIZATION_THAWING_PERIOD() external view returns (uint256);
100+
95101
/**
96102
* @notice Authorize a signer to sign on behalf of the authorizer
97103
* @dev Requirements:

packages/interfaces/contracts/horizon/IGraphPayments.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ interface IGraphPayments {
5858
*/
5959
error GraphPaymentsInvalidCut(uint256 cut);
6060

61+
/**
62+
* @notice Returns the protocol payment cut
63+
* @return The protocol payment cut in PPM
64+
*/
65+
function PROTOCOL_PAYMENT_CUT() external view returns (uint256);
66+
6167
/**
6268
* @notice Initialize the contract
6369
*/

packages/interfaces/contracts/horizon/IGraphTallyCollector.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma solidity 0.8.27;
33

44
import { IPaymentsCollector } from "./IPaymentsCollector.sol";
55
import { IGraphPayments } from "./IGraphPayments.sol";
6+
import { IAuthorizable } from "./IAuthorizable.sol";
67

78
/**
89
* @title Interface for the {GraphTallyCollector} contract
@@ -13,7 +14,7 @@ import { IGraphPayments } from "./IGraphPayments.sol";
1314
* @custom:security-contact Please email [email protected] if you find any
1415
* bugs. We may have an active bug bounty program.
1516
*/
16-
interface IGraphTallyCollector is IPaymentsCollector {
17+
interface IGraphTallyCollector is IPaymentsCollector, IAuthorizable {
1718
/**
1819
* @notice The Receipt Aggregate Voucher (RAV) struct
1920
* @param collectionId The ID of the collection "bucket" the RAV belongs to. Note that multiple RAVs can be collected for the same collection id.

packages/interfaces/contracts/horizon/IPaymentsEscrow.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,18 @@ interface IPaymentsEscrow {
143143
*/
144144
error PaymentsEscrowInvalidZeroTokens();
145145

146+
/**
147+
* @notice The maximum thawing period for escrow funds withdrawal
148+
* @return The maximum thawing period in seconds
149+
*/
150+
function MAX_WAIT_PERIOD() external view returns (uint256);
151+
152+
/**
153+
* @notice The thawing period for escrow funds withdrawal
154+
* @return The thawing period in seconds
155+
*/
156+
function WITHDRAW_ESCROW_THAWING_PERIOD() external view returns (uint256);
157+
146158
/**
147159
* @notice Initialize the contract
148160
*/

0 commit comments

Comments
 (0)