Skip to content

Commit

Permalink
Add test Rune cannot be minted less than limit amount (#3556)
Browse files Browse the repository at this point in the history
  • Loading branch information
lugondev committed Apr 19, 2024
1 parent e85c325 commit 1fd7aef
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions src/runes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3909,6 +3909,100 @@ mod tests {
);
}

#[test]
fn rune_cannot_be_minted_less_than_limit_amount() {
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),
cap: Some(100),
..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,
mints: 0,
terms: Some(Terms {
amount: Some(1000),
cap: Some(100),
..default()
}),
..default()
},
)],
[],
);

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

context.mine_blocks(1);

context.assert_runes(
[(
id,
RuneEntry {
block: id.block,
etching: txid0,
terms: Some(Terms {
amount: Some(1000),
cap: Some(100),
..default()
}),
mints: 1,
spaced_rune: SpacedRune {
rune: Rune(RUNE),
spacers: 0,
},
premine: 0,
timestamp: id.block,
..default()
},
)],
[(
OutPoint {
txid: txid1,
vout: 0,
},
vec![(id, 1000)],
)],
);
}

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

0 comments on commit 1fd7aef

Please sign in to comment.