Skip to content

Commit

Permalink
Test that mints without a cap are unmintable (#3495)
Browse files Browse the repository at this point in the history
Test that if the `cap` field of an etching is unset, it is treated as being
zero, and the rune is unmintable.Test that if the `cap` field of an etching is
unset, it is treated as being zero, and the rune is unmintable.
  • Loading branch information
lugondev committed Apr 11, 2024
1 parent 52ef5b1 commit 6eddd41
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions src/runes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4770,6 +4770,91 @@ mod tests {
);
}

#[test]
fn open_mints_without_a_cap_are_unmintable() {
let context = Context::builder().arg("--index-runes").build();

let (txid0, id) = context.etch(
Runestone {
etching: Some(Etching {
rune: Some(Rune(RUNE)),
terms: Some(Terms {
amount: Some(1000),
offset: (None, Some(2)),
..default()
}),
..default()
}),
..default()
},
1,
);

context.assert_runes(
[(
id,
RuneEntry {
block: id.block,
etching: txid0,
spaced_rune: SpacedRune {
rune: Rune(RUNE),
spacers: 0,
},
timestamp: id.block,
terms: Some(Terms {
amount: Some(1000),
offset: (None, Some(2)),
..default()
}),
..default()
},
)],
[],
);

context.core.broadcast_tx(TransactionTemplate {
inputs: &[(2, 0, 0, Witness::new())],
op_return: Some(
Runestone {
edicts: vec![Edict {
id,
amount: 1000,
output: 0,
}],
mint: Some(id),
..default()
}
.encipher(),
),
..default()
});

context.mine_blocks(1);

context.assert_runes(
[(
id,
RuneEntry {
block: id.block,
spaced_rune: SpacedRune {
rune: Rune(RUNE),
spacers: 0,
},
timestamp: id.block,
mints: 0,
etching: txid0,
terms: Some(Terms {
amount: Some(1000),
offset: (None, Some(2)),
..default()
}),
..default()
},
)],
[],
);
}

#[test]
fn open_mint_claims_can_use_split() {
let context = Context::builder().arg("--index-runes").build();
Expand Down

0 comments on commit 6eddd41

Please sign in to comment.