@ajna-finance/sdk
Version:
A typescript SDK that can be used to create Dapps in Ajna ecosystem.
57 lines • 3.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.indexToPrice = exports.priceToIndex = exports.lpToCollateral = exports.lpToQuoteTokens = exports.bucketInfo = exports.poolUtilizationInfo = exports.poolLoansInfo = exports.poolPricesInfo = exports.borrowerInfo = exports.auctionStatus = exports.getPoolInfoUtilsContractMulti = exports.getPoolInfoUtilsContract = void 0;
const tslib_1 = require("tslib");
const ethcall_1 = require("ethcall");
const PoolInfoUtils_json_1 = tslib_1.__importDefault(require("../abis/PoolInfoUtils.json"));
const Config_1 = require("../classes/Config");
const types_1 = require("../types");
const getPoolInfoUtilsContract = (provider) => {
return types_1.PoolInfoUtils__factory.connect(Config_1.Config.poolUtils, provider);
};
exports.getPoolInfoUtilsContract = getPoolInfoUtilsContract;
const getPoolInfoUtilsContractMulti = () => {
return new ethcall_1.Contract(Config_1.Config.poolUtils, PoolInfoUtils_json_1.default);
};
exports.getPoolInfoUtilsContractMulti = getPoolInfoUtilsContractMulti;
const auctionStatus = (contractUtils, poolAddress, borrowerAddress) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.auctionStatus(poolAddress, borrowerAddress);
});
exports.auctionStatus = auctionStatus;
const borrowerInfo = (contractUtils, poolAddress, borrowerAddress) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.borrowerInfo(poolAddress, borrowerAddress);
});
exports.borrowerInfo = borrowerInfo;
const poolPricesInfo = (contractUtils, poolAddress) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.poolPricesInfo(poolAddress);
});
exports.poolPricesInfo = poolPricesInfo;
const poolLoansInfo = (contractUtils, poolAddress) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.poolLoansInfo(poolAddress);
});
exports.poolLoansInfo = poolLoansInfo;
const poolUtilizationInfo = (contractUtils, poolAddress) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.poolUtilizationInfo(poolAddress);
});
exports.poolUtilizationInfo = poolUtilizationInfo;
const bucketInfo = (contractUtils, poolAddress, index) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.bucketInfo(poolAddress, index);
});
exports.bucketInfo = bucketInfo;
const lpToQuoteTokens = (contractUtils, poolAddress, lpTokens, index) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.lpToQuoteTokens(poolAddress, lpTokens, index);
});
exports.lpToQuoteTokens = lpToQuoteTokens;
const lpToCollateral = (contractUtils, poolAddress, lpTokens, index) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.lpToCollateral(poolAddress, lpTokens, index);
});
exports.lpToCollateral = lpToCollateral;
const priceToIndex = (contractUtils, price) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.priceToIndex(price);
});
exports.priceToIndex = priceToIndex;
const indexToPrice = (contractUtils, index) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
return yield contractUtils.indexToPrice(index);
});
exports.indexToPrice = indexToPrice;
//# sourceMappingURL=pool-info-utils.js.map