Skip to content

Commit

Permalink
if there is no max supply, then default to issued supply
Browse files Browse the repository at this point in the history
  • Loading branch information
jack committed Jul 4, 2024
1 parent 4506eaf commit 902b87f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/rgb20/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,16 @@ impl Rgb20 {
.sum()
}

// max_supply for the inflation asset
// Max supply for the inflation asset, if there is no `max supply`, then it will
// default to the non-inflatable asset `issued supply`
pub fn max_supply(&self) -> Amount {
self.0
.global("maxSupply")
.expect("RGB20 interface requires global `maxSupply`")
.unwrap_or(
self.0
.global("issuedSupply")
.expect("RGB20 interface requires global `issuedSupply`"),
)
.iter()
.map(Amount::from_strict_val_unchecked)
.sum()
Expand Down

0 comments on commit 902b87f

Please sign in to comment.