contract ASKey is ERC721Token, Whitelist {
  using strings for *;

  constructor (string _name, string _symbol) public ERC721Token(_name, _symbol)
  {
    addAddressToWhitelist(msg.sender);
  }


  /**
  * Custom accessor to create multiple tokens in a single transaction
  */
  function batchMint (
    address[] _to
  ) public onlyIfWhitelisted(msg.sender) {

    uint256 tokenId = totalSupply();

    for(uint i = 0; i < _to.length; i++) {

      tokenId++;

      super._mint(_to[i], tokenId);
    }
  }

  /**
  * Custom accessor to create a unique token
  */
  function mint (
    address _to
  ) public onlyIfWhitelisted(msg.sender) {
    uint256 tokenId = totalSupply() + 1;
    super._mint(_to, tokenId);

  }

  function tokenURI(uint _tokenId) public view returns (string _infoUrl) {
      string memory base = "https://vault.amnesiascanner.net/keys/metadata/0x";
      string memory id = uint2hexstr(_tokenId);

      return base.toSlice().concat(id.toSlice());
  }

  function uint2hexstr(uint i) internal pure returns (string) {
      if (i == 0) return "0";
      uint j = i;
      uint length;
      while (j != 0) {
          length++;
          j = j >> 4;
      }
      uint mask = 15;
      bytes memory bstr = new bytes(length);
      uint k = length - 1;
      while (i != 0){
          uint curr = (i & mask);
          bstr[k--] = curr > 9 ? byte(55 + curr) : byte(48 + curr); // 55 = 65 - 10
          i = i >> 4;
      }
      return string(bstr);
  }
}
function mint (
    address _to
  ) public onlyIfWhitelisted(msg.sender) {
    uint256 tokenId = totalSupply() + 1;
    super._mint(_to, tokenId);

  }
/**
 * Custom accessor to create a unique token
 */