"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); }
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AvalancheHakuswapPoolTokenFetcher = void 0;
const common_1 = require("@nestjs/common");
const app_toolkit_interface_1 = require("../../../app-toolkit/app-toolkit.interface");
const position_template_decorator_1 = require("../../../app-toolkit/decorators/position-template.decorator");
const uniswap_v2_pool_on_chain_template_token_fetcher_1 = require("../../../apps/uniswap-v2/common/uniswap-v2.pool.on-chain.template.token-fetcher");
const contracts_1 = require("../contracts");
const poolNotUsingDecimals = [
    '0x519de4668ea6661d1870928a3033a62dc2acc503',
    '0x1f0bc5c91518d903c0c097bde9741746b4423008',
    '0x29e144ea1abac02b62be7afb877d1bbaca141295',
    '0x6075eccadfc2917d58062af55090b6bd3de258f5',
    '0x6c2782d9632efd35e93d33e25ba75c118682954c',
    '0x3152e0dd889045595d7635d8fc41965cea6209f2',
    '0xeffff893f9423fdb7a5c010cef202ea5a52575a6',
    '0x6f6a5f63cc7b7ddcad76752e633d45f3d5efb0e2',
    '0xffa26cb3458023c4b78c3d10f8bef4704c2fd198',
    '0x6bdd9d3ebb4be7289ccb8d7d8c6d95ee4a37ae7e',
    '0x022057df5019b8c165dda59c360cbc0842488c18',
    '0x8caf27646b392c7fdd49d8c55f3d93dd70cb1692',
];
let AvalancheHakuswapPoolTokenFetcher = class AvalancheHakuswapPoolTokenFetcher extends uniswap_v2_pool_on_chain_template_token_fetcher_1.UniswapV2PoolOnChainTemplateTokenFetcher {
    constructor(appToolkit, contractFactory) {
        super(appToolkit);
        this.appToolkit = appToolkit;
        this.contractFactory = contractFactory;
        this.factoryAddress = '0x2db46feb38c57a6621bca4d97820e1fc1de40f41';
        this.groupLabel = 'Pools';
    }
    getPoolTokenContract(address) {
        return this.contractFactory.hakuswapPool({ address, network: this.network });
    }
    getPoolFactoryContract(address) {
        return this.contractFactory.hakuswapFactory({ address, network: this.network });
    }
    getPoolsLength(contract) {
        return contract.allPairsLength();
    }
    getPoolAddress(contract, index) {
        return contract.allPairs(index);
    }
    getPoolToken0(contract) {
        return contract.token0();
    }
    getPoolToken1(contract) {
        return contract.token1();
    }
    getPoolReserves(contract) {
        return contract.getReserves();
    }
    getDecimals({ address, contract, }) {
        return __awaiter(this, void 0, void 0, function* () {
            const decimals = !poolNotUsingDecimals.includes(address) ? yield contract.decimals() : 0;
            return decimals;
        });
    }
};
AvalancheHakuswapPoolTokenFetcher = __decorate([
    (0, position_template_decorator_1.PositionTemplate)(),
    __param(0, (0, common_1.Inject)(app_toolkit_interface_1.APP_TOOLKIT)),
    __param(1, (0, common_1.Inject)(contracts_1.HakuswapContractFactory)),
    __metadata("design:paramtypes", [Object, contracts_1.HakuswapContractFactory])
], AvalancheHakuswapPoolTokenFetcher);
exports.AvalancheHakuswapPoolTokenFetcher = AvalancheHakuswapPoolTokenFetcher;
//# sourceMappingURL=hakuswap.pool.token-fetcher.js.map