Skip to content

Commit

Permalink
Cleanup 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Dec 11, 2024
1 parent 308ef71 commit 58067f5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
13 changes: 11 additions & 2 deletions crates/chia-sdk-driver/src/primitives/vault/vault_launcher.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chia_puzzles::{EveProof, Proof};
use chia_sdk_types::Conditions;
use clvm_traits::ToClvm;
use clvmr::Allocator;
Expand All @@ -16,10 +17,18 @@ impl Launcher {
where
M: ToClvm<Allocator>,
{
let launcher_id = self.coin().coin_id();
let launcher_coin = self.coin();
let custody_hash = custody.puzzle_hash();
let (conditions, coin) = self.spend(ctx, custody_hash.into(), memos)?;
let vault = Vault::new(coin, launcher_id, custody);
let vault = Vault {
coin,
launcher_id: launcher_coin.coin_id(),
proof: Proof::Eve(EveProof {
parent_parent_coin_info: launcher_coin.parent_coin_info,
parent_amount: launcher_coin.amount,
}),
custody,
};
Ok((conditions, vault))
}
}
14 changes: 3 additions & 11 deletions crates/chia-sdk-driver/src/primitives/vault/vault_primitive.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chia_protocol::{Bytes32, Coin};
use chia_puzzles::singleton::SingletonArgs;
use chia_puzzles::{singleton::SingletonArgs, Proof};
use chia_sdk_types::Mod;
use clvm_utils::TreeHash;
use clvmr::NodePtr;
Expand All @@ -12,19 +12,10 @@ use super::{KnownPuzzles, Member, PuzzleWithRestrictions, VaultLayer};
pub struct Vault {
pub coin: Coin,
pub launcher_id: Bytes32,
pub proof: Proof,
pub custody: PuzzleWithRestrictions<Member>,
}

impl Vault {
pub fn new(coin: Coin, launcher_id: Bytes32, custody: PuzzleWithRestrictions<Member>) -> Self {
Self {
coin,
launcher_id,
custody,
}
}
}

impl VaultLayer for Vault {
fn puzzle_hash(&self) -> TreeHash {
SingletonArgs::new(self.launcher_id, self.custody.puzzle_hash()).curry_tree_hash()
Expand All @@ -39,6 +30,7 @@ impl VaultLayer for Vault {
Self {
coin: self.coin,
launcher_id: self.launcher_id,
proof: self.proof,
custody: self.custody.replace(known_puzzles),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/chia-sdk-signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "chia-sdk-signer"
version = "0.19.1"
edition = "2021"
license = "Apache-2.0"
description = "Calculates the BLS signatures required for coin spends in a transaction."
description = "Calculates the signatures required for coin spends in a transaction."
authors = ["Brandon Haggstrom <[email protected]>"]
homepage = "https://github.com/Rigidity/chia-wallet-sdk"
repository = "https://github.com/Rigidity/chia-wallet-sdk"
Expand Down

0 comments on commit 58067f5

Please sign in to comment.