Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GNS): use the correct token amount when curation or owner tax are zero #873

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion contracts/discovery/GNS.sol
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,13 @@ abstract contract GNS is GNSV3Storage, GraphUpgradeable, IGNS, Multicall {
address _owner,
uint32 _curationTaxPercentage
) internal returns (uint256) {
// If curation or owner tax are zero, we don't need to charge owner tax
// so the amount of tokens to signal will remain the same.
// Note if owner tax is zero but curation tax is nonzero, the curation tax
// will still be charged (in Curation or L2Curation) - this function just calculates
// the owner's additional tax.
if (_curationTaxPercentage == 0 || ownerTaxPercentage == 0) {
return 0;
return _tokens;
}

// Tax on the total bonding curve funds
Expand Down
5 changes: 5 additions & 0 deletions test/gns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ describe('L1GNS', () => {
await publishNewVersion(me, subgraph.id, newSubgraph1, gns, curation)
})

it('should publish a new version on an existing subgraph when owner tax is zero', async function () {
await gns.connect(governor.signer).setOwnerTaxPercentage(0)
await publishNewVersion(me, subgraph.id, newSubgraph1, gns, curation)
})

it('should publish a new version on an existing subgraph with no current signal', async function () {
const emptySignalSubgraph = await publishNewSubgraph(me, buildSubgraph(), gns)
await publishNewVersion(me, emptySignalSubgraph.id, newSubgraph1, gns, curation)
Expand Down
5 changes: 5 additions & 0 deletions test/l2/l2GNS.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ describe('L2GNS', () => {
await publishNewVersion(me, subgraph.id, newSubgraph1, gns, curation)
})

it('should publish a new version on an existing subgraph when owner tax is zero', async function () {
await gns.connect(governor.signer).setOwnerTaxPercentage(0)
await publishNewVersion(me, subgraph.id, newSubgraph1, gns, curation)
})

it('should publish a new version on an existing subgraph with no current signal', async function () {
const emptySignalSubgraph = await publishNewSubgraph(me, buildSubgraph(), gns)
await publishNewVersion(me, emptySignalSubgraph.id, newSubgraph1, gns, curation)
Expand Down