"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarketXyzBorrowContractPositionFetcher = void 0;
const common_1 = require("@nestjs/common");
const app_toolkit_interface_1 = require("../../../app-toolkit/app-toolkit.interface");
const rari_fuse_borrow_contract_position_fetcher_1 = require("../../../apps/rari-fuse/common/rari-fuse.borrow.contract-position-fetcher");
const contracts_1 = require("../contracts");
let MarketXyzBorrowContractPositionFetcher = class MarketXyzBorrowContractPositionFetcher extends rari_fuse_borrow_contract_position_fetcher_1.RariFuseBorrowContractPositionFetcher {
    constructor(appToolkit, contractFactory) {
        super(appToolkit);
        this.appToolkit = appToolkit;
        this.contractFactory = contractFactory;
    }
    getPoolDirectoryContract(address) {
        return this.contractFactory.marketXyzPoolDirectory({ address, network: this.network });
    }
    getComptrollerContract(address) {
        return this.contractFactory.marketXyzComptroller({ address, network: this.network });
    }
    getTokenContract(address) {
        return this.contractFactory.marketXyzToken({ address, network: this.network });
    }
    getLensContract(address) {
        return this.contractFactory.marketXyzPoolLens({ address, network: this.network });
    }
    getPools(contract) {
        return contract.getAllPools();
    }
    getMarketTokenAddresses(contract) {
        return contract.getAllMarkets();
    }
    getUnderlyingTokenAddress(contract) {
        return contract.underlying();
    }
    getBorrowRateRaw(contract) {
        return contract.borrowRatePerBlock();
    }
    getTotalBorrows(contract) {
        return contract.totalBorrows();
    }
    getBorrowBalance(address, contract) {
        return contract.borrowBalanceCurrent(address);
    }
    getPoolsBySupplier(address, contract) {
        return contract.getPoolsBySupplier(address);
    }
};
MarketXyzBorrowContractPositionFetcher = __decorate([
    __param(0, (0, common_1.Inject)(app_toolkit_interface_1.APP_TOOLKIT)),
    __param(1, (0, common_1.Inject)(contracts_1.MarketXyzContractFactory)),
    __metadata("design:paramtypes", [Object, contracts_1.MarketXyzContractFactory])
], MarketXyzBorrowContractPositionFetcher);
exports.MarketXyzBorrowContractPositionFetcher = MarketXyzBorrowContractPositionFetcher;
//# sourceMappingURL=market-xyz.borrow.contract-position-fetcher.js.map