"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 __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.ArbitrumDopexEthSsovContractPositionFetcher = void 0;
const ethers_1 = require("ethers");
const position_template_decorator_1 = require("../../../app-toolkit/decorators/position-template.decorator");
const dopex_ssov_contract_position_fetcher_1 = require("../common/dopex.ssov.contract-position-fetcher");
let ArbitrumDopexEthSsovContractPositionFetcher = class ArbitrumDopexEthSsovContractPositionFetcher extends dopex_ssov_contract_position_fetcher_1.DopexSsovContractPositionFetcher {
    constructor() {
        super(...arguments);
        this.groupLabel = 'SSOVs';
    }
    getContract(address) {
        return this.contractFactory.dopexEthSsov({ address, network: this.network });
    }
    getSsovDefinitions() {
        return [
            {
                address: '0x3154b747c4bfd35c67607d860b884d28f32ed00f',
                depositTokenAddress: '0x0000000000000000000000000000000000000000',
                extraRewardTokenAddresses: [
                    '0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55',
                    '0x32eb7902d4134bf98a28b963d26de779af92a212',
                ],
            },
            {
                address: '0x711da677a0d61ee855dad4241b552a706f529c70',
                depositTokenAddress: '0x0000000000000000000000000000000000000000',
                extraRewardTokenAddresses: [
                    '0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55',
                    '0x32eb7902d4134bf98a28b963d26de779af92a212',
                ],
            },
            {
                address: '0x2c9c1e9b4bdf6bf9cb59c77e0e8c0892ce3a9d5f',
                depositTokenAddress: '0x0000000000000000000000000000000000000000',
                extraRewardTokenAddresses: [
                    '0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55',
                    '0x32eb7902d4134bf98a28b963d26de779af92a212',
                ],
            },
        ];
    }
    getTotalEpochStrikeDepositBalance({ contract, contractPosition, }) {
        const { epoch, strike } = contractPosition.dataProps;
        return contract.totalEpochStrikeEthBalance(epoch, strike);
    }
    getTotalEpochStrikeRewardBalances({ contract, contractPosition, multicall, }) {
        return __awaiter(this, void 0, void 0, function* () {
            const { epoch } = contractPosition.dataProps;
            const rewardDistributionName = ethers_1.ethers.utils.formatBytes32String('RewardsDistribution');
            const rewardDistrbutionAddress = yield multicall.wrap(contract).getAddress(rewardDistributionName);
            const rewardDistributionContract = this.contractFactory.dopexRewardDistribution({
                address: rewardDistrbutionAddress,
                network: this.network,
            });
            return Promise.all([
                multicall.wrap(rewardDistributionContract).dpxReceived(epoch),
                multicall.wrap(rewardDistributionContract).rdpxReceived(epoch),
            ]);
        });
    }
};
ArbitrumDopexEthSsovContractPositionFetcher = __decorate([
    (0, position_template_decorator_1.PositionTemplate)()
], ArbitrumDopexEthSsovContractPositionFetcher);
exports.ArbitrumDopexEthSsovContractPositionFetcher = ArbitrumDopexEthSsovContractPositionFetcher;
//# sourceMappingURL=dopex.eth-ssov.contract-position-fetcher.js.map