-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from xch-dev/vault-members-restrictions
Vault members restrictions
- Loading branch information
Showing
23 changed files
with
769 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,3 +1,21 @@ | ||
mod bls_member; | ||
mod bls_taproot_member; | ||
mod fixed_puzzle_member; | ||
mod passkey_member; | ||
mod passkey_member_puzzle_assert; | ||
mod secp256k1_member; | ||
mod secp256k1_member_puzzle_assert; | ||
mod secp256r1_member; | ||
mod secp256r1_member_puzzle_assert; | ||
mod singleton_member; | ||
|
||
pub use bls_member::*; | ||
pub use bls_taproot_member::*; | ||
pub use fixed_puzzle_member::*; | ||
pub use passkey_member::*; | ||
pub use passkey_member_puzzle_assert::*; | ||
pub use secp256k1_member::*; | ||
pub use secp256k1_member_puzzle_assert::*; | ||
pub use secp256r1_member::*; | ||
pub use secp256r1_member_puzzle_assert::*; | ||
pub use singleton_member::*; |
50 changes: 50 additions & 0 deletions
50
crates/chia-sdk-types/src/puzzles/vault/members/bls_taproot_member.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,50 @@ | ||
use chia_bls::PublicKey; | ||
use clvm_traits::{FromClvm, ToClvm}; | ||
use clvm_utils::TreeHash; | ||
use hex_literal::hex; | ||
|
||
use crate::Mod; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ToClvm, FromClvm)] | ||
#[clvm(curry)] | ||
pub struct BlsTaprootMember { | ||
pub synthetic_key: PublicKey, | ||
} | ||
|
||
impl BlsTaprootMember { | ||
pub fn new(synthetic_key: PublicKey) -> Self { | ||
Self { synthetic_key } | ||
} | ||
} | ||
|
||
impl Mod for BlsTaprootMember { | ||
const MOD_REVEAL: &[u8] = &BLS_TAPROOT_MEMBER; | ||
const MOD_HASH: TreeHash = BLS_TAPROOT_MEMBER_HASH; | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ToClvm, FromClvm)] | ||
#[clvm(solution)] | ||
pub struct BlsTaprootMemberSolution { | ||
pub original_public_key: Option<PublicKey>, | ||
} | ||
|
||
impl BlsTaprootMemberSolution { | ||
pub fn new(original_public_key: Option<PublicKey>) -> Self { | ||
Self { | ||
original_public_key, | ||
} | ||
} | ||
} | ||
|
||
pub const BLS_TAPROOT_MEMBER: [u8; 99] = hex!( | ||
" | ||
ff02ffff01ff02ffff03ff17ffff01ff02ffff03ffff09ff05ffff1dff17ffff | ||
1effff0bff17ff0b80808080ff80ffff01ff088080ff0180ffff01ff04ffff04 | ||
ff02ffff04ff05ffff04ff0bff80808080ff808080ff0180ffff04ffff0132ff | ||
018080 | ||
" | ||
); | ||
|
||
pub const BLS_TAPROOT_MEMBER_HASH: TreeHash = TreeHash::new(hex!( | ||
"35d2ad31aaf0df91c965909e5112294c57a18354ee4a5aae80572080ec3b6842" | ||
)); |
30 changes: 30 additions & 0 deletions
30
crates/chia-sdk-types/src/puzzles/vault/members/fixed_puzzle_member.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,30 @@ | ||
use chia_protocol::Bytes32; | ||
use clvm_traits::{FromClvm, ToClvm}; | ||
use clvm_utils::TreeHash; | ||
use hex_literal::hex; | ||
|
||
use crate::Mod; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, ToClvm, FromClvm)] | ||
#[clvm(curry)] | ||
pub struct FixedPuzzleMember { | ||
pub fixed_puzzle_hash: Bytes32, | ||
} | ||
|
||
impl FixedPuzzleMember { | ||
pub fn new(fixed_puzzle_hash: Bytes32) -> Self { | ||
Self { fixed_puzzle_hash } | ||
} | ||
} | ||
|
||
impl Mod for FixedPuzzleMember { | ||
const MOD_REVEAL: &[u8] = &FIXED_PUZZLE_MEMBER; | ||
const MOD_HASH: TreeHash = FIXED_PUZZLE_MEMBER_HASH; | ||
} | ||
|
||
pub const FIXED_PUZZLE_MEMBER: [u8; 25] = | ||
hex!("ff02ffff03ffff09ff02ff0580ff80ffff01ff088080ff0180"); | ||
|
||
pub const FIXED_PUZZLE_MEMBER_HASH: TreeHash = TreeHash::new(hex!( | ||
"34ede3eadc52ed750e405f2b9dea9891506547f651290bb606356d997c64f219" | ||
)); |
Oops, something went wrong.