function onERC721Received(
        address _from,
        uint256 _tokenId,
        bytes
    ) public returns (bytes4) {
        require(msg.sender == TVKeyAddress);
        (, uint chestId) = ITVKey(TVKeyAddress).keys(_tokenId);
        Chest memory chest = chests[chestId];
        Lottery memory lottery = lotteries[chest.lotteryId];

        ITVKey(TVKeyAddress).transferFrom(this, lottery.bank, _tokenId);
        lotteries[chest.lotteryId].bankPercentage -= chest.percentage;
        chests[chestId].openedCount = chest.openedCount + 1;
        uint reward = getChestReward(chestId);
        ITVToken(TVTokenAddress).transferFrom(lottery.bank, _from, reward);
        emit ChestOpened(_tokenId, lottery.id, chest.id, reward, _from);
        return ERC721_RECEIVED;
    }