@sonarwatch/portfolio-plugins 0.12.162 → 0.12.163
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/plugins/orca/getWhirlpoolPositions.js +59 -15
- package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
- package/src/plugins/orca/helpers_fees.d.ts +22 -0
- package/src/plugins/orca/helpers_fees.js +248 -0
- package/src/plugins/orca/helpers_fees.js.map +1 -0
- package/src/plugins/orca/structs/whirlpool.d.ts +18 -0
- package/src/plugins/orca/structs/whirlpool.js +17 -1
- package/src/plugins/orca/structs/whirlpool.js.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.12.163](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.162...plugins-0.12.163) (2024-09-09)
|
6
|
+
|
7
|
+
|
8
|
+
|
5
9
|
## [0.12.162](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.161...plugins-0.12.162) (2024-09-09)
|
6
10
|
|
7
11
|
|
package/package.json
CHANGED
@@ -20,8 +20,8 @@ const clients_1 = require("../../utils/clients");
|
|
20
20
|
const solana_1 = require("../../utils/solana");
|
21
21
|
const whirlpool_1 = require("./structs/whirlpool");
|
22
22
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
23
|
-
const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
|
24
23
|
const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
|
24
|
+
const helpers_fees_1 = require("./helpers_fees");
|
25
25
|
exports.getWhirlpoolPositions = getOrcaNftFetcher(constants_1.platformId, constants_1.whirlpoolProgram);
|
26
26
|
function getOrcaNftFetcher(platformId, programId) {
|
27
27
|
return (cache, nfts) => __awaiter(this, void 0, void 0, function* () {
|
@@ -47,27 +47,33 @@ function getOrcaNftFetcher(platformId, programId) {
|
|
47
47
|
prefix: constants_1.whirlpoolPrefix,
|
48
48
|
networkId: portfolio_core_1.NetworkId.solana,
|
49
49
|
});
|
50
|
-
const tokensMints =
|
50
|
+
const tokensMints = new Set();
|
51
51
|
const whirlpoolMap = new Map();
|
52
52
|
allWhirlpoolsInfo.forEach((wInfo) => {
|
53
|
+
var _a, _b, _c;
|
53
54
|
if (!wInfo)
|
54
55
|
return;
|
55
56
|
if (whirlpoolAddresses.has(wInfo.pubkey.toString())) {
|
56
57
|
whirlpoolMap.set(wInfo.pubkey.toString(), wInfo);
|
57
|
-
tokensMints.
|
58
|
+
tokensMints.add(wInfo.tokenMintA.toString());
|
59
|
+
tokensMints.add(wInfo.tokenMintB.toString());
|
60
|
+
if (!(0, helpers_fees_1.isRewardInitialized)(wInfo.rewardInfos[0])) {
|
61
|
+
tokensMints.add((_a = wInfo.rewardInfos[0]) === null || _a === void 0 ? void 0 : _a.mint.toString());
|
62
|
+
}
|
63
|
+
if (!(0, helpers_fees_1.isRewardInitialized)(wInfo.rewardInfos[1])) {
|
64
|
+
tokensMints.add((_b = wInfo.rewardInfos[1]) === null || _b === void 0 ? void 0 : _b.mint.toString());
|
65
|
+
}
|
66
|
+
if (!(0, helpers_fees_1.isRewardInitialized)(wInfo.rewardInfos[2])) {
|
67
|
+
tokensMints.add((_c = wInfo.rewardInfos[2]) === null || _c === void 0 ? void 0 : _c.mint.toString());
|
68
|
+
}
|
58
69
|
}
|
59
70
|
});
|
60
|
-
const tokenPriceResults = yield (0, runInBatch_1.default)(tokensMints.map((mint) => () => cache.getTokenPrice(mint, portfolio_core_1.NetworkId.solana)));
|
61
|
-
const tokenPrices = new Map();
|
62
|
-
tokenPriceResults.forEach((r) => {
|
63
|
-
if (r.status === 'rejected')
|
64
|
-
return;
|
65
|
-
if (!r.value)
|
66
|
-
return;
|
67
|
-
tokenPrices.set(r.value.address, r.value);
|
68
|
-
});
|
69
71
|
if (whirlpoolMap.size === 0)
|
70
72
|
return [];
|
73
|
+
const [tokenPrices, tickArrays] = yield Promise.all([
|
74
|
+
cache.getTokenPricesAsMap([...tokensMints], portfolio_core_1.NetworkId.solana),
|
75
|
+
(0, helpers_fees_1.getTickArraysAsMap)(positionsInfo, whirlpoolMap),
|
76
|
+
]);
|
71
77
|
const assets = [];
|
72
78
|
let totalLiquidityValue = 0;
|
73
79
|
for (let index = 0; index < positionsInfo.length; index++) {
|
@@ -82,14 +88,52 @@ function getOrcaNftFetcher(platformId, programId) {
|
|
82
88
|
!whirlpoolInfo.tickCurrentIndex)
|
83
89
|
continue;
|
84
90
|
const { tokenAmountA, tokenAmountB } = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(positionInfo.liquidity, whirlpoolInfo.tickCurrentIndex, positionInfo.tickLowerIndex, positionInfo.tickUpperIndex, false);
|
91
|
+
const rewardAssets = [];
|
85
92
|
const tokenPriceA = tokenPrices.get(whirlpoolInfo.tokenMintA.toString());
|
86
93
|
if (!tokenPriceA)
|
87
94
|
continue;
|
88
|
-
const assetTokenA = (0, tokenPriceToAssetToken_1.default)(whirlpoolInfo.tokenMintA.toString(), tokenAmountA.dividedBy(Math.pow(10, tokenPriceA.decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPriceA);
|
89
95
|
const tokenPriceB = tokenPrices.get(whirlpoolInfo.tokenMintB.toString());
|
90
96
|
if (!tokenPriceB)
|
91
97
|
continue;
|
98
|
+
const assetTokenA = (0, tokenPriceToAssetToken_1.default)(whirlpoolInfo.tokenMintA.toString(), tokenAmountA.dividedBy(Math.pow(10, tokenPriceA.decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPriceA);
|
92
99
|
const assetTokenB = (0, tokenPriceToAssetToken_1.default)(whirlpoolInfo.tokenMintB.toString(), tokenAmountB.dividedBy(Math.pow(10, tokenPriceB.decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPriceB);
|
100
|
+
const feesAndRewards = (0, helpers_fees_1.calcFeesAndRewards)(whirlpoolInfo, positionInfo, tickArrays);
|
101
|
+
if (feesAndRewards) {
|
102
|
+
if (feesAndRewards.feeOwedA.isGreaterThan(0)) {
|
103
|
+
rewardAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPriceA.address, feesAndRewards.feeOwedA
|
104
|
+
.dividedBy(Math.pow(10, tokenPriceA.decimals))
|
105
|
+
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPriceA));
|
106
|
+
}
|
107
|
+
if (feesAndRewards.feeOwedB.isGreaterThan(0)) {
|
108
|
+
rewardAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPriceB.address, feesAndRewards.feeOwedB
|
109
|
+
.dividedBy(Math.pow(10, tokenPriceB.decimals))
|
110
|
+
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPriceB));
|
111
|
+
}
|
112
|
+
if (feesAndRewards.rewardOwedA.isGreaterThan(0)) {
|
113
|
+
const tokenPriceRewardA = tokenPrices.get(whirlpoolInfo.rewardInfos[0].mint.toString());
|
114
|
+
if (tokenPriceRewardA) {
|
115
|
+
rewardAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPriceRewardA.address, feesAndRewards.rewardOwedA
|
116
|
+
.dividedBy(Math.pow(10, tokenPriceRewardA.decimals))
|
117
|
+
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPriceRewardA));
|
118
|
+
}
|
119
|
+
}
|
120
|
+
if (feesAndRewards.rewardOwedB.isGreaterThan(0)) {
|
121
|
+
const tokenPriceRewardB = tokenPrices.get(whirlpoolInfo.rewardInfos[1].mint.toString());
|
122
|
+
if (tokenPriceRewardB) {
|
123
|
+
rewardAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPriceRewardB.address, feesAndRewards.rewardOwedB
|
124
|
+
.dividedBy(Math.pow(10, tokenPriceRewardB.decimals))
|
125
|
+
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPriceRewardB));
|
126
|
+
}
|
127
|
+
}
|
128
|
+
if (feesAndRewards.rewardOwedC.isGreaterThan(0)) {
|
129
|
+
const tokenPriceRewardC = tokenPrices.get(whirlpoolInfo.rewardInfos[2].mint.toString());
|
130
|
+
if (tokenPriceRewardC) {
|
131
|
+
rewardAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPriceRewardC.address, feesAndRewards.rewardOwedC
|
132
|
+
.dividedBy(Math.pow(10, tokenPriceRewardC.decimals))
|
133
|
+
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPriceRewardC));
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
93
137
|
if (!assetTokenA ||
|
94
138
|
!assetTokenB ||
|
95
139
|
assetTokenA.value === null ||
|
@@ -99,8 +143,8 @@ function getOrcaNftFetcher(platformId, programId) {
|
|
99
143
|
assets.push({
|
100
144
|
assets: [assetTokenA, assetTokenB],
|
101
145
|
assetsValue: value,
|
102
|
-
rewardAssets
|
103
|
-
rewardAssetsValue: 0,
|
146
|
+
rewardAssets,
|
147
|
+
rewardAssetsValue: (0, portfolio_core_1.getUsdValueSum)(rewardAssets.map((a) => a.value)),
|
104
148
|
value,
|
105
149
|
yields: [],
|
106
150
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAChE,qGAA6E;AAC7E,wFAAyF;AAEzF,iDAIwB;AAEX,QAAA,qBAAqB,GAAG,iBAAiB,CACpD,sBAAc,EACd,4BAAgB,CACjB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAo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E,MAAM;iBACpB;aACF;SACF,CAAC;IACJ,CAAC,CAAA,CAAC;AACJ,CAAC;AA/OD,8CA+OC"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Position, Tick, TickArray, Whirlpool, WhirlpoolRewardInfo } from './structs/whirlpool';
|
2
|
+
import { ParsedAccount } from '../../utils/solana';
|
3
|
+
import BigNumber from 'bignumber.js';
|
4
|
+
export declare const getTickArraysAsMap: (positionsInfo: (ParsedAccount<Position> | null)[], whirlpoolMap: Map<string, Whirlpool>) => Promise<Map<string, TickArray>>;
|
5
|
+
export declare const calcFeesAndRewards: (whirlpool: Whirlpool, position: ParsedAccount<Position>, tickArrays: Map<string, TickArray>) => {
|
6
|
+
feeOwedA: BigNumber;
|
7
|
+
feeOwedB: BigNumber;
|
8
|
+
rewardOwedA: BigNumber;
|
9
|
+
rewardOwedB: BigNumber;
|
10
|
+
rewardOwedC: BigNumber;
|
11
|
+
} | null;
|
12
|
+
export declare function isRewardInitialized(rewardInfo: WhirlpoolRewardInfo): boolean;
|
13
|
+
export declare function getCollectRewardsQuoteInternal(param: {
|
14
|
+
whirlpool: Whirlpool;
|
15
|
+
position: Position;
|
16
|
+
tickLower: Tick;
|
17
|
+
tickUpper: Tick;
|
18
|
+
}): {
|
19
|
+
rewardOwedA: BigNumber;
|
20
|
+
rewardOwedB: BigNumber;
|
21
|
+
rewardOwedC: BigNumber;
|
22
|
+
};
|
@@ -0,0 +1,248 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.getCollectRewardsQuoteInternal = exports.isRewardInitialized = exports.calcFeesAndRewards = exports.getTickArraysAsMap = void 0;
|
16
|
+
const whirlpool_1 = require("./structs/whirlpool");
|
17
|
+
const solana_1 = require("../../utils/solana");
|
18
|
+
const constants_1 = require("./constants");
|
19
|
+
const clients_1 = require("../../utils/clients");
|
20
|
+
const web3_js_1 = require("@solana/web3.js");
|
21
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
22
|
+
const toBN_1 = require("../../utils/misc/toBN");
|
23
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
24
|
+
const TWO = new bn_js_1.default(2);
|
25
|
+
const U128 = TWO.pow(new bn_js_1.default(128));
|
26
|
+
const TICK_ARRAY_SIZE = 88;
|
27
|
+
const MAX_TICK_INDEX = 443636;
|
28
|
+
const MIN_TICK_INDEX = -443636;
|
29
|
+
const NUM_REWARDS = 3;
|
30
|
+
const getTickArraysAsMap = (positionsInfo, whirlpoolMap) => __awaiter(void 0, void 0, void 0, function* () {
|
31
|
+
const client = (0, clients_1.getClientSolana)();
|
32
|
+
const tickArrayAddresses = [];
|
33
|
+
for (let index = 0; index < positionsInfo.length; index++) {
|
34
|
+
const positionInfo = positionsInfo[index];
|
35
|
+
if (!positionInfo)
|
36
|
+
continue;
|
37
|
+
const whirlpoolInfo = whirlpoolMap.get(positionInfo.whirlpool.toString());
|
38
|
+
if (!whirlpoolInfo)
|
39
|
+
continue;
|
40
|
+
tickArrayAddresses.push(getTickArrayPda(constants_1.whirlpoolProgram, positionInfo.whirlpool, getStartTickIndex(positionInfo.tickLowerIndex, whirlpoolInfo.tickSpacing)), getTickArrayPda(constants_1.whirlpoolProgram, positionInfo.whirlpool, getStartTickIndex(positionInfo.tickUpperIndex, whirlpoolInfo.tickSpacing)));
|
41
|
+
}
|
42
|
+
const tickArrays = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, whirlpool_1.tickArrayStruct, tickArrayAddresses);
|
43
|
+
const tickArraysAsMap = new Map();
|
44
|
+
tickArrays.forEach((ta) => {
|
45
|
+
if (ta)
|
46
|
+
tickArraysAsMap.set(ta.pubkey.toString(), ta);
|
47
|
+
});
|
48
|
+
return tickArraysAsMap;
|
49
|
+
});
|
50
|
+
exports.getTickArraysAsMap = getTickArraysAsMap;
|
51
|
+
const calcFeesAndRewards = (whirlpool, position, tickArrays) => {
|
52
|
+
const tickArrayLowerAddress = getTickArrayPda(constants_1.whirlpoolProgram, position.whirlpool, getStartTickIndex(position.tickLowerIndex, whirlpool.tickSpacing));
|
53
|
+
const tickArrayUpperAddress = getTickArrayPda(constants_1.whirlpoolProgram, position.whirlpool, getStartTickIndex(position.tickUpperIndex, whirlpool.tickSpacing));
|
54
|
+
const tickArrayLower = tickArrays.get(tickArrayLowerAddress.toString());
|
55
|
+
const tickArrayUpper = tickArrays.get(tickArrayUpperAddress.toString());
|
56
|
+
if (!tickArrayLower || !tickArrayUpper) {
|
57
|
+
return null;
|
58
|
+
}
|
59
|
+
const tickLower = getTick(tickArrayLower, position.tickLowerIndex, whirlpool.tickSpacing);
|
60
|
+
const tickUpper = getTick(tickArrayUpper, position.tickUpperIndex, whirlpool.tickSpacing);
|
61
|
+
const rewards = getCollectRewardsQuoteInternal({
|
62
|
+
whirlpool,
|
63
|
+
position,
|
64
|
+
tickLower,
|
65
|
+
tickUpper,
|
66
|
+
});
|
67
|
+
const fees = getCollectFeesQuoteInternal({
|
68
|
+
whirlpool,
|
69
|
+
position,
|
70
|
+
tickUpper,
|
71
|
+
tickLower,
|
72
|
+
});
|
73
|
+
return Object.assign(Object.assign({}, rewards), fees);
|
74
|
+
};
|
75
|
+
exports.calcFeesAndRewards = calcFeesAndRewards;
|
76
|
+
function invariant(condition, message) {
|
77
|
+
if (condition) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
const prefix = 'Invariant failed';
|
81
|
+
const provided = typeof message === 'function' ? message() : message;
|
82
|
+
const value = provided ? `${prefix}: ${provided}` : prefix;
|
83
|
+
throw new Error(value);
|
84
|
+
}
|
85
|
+
function getStartTickIndex(tickIndex, tickSpacing, offset = 0) {
|
86
|
+
const realIndex = Math.floor(tickIndex / tickSpacing / TICK_ARRAY_SIZE);
|
87
|
+
const startTickIndex = (realIndex + offset) * tickSpacing * TICK_ARRAY_SIZE;
|
88
|
+
const ticksInArray = TICK_ARRAY_SIZE * tickSpacing;
|
89
|
+
const minTickIndex = MIN_TICK_INDEX - ((MIN_TICK_INDEX % ticksInArray) + ticksInArray);
|
90
|
+
invariant(startTickIndex >= minTickIndex, 'startTickIndex is too small');
|
91
|
+
invariant(startTickIndex <= MAX_TICK_INDEX, 'startTickIndex is too large');
|
92
|
+
return startTickIndex;
|
93
|
+
}
|
94
|
+
function getTickArrayPda(programId, whirlpool, startIndex) {
|
95
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
96
|
+
Buffer.from('tick_array', 'utf8'),
|
97
|
+
whirlpool.toBuffer(),
|
98
|
+
Buffer.from(startIndex.toString(), 'utf8'),
|
99
|
+
], programId)[0];
|
100
|
+
}
|
101
|
+
function subUnderflowU128(n0, n1) {
|
102
|
+
return n0.add(U128).sub(n1).mod(U128);
|
103
|
+
}
|
104
|
+
function getCollectFeesQuoteInternal(param) {
|
105
|
+
const { whirlpool, position, tickLower, tickUpper } = param;
|
106
|
+
const { tickCurrentIndex, feeGrowthGlobalA: feeGrowthGlobalAX64, feeGrowthGlobalB: feeGrowthGlobalBX64, } = whirlpool;
|
107
|
+
const { tickLowerIndex, tickUpperIndex, liquidity, feeOwedA, feeOwedB, feeGrowthCheckpointA: feeGrowthCheckpointAX64, feeGrowthCheckpointB: feeGrowthCheckpointBX64, } = position;
|
108
|
+
const { feeGrowthOutsideA: tickLowerFeeGrowthOutsideAX64, feeGrowthOutsideB: tickLowerFeeGrowthOutsideBX64, } = tickLower;
|
109
|
+
const { feeGrowthOutsideA: tickUpperFeeGrowthOutsideAX64, feeGrowthOutsideB: tickUpperFeeGrowthOutsideBX64, } = tickUpper;
|
110
|
+
// Calculate the fee growths inside the position
|
111
|
+
let feeGrowthBelowAX64 = null;
|
112
|
+
let feeGrowthBelowBX64 = null;
|
113
|
+
if (tickCurrentIndex < tickLowerIndex) {
|
114
|
+
feeGrowthBelowAX64 = subUnderflowU128((0, toBN_1.toBN)(feeGrowthGlobalAX64), (0, toBN_1.toBN)(tickLowerFeeGrowthOutsideAX64));
|
115
|
+
feeGrowthBelowBX64 = subUnderflowU128((0, toBN_1.toBN)(feeGrowthGlobalBX64), (0, toBN_1.toBN)(tickLowerFeeGrowthOutsideBX64));
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
feeGrowthBelowAX64 = (0, toBN_1.toBN)(tickLowerFeeGrowthOutsideAX64);
|
119
|
+
feeGrowthBelowBX64 = (0, toBN_1.toBN)(tickLowerFeeGrowthOutsideBX64);
|
120
|
+
}
|
121
|
+
let feeGrowthAboveAX64 = null;
|
122
|
+
let feeGrowthAboveBX64 = null;
|
123
|
+
if (tickCurrentIndex < tickUpperIndex) {
|
124
|
+
feeGrowthAboveAX64 = (0, toBN_1.toBN)(tickUpperFeeGrowthOutsideAX64);
|
125
|
+
feeGrowthAboveBX64 = (0, toBN_1.toBN)(tickUpperFeeGrowthOutsideBX64);
|
126
|
+
}
|
127
|
+
else {
|
128
|
+
feeGrowthAboveAX64 = subUnderflowU128((0, toBN_1.toBN)(feeGrowthGlobalAX64), (0, toBN_1.toBN)(tickUpperFeeGrowthOutsideAX64));
|
129
|
+
feeGrowthAboveBX64 = subUnderflowU128((0, toBN_1.toBN)(feeGrowthGlobalBX64), (0, toBN_1.toBN)(tickUpperFeeGrowthOutsideBX64));
|
130
|
+
}
|
131
|
+
const feeGrowthInsideAX64 = subUnderflowU128(subUnderflowU128((0, toBN_1.toBN)(feeGrowthGlobalAX64), feeGrowthBelowAX64), feeGrowthAboveAX64);
|
132
|
+
const feeGrowthInsideBX64 = subUnderflowU128(subUnderflowU128((0, toBN_1.toBN)(feeGrowthGlobalBX64), feeGrowthBelowBX64), feeGrowthAboveBX64);
|
133
|
+
// Calculate the updated fees owed
|
134
|
+
const feeOwedADelta = subUnderflowU128(feeGrowthInsideAX64, (0, toBN_1.toBN)(feeGrowthCheckpointAX64))
|
135
|
+
.mul((0, toBN_1.toBN)(liquidity))
|
136
|
+
.shrn(64);
|
137
|
+
const feeOwedBDelta = subUnderflowU128(feeGrowthInsideBX64, (0, toBN_1.toBN)(feeGrowthCheckpointBX64))
|
138
|
+
.mul((0, toBN_1.toBN)(liquidity))
|
139
|
+
.shrn(64);
|
140
|
+
const updatedFeeOwedA = feeOwedA.plus(feeOwedADelta.toString());
|
141
|
+
const updatedFeeOwedB = feeOwedB.plus(feeOwedBDelta.toString());
|
142
|
+
return {
|
143
|
+
feeOwedA: updatedFeeOwedA,
|
144
|
+
feeOwedB: updatedFeeOwedB,
|
145
|
+
};
|
146
|
+
}
|
147
|
+
function getTick(tickArray, tickIndex, tickSpacing) {
|
148
|
+
const realIndex = tickIndexToTickArrayIndex(tickArray, tickIndex, tickSpacing);
|
149
|
+
const tick = tickArray.ticks[realIndex];
|
150
|
+
invariant(!!tick, 'tick realIndex out of range');
|
151
|
+
return tick;
|
152
|
+
}
|
153
|
+
function tickIndexToTickArrayIndex({ startTickIndex }, tickIndex, tickSpacing) {
|
154
|
+
return Math.floor((tickIndex - startTickIndex) / tickSpacing);
|
155
|
+
}
|
156
|
+
function isRewardInitialized(rewardInfo) {
|
157
|
+
return (rewardInfo.mint.toString() !== '11111111111111111111111111111111' &&
|
158
|
+
rewardInfo.vault.toString() !== '11111111111111111111111111111111');
|
159
|
+
}
|
160
|
+
exports.isRewardInitialized = isRewardInitialized;
|
161
|
+
function getCollectRewardsQuoteInternal(param) {
|
162
|
+
var _a, _b, _c, _d, _e, _f;
|
163
|
+
const { whirlpool, position, tickLower, tickUpper } = param;
|
164
|
+
const { tickCurrentIndex, rewardInfos: whirlpoolRewardsInfos } = whirlpool;
|
165
|
+
const { tickLowerIndex, tickUpperIndex, liquidity, rewardInfos } = position;
|
166
|
+
// Calculate the reward growths inside the position
|
167
|
+
const range = [...Array(NUM_REWARDS).keys()];
|
168
|
+
const rewardGrowthsBelowX64 = range.map(() => new bn_js_1.default(0));
|
169
|
+
const rewardGrowthsAboveX64 = range.map(() => new bn_js_1.default(0));
|
170
|
+
const tickLowerRewardGrowthsOutside = [
|
171
|
+
tickLower.rewardGrowthsOutside1,
|
172
|
+
tickLower.rewardGrowthsOutside2,
|
173
|
+
tickLower.rewardGrowthsOutside3,
|
174
|
+
];
|
175
|
+
const tickUpperRewardGrowthsOutside = [
|
176
|
+
tickUpper.rewardGrowthsOutside1,
|
177
|
+
tickUpper.rewardGrowthsOutside2,
|
178
|
+
tickLower.rewardGrowthsOutside3,
|
179
|
+
];
|
180
|
+
for (const i of range) {
|
181
|
+
const rewardInfo = whirlpoolRewardsInfos[i];
|
182
|
+
invariant(!!rewardInfo, 'whirlpoolRewardsInfos cannot be undefined');
|
183
|
+
const growthGlobalX64 = rewardInfo.growthGlobalX64;
|
184
|
+
const lowerRewardGrowthsOutside = tickLowerRewardGrowthsOutside[i];
|
185
|
+
const upperRewardGrowthsOutside = tickUpperRewardGrowthsOutside[i];
|
186
|
+
invariant(!!lowerRewardGrowthsOutside, 'lowerRewardGrowthsOutside cannot be undefined');
|
187
|
+
invariant(!!upperRewardGrowthsOutside, 'upperRewardGrowthsOutside cannot be undefined');
|
188
|
+
if (tickCurrentIndex < tickLowerIndex) {
|
189
|
+
rewardGrowthsBelowX64[i] = subUnderflowU128((0, toBN_1.toBN)(growthGlobalX64), (0, toBN_1.toBN)(lowerRewardGrowthsOutside));
|
190
|
+
}
|
191
|
+
else {
|
192
|
+
rewardGrowthsBelowX64[i] = (0, toBN_1.toBN)(lowerRewardGrowthsOutside);
|
193
|
+
}
|
194
|
+
if (tickCurrentIndex < tickUpperIndex) {
|
195
|
+
rewardGrowthsAboveX64[i] = (0, toBN_1.toBN)(upperRewardGrowthsOutside);
|
196
|
+
}
|
197
|
+
else {
|
198
|
+
rewardGrowthsAboveX64[i] = subUnderflowU128((0, toBN_1.toBN)(growthGlobalX64), (0, toBN_1.toBN)(upperRewardGrowthsOutside));
|
199
|
+
}
|
200
|
+
}
|
201
|
+
const rewardGrowthsInsideX64 = range.map(() => [
|
202
|
+
new bn_js_1.default(0),
|
203
|
+
false,
|
204
|
+
]);
|
205
|
+
for (const i of range) {
|
206
|
+
const rewardInfo = whirlpoolRewardsInfos[i];
|
207
|
+
invariant(!!rewardInfo, 'whirlpoolRewardsInfos cannot be undefined');
|
208
|
+
const rewardInitialized = isRewardInitialized(rewardInfo);
|
209
|
+
if (rewardInitialized) {
|
210
|
+
const growthBelowX64 = rewardGrowthsBelowX64[i];
|
211
|
+
const growthAboveX64 = rewardGrowthsAboveX64[i];
|
212
|
+
invariant(!!growthBelowX64, 'growthBelowX64 cannot be undefined');
|
213
|
+
invariant(!!growthAboveX64, 'growthAboveX64 cannot be undefined');
|
214
|
+
const growthInsde = subUnderflowU128(subUnderflowU128((0, toBN_1.toBN)(rewardInfo.growthGlobalX64), growthBelowX64), growthAboveX64);
|
215
|
+
rewardGrowthsInsideX64[i] = [growthInsde, true];
|
216
|
+
}
|
217
|
+
}
|
218
|
+
// Calculate the updated rewards owed
|
219
|
+
const updatedRewardInfosX64 = range.map(() => new bn_js_1.default(0));
|
220
|
+
for (const i of range) {
|
221
|
+
const growthInsideX64 = rewardGrowthsInsideX64[i];
|
222
|
+
invariant(!!growthInsideX64, 'growthInsideX64 cannot be undefined');
|
223
|
+
const [rewardGrowthInsideX64, isRewardInitialized] = growthInsideX64;
|
224
|
+
if (isRewardInitialized) {
|
225
|
+
const rewardInfo = rewardInfos[i];
|
226
|
+
invariant(!!rewardInfo, 'rewardInfo cannot be undefined');
|
227
|
+
const amountOwedX64 = (0, toBN_1.toBN)(rewardInfo.amountOwed).shln(64);
|
228
|
+
const growthInsideCheckpointX64 = rewardInfo.growthInsideCheckpoint;
|
229
|
+
updatedRewardInfosX64[i] = amountOwedX64.add(subUnderflowU128(rewardGrowthInsideX64, (0, toBN_1.toBN)(growthInsideCheckpointX64)).mul((0, toBN_1.toBN)(liquidity)));
|
230
|
+
}
|
231
|
+
}
|
232
|
+
invariant(rewardGrowthsInsideX64.length >= 3, 'rewards length is less than 3');
|
233
|
+
const rewardExistsA = (_a = rewardGrowthsInsideX64[0]) === null || _a === void 0 ? void 0 : _a[1];
|
234
|
+
const rewardExistsB = (_b = rewardGrowthsInsideX64[1]) === null || _b === void 0 ? void 0 : _b[1];
|
235
|
+
const rewardExistsC = (_c = rewardGrowthsInsideX64[2]) === null || _c === void 0 ? void 0 : _c[1];
|
236
|
+
const rewardOwedA = rewardExistsA
|
237
|
+
? new bignumber_js_1.default((_d = updatedRewardInfosX64[0]) === null || _d === void 0 ? void 0 : _d.shrn(64).toString())
|
238
|
+
: new bignumber_js_1.default(0);
|
239
|
+
const rewardOwedB = rewardExistsB
|
240
|
+
? new bignumber_js_1.default((_e = updatedRewardInfosX64[1]) === null || _e === void 0 ? void 0 : _e.shrn(64).toString())
|
241
|
+
: new bignumber_js_1.default(0);
|
242
|
+
const rewardOwedC = rewardExistsC
|
243
|
+
? new bignumber_js_1.default((_f = updatedRewardInfosX64[2]) === null || _f === void 0 ? void 0 : _f.shrn(64).toString())
|
244
|
+
: new bignumber_js_1.default(0);
|
245
|
+
return { rewardOwedA, rewardOwedB, rewardOwedC };
|
246
|
+
}
|
247
|
+
exports.getCollectRewardsQuoteInternal = getCollectRewardsQuoteInternal;
|
248
|
+
//# sourceMappingURL=helpers_fees.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers_fees.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src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,CAAC;IACH,CAAC;IAED,SAAS,CACP,sBAAsB,CAAC,MAAM,IAAI,CAAC,EAClC,+BAA+B,CAChC,CAAC;IAEF,MAAM,aAAa,GAAG,MAAA,sBAAsB,CAAC,CAAC,CAAC,0CAAG,CAAC,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,MAAA,sBAAsB,CAAC,CAAC,CAAC,0CAAG,CAAC,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,MAAA,sBAAsB,CAAC,CAAC,CAAC,0CAAG,CAAC,CAAC,CAAC;IAErD,MAAM,WAAW,GAAG,aAAa;QAC/B,CAAC,CAAC,IAAI,sBAAS,CAAC,MAAA,qBAAqB,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC;QAC9D,CAAC,CAAC,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,WAAW,GAAG,aAAa;QAC/B,CAAC,CAAC,IAAI,sBAAS,CAAC,MAAA,qBAAqB,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC;QAC9D,CAAC,CAAC,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,WAAW,GAAG,aAAa;QAC/B,CAAC,CAAC,IAAI,sBAAS,CAAC,MAAA,qBAAqB,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC;QAC9D,CAAC,CAAC,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IAErB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACnD,CAAC;AAzID,wEAyIC"}
|
@@ -52,3 +52,21 @@ export type Whirlpool = {
|
|
52
52
|
rewardInfos: WhirlpoolRewardInfo[];
|
53
53
|
};
|
54
54
|
export declare const whirlpoolStruct: BeetStruct<Whirlpool, Partial<Whirlpool>>;
|
55
|
+
export type Tick = {
|
56
|
+
initialized: boolean;
|
57
|
+
liquidityNet: BigNumber;
|
58
|
+
liquidityGross: BigNumber;
|
59
|
+
feeGrowthOutsideA: BigNumber;
|
60
|
+
feeGrowthOutsideB: BigNumber;
|
61
|
+
rewardGrowthsOutside1: BigNumber;
|
62
|
+
rewardGrowthsOutside2: BigNumber;
|
63
|
+
rewardGrowthsOutside3: BigNumber;
|
64
|
+
};
|
65
|
+
export declare const tickStruct: BeetStruct<Tick, Partial<Tick>>;
|
66
|
+
export type TickArray = {
|
67
|
+
padding: Buffer;
|
68
|
+
startTickIndex: number;
|
69
|
+
ticks: Tick[];
|
70
|
+
whirlpool: PublicKey;
|
71
|
+
};
|
72
|
+
export declare const tickArrayStruct: BeetStruct<TickArray, Partial<TickArray>>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.whirlpoolStruct = exports.whirlpoolRewardInfoStruct = exports.positionStruct = exports.positionRewardInfoStruct = void 0;
|
3
|
+
exports.tickArrayStruct = exports.tickStruct = exports.whirlpoolStruct = exports.whirlpoolRewardInfoStruct = exports.positionStruct = exports.positionRewardInfoStruct = void 0;
|
4
4
|
const beet_1 = require("@metaplex-foundation/beet");
|
5
5
|
const beet_solana_1 = require("@metaplex-foundation/beet-solana");
|
6
6
|
const solana_1 = require("../../../utils/solana");
|
@@ -50,4 +50,20 @@ exports.whirlpoolStruct = new beet_1.BeetStruct([
|
|
50
50
|
['rewardLastUpdatedTimestamp', solana_1.u64],
|
51
51
|
['rewardInfos', (0, beet_1.uniformFixedSizeArray)(exports.whirlpoolRewardInfoStruct, 3)],
|
52
52
|
], (args) => args);
|
53
|
+
exports.tickStruct = new beet_1.BeetStruct([
|
54
|
+
['initialized', beet_1.bool],
|
55
|
+
['liquidityNet', solana_1.i128],
|
56
|
+
['liquidityGross', solana_1.u128],
|
57
|
+
['feeGrowthOutsideA', solana_1.u128],
|
58
|
+
['feeGrowthOutsideB', solana_1.u128],
|
59
|
+
['rewardGrowthsOutside1', solana_1.u128],
|
60
|
+
['rewardGrowthsOutside2', solana_1.u128],
|
61
|
+
['rewardGrowthsOutside3', solana_1.u128],
|
62
|
+
], (args) => args);
|
63
|
+
exports.tickArrayStruct = new beet_1.BeetStruct([
|
64
|
+
['padding', (0, solana_1.blob)(8)],
|
65
|
+
['startTickIndex', beet_1.i32],
|
66
|
+
['ticks', (0, beet_1.uniformFixedSizeArray)(exports.tickStruct, 88)],
|
67
|
+
['whirlpool', beet_solana_1.publicKey],
|
68
|
+
], (args) => args);
|
53
69
|
//# sourceMappingURL=whirlpool.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"whirlpool.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/orca/structs/whirlpool.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"whirlpool.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/orca/structs/whirlpool.ts"],"names":[],"mappings":";;;AAAA,oDAOmC;AACnC,kEAA6D;AAG7D,kDAA8D;AAOjD,QAAA,wBAAwB,GAAG,IAAI,iBAAU,CACpD;IACE,CAAC,wBAAwB,EAAE,aAAI,CAAC;IAChC,CAAC,YAAY,EAAE,YAAG,CAAC;CACpB,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAA0B,CACrC,CAAC;AAgBW,QAAA,cAAc,GAAG,IAAI,iBAAU,CAC1C;IACE,CAAC,SAAS,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACpB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,cAAc,EAAE,uBAAS,CAAC;IAC3B,CAAC,WAAW,EAAE,aAAI,CAAC;IACnB,CAAC,gBAAgB,EAAE,UAAG,CAAC;IACvB,CAAC,gBAAgB,EAAE,UAAG,CAAC;IACvB,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,sBAA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