# drill/v1.ts

    import { ethers } from "ethers";
    import { pad0xBegin } from "@evo/utils/common/utils";
    import { triggerContractByContractName } from "@evo/utils/ethers/contractHelper";
    import type { CallbackType } from "@evo/utils/ethers/contractHelper";
    import { LandId } from "@evo/config/constants";
    import { TransactionResponse } from "@ethersproject/providers";

    /**
     * Transfer Drill
     * @param landId Land Id
     * @param signer Signer
     * @param from Drill owner
     * @param to Recipient
     * @param tokenId Drill tokenId
     * @param callback Callback
     * @returns any
     */
    export const drillTransfer = (
      landId: LandId,
      signer: ethers.Signer,
      from: string,
      to: string,
      tokenId: string,
      callback?: CallbackType
    ): Promise<TransactionResponse> => {
      return triggerContractByContractName(
        landId,
        signer,
        "objectOwnership",
        "transferFrom",
        [from, to, pad0xBegin(tokenId)],
        callback
      );
    };

    /**
     * Divest the props on the index slot on the tokenid land
     * @param landId The tokenId of land
     * @param signer Signer
     * @param tokenId Drill tokenId
     * @param index The index slot
     * @param callback Callback
     * @returns any
     */
    export const drillStopWork = (
      landId: LandId,
      signer: ethers.Signer,
      tokenId: string,
      index: number,
      callback?: CallbackType
    ): Promise<TransactionResponse> => {
      return triggerContractByContractName(
        landId,
        signer,
        "apostleLandResource",
        "divest",
        [pad0xBegin(tokenId), index],
        callback
      );
    };

    /**
     * Equip function, A NFT can equip to EVO Bar (LandBar or ApostleBar).
     * @param landId Land Id
     * @param signer Signer
     * @param landTokenId Land token Id which to be quiped
     * @param drillContractAddress Drill contract address
     * @param drillTokenId Props token address which to quip
     * @param resourceContractAddress Which resouce appply to
     * @param slotIndex Index of the Bar
     * @param callback Callback
     * @returns any
     */
    export const drillWork = (
      landId: LandId,
      signer: ethers.Signer,
      landTokenId: string,
      drillContractAddress: string,
      drillTokenId: string,
      resourceContractAddress: string,
      slotIndex: number,
      callback?: CallbackType
    ): Promise<TransactionResponse> => {
      return triggerContractByContractName(
        landId,
        signer,
        "apostleLandResource",
        "equip",
        [pad0xBegin(landTokenId), resourceContractAddress, slotIndex, drillContractAddress, pad0xBegin(drillTokenId)],
        callback
      );
    };