diff --git a/src/contract/money/Cargo.toml b/src/contract/money/Cargo.toml index d4642fecc..230cce46e 100644 --- a/src/contract/money/Cargo.toml +++ b/src/contract/money/Cargo.toml @@ -28,7 +28,6 @@ async-std = {version = "1.12.0", features = ["attributes"]} darkfi = {path = "../../../", features = ["tx", "blockchain"]} simplelog = "0.12.1" sled = "0.34.7" -#sqlx = {version = "0.6.3", features = ["runtime-async-std-rustls", "sqlite"]} darkfi-contract-test-harness = {path = "../test-harness"} # We need to disable random using "custom" which makes the crate a noop diff --git a/src/contract/money/src/client/transfer_v1.rs b/src/contract/money/src/client/transfer_v1.rs index 9d89f3dab..7f0e8d1a5 100644 --- a/src/contract/money/src/client/transfer_v1.rs +++ b/src/contract/money/src/client/transfer_v1.rs @@ -41,11 +41,22 @@ use crate::{ model::{ClearInput, Coin, Input, MoneyTransferParamsV1, Output}, }; +/// Output metadata claimed from building a `Money::Transfer` call pub struct TransferCallDebris { + /// The parameters for `Money::Transfer` respective to this call pub params: MoneyTransferParamsV1, + /// The ZK proofs created in this builder pub proofs: Vec, + /// The ephemeral secret keys created for signing pub signature_secrets: Vec, + /// The coins that have been spent in this builder pub spent_coins: Vec, + /// The coins that have been minted in this builder + pub minted_coins: Vec, + /// The value blinds created for the inputs + pub input_value_blinds: Vec, + /// The value blinds created for the outputs + pub output_value_blinds: Vec, } pub struct TransferMintRevealed { @@ -181,6 +192,7 @@ impl TransferCallBuilder { let mut outputs = vec![]; let mut change_outputs = vec![]; let mut spent_coins = vec![]; + let mut minted_coins = vec![]; let mut signature_secrets = vec![]; let mut proofs = vec![]; @@ -287,7 +299,7 @@ impl TransferCallBuilder { token_commit: public_inputs.token_commit, nullifier: public_inputs.nullifier, merkle_root: public_inputs.merkle_root, - spend_hook: public_inputs.spend_hook, // FIXME: Do we need spend hook here? + spend_hook: public_inputs.spend_hook, user_data_enc: public_inputs.user_data_enc, signature_public: public_inputs.signature_public, }); @@ -345,6 +357,14 @@ impl TransferCallBuilder { let encrypted_note = AeadEncryptedNote::encrypt(¬e, &output.public_key, &mut OsRng)?; + minted_coins.push(OwnCoin { + coin: public_inputs.coin, + note, + secret: SecretKey::from(pallas::Base::ZERO), + nullifier: Nullifier::from(pallas::Base::ZERO), + leaf_position: 0.into(), + }); + params.outputs.push(Output { value_commit: public_inputs.value_commit, token_commit: public_inputs.token_commit, @@ -355,7 +375,15 @@ impl TransferCallBuilder { // Now we should have all the params, zk proofs, and signature secrets. // We return it all and let the caller deal with it. - let debris = TransferCallDebris { params, proofs, signature_secrets, spent_coins }; + let debris = TransferCallDebris { + params, + proofs, + signature_secrets, + spent_coins, + minted_coins, + input_value_blinds: input_blinds, + output_value_blinds: output_blinds, + }; Ok(debris) } }