Skip to content

Commit

Permalink
rgb25: add allocations method
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 29, 2024
1 parent b7cdb28 commit 95755d6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/rgb25/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use rgbstd::interface::{ContractIface, Iface, IfaceClass, IfaceId};
use rgbstd::interface::{
ContractIface, FungibleAllocation, Iface, IfaceClass, IfaceId, OutpointFilter,
};
use rgbstd::invoice::{Amount, Precision};
use rgbstd::persistence::ContractStateRead;
use rgbstd::stl::{rgb_contract_stl, ContractTerms, Details, Name};
Expand Down Expand Up @@ -130,6 +132,15 @@ impl<S: ContractStateRead> Rgb25<S> {
Precision::from_strict_val_unchecked(strict_val)
}

pub fn allocations<'c>(
&'c self,
filter: impl OutpointFilter + 'c,
) -> impl Iterator<Item = FungibleAllocation> + 'c {
self.0
.fungible("assetOwner", filter)
.expect("RGB25 interface requires `assetOwner` state")
}

pub fn total_issued_supply(&self) -> Amount {
self.0
.global("issuedSupply")
Expand Down

0 comments on commit 95755d6

Please sign in to comment.