Skip to content

Commit

Permalink
Added prover address to the memo
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgenKor committed Mar 29, 2024
1 parent 0ef2829 commit 139d9ba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libzkbob-rs-wasm/src/client/tx_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub struct TxExtraData {
pub struct TxBaseFields {
#[serde(with = "serde_bytes")]
proxy: Vec<u8>,
#[serde(with = "serde_bytes")]
prover: Vec<u8>,
proxy_fee: TokenAmount<Fr>,
prover_fee: TokenAmount<Fr>,
data: Vec<TxExtraData>,
Expand All @@ -53,6 +55,7 @@ impl JsTxType for IDepositData {

let operator = TxOperator {
proxy_address: base_fields.proxy,
prover_address: base_fields.prover,
proxy_fee: base_fields.proxy_fee,
prover_fee: base_fields.prover_fee,
};
Expand Down Expand Up @@ -97,6 +100,7 @@ impl JsTxType for IDepositPermittableData {

let operator = TxOperator {
proxy_address: base_fields.proxy,
prover_address: base_fields.prover,
proxy_fee: base_fields.proxy_fee,
prover_fee: base_fields.prover_fee,
};
Expand Down Expand Up @@ -152,6 +156,7 @@ impl JsTxType for ITransferData {

let operator = TxOperator {
proxy_address: base_fields.proxy,
prover_address: base_fields.prover,
proxy_fee: base_fields.proxy_fee,
prover_fee: base_fields.prover_fee,
};
Expand Down Expand Up @@ -198,6 +203,7 @@ impl JsTxType for IWithdrawData {

let operator = TxOperator {
proxy_address: base_fields.proxy,
prover_address: base_fields.prover,
proxy_fee: base_fields.proxy_fee,
prover_fee: base_fields.prover_fee,
};
Expand Down
1 change: 1 addition & 0 deletions libzkbob-rs-wasm/src/ts_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export interface IExtraItem {
export interface ITxBaseFields {
proxy: Uint8Array;
prover: Uint8Array;
proxy_fee: string;
prover_fee: string;
data: IExtraItem[];
Expand Down
6 changes: 6 additions & 0 deletions libzkbob-rs/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub struct TxOutput<Fr: PrimeField> {
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct TxOperator<Fr: PrimeField> {
pub proxy_address: Vec<u8>,
pub prover_address: Vec<u8>,
pub proxy_fee: TokenAmount<Fr>,
pub prover_fee: TokenAmount<Fr>,
}
Expand All @@ -116,6 +117,7 @@ impl<Fr: PrimeField> TxOperator<Fr> {
dst.write_all(&raw_fee.to_be_bytes()).unwrap();
} else {
dst.append(&mut self.proxy_address.clone());
dst.append(&mut self.prover_address.clone());
let raw_proxy_fee: u64 = self.proxy_fee.to_num().try_into().unwrap();
let raw_prover_fee: u64 = self.prover_fee.to_num().try_into().unwrap();
dst.write_all(&raw_proxy_fee.to_be_bytes()).unwrap();
Expand Down Expand Up @@ -703,6 +705,7 @@ mod tests {

let op = TxOperator {
proxy_address: vec![],
prover_address: vec![],
proxy_fee: BoundedNum::ZERO,
prover_fee: BoundedNum::ZERO,
};
Expand All @@ -726,6 +729,7 @@ mod tests {

let op = TxOperator {
proxy_address: vec![],
prover_address: vec![],
proxy_fee: BoundedNum::ZERO,
prover_fee: BoundedNum::ONE,
};
Expand Down Expand Up @@ -757,6 +761,7 @@ mod tests {

let op = TxOperator {
proxy_address: vec![],
prover_address: vec![],
proxy_fee: BoundedNum::ZERO,
prover_fee: BoundedNum::ZERO,
};
Expand Down Expand Up @@ -784,6 +789,7 @@ mod tests {

let op = TxOperator {
proxy_address: vec![],
prover_address: vec![],
proxy_fee: BoundedNum::ZERO,
prover_fee: BoundedNum::ZERO,
};
Expand Down

0 comments on commit 139d9ba

Please sign in to comment.