impermax-sdk 2.1.449 → 2.1.452
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/subgraphs.js +2 -2
- package/lib/index.d.ts +3 -3
- package/lib/index.js +4 -4
- package/lib/offchain/account/lendingPool/nftlp/offchainAccountNftlpAeroCL.d.ts +23 -0
- package/lib/offchain/account/lendingPool/nftlp/offchainAccountNftlpAeroCL.js +55 -0
- package/lib/offchain/account/lendingPool/nftlp/offchainAccountNftlpGenericCL.d.ts +28 -0
- package/lib/offchain/account/lendingPool/nftlp/{offchainAccountNftlpAerodromeV3.js → offchainAccountNftlpGenericCL.js} +21 -46
- package/lib/offchain/account/lendingPool/nftlp/offchainAccountNftlpUniswapV3.d.ts +5 -34
- package/lib/offchain/account/lendingPool/nftlp/offchainAccountNftlpUniswapV3.js +4 -61
- package/lib/offchain/lendingPool/nftlp/index.d.ts +2 -2
- package/lib/offchain/lendingPool/nftlp/index.js +3 -3
- package/lib/offchain/lendingPool/nftlp/offchainNftlpAeroCL.d.ts +12 -0
- package/lib/offchain/lendingPool/nftlp/offchainNftlpAeroCL.js +48 -0
- package/lib/offchain/lendingPool/nftlp/offchainNftlpGenericCL.d.ts +35 -0
- package/lib/offchain/lendingPool/nftlp/offchainNftlpGenericCL.js +129 -0
- package/lib/offchain/lendingPool/nftlp/offchainNftlpUniswapV3.d.ts +5 -40
- package/lib/offchain/lendingPool/nftlp/offchainNftlpUniswapV3.js +48 -145
- package/lib/offchain/lendingPool/offchainCollateralV3.js +1 -1
- package/lib/offchain/offchainTypes.d.ts +44 -21
- package/lib/offchain/queries/apis/ponder/index.d.ts +1 -1
- package/lib/offchain/queries/apis/ponder/index.js +12 -34
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpAeroCL.d.ts +3 -1
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpAeroCL.js +3 -0
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpGenericCL.d.ts +4 -15
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpGenericCL.js +0 -1
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpUniswapV3.d.ts +3 -1
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlpUniswapV3.js +3 -0
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpAeroCL.js +1 -1
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpGenericCL.d.ts +2 -2
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpGenericCL.js +0 -1
- package/lib/onchain/onchainTypes.d.ts +17 -0
- package/package.json +1 -1
- package/lib/offchain/account/lendingPool/nftlp/offchainAccountNftlpAerodromeV3.d.ts +0 -51
- package/lib/offchain/lendingPool/nftlp/offchainNftlpAerodromeV3.d.ts +0 -47
- package/lib/offchain/lendingPool/nftlp/offchainNftlpAerodromeV3.js +0 -231
package/lib/config/subgraphs.js
CHANGED
|
@@ -114,7 +114,7 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
114
114
|
],
|
|
115
115
|
[types_1.Factory.V3]: [
|
|
116
116
|
"https://base-factory-v3-production.up.railway.app/",
|
|
117
|
-
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/
|
|
117
|
+
"https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmNfoQmpxoKWxE4mqMiAJhchwyQGwLpBCTKwZ2oYtFP24V"
|
|
118
118
|
],
|
|
119
119
|
},
|
|
120
120
|
[types_1.Networks.Scroll]: {
|
|
@@ -164,7 +164,7 @@ exports.IMPERMAX_SUBGRAPH_URL = {
|
|
|
164
164
|
[types_1.Networks.Unichain]: {
|
|
165
165
|
[types_1.Factory.V3]: [
|
|
166
166
|
'https://unichain-factoryv3-production.up.railway.app/',
|
|
167
|
-
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/
|
|
167
|
+
'https://gateway.thegraph.com/api/e9bbf185bbf657f7ea313387cdf0e5ce/deployments/id/QmQCqDoFncFWGqadCZqFmkvPQ5TbH49vPvVcSzwaCmqCha'
|
|
168
168
|
]
|
|
169
169
|
},
|
|
170
170
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ import OnchainAccountLendingPoolV2 from './onchain/account/lendingPool/onchainAc
|
|
|
45
45
|
import { decimalToBalance } from './utils/ether-utils';
|
|
46
46
|
import OffchainAccountLendingPoolV3 from "./offchain/account/lendingPool/offchainAccountLendingPoolV3";
|
|
47
47
|
import OffchainAccountNftlpUniswapV3 from './offchain/account/lendingPool/nftlp/offchainAccountNftlpUniswapV3';
|
|
48
|
-
import
|
|
48
|
+
import OffchainAccountNftlpAeroCL from './offchain/account/lendingPool/nftlp/offchainAccountNftlpAeroCL';
|
|
49
49
|
import { MAX_TICK, MIN_TICK, formatPriceSqrtX96, clTickToPrice } from "./utils/nftlpMath/CLGeneral";
|
|
50
50
|
import GenericCLPosition from './utils/position/cl';
|
|
51
51
|
import UniswapV2Position from './utils/position/uniswapV2';
|
|
@@ -58,7 +58,7 @@ import OffchainBorrowableV2 from './offchain/lendingPool/offchainBorrowableV2';
|
|
|
58
58
|
import OffchainCollateralV2 from './offchain/lendingPool/offchainCollateralV2';
|
|
59
59
|
import OffchainBorrowableV3 from './offchain/lendingPool/offchainBorrowableV3';
|
|
60
60
|
import OffchainLendingPoolV3 from './offchain/lendingPool/offchainLendingPoolV3';
|
|
61
|
-
import OffchainNftlp, { OffchainNftlpUniswapV3,
|
|
61
|
+
import OffchainNftlp, { OffchainNftlpUniswapV3, OffchainNftlpAeroCL } from './offchain/lendingPool/nftlp';
|
|
62
62
|
import OffchainCollateralV3 from './offchain/lendingPool/offchainCollateralV3';
|
|
63
63
|
import OffchainAccountLendingPoolV2 from './offchain/account/lendingPool/offchainAccountLendingPoolV2';
|
|
64
64
|
import OffchainAccountBorrowableV2 from './offchain/account/lendingPool/offchainAccountBorrowableV2';
|
|
@@ -77,4 +77,4 @@ import OffchainAccountStakingModule from './offchain/account/staking';
|
|
|
77
77
|
import OnchainStakingModule from './onchain';
|
|
78
78
|
import OnchainInteractionsStakingModule from './onchain/interactions/onchainInteractionsStakingModule';
|
|
79
79
|
import OnchainAccountStakingModule from './onchain/account/onchainAccountStakingModule';
|
|
80
|
-
export { offchain, OffchainMultichain, Offchain, OffchainPoolToken, OffchainLendingPool, OffchainCollateral, OffchainBorrowable, OffchainLendingPoolV2, OffchainCollateralV2, OffchainBorrowableV2, OffchainLendingPoolV3, OffchainCollateralV3, OffchainBorrowableV3, OffchainNftlp, OffchainNftlpUniswapV3, OffchainVault, OffchainLeveragedVault, OffchainLendingVault, OffchainHedgedVault, OffchainConfigManager, OffchainPairConfig, OffchainProposal, OffchainMultichainAccount, OffchainAccount, OffchainAccountPoolToken, OffchainAccountLendingPool, OffchainAccountCollateral, OffchainAccountBorrowable, OffchainAccountLendingPoolV2, OffchainAccountCollateralV2, OffchainAccountBorrowableV2, OffchainAccountLendingPoolV3, OffchainAccountCollateralV3, OffchainAccountBorrowableV3, OffchainAccountNftlp, OffchainAccountNftlpUniswapV3, OffchainLeveragedPosition, OffchainAccountVault, OffchainPriceHelper, OffchainSolidexHelper,
|
|
80
|
+
export { offchain, OffchainMultichain, Offchain, OffchainPoolToken, OffchainLendingPool, OffchainCollateral, OffchainBorrowable, OffchainLendingPoolV2, OffchainCollateralV2, OffchainBorrowableV2, OffchainLendingPoolV3, OffchainCollateralV3, OffchainBorrowableV3, OffchainNftlp, OffchainNftlpUniswapV3, OffchainVault, OffchainLeveragedVault, OffchainLendingVault, OffchainHedgedVault, OffchainConfigManager, OffchainPairConfig, OffchainProposal, OffchainMultichainAccount, OffchainAccount, OffchainAccountPoolToken, OffchainAccountLendingPool, OffchainAccountCollateral, OffchainAccountBorrowable, OffchainAccountLendingPoolV2, OffchainAccountCollateralV2, OffchainAccountBorrowableV2, OffchainAccountLendingPoolV3, OffchainAccountCollateralV3, OffchainAccountBorrowableV3, OffchainAccountNftlp, OffchainAccountNftlpUniswapV3, OffchainLeveragedPosition, OffchainAccountVault, OffchainPriceHelper, OffchainSolidexHelper, OffchainAccountNftlpAeroCL, OffchainNftlpAeroCL, PoolTokenData, BorrowableData, CollateralData, BorrowablePastData, TokenData, RewardData, PairData, FarmingPoolData, LendingPoolPastData, LendingPoolData, CollateralPosition, SupplyPosition, BorrowPosition, UserData, TvlData, XIbexData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata, VaultRisk, VaultType, onchain, Onchain, OnchainImpermaxFactory, OnchainImpermaxFactoryV2, OnchainImpermaxFactoryV3, OnchainPoolToken, OnchainLendingPool, OnchainBorrowable, OnchainCollateral, OnchainLendingPoolV2, OnchainBorrowableV2, OnchainCollateralV2, OnchainLendingPoolV3, OnchainBorrowableV3, OnchainCollateralV3, OnchainNftlp, OnchainNftlpUniswapV3, OnchainLendingVault, OnchainConfigManager, OnchainProposal, OnchainPairConfig, OnchainAccount, OnchainAccountPoolToken, OnchainAccountLendingPool, OnchainAccountBorrowable, OnchainAccountCollateral, OnchainAccountLendingPoolV2, OnchainAccountBorrowableV2, OnchainAccountCollateralV2, OnchainAccountLendingPoolV3, OnchainAccountBorrowableV3, OnchainAccountCollateralV3, OnchainAccountNftlp, OnchainAccountNftlpUniswapV3, OnchainAccountLendingVault, OnchainContractsHelper, OnchainInteractions, OnchainInteractionsPoolToken, OnchainInteractionsLendingPool, OnchainInteractionsCollateral, OnchainInteractionsBorrowable, OnchainInteractionsLendingPoolV2, OnchainInteractionsCollateralV2, OnchainInteractionsBorrowableV2, OnchainInteractionsLendingPoolV3, OnchainInteractionsCollateralV3, OnchainInteractionsBorrowableV3, OnchainInteractionsNftlp, OnchainInteractionsNftlpUniswapV3, OnchainInteractionsLendingVault, OnchainInteractionsConfigManager, Contract, ApprovalType, PermitData, OnchainConfig, Changes, NO_CHANGES, Values, AirdropData, PendingRewardUI, CollateralConfig, BorrowableV2Config, BorrowableV3Config, PairConfig, CLAIM_AGGREGATOR, IMPERMAX_CHEF, IMX, IMPERMAX_FACTORY, getNetworkFactories, getFactoryByAddress, LENDING_VAULT_WATCHER, MERKLE_DISTRIBUTOR_IBEX, MERKLE_DISTRIBUTOR_IBEX_2, MERKLE_DISTRIBUTOR_ETH, ROUTER, SIMPLE_UNISWAP_ORACLE, WETH, MERKLE_URL_ETH, MERKLE_URL_IBEX, MERKLE_URL_IBEX_2, hrAmms, AMM_FACTORY, getAmmByFactory, AMM_SUBGRAPH_URLS, ADD_LIQUIDITY_URLS, AMM_LP_FEE, DEBANK_IDS, ETH_SYMBOL, ETH_NAME, SOLIDEX_FACTORIES, BORROW_FEE_FACTORIES, OLD_KINK_MULTIPLIER_FACTORIES, LIQUIDATION_FEE_FACTORIES, V2_FACTORIES, Farms, hrFarms, FarmIndex, STAKED_LP_FACTORY, getFarmByStakedLPFactory, NOT_SYNCED, DEADLINE, ZERO, APPROVE_AMOUNT, IMPERMAX_SUBGRAPH_URL, IMPERMAX_CHEF_SUBGRAPH_URL, BLOCKS_SUBGRAPH_URL, XIBEX_SUBGRAPH_URL, Networks, Factory, Extension, PoolTokenType, Amms, Address, NetworkIndex, FactoryIndex, AddressIndex, NetworkFactoryIndex, LendingPoolIndex, AmmIndex, DistributorDetails, ProposalState, WhitelistState, VaultListOrderBy, VaultListParams, LendingPoolListOrderBy, LendingPoolListParams, SortDirection, LendingPoolVersion, PositionType, AccountPosition, PermitType, Permits, Permit, Borrowable, decimalToBalance, MAX_TICK, MIN_TICK, formatPriceSqrtX96, clTickToPrice, isV3Factory, GenericCLPosition, UniswapV2Position, Position, BorrowableEntity, BorrowablePosition, LendingVaultEntity, PairState, SupplyPositionsParams, BorrowPositionsParams, TopPositionsParams, VaultPositionsParams, AccountEarningsParams, AccountMarketData, OffchainStakingModule, IBEX, XIBEX, OffchainAccountStakingModule, OnchainStakingModule, OnchainInteractionsStakingModule, OnchainAccountStakingModule };
|
package/lib/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.OnchainPoolToken = exports.OnchainImpermaxFactoryV3 = exports.OnchainImpermaxFactoryV2 = exports.OnchainImpermaxFactory = exports.Onchain = exports.onchain = exports.VaultType = exports.VaultRisk = exports.
|
|
29
|
+
exports.OnchainPoolToken = exports.OnchainImpermaxFactoryV3 = exports.OnchainImpermaxFactoryV2 = exports.OnchainImpermaxFactory = exports.Onchain = exports.onchain = exports.VaultType = exports.VaultRisk = exports.OffchainNftlpAeroCL = exports.OffchainAccountNftlpAeroCL = exports.OffchainSolidexHelper = exports.OffchainPriceHelper = exports.OffchainAccountVault = exports.OffchainLeveragedPosition = exports.OffchainAccountNftlpUniswapV3 = exports.OffchainAccountNftlp = exports.OffchainAccountBorrowableV3 = exports.OffchainAccountCollateralV3 = exports.OffchainAccountLendingPoolV3 = exports.OffchainAccountBorrowableV2 = exports.OffchainAccountCollateralV2 = exports.OffchainAccountLendingPoolV2 = exports.OffchainAccountBorrowable = exports.OffchainAccountCollateral = exports.OffchainAccountLendingPool = exports.OffchainAccountPoolToken = exports.OffchainAccount = exports.OffchainMultichainAccount = exports.OffchainProposal = exports.OffchainPairConfig = exports.OffchainConfigManager = exports.OffchainHedgedVault = exports.OffchainLendingVault = exports.OffchainLeveragedVault = exports.OffchainVault = exports.OffchainNftlpUniswapV3 = exports.OffchainNftlp = exports.OffchainBorrowableV3 = exports.OffchainCollateralV3 = exports.OffchainLendingPoolV3 = exports.OffchainBorrowableV2 = exports.OffchainCollateralV2 = exports.OffchainLendingPoolV2 = exports.OffchainBorrowable = exports.OffchainCollateral = exports.OffchainLendingPool = exports.OffchainPoolToken = exports.Offchain = exports.OffchainMultichain = exports.offchain = void 0;
|
|
30
30
|
exports.IMX = exports.IMPERMAX_CHEF = exports.CLAIM_AGGREGATOR = exports.NO_CHANGES = exports.ApprovalType = exports.OnchainInteractionsConfigManager = exports.OnchainInteractionsLendingVault = exports.OnchainInteractionsNftlpUniswapV3 = exports.OnchainInteractionsNftlp = exports.OnchainInteractionsBorrowableV3 = exports.OnchainInteractionsCollateralV3 = exports.OnchainInteractionsLendingPoolV3 = exports.OnchainInteractionsBorrowableV2 = exports.OnchainInteractionsCollateralV2 = exports.OnchainInteractionsLendingPoolV2 = exports.OnchainInteractionsBorrowable = exports.OnchainInteractionsCollateral = exports.OnchainInteractionsLendingPool = exports.OnchainInteractionsPoolToken = exports.OnchainInteractions = exports.OnchainContractsHelper = exports.OnchainAccountLendingVault = exports.OnchainAccountNftlpUniswapV3 = exports.OnchainAccountNftlp = exports.OnchainAccountCollateralV3 = exports.OnchainAccountBorrowableV3 = exports.OnchainAccountLendingPoolV3 = exports.OnchainAccountCollateralV2 = exports.OnchainAccountBorrowableV2 = exports.OnchainAccountLendingPoolV2 = exports.OnchainAccountCollateral = exports.OnchainAccountBorrowable = exports.OnchainAccountLendingPool = exports.OnchainAccountPoolToken = exports.OnchainAccount = exports.OnchainPairConfig = exports.OnchainProposal = exports.OnchainConfigManager = exports.OnchainLendingVault = exports.OnchainNftlpUniswapV3 = exports.OnchainNftlp = exports.OnchainCollateralV3 = exports.OnchainBorrowableV3 = exports.OnchainLendingPoolV3 = exports.OnchainCollateralV2 = exports.OnchainBorrowableV2 = exports.OnchainLendingPoolV2 = exports.OnchainCollateral = exports.OnchainBorrowable = exports.OnchainLendingPool = void 0;
|
|
31
31
|
exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = exports.WhitelistState = exports.ProposalState = exports.Amms = exports.PoolTokenType = exports.Extension = exports.Factory = exports.Networks = exports.XIBEX_SUBGRAPH_URL = exports.BLOCKS_SUBGRAPH_URL = exports.IMPERMAX_CHEF_SUBGRAPH_URL = exports.IMPERMAX_SUBGRAPH_URL = exports.APPROVE_AMOUNT = exports.ZERO = exports.DEADLINE = exports.NOT_SYNCED = exports.getFarmByStakedLPFactory = exports.STAKED_LP_FACTORY = exports.hrFarms = exports.Farms = exports.V2_FACTORIES = exports.LIQUIDATION_FEE_FACTORIES = exports.OLD_KINK_MULTIPLIER_FACTORIES = exports.BORROW_FEE_FACTORIES = exports.SOLIDEX_FACTORIES = exports.ETH_NAME = exports.ETH_SYMBOL = exports.DEBANK_IDS = exports.AMM_LP_FEE = exports.ADD_LIQUIDITY_URLS = exports.AMM_SUBGRAPH_URLS = exports.getAmmByFactory = exports.AMM_FACTORY = exports.hrAmms = exports.MERKLE_URL_IBEX_2 = exports.MERKLE_URL_IBEX = exports.MERKLE_URL_ETH = exports.WETH = exports.SIMPLE_UNISWAP_ORACLE = exports.ROUTER = exports.MERKLE_DISTRIBUTOR_ETH = exports.MERKLE_DISTRIBUTOR_IBEX_2 = exports.MERKLE_DISTRIBUTOR_IBEX = exports.LENDING_VAULT_WATCHER = exports.getFactoryByAddress = exports.getNetworkFactories = exports.IMPERMAX_FACTORY = void 0;
|
|
32
32
|
exports.OnchainAccountStakingModule = exports.OnchainInteractionsStakingModule = exports.OnchainStakingModule = exports.OffchainAccountStakingModule = exports.XIBEX = exports.IBEX = exports.OffchainStakingModule = exports.LendingVaultEntity = exports.BorrowablePosition = exports.BorrowableEntity = exports.UniswapV2Position = exports.GenericCLPosition = exports.isV3Factory = exports.clTickToPrice = exports.formatPriceSqrtX96 = exports.MIN_TICK = exports.MAX_TICK = exports.decimalToBalance = exports.Borrowable = exports.PermitType = exports.PositionType = void 0;
|
|
@@ -217,8 +217,8 @@ const offchainAccountLendingPoolV3_1 = __importDefault(require("./offchain/accou
|
|
|
217
217
|
exports.OffchainAccountLendingPoolV3 = offchainAccountLendingPoolV3_1.default;
|
|
218
218
|
const offchainAccountNftlpUniswapV3_1 = __importDefault(require("./offchain/account/lendingPool/nftlp/offchainAccountNftlpUniswapV3"));
|
|
219
219
|
exports.OffchainAccountNftlpUniswapV3 = offchainAccountNftlpUniswapV3_1.default;
|
|
220
|
-
const
|
|
221
|
-
exports.
|
|
220
|
+
const offchainAccountNftlpAeroCL_1 = __importDefault(require("./offchain/account/lendingPool/nftlp/offchainAccountNftlpAeroCL"));
|
|
221
|
+
exports.OffchainAccountNftlpAeroCL = offchainAccountNftlpAeroCL_1.default;
|
|
222
222
|
const CLGeneral_1 = require("./utils/nftlpMath/CLGeneral");
|
|
223
223
|
Object.defineProperty(exports, "MAX_TICK", { enumerable: true, get: function () { return CLGeneral_1.MAX_TICK; } });
|
|
224
224
|
Object.defineProperty(exports, "MIN_TICK", { enumerable: true, get: function () { return CLGeneral_1.MIN_TICK; } });
|
|
@@ -247,7 +247,7 @@ exports.OffchainLendingPoolV3 = offchainLendingPoolV3_1.default;
|
|
|
247
247
|
const nftlp_2 = __importStar(require("./offchain/lendingPool/nftlp"));
|
|
248
248
|
exports.OffchainNftlp = nftlp_2.default;
|
|
249
249
|
Object.defineProperty(exports, "OffchainNftlpUniswapV3", { enumerable: true, get: function () { return nftlp_2.OffchainNftlpUniswapV3; } });
|
|
250
|
-
Object.defineProperty(exports, "
|
|
250
|
+
Object.defineProperty(exports, "OffchainNftlpAeroCL", { enumerable: true, get: function () { return nftlp_2.OffchainNftlpAeroCL; } });
|
|
251
251
|
const offchainCollateralV3_1 = __importDefault(require("./offchain/lendingPool/offchainCollateralV3"));
|
|
252
252
|
exports.OffchainCollateralV3 = offchainCollateralV3_1.default;
|
|
253
253
|
const offchainAccountLendingPoolV2_1 = __importDefault(require("./offchain/account/lendingPool/offchainAccountLendingPoolV2"));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AeroCLPositionData, UniswapV3PositionData } from "../../../offchainTypes";
|
|
2
|
+
import GenericCLPosition from "../../../../utils/position/cl";
|
|
3
|
+
import OffchainAccountNftlpGenericCL from "./offchainAccountNftlpGenericCL";
|
|
4
|
+
export default class OffchainAccountNftlpAeroCL extends OffchainAccountNftlpGenericCL {
|
|
5
|
+
protected cache: {
|
|
6
|
+
positionsData?: {
|
|
7
|
+
[keys in number]: Promise<UniswapV3PositionData>;
|
|
8
|
+
};
|
|
9
|
+
positionsObject?: {
|
|
10
|
+
[keys in number]: Promise<GenericCLPosition>;
|
|
11
|
+
};
|
|
12
|
+
newlyEarnedReward?: {
|
|
13
|
+
[keys in number]: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
getNftlp: () => any;
|
|
17
|
+
protected getPositionData(tokenId: number): Promise<AeroCLPositionData>;
|
|
18
|
+
getNewlyEarnedReward(tokenId: number): Promise<number>;
|
|
19
|
+
getStoredUnclaimedReward(tokenId: number): Promise<number>;
|
|
20
|
+
getStoredTotalRewardEarned(tokenId: number): Promise<number>;
|
|
21
|
+
getUnclaimedReward(tokenId: number): Promise<number>;
|
|
22
|
+
getTotalRewardEarned(tokenId: number): Promise<number>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const offchainAccountNftlpGenericCL_1 = __importDefault(require("./offchainAccountNftlpGenericCL"));
|
|
7
|
+
class OffchainAccountNftlpAeroCL extends offchainAccountNftlpGenericCL_1.default {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.cache = {};
|
|
11
|
+
// Return as NFTLP Dex class
|
|
12
|
+
this.getNftlp = () => super.getNftlp();
|
|
13
|
+
}
|
|
14
|
+
async getPositionData(tokenId) {
|
|
15
|
+
return await super.getPositionData(tokenId);
|
|
16
|
+
}
|
|
17
|
+
async getNewlyEarnedReward(tokenId) {
|
|
18
|
+
if (!this.cache.newlyEarnedReward)
|
|
19
|
+
this.cache.newlyEarnedReward = {};
|
|
20
|
+
if (tokenId in this.cache.newlyEarnedReward)
|
|
21
|
+
return this.cache.newlyEarnedReward[tokenId];
|
|
22
|
+
const network = this.getLendingPool().getLendingPool().getOffchain().network;
|
|
23
|
+
const lendingPoolId = this.getLendingPool().getLendingPool().getPairAddress();
|
|
24
|
+
const positionId = `${lendingPoolId}-${tokenId}`;
|
|
25
|
+
try {
|
|
26
|
+
const account = this.getLendingPool().getAccount().getAccountAddress();
|
|
27
|
+
const newlyEarnedRewards = await this.getLendingPool().getLendingPool().getOffchain().getAerodromeV3NewlyEarnedRewards(account, positionId);
|
|
28
|
+
this.cache.newlyEarnedReward[tokenId] = Number(newlyEarnedRewards?.newlyEarnedReward) ?? 0;
|
|
29
|
+
return this.cache.newlyEarnedReward[tokenId];
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
console.log(`No newly earned aero reward data for ${lendingPoolId} on ${network}`);
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async getStoredUnclaimedReward(tokenId) {
|
|
37
|
+
const { storedUnclaimedReward } = (await this.getPositionData(tokenId));
|
|
38
|
+
return Number(storedUnclaimedReward);
|
|
39
|
+
}
|
|
40
|
+
async getStoredTotalRewardEarned(tokenId) {
|
|
41
|
+
const { storedTotalRewardEarned } = (await this.getPositionData(tokenId));
|
|
42
|
+
return Number(storedTotalRewardEarned);
|
|
43
|
+
}
|
|
44
|
+
async getUnclaimedReward(tokenId) {
|
|
45
|
+
const storedUnclaimedReward = await this.getStoredUnclaimedReward(tokenId);
|
|
46
|
+
const newlyEarnedReward = await this.getNewlyEarnedReward(tokenId);
|
|
47
|
+
return storedUnclaimedReward + newlyEarnedReward;
|
|
48
|
+
}
|
|
49
|
+
async getTotalRewardEarned(tokenId) {
|
|
50
|
+
const storedTotalRewardEarned = await this.getStoredTotalRewardEarned(tokenId);
|
|
51
|
+
const newlyEarnedReward = await this.getNewlyEarnedReward(tokenId);
|
|
52
|
+
return storedTotalRewardEarned + newlyEarnedReward;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.default = OffchainAccountNftlpAeroCL;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import OffchainAccountNftlp from "./offchainAccountNftlp";
|
|
2
|
+
import { FeeAmounts, GenericCLNftlpPosition, GenericCLPositionData } from "../../../offchainTypes";
|
|
3
|
+
import GenericCLPosition from "../../../../utils/position/cl";
|
|
4
|
+
import OffchainNftlpGenericCL from "../../../lendingPool/nftlp/offchainNftlpGenericCL";
|
|
5
|
+
export default abstract class OffchainAccountNftlpGenericCL extends OffchainAccountNftlp {
|
|
6
|
+
protected cache: {
|
|
7
|
+
positionsData?: {
|
|
8
|
+
[keys in number]: Promise<GenericCLPositionData>;
|
|
9
|
+
};
|
|
10
|
+
positionsObject?: {
|
|
11
|
+
[keys in number]: Promise<GenericCLPosition>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
getNftlp: () => OffchainNftlpGenericCL;
|
|
15
|
+
getTokenPositions(): Promise<Record<string, GenericCLNftlpPosition>>;
|
|
16
|
+
protected getPositionData(tokenId: number): Promise<GenericCLPositionData>;
|
|
17
|
+
getTickSpacing(tokenId: number): Promise<number>;
|
|
18
|
+
getRawFee(tokenId: number): Promise<number>;
|
|
19
|
+
getFee(tokenId: number): Promise<number>;
|
|
20
|
+
getTickLower(tokenId: number): Promise<number>;
|
|
21
|
+
getTickUpper(tokenId: number): Promise<number>;
|
|
22
|
+
getPriceA(tokenId: number): Promise<number>;
|
|
23
|
+
getPriceB(tokenId: number): Promise<number>;
|
|
24
|
+
getLiquidity(tokenId: number): Promise<number>;
|
|
25
|
+
getUnclaimedFees(tokenId: number): Promise<FeeAmounts>;
|
|
26
|
+
createPositionObject(tokenId: number): Promise<GenericCLPosition>;
|
|
27
|
+
getPositionObject(tokenId: number): Promise<GenericCLPosition>;
|
|
28
|
+
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const offchainAccountNftlp_1 = __importDefault(require("./offchainAccountNftlp"));
|
|
7
7
|
const CLGeneral_1 = require("../../../../utils/nftlpMath/CLGeneral");
|
|
8
8
|
const cl_1 = __importDefault(require("../../../../utils/position/cl"));
|
|
9
|
-
class
|
|
9
|
+
class OffchainAccountNftlpGenericCL extends offchainAccountNftlp_1.default {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.cache = {};
|
|
@@ -24,14 +24,20 @@ class OffchainAccountNftlpAerodromeV3 extends offchainAccountNftlp_1.default {
|
|
|
24
24
|
return positions[tokenId].nftlp;
|
|
25
25
|
}
|
|
26
26
|
// Mirrored from Onchain
|
|
27
|
+
async getTickSpacing(tokenId) {
|
|
28
|
+
return Number((await this.getPositionData(tokenId)).uniswapV3Pool.tickSpacing);
|
|
29
|
+
}
|
|
30
|
+
async getRawFee(tokenId) {
|
|
31
|
+
return Number((await this.getPositionData(tokenId)).uniswapV3Pool.fee);
|
|
32
|
+
}
|
|
27
33
|
async getFee(tokenId) {
|
|
28
|
-
return
|
|
34
|
+
return await this.getRawFee(tokenId) / 1000000;
|
|
29
35
|
}
|
|
30
36
|
async getTickLower(tokenId) {
|
|
31
|
-
return (await this.getPositionData(tokenId)).tickLower;
|
|
37
|
+
return Number((await this.getPositionData(tokenId)).tickLower);
|
|
32
38
|
}
|
|
33
39
|
async getTickUpper(tokenId) {
|
|
34
|
-
return (await this.getPositionData(tokenId)).tickUpper;
|
|
40
|
+
return Number((await this.getPositionData(tokenId)).tickUpper);
|
|
35
41
|
}
|
|
36
42
|
async getPriceA(tokenId) {
|
|
37
43
|
return this.getNftlp().tickToPrice(await this.getTickLower(tokenId));
|
|
@@ -42,15 +48,21 @@ class OffchainAccountNftlpAerodromeV3 extends offchainAccountNftlp_1.default {
|
|
|
42
48
|
async getLiquidity(tokenId) {
|
|
43
49
|
const decimalsA = await this.getNftlp().getLendingPool().getBorrowableA().getDecimals();
|
|
44
50
|
const decimalsB = await this.getNftlp().getLendingPool().getBorrowableB().getDecimals();
|
|
45
|
-
const liquidity = (await this.getPositionData(tokenId)).liquidity;
|
|
51
|
+
const liquidity = Number((await this.getPositionData(tokenId)).liquidity);
|
|
46
52
|
return (0, CLGeneral_1.formatCLLiquidity)(liquidity, decimalsA, decimalsB);
|
|
47
53
|
}
|
|
54
|
+
async getUnclaimedFees(tokenId) {
|
|
55
|
+
return {
|
|
56
|
+
amountX: 0,
|
|
57
|
+
amountY: 0,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
48
60
|
async createPositionObject(tokenId) {
|
|
49
|
-
|
|
61
|
+
const unclaimedFees = await this.getUnclaimedFees(tokenId);
|
|
50
62
|
return new cl_1.default({
|
|
51
63
|
liquidity: await this.getLiquidity(tokenId),
|
|
52
|
-
unclaimedFeesX:
|
|
53
|
-
unclaimedFeesY:
|
|
64
|
+
unclaimedFeesX: unclaimedFees.amountX,
|
|
65
|
+
unclaimedFeesY: unclaimedFees.amountY,
|
|
54
66
|
debtX: await this.getLendingPool().getBorrowableA().getBorrowedAmount(tokenId),
|
|
55
67
|
debtY: await this.getLendingPool().getBorrowableB().getBorrowedAmount(tokenId),
|
|
56
68
|
marketPrice: await this.getNftlp().getMarketPrice(),
|
|
@@ -71,42 +83,5 @@ class OffchainAccountNftlpAerodromeV3 extends offchainAccountNftlp_1.default {
|
|
|
71
83
|
this.cache.positionsObject[tokenId] = this.createPositionObject(tokenId);
|
|
72
84
|
return this.cache.positionsObject[tokenId];
|
|
73
85
|
}
|
|
74
|
-
async getNewlyEarnedReward(tokenId) {
|
|
75
|
-
if (!this.cache.newlyEarnedReward)
|
|
76
|
-
this.cache.newlyEarnedReward = {};
|
|
77
|
-
if (tokenId in this.cache.newlyEarnedReward)
|
|
78
|
-
return this.cache.newlyEarnedReward[tokenId];
|
|
79
|
-
const network = this.getLendingPool().getLendingPool().getOffchain().network;
|
|
80
|
-
const lendingPoolId = this.getLendingPool().getLendingPool().getPairAddress();
|
|
81
|
-
const positionId = `${lendingPoolId}-${tokenId}`;
|
|
82
|
-
try {
|
|
83
|
-
const account = this.getLendingPool().getAccount().getAccountAddress();
|
|
84
|
-
const newlyEarnedRewards = await this.getLendingPool().getLendingPool().getOffchain().getAerodromeV3NewlyEarnedRewards(account, positionId);
|
|
85
|
-
this.cache.newlyEarnedReward[tokenId] = Number(newlyEarnedRewards?.newlyEarnedReward) ?? 0;
|
|
86
|
-
return this.cache.newlyEarnedReward[tokenId];
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
console.log(`No newly earned aero reward data for ${lendingPoolId} on ${network}`);
|
|
90
|
-
return 0;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
async getStoredUnclaimedReward(tokenId) {
|
|
94
|
-
const { storedUnclaimedReward } = (await this.getPositionData(tokenId));
|
|
95
|
-
return Number(storedUnclaimedReward);
|
|
96
|
-
}
|
|
97
|
-
async getStoredTotalRewardEarned(tokenId) {
|
|
98
|
-
const { storedTotalRewardEarned } = (await this.getPositionData(tokenId));
|
|
99
|
-
return Number(storedTotalRewardEarned);
|
|
100
|
-
}
|
|
101
|
-
async getUnclaimedReward(tokenId) {
|
|
102
|
-
const storedUnclaimedReward = await this.getStoredUnclaimedReward(tokenId);
|
|
103
|
-
const newlyEarnedReward = await this.getNewlyEarnedReward(tokenId);
|
|
104
|
-
return storedUnclaimedReward + newlyEarnedReward;
|
|
105
|
-
}
|
|
106
|
-
async getTotalRewardEarned(tokenId) {
|
|
107
|
-
const storedTotalRewardEarned = await this.getStoredTotalRewardEarned(tokenId);
|
|
108
|
-
const newlyEarnedReward = await this.getNewlyEarnedReward(tokenId);
|
|
109
|
-
return storedTotalRewardEarned + newlyEarnedReward;
|
|
110
|
-
}
|
|
111
86
|
}
|
|
112
|
-
exports.default =
|
|
87
|
+
exports.default = OffchainAccountNftlpGenericCL;
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { NftlpPosition } from "../../../offchainTypes";
|
|
1
|
+
import { FeeAmounts, UniswapV3PositionData } from "../../../offchainTypes";
|
|
3
2
|
import GenericCLPosition from "../../../../utils/position/cl";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tickLower: number;
|
|
7
|
-
tickUpper: number;
|
|
8
|
-
liquidity: number;
|
|
9
|
-
feeGrowthInside0LastX128: number;
|
|
10
|
-
feeGrowthInside1LastX128: number;
|
|
11
|
-
storedUnclaimedFees0: number;
|
|
12
|
-
storedUnclaimedFees1: number;
|
|
13
|
-
storedTotalFeesEarned0: number;
|
|
14
|
-
storedTotalFeesEarned1: number;
|
|
15
|
-
}
|
|
16
|
-
export type UniswapV3PositionData = NftlpPosition & {
|
|
17
|
-
nftlp: PositionData;
|
|
18
|
-
};
|
|
19
|
-
interface FeeAmounts {
|
|
20
|
-
amountX: number;
|
|
21
|
-
amountY: number;
|
|
22
|
-
}
|
|
23
|
-
export default class OffchainAccountNftlpUniswapV3 extends OffchainAccountNftlp {
|
|
3
|
+
import OffchainAccountNftlpGenericCL from "./offchainAccountNftlpGenericCL";
|
|
4
|
+
export default class OffchainAccountNftlpUniswapV3 extends OffchainAccountNftlpGenericCL {
|
|
24
5
|
protected cache: {
|
|
25
6
|
positionsData?: {
|
|
26
|
-
[keys in number]: Promise<
|
|
7
|
+
[keys in number]: Promise<UniswapV3PositionData>;
|
|
27
8
|
};
|
|
28
9
|
positionsObject?: {
|
|
29
10
|
[keys in number]: Promise<GenericCLPosition>;
|
|
@@ -33,20 +14,10 @@ export default class OffchainAccountNftlpUniswapV3 extends OffchainAccountNftlp
|
|
|
33
14
|
};
|
|
34
15
|
};
|
|
35
16
|
getNftlp: () => any;
|
|
36
|
-
|
|
37
|
-
getPositionData(tokenId: number): Promise<PositionData>;
|
|
38
|
-
getFee(tokenId: number): Promise<number>;
|
|
39
|
-
getTickLower(tokenId: number): Promise<number>;
|
|
40
|
-
getTickUpper(tokenId: number): Promise<number>;
|
|
41
|
-
getPriceA(tokenId: number): Promise<number>;
|
|
42
|
-
getPriceB(tokenId: number): Promise<number>;
|
|
43
|
-
getLiquidity(tokenId: number): Promise<number>;
|
|
44
|
-
createPositionObject(tokenId: number): Promise<GenericCLPosition>;
|
|
45
|
-
getPositionObject(tokenId: number): Promise<GenericCLPosition>;
|
|
17
|
+
protected getPositionData(tokenId: number): Promise<UniswapV3PositionData>;
|
|
46
18
|
getNewlyEarnedFees(tokenId: number): Promise<FeeAmounts>;
|
|
47
19
|
getStoredUnclaimedFees(tokenId: number): Promise<FeeAmounts>;
|
|
48
20
|
getStoredTotalFeesEarned(tokenId: number): Promise<FeeAmounts>;
|
|
49
21
|
getUnclaimedFees(tokenId: number): Promise<FeeAmounts>;
|
|
50
22
|
getTotalFeesEarned(tokenId: number): Promise<FeeAmounts>;
|
|
51
23
|
}
|
|
52
|
-
export {};
|
|
@@ -3,73 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const cl_1 = __importDefault(require("../../../../utils/position/cl"));
|
|
9
|
-
class OffchainAccountNftlpUniswapV3 extends offchainAccountNftlp_1.default {
|
|
6
|
+
const offchainAccountNftlpGenericCL_1 = __importDefault(require("./offchainAccountNftlpGenericCL"));
|
|
7
|
+
class OffchainAccountNftlpUniswapV3 extends offchainAccountNftlpGenericCL_1.default {
|
|
10
8
|
constructor() {
|
|
11
9
|
super(...arguments);
|
|
12
10
|
this.cache = {};
|
|
13
11
|
// Return as NFTLP Dex class
|
|
14
|
-
this.getNftlp = () =>
|
|
12
|
+
this.getNftlp = () => super.getNftlp();
|
|
15
13
|
}
|
|
16
|
-
// Returns all positions by token ID
|
|
17
|
-
async getTokenPositions() {
|
|
18
|
-
const positions = (await this.getLendingPool().getLendingPoolPosition())?.positions;
|
|
19
|
-
return positions;
|
|
20
|
-
}
|
|
21
|
-
// Returns single position data
|
|
22
14
|
async getPositionData(tokenId) {
|
|
23
|
-
|
|
24
|
-
return positions[tokenId].nftlp;
|
|
25
|
-
}
|
|
26
|
-
// Mirrored from Onchain
|
|
27
|
-
async getFee(tokenId) {
|
|
28
|
-
return (await this.getPositionData(tokenId)).fee / 1000000;
|
|
29
|
-
}
|
|
30
|
-
async getTickLower(tokenId) {
|
|
31
|
-
return (await this.getPositionData(tokenId)).tickLower;
|
|
32
|
-
}
|
|
33
|
-
async getTickUpper(tokenId) {
|
|
34
|
-
return (await this.getPositionData(tokenId)).tickUpper;
|
|
35
|
-
}
|
|
36
|
-
async getPriceA(tokenId) {
|
|
37
|
-
return this.getNftlp().tickToPrice(await this.getTickLower(tokenId));
|
|
38
|
-
}
|
|
39
|
-
async getPriceB(tokenId) {
|
|
40
|
-
return this.getNftlp().tickToPrice(await this.getTickUpper(tokenId));
|
|
41
|
-
}
|
|
42
|
-
async getLiquidity(tokenId) {
|
|
43
|
-
const decimalsA = await this.getNftlp().getLendingPool().getBorrowableA().getDecimals();
|
|
44
|
-
const decimalsB = await this.getNftlp().getLendingPool().getBorrowableB().getDecimals();
|
|
45
|
-
const liquidity = (await this.getPositionData(tokenId)).liquidity;
|
|
46
|
-
return (0, CLGeneral_1.formatCLLiquidity)(liquidity, decimalsA, decimalsB);
|
|
47
|
-
}
|
|
48
|
-
async createPositionObject(tokenId) {
|
|
49
|
-
const unclaimedFees = await this.getUnclaimedFees(tokenId);
|
|
50
|
-
return new cl_1.default({
|
|
51
|
-
liquidity: await this.getLiquidity(tokenId),
|
|
52
|
-
unclaimedFeesX: unclaimedFees.amountX,
|
|
53
|
-
unclaimedFeesY: unclaimedFees.amountY,
|
|
54
|
-
debtX: await this.getLendingPool().getBorrowableA().getBorrowedAmount(tokenId),
|
|
55
|
-
debtY: await this.getLendingPool().getBorrowableB().getBorrowedAmount(tokenId),
|
|
56
|
-
marketPrice: await this.getNftlp().getMarketPrice(),
|
|
57
|
-
oraclePrice: await this.getNftlp().getOraclePrice(),
|
|
58
|
-
priceA: await this.getPriceA(tokenId),
|
|
59
|
-
priceB: await this.getPriceB(tokenId),
|
|
60
|
-
safetyMargin: await this.getLendingPool().getSafetyMargin(),
|
|
61
|
-
liquidationPenalty: await this.getLendingPool().getLiquidationPenalty(),
|
|
62
|
-
borrowableX: await this.getNftlp().getLendingPool().getBorrowableA().createBorrowableObject(),
|
|
63
|
-
borrowableY: await this.getNftlp().getLendingPool().getBorrowableB().createBorrowableObject(),
|
|
64
|
-
fullRangeRate: await this.getNftlp().getFullRangeRate(await this.getFee(tokenId)),
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
async getPositionObject(tokenId) {
|
|
68
|
-
if (!this.cache.positionsObject)
|
|
69
|
-
this.cache.positionsObject = {};
|
|
70
|
-
if (!this.cache.positionsObject[tokenId])
|
|
71
|
-
this.cache.positionsObject[tokenId] = this.createPositionObject(tokenId);
|
|
72
|
-
return this.cache.positionsObject[tokenId];
|
|
15
|
+
return await super.getPositionData(tokenId);
|
|
73
16
|
}
|
|
74
17
|
async getNewlyEarnedFees(tokenId) {
|
|
75
18
|
if (!this.cache.newlyEarnedFees)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import OffchainNftlp from './offchainNftlp';
|
|
2
2
|
import OffchainNftlpUniswapV3 from './offchainNftlpUniswapV3';
|
|
3
|
-
import
|
|
4
|
-
export { OffchainNftlp, OffchainNftlpUniswapV3,
|
|
3
|
+
import OffchainNftlpAeroCL from './offchainNftlpAeroCL';
|
|
4
|
+
export { OffchainNftlp, OffchainNftlpUniswapV3, OffchainNftlpAeroCL };
|
|
5
5
|
export default OffchainNftlp;
|
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.OffchainNftlpAeroCL = exports.OffchainNftlpUniswapV3 = exports.OffchainNftlp = void 0;
|
|
7
7
|
const offchainNftlp_1 = __importDefault(require("./offchainNftlp"));
|
|
8
8
|
exports.OffchainNftlp = offchainNftlp_1.default;
|
|
9
9
|
const offchainNftlpUniswapV3_1 = __importDefault(require("./offchainNftlpUniswapV3"));
|
|
10
10
|
exports.OffchainNftlpUniswapV3 = offchainNftlpUniswapV3_1.default;
|
|
11
|
-
const
|
|
12
|
-
exports.
|
|
11
|
+
const offchainNftlpAeroCL_1 = __importDefault(require("./offchainNftlpAeroCL"));
|
|
12
|
+
exports.OffchainNftlpAeroCL = offchainNftlpAeroCL_1.default;
|
|
13
13
|
exports.default = offchainNftlp_1.default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import OffchainAccountCollateralV3 from "../../account/lendingPool/offchainAccountCollateralV3";
|
|
2
|
+
import OffchainAccountNftlpAeroCL from "../../account/lendingPool/nftlp/offchainAccountNftlpAeroCL";
|
|
3
|
+
import { Extension } from "../../../config/types";
|
|
4
|
+
import OffchainNftlpGenericCL from "./offchainNftlpGenericCL";
|
|
5
|
+
export default class OffchainNftlpAeroCL extends OffchainNftlpGenericCL {
|
|
6
|
+
getExtension(): Extension;
|
|
7
|
+
getNewAccountNftlpObject(accountCollateral: OffchainAccountCollateralV3): OffchainAccountNftlpAeroCL;
|
|
8
|
+
protected tickSpacings: () => number[];
|
|
9
|
+
initializeFullRangeRateAccurate(tickSpacing: number): Promise<number>;
|
|
10
|
+
getRewardsToken(): Promise<string | undefined>;
|
|
11
|
+
getRewardsTokenPrice(): Promise<number>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const offchainAccountNftlpAeroCL_1 = __importDefault(require("../../account/lendingPool/nftlp/offchainAccountNftlpAeroCL"));
|
|
7
|
+
const types_1 = require("../../../config/types");
|
|
8
|
+
const offchainNftlpGenericCL_1 = __importDefault(require("./offchainNftlpGenericCL"));
|
|
9
|
+
const aeroCLGeneral_1 = require("../../../utils/nftlpMath/aeroCLGeneral");
|
|
10
|
+
class OffchainNftlpAeroCL extends offchainNftlpGenericCL_1.default {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.tickSpacings = () => aeroCLGeneral_1.AERO_TICK_SPACINGS;
|
|
14
|
+
}
|
|
15
|
+
getExtension() {
|
|
16
|
+
return types_1.Extension.AeroCL;
|
|
17
|
+
}
|
|
18
|
+
getNewAccountNftlpObject(accountCollateral) {
|
|
19
|
+
return new offchainAccountNftlpAeroCL_1.default(accountCollateral);
|
|
20
|
+
}
|
|
21
|
+
// TODO
|
|
22
|
+
/*public async getFullRangeRateAndTvl(tickSpacing: number): Promise<{
|
|
23
|
+
fullRangeRate: number,
|
|
24
|
+
tvlUsd: number,
|
|
25
|
+
}> {
|
|
26
|
+
const zero = { fullRangeRate: 0, tvlUsd: 0 };
|
|
27
|
+
return zero;
|
|
28
|
+
// TODO
|
|
29
|
+
}*/
|
|
30
|
+
async initializeFullRangeRateAccurate(tickSpacing) {
|
|
31
|
+
return 0;
|
|
32
|
+
// TODO
|
|
33
|
+
}
|
|
34
|
+
async getRewardsToken() {
|
|
35
|
+
return undefined;
|
|
36
|
+
// TODO
|
|
37
|
+
//const nftlpData = await this.getNftlpData() as NftlpGenericCLData;
|
|
38
|
+
//return nftlpData.factory?.rewardsToken?.id
|
|
39
|
+
}
|
|
40
|
+
async getRewardsTokenPrice() {
|
|
41
|
+
const rewardsToken = await this.getRewardsToken();
|
|
42
|
+
if (!rewardsToken)
|
|
43
|
+
return 0;
|
|
44
|
+
const offchain = this.getLendingPool().getOffchain();
|
|
45
|
+
return offchain.getPriceHelper().getTokenPrice(offchain.network, rewardsToken);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = OffchainNftlpAeroCL;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import OffchainNftlp from "./offchainNftlp";
|
|
2
|
+
import { Address } from "../../../config/types";
|
|
3
|
+
export default abstract class OffchainNftlpGenericCL extends OffchainNftlp {
|
|
4
|
+
protected cache: {
|
|
5
|
+
marketPrice?: Promise<number>;
|
|
6
|
+
oraclePrice?: Promise<number>;
|
|
7
|
+
clPools?: {
|
|
8
|
+
[key in number]: Promise<{
|
|
9
|
+
address?: Address;
|
|
10
|
+
liquidity: number;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
fullRangeRateAccurate?: {
|
|
14
|
+
[key in number]: Promise<number>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
protected abstract tickSpacings(): Array<number>;
|
|
18
|
+
private priceAdjustment;
|
|
19
|
+
tickToPrice(tick: number): Promise<number>;
|
|
20
|
+
protected initializeMarketPrice(): Promise<number>;
|
|
21
|
+
protected initializeGenericCLPool(tickSpacing: number): Promise<{
|
|
22
|
+
address?: Address;
|
|
23
|
+
liquidity: number;
|
|
24
|
+
}>;
|
|
25
|
+
getGenericCLPool(tickSpacing: number): Promise<{
|
|
26
|
+
address?: Address;
|
|
27
|
+
liquidity: number;
|
|
28
|
+
}>;
|
|
29
|
+
getGlobalTvl(tickSpacing: number): Promise<number>;
|
|
30
|
+
abstract initializeFullRangeRateAccurate(tickSpacing: number): Promise<number>;
|
|
31
|
+
getFullRangeRateAccurate(tickSpacing: number): Promise<number>;
|
|
32
|
+
getFullRangeRate(tickSpacing: number): Promise<number>;
|
|
33
|
+
getBestFullRangeRate(): Promise<number>;
|
|
34
|
+
getTotalAPR(): Promise<number>;
|
|
35
|
+
}
|