contract BurnableWallets is Claimable {
    address[] public burnableWalletArray;

    struct BurnableWalletInfo {
        bool valid;
        uint256 index;
    }

    mapping(address => BurnableWalletInfo) public burnableWalletsTable;

    event BurnableWalletAccepted(address indexed _wallet);
    event BurnableWalletRejected(address indexed _wallet);

    /**
     * @dev Accept a new wallet.
     * @param _wallet The burnable wallet's address.
     */
    function accept(address _wallet) external onlyOwner {
        require(_wallet != address(0), "wallet is illegal");
        BurnableWalletInfo storage burnableWalletInfo = burnableWalletsTable[_wallet];
        require(!burnableWalletInfo.valid, "wallet is already accepted");
        burnableWalletInfo.valid = true;
        burnableWalletInfo.index = burnableWalletArray.length;
        burnableWalletArray.push(_wallet);
        emit BurnableWalletAccepted(_wallet);
    }

    /**
     * @dev Reject an existing burnable wallet.
     * @param _wallet The burnable wallet address.
     */
    function reject(address _wallet) external onlyOwner {
        BurnableWalletInfo storage burnableWalletInfo = burnableWalletsTable[_wallet];
        require(burnableWalletArray.length > burnableWalletInfo.index, "wallet is already rejected");
        require(_wallet == burnableWalletArray[burnableWalletInfo.index], "wallet is already rejected");
        // at this point we know that burnableWalletArray.length > burnableWalletInfo.index >= 0
        address lastWallet = burnableWalletArray[burnableWalletArray.length - 1];
        // will never underflow
        burnableWalletsTable[lastWallet].index = burnableWalletInfo.index;
        burnableWalletArray[burnableWalletInfo.index] = lastWallet;
        burnableWalletArray.length -= 1;
        // will never underflow
        delete burnableWalletsTable[_wallet];
        emit BurnableWalletRejected(_wallet);
    }

    /**
     * @dev Get an array of all the burnable wallets.
     * @return An array of all the burnable wallets.
     */
    function getBurnableWalletArray() external view returns (address[] memory) {
        return burnableWalletArray;
    }

    /**
     * @dev Get the total number of burnable wallets.
     * @return The total number of burnable wallets.
     */
    function getBurnableWalletCount() external view returns (uint256) {
        return burnableWalletArray.length;
    }

    /**
     * @dev Is a given wallet is a burnable wallet.
     * @param _wallet to check if its a burnable wallet.
     * @return True if a wallet is a burnable wallet.
     */
    function isBurnableWallet(address _wallet) public view returns (bool){
        return burnableWalletsTable[_wallet].valid;
    }
}
/**
 * @title BurnableWallets.
 */
function getBurnableWalletCount() external view returns (uint256) {
    return burnableWalletArray.length;
}

/**
 * @dev Get the total number of burnable wallets.
 * @return The total number of burnable wallets.
 */