Skip to content

Commit

Permalink
Improving RGB20 asset field names
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Feb 2, 2021
1 parent 8058c03 commit be34a99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions rgb20/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl Asset {
Clone, Copy, Getters, PartialEq, Debug, Display, StrictEncode, StrictDecode,
)]
#[strict_encoding_crate(lnpbp::strict_encoding)]
#[display("{value}@{node_id}#{index}={outpoint}")]
#[display("{confidential_amount}@{node_id}/{index}={outpoint}")]
pub struct Allocation {
/// Unique primary key is `node_id` + `index`
node_id: NodeId,
Expand All @@ -241,9 +241,9 @@ pub struct Allocation {
#[cfg_attr(feature = "serde", serde(with = "As::<DisplayFromStr>"))]
outpoint: bitcoin::OutPoint,

/// Revealed value consisting of an explicit atomic amount and Pedesen
/// commitment blinding factor
value: value::Revealed,
/// Revealed confidential amount consisting of an explicit atomic amount
/// and Pedesen commitment blinding factor
confidential_amount: value::Revealed,
}

impl Allocation {
Expand All @@ -258,7 +258,7 @@ impl Allocation {
node_id,
index,
outpoint,
value,
confidential_amount: value,
}
}
}
Expand Down Expand Up @@ -415,7 +415,7 @@ impl Asset {
node_id,
index,
outpoint,
value,
confidential_amount: value,
};
if !self.known_allocations.contains(&new_allocation) {
self.known_allocations.push(new_allocation);
Expand All @@ -436,7 +436,7 @@ impl Asset {
node_id,
index,
outpoint,
value,
confidential_amount: value,
};
if let Some(index) = self
.known_allocations
Expand Down Expand Up @@ -539,7 +539,7 @@ impl TryFrom<Genesis> for Asset {
node_id,
index: index as u16,
outpoint: outpoint_reveal.into(),
value: assigned_state,
confidential_amount: assigned_state,
})
}
});
Expand Down
4 changes: 2 additions & 2 deletions rgb20/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn transfer(
// Computing sum of inputs
let total_inputs = input_allocations
.iter()
.fold(0u64, |acc, alloc| acc + alloc.value().value);
.fold(0u64, |acc, alloc| acc + alloc.confidential_amount().value);

let metadata = type_map! {};
let mut total_outputs = 0;
Expand Down Expand Up @@ -186,7 +186,7 @@ pub fn transfer(

let input_amounts = input_allocations
.iter()
.map(|alloc| alloc.value().clone())
.map(|alloc| alloc.confidential_amount().clone())
.collect();
let assignments = type_map! {
OwnedRightsType::Assets =>
Expand Down

0 comments on commit be34a99

Please sign in to comment.