Skip to content

Commit

Permalink
improved get_total_minted_stablecoin() function
Browse files Browse the repository at this point in the history
  • Loading branch information
rober-m committed Mar 24, 2024
1 parent 8779196 commit 7ac44d8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/ppp-contracts-in-aiken/stablecoin_shared.ak
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use aiken/dict
use aiken/list
use aiken/transaction.{ScriptContext}
use aiken/transaction/value.{PolicyId, from_minted_value, tokens}
use aiken/transaction/value.{PolicyId, from_minted_value, quantity_of}
use ppp_contracts_in_aiken/util.{PKH}

const stablecoinTokenName = "stablecoin"
Expand All @@ -13,10 +11,7 @@ pub fn get_total_minted_stablecoin(
) -> Int {
ctx.transaction.mint
|> from_minted_value()
|> tokens(policy_id)
|> dict.filter(fn(asset_name, _v) { asset_name == stablecoinTokenName })
|> dict.values()
|> list.foldl(0, fn(n, total) { n + total })
|> quantity_of(policy_id, stablecoinTokenName)
}

pub type CollateralDatum {
Expand Down

0 comments on commit 7ac44d8

Please sign in to comment.