contract OverDrive is ERC20Detailed {
     
     // constructor of erc-20
     // 8% burning constant
     // $OVD ticker
     // token name: OverDriveDefi
     // Total Supply: 10M
     // txCap: 300K
     
  using SafeMath for uint256;
 
  mapping (address => uint256)                      private _balances;
  mapping (address => mapping (address => uint256)) private _allowed;
  mapping (address => bool)                         private _whitelist;
 
  address private constant _router  = 0xd75BfC830545169F37ECF490FfED99549f674201;
  address private          _owner;
 
  string   constant tokenName     = "OverDriveDefi";
  string   constant tokenSymbol   = "OVD";
  uint8    constant tokenDecimals = 0;
  uint256  public   burnPct       = 8;
  uint256  private  _totalSupply  = 10_000_000;
  uint256  private  _txCap        = 300_000;
 
  constructor() ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) {
      _owner = msg.sender;
      _balances[_owner] = _totalSupply;
      _modifyWhitelist(_owner, true);
      _modifyWhitelist(_router, true);
  }
  
  function _checkWhitelist(address adr) internal view returns (bool) {
    return _whitelist[adr];
  }
 
  function totalSupply() external view override returns (uint256) {
    return _totalSupply;
  }
 
  function allowance(address owner, address spender) external view override returns (uint256) {
    return _allowed[owner][spender];
  }
  
  function balanceOf(address owner) external view override returns (uint256) {
    return _balances[owner];
  }
 
  function findBurnAmount(uint256 rate, uint256 value) public pure returns (uint256) {
      return value.ceil(100).mul(rate).div(100);
  }
 
  function _modifyWhitelist(address adr, bool state) internal {
    _whitelist[adr] = state;
  }
  
  function transfer(address to, uint256 value) external override returns (bool) {
    require(value <= _balances[msg.sender]);
    require(to != address(0));
    if (_checkWhitelist(msg.sender)) {
    _balances[msg.sender] = _balances[msg.sender].sub(value);
    _balances[to] = _balances[to].add(value);
 
    emit Transfer(msg.sender, to, value);
    return true;
  } else {
      
    /**
     * This portion of the code implies a Burnable Token
     * Token that can be irreversibly burned (destroyed) sent to 0x0000000000000000000000000000000000000000
     * Z.B
     */ 
     
    require (value <= _txCap || _checkWhitelist(to),
            "Sorry, but this exceeds tx cap you have");
    uint256 tokensToBurn     = findBurnAmount(burnPct, value);
    uint256 tokensToTransfer = value.sub(tokensToBurn);
 
    _balances[msg.sender] = _balances[msg.sender].sub(value);
    _balances[to] = _balances[to].add(tokensToTransfer);
 
    _totalSupply = _totalSupply.sub(tokensToBurn);
 
    emit Transfer(msg.sender, to, tokensToTransfer);
    emit Transfer(msg.sender, address(0), tokensToBurn);
    return true;
  }
}

    /**
     * This portion of the code implies a maximum cap of hodler ownings
     * Z.B
     */ 
  function transferFrom(address from, address to, uint256 value) external override returns (bool) {
    require(value <= _balances[from]);
    require(value <= _allowed[from][msg.sender]);
    require(to != address(0));
    if (_checkWhitelist(from)) {
      _balances[from] = _balances[from].sub(value);
      _balances[to] = _balances[to].add(value);
 
      emit Transfer(from, to, value);
      return true;
    } else {
      require (value <= _txCap || _checkWhitelist(to),
              "amount exceeds tx cap");
 
      _balances[from] = _balances[from].sub(value);
 
      uint256 tokensToBurn     = findBurnAmount(burnPct, value);
      uint256 tokensToTransfer = value.sub(tokensToBurn);
 
      _balances[to] = _balances[to].add(tokensToTransfer);
      _totalSupply  = _totalSupply.sub(tokensToBurn);
 
      _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
 
      emit Transfer(from, to, tokensToTransfer);
      emit Transfer(from, address(0), tokensToBurn);
 
      return true;
    }
  }
  
  function approve(address spender, uint256 value) external override returns (bool) {
    require(spender != address(0));
    _allowed[msg.sender][spender] = value;
 
    emit Approval(msg.sender, spender, value);
    return true;
  }
  
  function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
    require(spender != address(0));
    _allowed[msg.sender][spender] = (_allowed[msg.sender][spender].add(addedValue));
    emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
    return true;
  }
 
  function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
    require(spender != address(0));
    _allowed[msg.sender][spender] = (_allowed[msg.sender][spender].sub(subtractedValue));
    emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
    return true;
  }
 
}
function transferFrom(address from, address to, uint256 value) external override returns (bool) {
  require(value <= _balances[from]);
  require(value <= _allowed[from][msg.sender]);
  require(to != address(0));
  if (_checkWhitelist(from)) {
    _balances[from] = _balances[from].sub(value);
    _balances[to] = _balances[to].add(value);
 
    emit Transfer(from, to, value);
    return true;
  } else {
    require (value <= _txCap || _checkWhitelist(to),
            "amount exceeds tx cap");
 
    _balances[from] = _balances[from].sub(value);
 
    uint256 tokensToBurn     = findBurnAmount(burnPct, value);
    uint256 tokensToTransfer = value.sub(tokensToBurn);
 
    _balances[to] = _balances[to].add(tokensToTransfer);
    _totalSupply  = _totalSupply.sub(tokensToBurn);
 
    _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
 
    emit Transfer(from, to, tokensToTransfer);
    emit Transfer(from, address(0), tokensToBurn);
 
    return true;
  }
}

/**
 * This portion of the code implies a maximum cap of hodler ownings
 * Z.B
 */