-
Notifications
You must be signed in to change notification settings - Fork 161
chore: add stakeToFeesRatio to SubgraphService initialize #1027
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
Merged
Maikol
merged 2 commits into
horizon
from
mde/subgraph-service-initialize-stake-to-fees-ratio
Sep 20, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/subgraph-service/test/subgraphService/governance/stakeToFeesRatio.t.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.27; | ||
|
||
import "forge-std/Test.sol"; | ||
|
||
import { ISubgraphService } from "../../../contracts/interfaces/ISubgraphService.sol"; | ||
import { SubgraphServiceTest } from "../SubgraphService.t.sol"; | ||
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
|
||
contract DisputeManagerGovernanceArbitratorTest is SubgraphServiceTest { | ||
|
||
/** | ||
* ACTIONS | ||
*/ | ||
|
||
function _setStakeToFeesRatio(uint256 _stakeToFeesRatio) internal { | ||
vm.expectEmit(address(subgraphService)); | ||
emit ISubgraphService.StakeToFeesRatioSet(_stakeToFeesRatio); | ||
subgraphService.setStakeToFeesRatio(_stakeToFeesRatio); | ||
assertEq(subgraphService.stakeToFeesRatio(), _stakeToFeesRatio); | ||
} | ||
|
||
/* | ||
* TESTS | ||
*/ | ||
|
||
function test_Governance_SetStakeToFeesRatio(uint256 stakeToFeesRatio) public useGovernor { | ||
vm.assume(stakeToFeesRatio > 0); | ||
_setStakeToFeesRatio(stakeToFeesRatio); | ||
} | ||
|
||
function test_Governance_RevertWhen_ZeroValue() public useGovernor { | ||
uint256 stakeToFeesRatio = 0; | ||
vm.expectRevert(abi.encodeWithSelector(ISubgraphService.SubgraphServiceInvalidZeroStakeToFeesRatio.selector)); | ||
subgraphService.setStakeToFeesRatio(stakeToFeesRatio); | ||
} | ||
|
||
function test_Governance_RevertWhen_NotGovernor() public useIndexer { | ||
uint256 stakeToFeesRatio = 2; | ||
vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, users.indexer)); | ||
subgraphService.setStakeToFeesRatio(stakeToFeesRatio); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.