"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.AvalanchePenguinVaultTokenFetcher = void 0;
const common_1 = require("@nestjs/common");
require("moment-duration-format");
const app_toolkit_interface_1 = require("../../../app-toolkit/app-toolkit.interface");
const position_template_decorator_1 = require("../../../app-toolkit/decorators/position-template.decorator");
const app_token_template_position_fetcher_1 = require("../../../position/template/app-token.template.position-fetcher");
const contracts_1 = require("../contracts");
let AvalanchePenguinVaultTokenFetcher = class AvalanchePenguinVaultTokenFetcher extends app_token_template_position_fetcher_1.AppTokenTemplatePositionFetcher {
    constructor(appToolkit, contractFactory) {
        super(appToolkit);
        this.appToolkit = appToolkit;
        this.contractFactory = contractFactory;
        this.groupLabel = 'Compounder Vaults';
    }
    getContract(address) {
        return this.contractFactory.penguinVault({ network: this.network, address });
    }
    getAddresses() {
        return __awaiter(this, void 0, void 0, function* () {
            return [
                '0xab6eed788beed09d1279b21b6c91f9750242e0f5',
                '0xbbd9dd1f15c729745edffd8e46253463d40a7d84',
                '0x323c5cc630c0ce1f2823d1a3d48260f770b5669b',
                '0xb6cd0569563549033c129769dbc58d1843ed98cb',
                '0x9acbca2315a517a3dab8e857f5921a8b3435891a',
                '0xdf5fb3fa0161a8508599a6dfc9d6c004cb58652b',
                '0x1ad8ff956247f87de904f31b0322843f32f19a5c',
                '0xbe42a57f4a08636c26457475e94409516fa39b3b',
                '0xfc8deac2f93e5b4739ece2802e5c5e05106fd872',
                '0xc90b9a965c800a0318ec4282a86e387beeef0ffe',
                '0xb4558486cd8fd2dd5e3b078e7822c1bb66c782d0',
                '0x85fc4ec9dee0df5060f321b743838f7068499177',
                '0xd6da9d000ffa1ea6d3939fcd80f4d473f2027567',
                '0x4ec41d1e25925c57876885c34fe0b323d7cc3846',
                '0x7dd48db5372539d01ed4b6cc525403d98bc61bdd',
                '0x21d2aaed1d2f5e36ff02b008b091054d065c9824',
            ];
        });
    }
    getUnderlyingTokenDefinitions({ contract }) {
        return __awaiter(this, void 0, void 0, function* () {
            return [{ address: yield contract.depositToken(), network: this.network }];
        });
    }
    getPricePerShare({ contract, appToken }) {
        return __awaiter(this, void 0, void 0, function* () {
            const reserveRaw = yield contract.totalDeposits();
            const reserve = Number(reserveRaw) / Math.pow(10, appToken.tokens[0].decimals);
            return [reserve / appToken.supply];
        });
    }
};
AvalanchePenguinVaultTokenFetcher = __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.PenguinContractFactory)),
    __metadata("design:paramtypes", [Object, contracts_1.PenguinContractFactory])
], AvalanchePenguinVaultTokenFetcher);
exports.AvalanchePenguinVaultTokenFetcher = AvalanchePenguinVaultTokenFetcher;
//# sourceMappingURL=penguin.vault.token-fetcher.js.map