// SPDX-License-Identifier: CC0


/*
 /$$$$$$$$ /$$$$$$$  /$$$$$$$$ /$$$$$$$$        /$$$$$$  /$$$$$$$$
| $$_____/| $$__  $$| $$_____/| $$_____/       /$$__  $$|_____ $$/
| $$      | $$  \ $$| $$      | $$            |__/  \ $$     /$$/
| $$$$$   | $$$$$$$/| $$$$$   | $$$$$           /$$$$$$/    /$$/
| $$__/   | $$__  $$| $$__/   | $$__/          /$$____/    /$$/
| $$      | $$  \ $$| $$      | $$            | $$        /$$/
| $$      | $$  | $$| $$$$$$$$| $$$$$$$$      | $$$$$$$$ /$$/
|__/      |__/  |__/|________/|________/      |________/|__/



 /$$
| $$
| $$$$$$$  /$$   /$$
| $$__  $$| $$  | $$
| $$  \ $$| $$  | $$
| $$  | $$| $$  | $$
| $$$$$$$/|  $$$$$$$
|_______/  \____  $$
           /$$  | $$
          |  $$$$$$/
           \______/
  /$$$$$$  /$$$$$$$$ /$$$$$$$$ /$$    /$$ /$$$$$$ /$$$$$$$$ /$$$$$$$
 /$$__  $$|__  $$__/| $$_____/| $$   | $$|_  $$_/| $$_____/| $$__  $$
| $$  \__/   | $$   | $$      | $$   | $$  | $$  | $$      | $$  \ $$
|  $$$$$$    | $$   | $$$$$   |  $$ / $$/  | $$  | $$$$$   | $$$$$$$/
 \____  $$   | $$   | $$__/    \  $$ $$/   | $$  | $$__/   | $$____/
 /$$  \ $$   | $$   | $$        \  $$$/    | $$  | $$      | $$
|  $$$$$$/   | $$   | $$$$$$$$   \  $/    /$$$$$$| $$$$$$$$| $$
 \______/    |__/   |________/    \_/    |______/|________/|__/


CC0 2023
*/


pragma solidity ^0.8.23;


import "./FreeChecker.sol";


interface Fiefdoms {
  function tokenIdToFiefdom(uint256) external view returns (address);
}

interface FiefdomsVassal {
  function ownerOf(uint256) external view returns (address);
}


contract Free27 is FreeChecker {

  Fiefdoms public fiefdoms = Fiefdoms(0x9304D9116Bb83ccedCc33ac4918Adb9b1E104230);
  mapping(uint256 => bool) public vassalIdUsed;


  function claim(uint256 free0TokenId, uint256 fiefdomVassalId) external {
    preCheck(free0TokenId, '27');

    FiefdomsVassal vassal = FiefdomsVassal(fiefdoms.tokenIdToFiefdom(fiefdomVassalId));

    require(vassal.ownerOf(0) == msg.sender, 'You do not lord over this vassal');
    require(!vassalIdUsed[fiefdomVassalId], 'Token already used');
    vassalIdUsed[fiefdomVassalId] = true;


    postCheck(free0TokenId, 27, '27');
  }

}
[{"inputs":[{"internalType":"uint256","name":"free0TokenId","type":"uint256"},{"internalType":"uint256","name":"fiefdomVassalId","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fiefdoms","outputs":[{"internalType":"contract Fiefdoms","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"free","outputs":[{"internalType":"contract IFree","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"free0TokenIdUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vassalIdUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]