From eeeff239507a57c6c61b30acf047f23a7d3acff1 Mon Sep 17 00:00:00 2001 From: scx1332 Date: Sun, 17 Mar 2024 22:27:39 +0100 Subject: [PATCH] fix distributor --- crates/erc20_payment_lib/src/transaction.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/erc20_payment_lib/src/transaction.rs b/crates/erc20_payment_lib/src/transaction.rs index ed5d1503..8a44a869 100644 --- a/crates/erc20_payment_lib/src/transaction.rs +++ b/crates/erc20_payment_lib/src/transaction.rs @@ -335,6 +335,7 @@ pub fn create_distribute_transaction( recipients: &[Address], amounts: &[U256], ) -> Result { + let sum_amounts = amounts.iter().fold(U256::zero(), |acc, x| acc + x); Ok(TxDbObj { method: "DISTRIBUTOR.distribute".to_string(), from_addr: format!("{from:#x}"), @@ -344,6 +345,7 @@ pub fn create_distribute_transaction( call_data: Some(hex::encode( encode_distribute(recipients, amounts).map_err(err_from!())?, )), + val: sum_amounts.to_string(), ..Default::default() }) }