-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement check_and_execute (sans nullifier check) for LQT
- Loading branch information
1 parent
551c987
commit 6097a52
Showing
7 changed files
with
109 additions
and
8 deletions.
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
1 change: 1 addition & 0 deletions
1
crates/core/component/funding/src/component/liquidity_tournament/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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod nullifier; | ||
pub mod votes; |
26 changes: 26 additions & 0 deletions
26
crates/core/component/funding/src/component/liquidity_tournament/votes/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,26 @@ | ||
use async_trait::async_trait; | ||
use cnidarium::StateWrite; | ||
use penumbra_sdk_asset::asset; | ||
use penumbra_sdk_keys::Address; | ||
|
||
use crate::component::state_key; | ||
|
||
#[async_trait] | ||
pub trait StateWriteExt: StateWrite { | ||
// Keeping this as returning a result to not have to touch other code if it changes to return an error. | ||
async fn tally( | ||
&mut self, | ||
epoch: u64, | ||
asset: asset::Id, | ||
power: u64, | ||
voter: &Address, | ||
) -> anyhow::Result<()> { | ||
self.nonverifiable_put_raw( | ||
state_key::lqt::v1::votes::receipt(epoch, asset, power, voter).to_vec(), | ||
Vec::default(), | ||
); | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl<T: StateWrite + ?Sized> StateWriteExt for T {} |
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