-
Notifications
You must be signed in to change notification settings - Fork 49
feat: snapshot proxy #1872
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
Merged
feat: snapshot proxy #1872
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6b7493b
feat(KlerosCore): create snapshot proxy
unknownunknown1 d839f18
fix: foundry test
unknownunknown1 a703fdd
feat(KlerosCore): snapshot proxy foundry test
unknownunknown1 20f5bb9
refactor: minor tweaks
jaybuidl ff46e40
chore: deployment of KlerosCoreSnapshotProxy
jaybuidl 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
228 changes: 228 additions & 0 deletions
228
contracts/deployments/arbitrum/KlerosCoreSnapshotProxy.json
Large diffs are not rendered by default.
Oops, something went wrong.
228 changes: 228 additions & 0 deletions
228
contracts/deployments/arbitrumSepolia/KlerosCoreSnapshotProxy.json
Large diffs are not rendered by default.
Oops, something went wrong.
228 changes: 228 additions & 0 deletions
228
contracts/deployments/arbitrumSepoliaDevnet/KlerosCoreSnapshotProxy.json
Large diffs are not rendered by default.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
contracts/src/arbitration/view/KlerosCoreSnapshotProxy.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,78 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// @custom:authors: [@unknownunknown1] | ||
/// @custom:reviewers: [] | ||
/// @custom:auditors: [] | ||
/// @custom:bounties: [] | ||
/// @custom:deployments: [] | ||
|
||
pragma solidity 0.8.24; | ||
|
||
import {ISortitionModule} from "../interfaces/ISortitionModule.sol"; | ||
|
||
interface IKlerosCore { | ||
function sortitionModule() external view returns (ISortitionModule); | ||
} | ||
|
||
/// @title KlerosCoreSnapshotProxy | ||
/// Proxy contract for V2 that exposes staked PNK with balanceOf() function for Snapshot voting. | ||
contract KlerosCoreSnapshotProxy { | ||
// ************************************* // | ||
// * State Modifiers * // | ||
// ************************************* // | ||
|
||
IKlerosCore public core; | ||
address public governor; | ||
string public constant name = "Staked Pinakion"; | ||
string public constant symbol = "stPNK"; | ||
uint8 public constant decimals = 18; | ||
|
||
// ************************************* // | ||
// * Modifiers * // | ||
// ************************************* // | ||
|
||
modifier onlyByGovernor() { | ||
require(governor == msg.sender, "Access not allowed: Governor only."); | ||
_; | ||
} | ||
|
||
// ************************************* // | ||
// * Constructor * // | ||
// ************************************* // | ||
|
||
/// @dev Constructor | ||
/// @param _governor The governor of the contract. | ||
/// @param _core KlerosCore to read the balance from. | ||
constructor(address _governor, IKlerosCore _core) { | ||
governor = _governor; | ||
core = _core; | ||
} | ||
jaybuidl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// ************************************* // | ||
// * Governance * // | ||
// ************************************* // | ||
|
||
/// @dev Changes the `governor` storage variable. | ||
/// @param _governor The new value for the `governor` storage variable. | ||
function changeGovernor(address _governor) external onlyByGovernor { | ||
governor = _governor; | ||
} | ||
|
||
/// @dev Changes the `core` storage variable. | ||
/// @param _core The new value for the `core` storage variable. | ||
function changeCore(IKlerosCore _core) external onlyByGovernor { | ||
core = _core; | ||
} | ||
jaybuidl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// ************************************* // | ||
// * Public Views * // | ||
// ************************************* // | ||
|
||
/// @dev Returns the amount of PNK staked in KlerosV2 for a particular address. | ||
/// Note: Proxy doesn't need to differentiate between courts so we pass 0 as courtID. | ||
/// @param _account The address to query. | ||
/// @return totalStaked Total amount staked in V2 by the address. | ||
function balanceOf(address _account) external view returns (uint256 totalStaked) { | ||
(totalStaked, , , ) = core.sortitionModule().getJurorBalance(_account, 0); | ||
} | ||
} | ||
jaybuidl marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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.