Skip to content

Commit a667f7a

Browse files
authored
Merge pull request #873 from graphprotocol/pcv/fix-zero-owner-tax
fix(GNS): use the correct token amount when curation or owner tax are zero
2 parents 5120495 + 322658e commit a667f7a

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

contracts/discovery/GNS.sol

+6-1
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,13 @@ abstract contract GNS is GNSV3Storage, GraphUpgradeable, IGNS, Multicall {
731731
address _owner,
732732
uint32 _curationTaxPercentage
733733
) internal returns (uint256) {
734+
// If curation or owner tax are zero, we don't need to charge owner tax
735+
// so the amount of tokens to signal will remain the same.
736+
// Note if owner tax is zero but curation tax is nonzero, the curation tax
737+
// will still be charged (in Curation or L2Curation) - this function just calculates
738+
// the owner's additional tax.
734739
if (_curationTaxPercentage == 0 || ownerTaxPercentage == 0) {
735-
return 0;
740+
return _tokens;
736741
}
737742

738743
// Tax on the total bonding curve funds

test/gns.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,11 @@ describe('L1GNS', () => {
420420
await publishNewVersion(me, subgraph.id, newSubgraph1, gns, curation)
421421
})
422422

423+
it('should publish a new version on an existing subgraph when owner tax is zero', async function () {
424+
await gns.connect(governor.signer).setOwnerTaxPercentage(0)
425+
await publishNewVersion(me, subgraph.id, newSubgraph1, gns, curation)
426+
})
427+
423428
it('should publish a new version on an existing subgraph with no current signal', async function () {
424429
const emptySignalSubgraph = await publishNewSubgraph(me, buildSubgraph(), gns)
425430
await publishNewVersion(me, emptySignalSubgraph.id, newSubgraph1, gns, curation)

test/l2/l2GNS.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ describe('L2GNS', () => {
178178
await publishNewVersion(me, subgraph.id, newSubgraph1, gns, curation)
179179
})
180180

181+
it('should publish a new version on an existing subgraph when owner tax is zero', async function () {
182+
await gns.connect(governor.signer).setOwnerTaxPercentage(0)
183+
await publishNewVersion(me, subgraph.id, newSubgraph1, gns, curation)
184+
})
185+
181186
it('should publish a new version on an existing subgraph with no current signal', async function () {
182187
const emptySignalSubgraph = await publishNewSubgraph(me, buildSubgraph(), gns)
183188
await publishNewVersion(me, emptySignalSubgraph.id, newSubgraph1, gns, curation)

0 commit comments

Comments
 (0)