Skip to content

Commit

Permalink
Correctly label insufficiently forwarded lovelaces during register step.
Browse files Browse the repository at this point in the history
  • Loading branch information
KtorZ committed Sep 23, 2024
1 parent bcaeac0 commit c996bb0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions validators/zhuli.test.ak
Original file line number Diff line number Diff line change
Expand Up @@ -289,20 +289,23 @@ fn register(
our_value_restricted_to(utxo, [ada_policy_id, validator_hash])

// The administrator does authorize (un)registration, and thus, it is totally
// allowed to NOT forward all lovelaces to the resulting address. This fork
// checks that.
let our_assets <-
// allowed to NOT forward all lovelaces to the resulting address, so long as
// it's signed by the administrator. This fork checks that.
let (labels, our_assets) <-
and_then(
scenario.fork(
240,
fn() { constant(our_assets) },
fn() { constant((labels, our_assets)) },
fn() {
let lovelace = assets.lovelace_of(our_assets)
if lovelace > 1 {
let removed <- map(int_between(1, lovelace - 1))
assets.add(our_assets, ada_policy_id, ada_asset_name, -removed)
(
[sc_insufficient_lovelace_forwarded, ..labels],
assets.add(our_assets, ada_policy_id, ada_asset_name, -removed),
)
} else {
constant(our_assets)
constant((labels, our_assets))
}
},
),
Expand Down

0 comments on commit c996bb0

Please sign in to comment.