Skip to content

Commit 7ab0e79

Browse files
0xNeshibidzyyys
andauthored
docs: update comments/test messages as per review suggestions
Co-authored-by: Daniel Bigos <[email protected]>
1 parent 204565d commit 7ab0e79

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Diff for: contracts/src/token/erc1155/extensions/burnable.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ pub trait IErc1155Burnable {
2121
///
2222
/// # Arguments
2323
///
24+
/// * `&mut self` - Write access to the contract's state.
2425
/// * `account` - Account to burn tokens from.
2526
/// * `token_id` - Token id to be burnt.
2627
/// * `value` - Amount to be burnt.
2728
///
2829
/// # Errors
2930
///
30-
/// If the caller is not account address and the account has not been
31+
/// If the caller is not `account` address and the `account` has not been
3132
/// approved, then the error [`Error::MissingApprovalForAll`] is
3233
/// returned.
3334
/// If `from` is the `Address::ZERO`, then the error
@@ -51,13 +52,14 @@ pub trait IErc1155Burnable {
5152
///
5253
/// # Arguments
5354
///
55+
/// * `&mut self` - Write access to the contract's state.
5456
/// * `account` - Accounts to burn tokens from.
5557
/// * `values` - All amount to be burnt.
5658
/// * `token_ids` - All token id to be burnt.
5759
///
5860
/// # Errors
5961
///
60-
/// If the caller is not account address and the account has not been
62+
/// If the caller is not `account` address and the `account` has not been
6163
/// approved, then the error [`Error::MissingApprovalForAll`] is
6264
/// returned.
6365
/// If `from` is the `Address::ZERO`, then the error
@@ -228,7 +230,7 @@ mod tests {
228230

229231
let err = contract
230232
.burn(invalid_sender, token_ids[0], values[0])
231-
.expect_err("should not burn tokens from the zero address");
233+
.expect_err("should not burn tokens from the `Address::ZERO`");
232234

233235
assert!(matches!(
234236
err,
@@ -250,7 +252,7 @@ mod tests {
250252

251253
contract
252254
.burn_batch(alice, token_ids.clone(), values.clone())
253-
.expect("should burn own tokens");
255+
.expect("should burn own tokens in batch");
254256

255257
for token_id in token_ids {
256258
let balance = contract.balance_of(alice, token_id);
@@ -272,7 +274,7 @@ mod tests {
272274

273275
contract
274276
.burn_batch(BOB, token_ids.clone(), values.clone())
275-
.expect("should burn Bob's tokens");
277+
.expect("should burn Bob's tokens in batch");
276278

277279
for token_id in token_ids {
278280
let balance = contract.balance_of(BOB, token_id);
@@ -287,7 +289,7 @@ mod tests {
287289

288290
let err = contract
289291
.burn_batch(BOB, token_ids.clone(), values.clone())
290-
.expect_err("should not burn tokens without approval");
292+
.expect_err("should not burn tokens in batch without approval");
291293

292294
assert!(matches!(
293295
err,
@@ -312,7 +314,7 @@ mod tests {
312314

313315
let err = contract
314316
.burn_batch(invalid_sender, token_ids.clone(), values.clone())
315-
.expect_err("should not burn tokens from the zero address");
317+
.expect_err("should not burn tokens in batch from the `Address::ZERO`");
316318

317319
assert!(matches!(
318320
err,

Diff for: examples/erc1155/tests/erc1155.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,10 @@ async fn error_when_insufficient_balance_safe_batch_transfer_from(
15661566
Ok(())
15671567
}
15681568

1569+
// ============================================================================
1570+
// Integration Tests: ERC-1155 Burnable Extension
1571+
// ============================================================================
1572+
15691573
#[e2e::test]
15701574
async fn burns(alice: Account) -> eyre::Result<()> {
15711575
let contract_addr = alice.as_deployer().deploy().await?.address()?;

0 commit comments

Comments
 (0)