Honey
This is the ERC20 token representation of Berachain's native stablecoin, Honey. The contract is upgradeable and access-controlled, with minting and burning restricted to the HoneyFactory contract.
Inherits: ERC20, AccessControlUpgradeable, UUPSUpgradeable, IHoneyErrors
State Variables
factory
The factory contract address that has exclusive permission to mint and burn Honey.
address public factory;
View Functions
name
Returns the name of the token: "Honey"
function name() public pure override returns (string memory);
symbol
Returns the symbol of the token: "HONEY"
function symbol() public pure override returns (string memory);
Functions
initialize
Initializes the contract with governance and factory addresses. Can only be called once.
Access: Only during deployment Errors:
ZeroAddress
: If either_governance
or_factory
is the zero address
function initialize(address _governance, address _factory) external initializer;
mint
Mints Honey tokens to a specified address.
Access: Only HoneyFactory Errors:
NotFactory
: If called by any address other than the factory
function mint(address to, uint256 amount) external onlyFactory;
burn
Burns Honey tokens from a specified address.
Access: Only HoneyFactory Errors:
NotFactory
: If called by any address other than the factory
function burn(address from, uint256 amount) external onlyFactory;
Events
Transfer
Emitted when tokens are transferred between accounts.
event Transfer(address indexed from, address indexed to, uint256 value);
Approval
Emitted when an account approves another account to spend tokens on their behalf.
event Approval(address indexed owner, address indexed spender, uint256 value);
Errors
ZeroAddress
error ZeroAddress();
Thrown when attempting to initialize with a zero address.
NotFactory
error NotFactory();
Thrown when a restricted function is called by an address other than the factory.
Other Errors
The contract inherits additional errors from IHoneyErrors that may be relevant in the broader system context.