@quantara/sdk
Version:
JavaScript/TypeScript SDK for interacting with Quantara Protocol on Neura Testnet
267 lines (266 loc) • 11.4 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hashMarketValuesKeys = exports.hashMarketConfigKeys = void 0;
const dataStore_1 = require("../configs/dataStore");
const hash_1 = require("./hash");
function hashMarketConfigKeys(market) {
const marketAddress = market.marketTokenAddress;
return (0, hash_1.hashDataMap)({
isDisabled: [
["bytes32", "address"],
[ ],
],
maxLongPoolAmount: [
["bytes32", "address", "address"],
[ ],
],
maxShortPoolAmount: [
["bytes32", "address", "address"],
[ ],
],
maxLongPoolUsdForDeposit: [
["bytes32", "address", "address"],
[ ],
],
maxShortPoolUsdForDeposit: [
["bytes32", "address", "address"],
[ ],
],
longPoolAmountAdjustment: [
["bytes32", "address", "address"],
[ ],
],
shortPoolAmountAdjustment: [
["bytes32", "address", "address"],
[ ],
],
reserveFactorLong: [
["bytes32", "address", "bool"],
[ ],
],
reserveFactorShort: [
["bytes32", "address", "bool"],
[ ],
],
openInterestReserveFactorLong: [
["bytes32", "address", "bool"],
[ ],
],
openInterestReserveFactorShort: [
["bytes32", "address", "bool"],
[ ],
],
maxOpenInterestLong: [
["bytes32", "address", "bool"],
[ ],
],
maxOpenInterestShort: [
["bytes32", "address", "bool"],
[ ],
],
minPositionImpactPoolAmount: [
["bytes32", "address"],
[ ],
],
positionImpactPoolDistributionRate: [
["bytes32", "address"],
[ ],
],
borrowingFactorLong: [
["bytes32", "address", "bool"],
[ ],
],
borrowingFactorShort: [
["bytes32", "address", "bool"],
[ ],
],
borrowingExponentFactorLong: [
["bytes32", "address", "bool"],
[ ],
],
borrowingExponentFactorShort: [
["bytes32", "address", "bool"],
[ ],
],
fundingFactor: [
["bytes32", "address"],
[ ],
],
fundingExponentFactor: [
["bytes32", "address"],
[ ],
],
fundingIncreaseFactorPerSecond: [
["bytes32", "address"],
[ ],
],
fundingDecreaseFactorPerSecond: [
["bytes32", "address"],
[ ],
],
thresholdForStableFunding: [
["bytes32", "address"],
[ ],
],
thresholdForDecreaseFunding: [
["bytes32", "address"],
[ ],
],
minFundingFactorPerSecond: [
["bytes32", "address"],
[ ],
],
maxFundingFactorPerSecond: [
["bytes32", "address"],
[ ],
],
maxPnlFactorForTradersLong: [
["bytes32", "bytes32", "address", "bool"],
[ ],
],
maxPnlFactorForTradersShort: [
["bytes32", "bytes32", "address", "bool"],
[ ],
],
positionFeeFactorForPositiveImpact: [
["bytes32", "address", "bool"],
[ ],
],
positionFeeFactorForNegativeImpact: [
["bytes32", "address", "bool"],
[ ],
],
positionImpactFactorPositive: [
["bytes32", "address", "bool"],
[ ],
],
positionImpactFactorNegative: [
["bytes32", "address", "bool"],
[ ],
],
maxPositionImpactFactorPositive: [
["bytes32", "address", "bool"],
[ ],
],
maxPositionImpactFactorNegative: [
["bytes32", "address", "bool"],
[ ],
],
maxPositionImpactFactorForLiquidations: [
["bytes32", "address"],
[ ],
],
minCollateralFactor: [
["bytes32", "address"],
[ ],
],
minCollateralFactorForOpenInterestLong: [
["bytes32", "address", "bool"],
[ ],
],
minCollateralFactorForOpenInterestShort: [
["bytes32", "address", "bool"],
[ ],
],
positionImpactExponentFactor: [
["bytes32", "address"],
[ ],
],
swapFeeFactorForPositiveImpact: [
["bytes32", "address", "bool"],
[ ],
],
swapFeeFactorForNegativeImpact: [
["bytes32", "address", "bool"],
[ ],
],
atomicSwapFeeFactor: [
["bytes32", "address"],
[ ],
],
swapImpactFactorPositive: [
["bytes32", "address", "bool"],
[ ],
],
swapImpactFactorNegative: [
["bytes32", "address", "bool"],
[ ],
],
swapImpactExponentFactor: [
["bytes32", "address"],
[ ],
],
virtualMarketId: [
["bytes32", "address"],
[ ],
],
virtualLongTokenId: [
["bytes32", "address"],
[ ],
],
virtualShortTokenId: [
["bytes32", "address"],
[ ],
],
});
}
exports.hashMarketConfigKeys = hashMarketConfigKeys;
function hashMarketValuesKeys(market) {
const marketAddress = market.marketTokenAddress;
const marketKeys = (0, hash_1.hashDataMap)({
longPoolAmount: [
["bytes32", "address", "address"],
[ ],
],
shortPoolAmount: [
["bytes32", "address", "address"],
[ ],
],
positionImpactPoolAmount: [
["bytes32", "address"],
[ ],
],
swapImpactPoolAmountLong: [
["bytes32", "address", "address"],
[ ],
],
swapImpactPoolAmountShort: [
["bytes32", "address", "address"],
[ ],
],
longInterestUsingLongToken: [
["bytes32", "address", "address", "bool"],
[ ],
],
longInterestUsingShortToken: [
["bytes32", "address", "address", "bool"],
[ ],
],
shortInterestUsingLongToken: [
["bytes32", "address", "address", "bool"],
[ ],
],
shortInterestUsingShortToken: [
["bytes32", "address", "address", "bool"],
[ ],
],
longInterestInTokensUsingLongToken: [
["bytes32", "address", "address", "bool"],
[ ],
],
longInterestInTokensUsingShortToken: [
["bytes32", "address", "address", "bool"],
[ ],
],
shortInterestInTokensUsingLongToken: [
["bytes32", "address", "address", "bool"],
[ ],
],
shortInterestInTokensUsingShortToken: [
["bytes32", "address", "address", "bool"],
[ ],
],
});
return marketKeys;
}
exports.hashMarketValuesKeys = hashMarketValuesKeys;