ERC-1155 Burnable
Extension of ERC-1155 that allows token holders to destroy both their own tokens and those that they have been approved to use.
Usage
In order to make ERC-1155 Burnable
methods “external” so that other contracts can call them, you need to implement them by yourself for your final contract as follows:
use openzeppelin_stylus::{
token::erc1155::{self, extensions::IErc1155Burnable, Erc1155},
utils::introspection::erc165::IErc165,
};
#[entrypoint]
#[storage]
struct Erc1155Example {
#[borrow]
erc1155: Erc1155,
}
#[public]
#[inherit(Erc1155)]
impl Erc1155Example {
fn burn(
&mut self,
account: Address,
token_id: U256,
value: U256,
) -> Result<(), erc1155::Error> {
// ...
self.erc1155.burn(account, token_id, value)?;
// ...
Ok(())
}
fn burn_batch(
&mut self,
account: Address,
token_ids: Vec<U256>,
values: Vec<U256>,
) -> Result<(), erc1155::Error> {
// ...
self.erc1155.burn_batch(account, token_ids, values)?;
// ...
Ok(())
}
fn supports_interface(interface_id: FixedBytes<4>) -> bool {
Erc1155::supports_interface(interface_id)
}
}