ShareXMomentumBadge
Inherits: ERC721Enumerable, AccessControl, IShareXMomentumBadge
Title: ShareX Momentum Badge
ERC721 badge contract to celebrate the 5th Anniversary of BNB Chain
This Badge is awarded to participants who joined ShareX activities during official #BNBDay celebrations
State Variables
MINTER_ROLE
Role for minting badges
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE")
BURNER_ROLE
Role for burning badges
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE")
_TOKEN_URI
Fixed metadata URI for all badges
string private constant _TOKEN_URI = "https://rwa.sharex.network/metadata/momentum-badge.json"
_currentTokenId
Current token ID counter
uint256 private _currentTokenId
Functions
constructor
Initialize the ShareX Momentum Badge contract
constructor(address admin) ERC721("ShareX Momentum Badge", "SMB");
Parameters
| Name | Type | Description |
|---|---|---|
admin | address | Address to be granted admin role |
mint
Mint a badge to a recipient
function mint(address to) external override onlyRole(MINTER_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
to | address | Recipient address |
batchMint
Mint badges to multiple recipients
function batchMint(address[] calldata recipients) external override onlyRole(MINTER_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
recipients | address[] | Array of recipient addresses |
burn
Burn a badge
function burn(uint256 tokenId) external override;
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | Token ID to burn |
batchBurn
Burn multiple badges
function batchBurn(uint256[] calldata tokenIds) external override;
Parameters
| Name | Type | Description |
|---|---|---|
tokenIds | uint256[] | Array of token IDs to burn |
tokenURI
Get the metadata URI for a token
function tokenURI(uint256 tokenId)
public
view
virtual
override(ERC721, IShareXMomentumBadge)
returns (string memory);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | Token ID |
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | The metadata URI |
totalSupply
Get the total supply of badges
function totalSupply()
public
view
override(ERC721Enumerable, IShareXMomentumBadge)
returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total number of badges minted |
supportsInterface
Check if the contract supports an interface
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Enumerable, AccessControl, IERC165)
returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
interfaceId | bytes4 | Interface identifier |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the interface is supported |
_exists
Internal function to check if a token exists
function _exists(uint256 tokenId) internal view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
tokenId | uint256 | Token ID to check |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if the token exists |