Skip to content

Commit 105b4f0

Browse files
committed
test(e2e): in L2, GraphToken has no minters for now
1 parent 78691c2 commit 105b4f0

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed

e2e/deployment/config/graphToken.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { NamedAccounts } from '../../../gre/type-extensions'
55
describe('GraphToken configuration', () => {
66
const {
77
getNamedAccounts,
8-
contracts: { GraphToken, RewardsManager },
8+
contracts: { GraphToken },
99
getDeployer,
1010
} = hre.graph()
1111

@@ -25,9 +25,4 @@ describe('GraphToken configuration', () => {
2525
const deployerIsMinter = await GraphToken.isMinter(deployer.address)
2626
expect(deployerIsMinter).eq(false)
2727
})
28-
29-
it('RewardsManager should be minter', async function () {
30-
const deployerIsMinter = await GraphToken.isMinter(RewardsManager.address)
31-
expect(deployerIsMinter).eq(true)
32-
})
3328
})
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'
2+
import { expect } from 'chai'
3+
import hre from 'hardhat'
4+
import GraphChain from '../../../../gre/helpers/network'
5+
6+
describe('[L1] GraphToken', () => {
7+
const graph = hre.graph()
8+
const { GraphToken, RewardsManager } = graph.contracts
9+
10+
let unauthorized: SignerWithAddress
11+
12+
before(async function () {
13+
if (GraphChain.isL2(graph.chainId)) this.skip()
14+
unauthorized = (await graph.getTestAccounts())[0]
15+
})
16+
17+
describe('calls with unauthorized user', () => {
18+
it('mint should revert', async function () {
19+
const tx = GraphToken.connect(unauthorized).mint(
20+
unauthorized.address,
21+
'1000000000000000000000',
22+
)
23+
await expect(tx).revertedWith('Only minter can call')
24+
})
25+
26+
it('RewardsManager should be minter', async function () {
27+
const rewardsMgrIsMinter = await GraphToken.isMinter(RewardsManager.address)
28+
expect(rewardsMgrIsMinter).eq(true)
29+
})
30+
})
31+
})

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

Lines changed: 6 additions & 1 deletion
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 } = graph.contracts
8+
const { L2GraphToken, RewardsManager } = graph.contracts
99

1010
let unauthorized: SignerWithAddress
1111

@@ -35,5 +35,10 @@ describe('[L2] L2GraphToken', () => {
3535
const tx = L2GraphToken.connect(unauthorized).setGateway(unauthorized.address)
3636
await expect(tx).revertedWith('Only Governor can call')
3737
})
38+
39+
it('RewardsManager should not be minter (for now)', async function () {
40+
const rewardsMgrIsMinter = await L2GraphToken.isMinter(RewardsManager.address)
41+
expect(rewardsMgrIsMinter).eq(false)
42+
})
3843
})
3944
})

0 commit comments

Comments
 (0)