parazyd 3 лет назад
Родитель
Сommit
f46000ecbd

+ 9 - 7
example/dao2/contract/money/src/lib.rs

@@ -1,15 +1,17 @@
 use darkfi_sdk::{
-    crypto::{ContractId, PublicKey, MerkleNode, MerkleTree},
+    crypto::{ContractId, MerkleNode, MerkleTree, PublicKey},
     db::{db_init, db_lookup, db_set},
     define_contract,
-    msg,
     error::ContractResult,
     merkle::merkle_add,
-    pasta::{pallas, group::Curve, arithmetic::CurveAffine},
+    msg,
+    pasta::{arithmetic::CurveAffine, group::Curve, pallas},
     tx::ContractCall,
     util::set_return_data,
 };
-use darkfi_serial::{serialize, Encodable, SerialDecodable, SerialEncodable, WriteExt, deserialize};
+use darkfi_serial::{
+    deserialize, serialize, Encodable, SerialDecodable, SerialEncodable, WriteExt,
+};
 
 #[repr(u8)]
 pub enum MoneyFunction {
@@ -39,7 +41,7 @@ pub struct MoneyTransferUpdate {
     /// Nullifiers
     pub nullifiers: Vec<pallas::Base>,
     /// Coins
-    pub coins: Vec<pallas::Base>
+    pub coins: Vec<pallas::Base>,
 }
 
 /// A transaction's clear input
@@ -137,7 +139,7 @@ fn get_metadata(_cid: ContractId, ix: &[u8]) -> ContractResult {
                         input.user_data_enc,
                         sig_x,
                         sig_y,
-                    ]
+                    ],
                 ));
 
                 signature_public_keys.push(input.signature_public.inner());
@@ -154,7 +156,7 @@ fn get_metadata(_cid: ContractId, ix: &[u8]) -> ContractResult {
                         *value_coords.y(),
                         *token_coords.x(),
                         *token_coords.y(),
-                    ]
+                    ],
                 ));
             }
 

+ 3 - 5
example/dao2/src/contract/money/transfer/wallet.rs

@@ -28,12 +28,12 @@ use darkfi::{
         types::{
             DrkCoinBlind, DrkSerial, DrkSpendHook, DrkUserData, DrkUserDataBlind, DrkValueBlind,
         },
-        Proof
+        Proof,
     },
     Result,
 };
 
-use money_contract::{MoneyFunction, MoneyTransferParams, ClearInput, Input, Output};
+use money_contract::{ClearInput, Input, MoneyFunction, MoneyTransferParams, Output};
 
 use crate::{
     note,
@@ -236,8 +236,6 @@ impl Builder {
             outputs.push(output);
         }
 
-        Ok((MoneyTransferParams {
-            clear_inputs, inputs, outputs
-        }, proofs))
+        Ok((MoneyTransferParams { clear_inputs, inputs, outputs }, proofs))
     }
 }

+ 4 - 4
example/dao2/src/main.rs

@@ -13,9 +13,9 @@ use darkfi::{
 };
 use darkfi_sdk::{
     crypto::{
-        constants::MERKLE_DEPTH, pedersen::pedersen_commitment_u64, poseidon_hash, ContractId,
-        Keypair, MerkleNode, MerkleTree, PublicKey, SecretKey, TokenId,
-        schnorr::SchnorrSecret,
+        constants::MERKLE_DEPTH, pedersen::pedersen_commitment_u64, poseidon_hash,
+        schnorr::SchnorrSecret, ContractId, Keypair, MerkleNode, MerkleTree, PublicKey, SecretKey,
+        TokenId,
     },
     tx::ContractCall,
 };
@@ -480,7 +480,7 @@ async fn main() -> BoxResult<()> {
             let coin = output.coin;
             let enc_note = note::EncryptedNote2 {
                 ciphertext: output.ciphertext,
-                ephem_public: output.ephem_public
+                ephem_public: output.ephem_public,
             };
 
             let coin = Coin(coin);

+ 1 - 1
example/dao2/src/tx.rs

@@ -1,5 +1,4 @@
 use darkfi::{crypto::Proof, Result, VerifyFailed::ProofVerifyFailed};
-use darkfi_serial::Encodable;
 use darkfi_sdk::{
     crypto::{
         schnorr::{SchnorrPublic, Signature},
@@ -8,6 +7,7 @@ use darkfi_sdk::{
     pasta::pallas,
     tx::ContractCall,
 };
+use darkfi_serial::Encodable;
 use log::debug;
 
 use crate::{