-
Notifications
You must be signed in to change notification settings - Fork 11
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
Governance #126
Merged
Merged
Governance #126
Changes from all commits
Commits
Show all changes
142 commits
Select commit
Hold shift + click to select a range
5efdd0c
Add governance structure
b4cdd41
Add utils
4855bd1
Add governor traits
c3176ff
Add governor struct
9c396c4
Add traits for extansions
prxgr4mm3r 2acf292
Merge remote-tracking branch 'origin/feature/governance' into feature…
prxgr4mm3r 3812d2f
fix some bugs
a4cb223
Fix errors and warnings
prxgr4mm3r 75341bb
Change inheritance
prxgr4mm3r ab34931
add checkpoint logic
f1969a7
Merge remote-tracking branch 'origin/feature/governance' into feature…
b6d97ac
fix bug with states
aec766e
Add impls for extensions
prxgr4mm3r 4880951
add governor impl
varex83 2754492
add governor internal impl
varex83 77d0d61
Add internal for extensions
prxgr4mm3r 8b89466
move timelock controller
varex83 db5191a
update features
varex83 f5673ee
fix features
varex83 accf4df
remove todo
varex83 01f2730
remove todo
varex83 e366693
update path
varex83 e93a160
my_governance contract
varex83 5f2352e
fix bugs wit imports
varex83 876b48b
update interfaces
varex83 0b39f3a
update interfaces
varex83 8fbbc34
add tests boilerplate
varex83 4d2964d
Add governance_settings
prxgr4mm3r edcda59
Add governance_votes_quorum_fraction
prxgr4mm3r 4900f08
Revert "Add governance_votes_quorum_fraction"
varex83 7be42ad
Revert "Add governance_settings"
varex83 80782cc
add PSP22Votes extension
Artemka374 87fe97c
Merge remote-tracking branch 'origin/feature/governance' into feature…
Artemka374 5ab1a27
add governor quorum fraction impl
varex83 1b45483
move & rename GovernorVotes -> Votes, add VotesRef, implement Governo…
varex83 3a248e9
add quorum implementation
varex83 8da3a44
add governance settings
varex83 6c0230d
add logics, fix conflicts
Artemka374 d5b091e
fix bugs, wrap everything up
varex83 f96e48a
Merge remote-tracking branch 'origin/feature/governance' into feature…
varex83 aeea7e4
add only_governance modifier, relay method in governor
Artemka374 aa4e9bb
fix compilation
Artemka374 5964c08
use map_err instead of unwrap
Artemka374 564cce6
Add nonces e2e tests
prxgr4mm3r 01a5078
Fix nonces e2e tests
prxgr4mm3r 02e299c
improve test structure a little bit
varex83 1e19af7
add quorum tests
varex83 a21e204
add psp22 votes contract, fix governor example contract
varex83 8bfe2dc
fix _is_valid_description_for_proposer
Artemka374 58db008
fix _is_valid_description_for_proposer
Artemka374 74990fb
Add tests for governor
prxgr4mm3r 76cee30
Add tests for governor
prxgr4mm3r 49acd2a
create mock timestamp provider
Artemka374 7ab1e26
add only_governance to set_proposal_threshold
Artemka374 d3ab126
add GovernorHelper class
Artemka374 50ad406
add execute method
Artemka374 90680d9
add cancel method
Artemka374 521818e
Add tests for governor
prxgr4mm3r a8f40cf
add offset to wait methods
Artemka374 176af91
Merge remote-tracking branch 'origin/feature/governance' into feature…
Artemka374 4e24594
add tests
Artemka374 318fe09
Merge branch 'main' into feature/governance
Artemka374 88091f7
fix findSelectorByName
Artemka374 d4d46c7
Merge remote-tracking branch 'origin/feature/governance' into feature…
Artemka374 897d1f1
Rework tests with helper
prxgr4mm3r 8a721a6
Change Canselled -> Canceled
prxgr4mm3r 7cef6d7
Add tests for state
prxgr4mm3r 6011d1e
add mock_receiver contract
Artemka374 fc65b02
fix encoding in description
Artemka374 9e895d4
Fixed Votes contract
prxgr4mm3r d0837d1
Fix Votes contract and tests
prxgr4mm3r 8b92fad
small test fix
prxgr4mm3r a06db05
fix checkpoints, add check for hex in _is_valid_description
Artemka374 aaa0903
fix is_valid_description
Artemka374 85e52e9
save this.proposalId
Artemka374 019f7f3
fix proposal length test
Artemka374 a173716
fix snapshot and deadline getter
Artemka374 a9349ce
use unwrap_or_default in places where it is needed
Artemka374 f6effee
add some tests
prxgr4mm3r dfc4154
fix state method
Artemka374 6cbff64
Merge remote-tracking branch 'origin/feature/governance' into feature…
Artemka374 2eb294b
fix state
prxgr4mm3r 5fc7b6c
fix cancel
prxgr4mm3r 99a532d
fix some cancel tests
prxgr4mm3r 078e378
set default voting delay
prxgr4mm3r 247fd5c
use Option instead of zero address, fix some bugs
Artemka374 89fc6a5
add tests for PSP22Votes
prxgr4mm3r c1b06e8
add tests for Counting
prxgr4mm3r 1035a1c
add get_votes and count_votes in contract
prxgr4mm3r a34a8bf
use Option in more places, use TimestampProvider in PSP22Votes
Artemka374 5541265
add check for votes in deployment check
Artemka374 7863269
fix bug with timestamp in checkpoints
Artemka374 1036b4b
make counting tests working
prxgr4mm3r 087fe10
add licences
prxgr4mm3r 2411de9
add inline docs to traits
prxgr4mm3r 18754e1
fix execute call input
Artemka374 26f1092
Merge remote-tracking branch 'origin/feature/governance' into feature…
Artemka374 cc7d93d
add inline docs to governance contracts and utils
prxgr4mm3r e477d01
fix bugs
Artemka374 67836a4
use correct selector and data values
Artemka374 828e837
delete useless storage fields from example governance contract, chang…
prxgr4mm3r e0e80e9
add restriction for voting period, clean up tests
Artemka374 ac3b345
Merge remote-tracking branch 'origin/feature/governance' into feature…
Artemka374 51027f6
fix inline docs
prxgr4mm3r 03c5f42
apply suggestions
Artemka374 01d4b97
Merge remote-tracking branch 'origin/feature/governance' into feature…
Artemka374 7b62bf2
fix conflicts
Artemka374 916116c
apply fmt
Artemka374 42ce434
add implementation macro to Governance
prxgr4mm3r 6e647d9
Merge remote-tracking branch 'origin/feature/governance' into feature…
prxgr4mm3r c115a76
make governor contract compilable
prxgr4mm3r 0db7102
split macro and do beautiful imports
prxgr4mm3r 1cebeb5
add Nonces macro
prxgr4mm3r 67ca713
add Nonces macro
prxgr4mm3r 6e58872
fix governance and votes import system and add PSP22Votes macro
prxgr4mm3r 33ce3e9
add feature flags on utils
Artemka374 ce3c950
fix config
Artemka374 be4cdd7
fix compilation, apply fmt
Artemka374 2d0cc46
delete strange folder
Artemka374 d4cc861
fix builds
Artemka374 0bfefc8
fix wrong symbol
Artemka374 be6a46b
fix build
Artemka374 6f4dd24
fix governance feature in psp22_votes
Artemka374 e9a7f3d
apply suggestions
Artemka374 76fba6b
fix build
Artemka374 dd84db2
fix unit tests
Artemka374 b42fdd9
remove unnecessary examples, update dockerfile
Artemka374 19833a3
update versions in ci
Artemka374 8da323e
add version in compile
Artemka374 7644e49
add version in compile
Artemka374 a415530
update package.json
Artemka374 af5e0fb
fix some tests
Artemka374 d85efd3
update typechain-compiler-config.json
Artemka374 16a0841
update wrapper test
Artemka374 01bacfa
add mock to compiler
Artemka374 fd776fc
apply eslint, delete counting mode
Artemka374 dafd2f8
fix some tests
Artemka374 8491a06
update quorum tests
Artemka374 5c158aa
Merge remote-tracking branch 'origin/develop' into feature/governance
Artemka374 de87bbc
fix some errors after merge
Artemka374 fd34f92
fix compilation in reentrancy_guard
Artemka374 30e560c
fix some warnings
Artemka374 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 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 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 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 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
41 changes: 41 additions & 0 deletions
41
contracts/src/governance/extensions/governor_counting/data.rs
This file contains 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,41 @@ | ||
// Copyright (c) 2023 Brushfam | ||
// Copyright (c) 2012-2022 Supercolony | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the"Software"), | ||
// to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
pub use crate::traits::governance::{ | ||
ProposalId, | ||
ProposalVote, | ||
}; | ||
pub use openbrush::{ | ||
storage::Mapping, | ||
traits::AccountId, | ||
}; | ||
|
||
#[derive(Default, Debug)] | ||
#[openbrush::storage_item] | ||
pub struct Data { | ||
/// Stores the ammounts of the votes of the proposals | ||
/// The key is the proposal id and the value is the vote, which contains the ammount of votes | ||
pub proposal_votes: Mapping<ProposalId, ProposalVote>, | ||
|
||
/// Stores if the account has voted for the proposal | ||
pub has_votes: Mapping<(ProposalId, AccountId), ()>, | ||
} |
49 changes: 49 additions & 0 deletions
49
contracts/src/governance/extensions/governor_counting/impls.rs
This file contains 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,49 @@ | ||
// Copyright (c) 2023 Brushfam | ||
// Copyright (c) 2012-2022 Supercolony | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the"Software"), | ||
// to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
use crate::governance::extensions::governor_counting::{ | ||
CountingInternal, | ||
Data, | ||
}; | ||
pub use crate::{ | ||
governance::extensions::governor_counting, | ||
traits::governance::extensions::governor_counting::*, | ||
}; | ||
use openbrush::traits::{ | ||
AccountId, | ||
Storage, | ||
}; | ||
|
||
/// Extension of `Governor` for simple, 3 options, vote counting. | ||
pub trait GovernorCountingImpl: Storage<Data> + CountingInternal { | ||
/// Returns `true` if the account has voted for the proposal, `false` otherwise | ||
fn has_voted(&self, proposal_id: ProposalId, account: AccountId) -> bool { | ||
self.data::<Data>().has_votes.get(&(proposal_id, account)).is_some() | ||
} | ||
/// Returns the tuple (for, against, abstain) votes for a proposal, where `for` is the total | ||
/// number of votes for the proposal, `against` is the total number of votes against the | ||
/// proposal, and `abstain` is the total number of abstained votes. | ||
fn proposal_votes(&self, proposal_id: ProposalId) -> Result<ProposalVote, GovernanceError> { | ||
let proposal_vote = self.data::<Data>().proposal_votes.get(&proposal_id).unwrap_or_default(); | ||
Ok(ProposalVote { ..proposal_vote }) | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
contracts/src/governance/extensions/governor_counting/internal.rs
This file contains 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,108 @@ | ||
// Copyright (c) 2023 Brushfam | ||
// Copyright (c) 2012-2022 Supercolony | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the"Software"), | ||
// to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
use crate::{ | ||
governance::{ | ||
extensions::{ | ||
governor_counting::Data, | ||
governor_quorum::QuorumImpl, | ||
}, | ||
governor::GovernorStorageGetters, | ||
}, | ||
traits::{ | ||
errors::GovernanceError, | ||
governance::{ | ||
ProposalId, | ||
VoteType, | ||
}, | ||
}, | ||
}; | ||
use openbrush::traits::{ | ||
AccountId, | ||
Balance, | ||
Storage, | ||
}; | ||
|
||
pub trait CountingInternal: Storage<Data> + QuorumImpl + GovernorStorageGetters { | ||
/// Returns true if the quorum is reached for the given proposal, false otherwise | ||
fn _quorum_reached(&self, proposal_id: ProposalId) -> Result<bool, GovernanceError> { | ||
let proposal_vote = self.data::<Data>().proposal_votes.get(&proposal_id).unwrap_or_default(); | ||
let num_votes = proposal_vote | ||
.for_votes | ||
.checked_add(proposal_vote.abstain_votes) | ||
.ok_or(GovernanceError::Overflow)?; | ||
|
||
Ok(self.quorum(self._proposal_snapshot(proposal_id)?)? <= num_votes) | ||
} | ||
|
||
/// Returns true if the proposal has succeeded, false otherwise | ||
fn _vote_succeeded(&self, proposal_id: ProposalId) -> bool { | ||
self.data::<Data>() | ||
.proposal_votes | ||
.get(&proposal_id) | ||
.map(|proposal_vote| proposal_vote.for_votes > proposal_vote.against_votes) | ||
.unwrap_or_default() | ||
} | ||
|
||
/// Adds a `account`'s vote to `proposal_id` with `weight` votes, to the `support` side. | ||
fn _count_vote( | ||
&mut self, | ||
proposal_id: ProposalId, | ||
account: AccountId, | ||
support: VoteType, | ||
weight: Balance, | ||
// params: Vec<u8>, | ||
) -> Result<(), GovernanceError> { | ||
let mut proposal_vote = self.data::<Data>().proposal_votes.get(&proposal_id).unwrap_or_default(); | ||
|
||
if self.data::<Data>().has_votes.get(&(proposal_id, account)).is_some() { | ||
return Err(GovernanceError::AlreadyCastVote(account))? | ||
} | ||
|
||
self.data::<Data>().has_votes.insert(&(proposal_id, account), &()); | ||
|
||
match support { | ||
VoteType::Against => { | ||
proposal_vote.against_votes = proposal_vote | ||
.against_votes | ||
.checked_add(weight) | ||
.ok_or(GovernanceError::Overflow)?; | ||
} | ||
VoteType::For => { | ||
proposal_vote.for_votes = proposal_vote | ||
.for_votes | ||
.checked_add(weight) | ||
.ok_or(GovernanceError::Overflow)?; | ||
} | ||
VoteType::Abstain => { | ||
proposal_vote.abstain_votes = proposal_vote | ||
.abstain_votes | ||
.checked_add(weight) | ||
.ok_or(GovernanceError::Overflow)?; | ||
} | ||
} | ||
|
||
self.data::<Data>().proposal_votes.insert(&proposal_id, &proposal_vote); | ||
|
||
Ok(()) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
contracts/src/governance/extensions/governor_counting/mod.rs
This file contains 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,29 @@ | ||
// Copyright (c) 2023 Brushfam | ||
// Copyright (c) 2012-2022 Supercolony | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the"Software"), | ||
// to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
mod data; | ||
mod impls; | ||
mod internal; | ||
|
||
pub use data::*; | ||
pub use impls::*; | ||
pub use internal::*; |
31 changes: 31 additions & 0 deletions
31
contracts/src/governance/extensions/governor_quorum/data.rs
This file contains 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,31 @@ | ||
// Copyright (c) 2023 Brushfam | ||
// Copyright (c) 2012-2022 Supercolony | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the"Software"), | ||
// to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
pub use crate::utils::checkpoint::Checkpoints; | ||
|
||
#[derive(Debug, Default)] | ||
#[openbrush::storage_item] | ||
pub struct Data { | ||
/// Stores the quorum numerator history of the governor | ||
#[lazy] | ||
pub quorum_numerator_history: Checkpoints, | ||
} |
29 changes: 29 additions & 0 deletions
29
contracts/src/governance/extensions/governor_quorum/events.rs
This file contains 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,29 @@ | ||
// Copyright (c) 2023 Brushfam | ||
// Copyright (c) 2012-2022 Supercolony | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the"Software"), | ||
// to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
pub trait QuorumEvents { | ||
/// Emitted when the quorum denominator is updated | ||
fn emit_quorum_numerator_updated(&self, _old_quorum_numerator: u128, _new_quorum_numerator: u128) {} | ||
|
||
/// Emitted when the governor quorum is invalid | ||
fn emit_governor_invalid_quorum_fraction(&self, _quorum_numerator: u128, _quorum_denominator: u128) {} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need a contract just for receiving?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's mock contract to test executing transactions in other contracts through governance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can be any contract though