"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.aprToLossBN = exports.aprToApyBN = exports.aprToLoss = exports.aprToApy = void 0;
var utils_1 = require("../utils");
function aprToApy(apr) {
    if (apr == null)
        return utils_1.N_A;
    return (0, utils_1.formatPercentage)(Math.pow(1 + apr / 365, 365) - 1);
}
exports.aprToApy = aprToApy;
function aprToLoss(apr) {
    if (!apr)
        return utils_1.N_A;
    return (0, utils_1.formatPercentage)(apr / 365);
}
exports.aprToLoss = aprToLoss;
function aprToApyBN(apr, dec) {
    if (!apr || dec == null)
        return utils_1.N_A;
    return aprToApy(parseFloat(dec ? (0, utils_1.formatUnits)(apr, dec) : apr));
}
exports.aprToApyBN = aprToApyBN;
function aprToLossBN(apr, dec) {
    if (!apr || dec == null)
        return utils_1.N_A;
    return aprToLoss(parseFloat((0, utils_1.formatUnits)(apr, dec)));
}
exports.aprToLossBN = aprToLossBN;
//# sourceMappingURL=apr.js.map