Skip to content

Commit 559ea00

Browse files
committed
fix: adjust gre, e2e and configs to account for reservoirs
1 parent 53e0a80 commit 559ea00

12 files changed

+140
-21
lines changed

cli/contracts.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { L1GraphTokenGateway } from '../build/types/L1GraphTokenGateway'
2626
import { L2GraphToken } from '../build/types/L2GraphToken'
2727
import { L2GraphTokenGateway } from '../build/types/L2GraphTokenGateway'
2828
import { BridgeEscrow } from '../build/types/BridgeEscrow'
29+
import { L1Reservoir } from '../build/types/L1Reservoir'
30+
import { L2Reservoir } from '../build/types/L2Reservoir'
2931

3032
export interface NetworkContracts {
3133
EpochManager: EpochManager
@@ -49,6 +51,8 @@ export interface NetworkContracts {
4951
BridgeEscrow: BridgeEscrow
5052
L2GraphToken: L2GraphToken
5153
L2GraphTokenGateway: L2GraphTokenGateway
54+
L1Reservoir: L1Reservoir
55+
L2Reservoir: L2Reservoir
5256
}
5357

5458
export const loadAddressBookContract = (

config/graph.arbitrum-goerli.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ contracts:
3333
- fn: "setContractProxy"
3434
id: "0xd362cac9cb75c10d67bcc0b7eeb0b1ef48bb5420b556c092d4fd7f758816fcf0" # keccak256('GraphTokenGateway')
3535
contractAddress: "${{L2GraphTokenGateway.address}}"
36+
- fn: "setContractProxy"
37+
id: "0x96ba401694892957e25e29c7a1e4171ae9945b5ee36339de79b199a530436e9e" # keccak256('Reservoir')
38+
contractAddress: "${{L2Reservoir.address}}"
3639
- fn: "setPauseGuardian"
3740
pauseGuardian: *pauseGuardian
3841
- fn: "transferOwnership"
@@ -149,3 +152,10 @@ contracts:
149152
- fn: "syncAllContracts"
150153
- fn: "setPauseGuardian"
151154
pauseGuardian: *pauseGuardian
155+
L2Reservoir:
156+
proxy: true
157+
init:
158+
controller: "${{Controller.address}}"
159+
calls:
160+
- fn: "approveRewardsManager"
161+
- fn: "syncAllContracts"

config/graph.arbitrum-localhost.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ contracts:
3333
- fn: "setContractProxy"
3434
id: "0xd362cac9cb75c10d67bcc0b7eeb0b1ef48bb5420b556c092d4fd7f758816fcf0" # keccak256('GraphTokenGateway')
3535
contractAddress: "${{L2GraphTokenGateway.address}}"
36+
- fn: "setContractProxy"
37+
id: "0x96ba401694892957e25e29c7a1e4171ae9945b5ee36339de79b199a530436e9e" # keccak256('Reservoir')
38+
contractAddress: "${{L2Reservoir.address}}"
3639
- fn: "setPauseGuardian"
3740
pauseGuardian: *pauseGuardian
3841
- fn: "transferOwnership"
@@ -149,3 +152,10 @@ contracts:
149152
- fn: "syncAllContracts"
150153
- fn: "setPauseGuardian"
151154
pauseGuardian: *pauseGuardian
155+
L2Reservoir:
156+
proxy: true
157+
init:
158+
controller: "${{Controller.address}}"
159+
calls:
160+
- fn: "approveRewardsManager"
161+
- fn: "syncAllContracts"

config/graph.goerli.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ contracts:
3333
- fn: "setContractProxy"
3434
id: "0xd362cac9cb75c10d67bcc0b7eeb0b1ef48bb5420b556c092d4fd7f758816fcf0" # keccak256('GraphTokenGateway')
3535
contractAddress: "${{L1GraphTokenGateway.address}}"
36+
- fn: "setContractProxy"
37+
id: "0x96ba401694892957e25e29c7a1e4171ae9945b5ee36339de79b199a530436e9e" # keccak256('Reservoir')
38+
contractAddress: "${{L1Reservoir.address}}"
3639
- fn: "setPauseGuardian"
3740
pauseGuardian: *pauseGuardian
3841
- fn: "transferOwnership"
@@ -57,7 +60,7 @@ contracts:
5760
initialSupply: "10000000000000000000000000000" # in wei
5861
calls:
5962
- fn: "addMinter"
60-
minter: "${{RewardsManager.address}}"
63+
minter: "${{L1Reservoir.address}}"
6164
- fn: "renounceMinter"
6265
- fn: "transferOwnership"
6366
owner: *governor
@@ -131,8 +134,6 @@ contracts:
131134
init:
132135
controller: "${{Controller.address}}"
133136
calls:
134-
- fn: "setIssuanceRate"
135-
issuanceRate: "1000000012184945188" # per block increase of total supply, blocks in a year = 365*60*60*24/13
136137
- fn: "setSubgraphAvailabilityOracle"
137138
subgraphAvailabilityOracle: *availabilityOracle
138139
- fn: "syncAllContracts"
@@ -158,3 +159,13 @@ contracts:
158159
controller: "${{Controller.address}}"
159160
calls:
160161
- fn: "syncAllContracts"
162+
L1Reservoir:
163+
proxy: true
164+
init:
165+
controller: "${{Controller.address}}"
166+
dripInterval: 50400
167+
calls:
168+
- fn: "approveRewardsManager"
169+
- fn: "initialSnapshot"
170+
pendingRewards: "0"
171+
- fn: "syncAllContracts"

config/graph.localhost.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ contracts:
3333
- fn: "setContractProxy"
3434
id: "0xd362cac9cb75c10d67bcc0b7eeb0b1ef48bb5420b556c092d4fd7f758816fcf0" # keccak256('GraphTokenGateway')
3535
contractAddress: "${{L1GraphTokenGateway.address}}"
36+
- fn: "setContractProxy"
37+
id: "0x96ba401694892957e25e29c7a1e4171ae9945b5ee36339de79b199a530436e9e" # keccak256('Reservoir')
38+
contractAddress: "${{L1Reservoir.address}}"
3639
- fn: "setPauseGuardian"
3740
pauseGuardian: *pauseGuardian
3841
- fn: "transferOwnership"
@@ -57,7 +60,7 @@ contracts:
5760
initialSupply: "10000000000000000000000000000" # in wei
5861
calls:
5962
- fn: "addMinter"
60-
minter: "${{RewardsManager.address}}"
63+
minter: "${{L1Reservoir.address}}"
6164
- fn: "renounceMinter"
6265
- fn: "transferOwnership"
6366
owner: *governor
@@ -131,8 +134,6 @@ contracts:
131134
init:
132135
controller: "${{Controller.address}}"
133136
calls:
134-
- fn: "setIssuanceRate"
135-
issuanceRate: "1000000012184945188" # per block increase of total supply, blocks in a year = 365*60*60*24/13
136137
- fn: "setSubgraphAvailabilityOracle"
137138
subgraphAvailabilityOracle: *availabilityOracle
138139
- fn: "syncAllContracts"
@@ -158,3 +159,13 @@ contracts:
158159
controller: "${{Controller.address}}"
159160
calls:
160161
- fn: "syncAllContracts"
162+
L1Reservoir:
163+
proxy: true
164+
init:
165+
controller: "${{Controller.address}}"
166+
dripInterval: 50400
167+
calls:
168+
- fn: "approveRewardsManager"
169+
- fn: "initialSnapshot"
170+
pendingRewards: "0"
171+
- fn: "syncAllContracts"

config/graph.mainnet.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,5 @@ contracts:
167167
calls:
168168
- fn: "approveRewardsManager"
169169
- fn: "initialSnapshot"
170+
pendingRewards: "0"
170171
- fn: "syncAllContracts"

e2e/deployment/config/l1/graphToken.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import GraphChain from '../../../../gre/helpers/network'
55

66
describe('[L1] GraphToken', () => {
77
const graph = hre.graph()
8-
const { GraphToken, RewardsManager } = graph.contracts
8+
const { GraphToken, L1Reservoir, RewardsManager } = graph.contracts
99

1010
let unauthorized: SignerWithAddress
1111

@@ -23,9 +23,14 @@ describe('[L1] GraphToken', () => {
2323
await expect(tx).revertedWith('Only minter can call')
2424
})
2525

26-
it('RewardsManager should be minter', async function () {
26+
it('L1Reservoir should be minter', async function () {
27+
const reservoirIsMinter = await GraphToken.isMinter(L1Reservoir.address)
28+
expect(reservoirIsMinter).eq(true)
29+
})
30+
31+
it('RewardsManager should not be minter', async function () {
2732
const rewardsMgrIsMinter = await GraphToken.isMinter(RewardsManager.address)
28-
expect(rewardsMgrIsMinter).eq(true)
33+
expect(rewardsMgrIsMinter).eq(false)
2934
})
3035
})
3136
})
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { expect } from 'chai'
2+
import hre from 'hardhat'
3+
import GraphChain from '../../../../gre/helpers/network'
4+
import { getItemValue } from '../../../../cli/config'
5+
6+
describe('[L1] L1Reservoir configuration', () => {
7+
const graph = hre.graph()
8+
const { graphConfig } = graph
9+
const { L1Reservoir, Controller, GraphToken, RewardsManager } = graph.contracts
10+
11+
before(async function () {
12+
if (GraphChain.isL2(graph.chainId)) this.skip()
13+
})
14+
15+
it('should be controlled by Controller', async function () {
16+
const controller = await L1Reservoir.controller()
17+
expect(controller).eq(Controller.address)
18+
})
19+
20+
it('should have a snapshot of the total supply', async function () {
21+
expect(await L1Reservoir.issuanceBase()).eq(await GraphToken.totalSupply())
22+
})
23+
24+
it('should have issuanceRate set to zero', async function () {
25+
expect(await L1Reservoir.issuanceRate()).eq(0)
26+
})
27+
28+
it('should have dripInterval set from config', async function () {
29+
const value = await L1Reservoir.dripInterval()
30+
const expected = getItemValue(graphConfig, 'contracts/L1Reservoir/init/dripInterval')
31+
expect(value).eq(expected)
32+
})
33+
34+
it('should have RewardsManager approved for the max GRT amount', async function () {
35+
expect(await GraphToken.allowance(L1Reservoir.address, RewardsManager.address)).eq(
36+
hre.ethers.constants.MaxUint256,
37+
)
38+
})
39+
})

e2e/deployment/config/l1/rewardsManager.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,4 @@ describe('[L1] RewardsManager configuration', () => {
99
before(async function () {
1010
if (GraphChain.isL2(graph.chainId)) this.skip()
1111
})
12-
13-
it('issuanceRate should match "issuanceRate" in the config file', async function () {
14-
const value = await RewardsManager.issuanceRate()
15-
expect(value).eq('1000000012184945188') // hardcoded as it's set with a function call rather than init parameter
16-
})
1712
})

e2e/deployment/config/l2/l2GraphToken.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import GraphChain from '../../../../gre/helpers/network'
55

66
describe('[L2] L2GraphToken', () => {
77
const graph = hre.graph()
8-
const { L2GraphToken, RewardsManager } = graph.contracts
8+
const { L2GraphToken, RewardsManager, L2Reservoir } = graph.contracts
99

1010
let unauthorized: SignerWithAddress
1111

@@ -36,9 +36,14 @@ describe('[L2] L2GraphToken', () => {
3636
await expect(tx).revertedWith('Only Governor can call')
3737
})
3838

39-
it('RewardsManager should not be minter (for now)', async function () {
39+
it('RewardsManager should not be minter', async function () {
4040
const rewardsMgrIsMinter = await L2GraphToken.isMinter(RewardsManager.address)
4141
expect(rewardsMgrIsMinter).eq(false)
4242
})
43+
44+
it('L2Reservoir should not be minter', async function () {
45+
const reservoirIsMinter = await L2GraphToken.isMinter(L2Reservoir.address)
46+
expect(reservoirIsMinter).eq(false)
47+
})
4348
})
4449
})
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { expect } from 'chai'
2+
import hre from 'hardhat'
3+
import GraphChain from '../../../../gre/helpers/network'
4+
import { getItemValue } from '../../../../cli/config'
5+
6+
describe('[L2] L2Reservoir configuration', () => {
7+
const graph = hre.graph()
8+
const { graphConfig } = graph
9+
const { L2Reservoir, Controller, GraphToken, RewardsManager } = graph.contracts
10+
11+
before(async function () {
12+
if (GraphChain.isL1(graph.chainId)) this.skip()
13+
})
14+
15+
it('should be controlled by Controller', async function () {
16+
const controller = await L2Reservoir.controller()
17+
expect(controller).eq(Controller.address)
18+
})
19+
20+
it('should have issuanceBase set to zero', async function () {
21+
expect(await L2Reservoir.issuanceBase()).eq(0)
22+
})
23+
24+
it('should have issuanceRate set to zero', async function () {
25+
expect(await L2Reservoir.issuanceRate()).eq(0)
26+
})
27+
28+
it('should have RewardsManager approved for the max GRT amount', async function () {
29+
expect(await GraphToken.allowance(L2Reservoir.address, RewardsManager.address)).eq(
30+
hre.ethers.constants.MaxUint256,
31+
)
32+
})
33+
})

e2e/deployment/config/l2/rewardsManager.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,4 @@ describe('[L2] RewardsManager configuration', () => {
99
before(async function () {
1010
if (GraphChain.isL1(graph.chainId)) this.skip()
1111
})
12-
13-
it('issuanceRate should be zero', async function () {
14-
const value = await RewardsManager.issuanceRate()
15-
expect(value).eq('0')
16-
})
1712
})

0 commit comments

Comments
 (0)