LUX Token
Native platform token with bridge support and access control
LUX Token
The native platform token for Lux Network with bridge integration and blacklist functionality.
Inherits: ERC20, ERC20Burnable, Pausable, Ownable, AccessControl
State Variables
BLACKLIST
bytes32 public constant BLACKLIST = keccak256("BLACKLIST")Role identifier for blacklisted addresses.
bridge
address public bridgeThe authorized bridge contract address.
Functions
constructor
constructor() ERC20("LUX", "LUX") Ownable(msg.sender)Initializes the LUX token with name "LUX" and symbol "LUX".
configure
function configure(address _bridge) public onlyOwnerSets the bridge contract address. Only callable by owner.
blacklistAddress
function blacklistAddress(address _addr) public onlyOwnerAdds an address to the blacklist. Blacklisted addresses cannot send or receive tokens.
isBlacklisted
function isBlacklisted(address _addr) public view returns (bool)Checks if an address is blacklisted.
transfer
function transfer(address _to, uint256 _value) public override whenNotPaused returns (bool)Transfers tokens. Reverts if sender or recipient is blacklisted or if paused.
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public override whenNotPaused returns (bool)Transfers tokens on behalf of another address. Reverts if any party is blacklisted or if paused.
bridgeMint
function bridgeMint(address to, uint256 value) external whenNotPaused onlyBridgeMints tokens via bridge. Only callable by the bridge contract.
bridgeBurn
function bridgeBurn(address account, uint256 amount) external whenNotPaused onlyBridgeBurns tokens via bridge. Only callable by the bridge contract.
pause / unpause
function pause() public onlyOwner whenNotPaused
function unpause() public onlyOwner whenPausedEmergency pause controls. Only callable by owner.
mint
function mint(address to, uint256 value) public onlyOwnerMints new tokens. Only callable by owner.
airdrop
function airdrop(address[] memory addresses, uint256[] memory amounts) public onlyOwner returns (uint256)Batch airdrop tokens to multiple addresses.
Usage
import "@luxfi/standard/src/LUX.sol";
// Deploy
LUX lux = new LUX();
// Configure bridge
lux.configure(bridgeAddress);
// Mint tokens
lux.mint(recipient, 1000 ether);
// Blacklist address
lux.blacklistAddress(badActor);