@strkfarm/sdk 2.0.0-staging.36 → 2.0.0-staging.39
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/dist/index.browser.global.js +569 -93
- package/dist/index.browser.mjs +569 -93
- package/dist/index.d.ts +35 -9
- package/dist/index.js +569 -93
- package/dist/index.mjs +569 -93
- package/package.json +1 -1
- package/src/data/yoloVault.abi.json +380 -81
- package/src/interfaces/common.tsx +1 -1
- package/src/strategies/base-strategy.ts +52 -7
- package/src/strategies/ekubo-cl-vault.tsx +40 -1
- package/src/strategies/sensei.ts +23 -4
- package/src/strategies/universal-lst-muliplier-strategy.tsx +48 -1
- package/src/strategies/universal-strategy.tsx +64 -1
- package/src/strategies/yoloVault.ts +37 -7
|
@@ -90498,7 +90498,7 @@ spurious results.`);
|
|
|
90498
90498
|
const parts = put.split(pattern);
|
|
90499
90499
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: parts.map((part, i) => {
|
|
90500
90500
|
const match = highlights.find((m) => m.highlight.toLowerCase() === part.toLowerCase());
|
|
90501
|
-
return match ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: match.link, target: "_blank", style: { color: "
|
|
90501
|
+
return match ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: match.link, target: "_blank", style: { color: "white", background: "rgba(255, 255, 255, 0.04)" }, children: part }, i) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: part }, i);
|
|
90502
90502
|
}) });
|
|
90503
90503
|
}
|
|
90504
90504
|
var VesuProtocol = {
|
|
@@ -92135,15 +92135,39 @@ spurious results.`);
|
|
|
92135
92135
|
async getPendingRewards() {
|
|
92136
92136
|
return [];
|
|
92137
92137
|
}
|
|
92138
|
-
getStrategyTooltip() {
|
|
92139
|
-
return {
|
|
92140
|
-
holdings: "Your Holdings",
|
|
92141
|
-
earnings: "Lifetime Earnings"
|
|
92142
|
-
};
|
|
92143
|
-
}
|
|
92144
92138
|
async getUserRealizedAPY(blockIdentifier, sinceBlocks) {
|
|
92145
92139
|
throw new Error("Not implemented");
|
|
92146
92140
|
}
|
|
92141
|
+
async getUserPositionCards(_input) {
|
|
92142
|
+
throw new Error("Not implemented");
|
|
92143
|
+
}
|
|
92144
|
+
formatTokenAmountForCard(amount, tokenInfo) {
|
|
92145
|
+
const displayDecimals = tokenInfo.displayDecimals ?? 2;
|
|
92146
|
+
const fixed = Number(amount.toFixed(displayDecimals));
|
|
92147
|
+
const normalized = Number.isFinite(fixed) ? fixed : 0;
|
|
92148
|
+
return `${normalized.toLocaleString("en-US", {
|
|
92149
|
+
maximumFractionDigits: displayDecimals,
|
|
92150
|
+
minimumFractionDigits: 0
|
|
92151
|
+
})} ${tokenInfo.symbol}`;
|
|
92152
|
+
}
|
|
92153
|
+
formatPercentForCard(value) {
|
|
92154
|
+
if (!Number.isFinite(value)) return "N/A";
|
|
92155
|
+
return `${(value * 100).toFixed(2)}%`;
|
|
92156
|
+
}
|
|
92157
|
+
formatUSDForCard(value) {
|
|
92158
|
+
if (!Number.isFinite(value)) return "$0.00";
|
|
92159
|
+
return new Intl.NumberFormat("en-US", {
|
|
92160
|
+
style: "currency",
|
|
92161
|
+
currency: "USD",
|
|
92162
|
+
maximumFractionDigits: 2
|
|
92163
|
+
}).format(value);
|
|
92164
|
+
}
|
|
92165
|
+
getSubValueColorFromSignedNumber(value) {
|
|
92166
|
+
if (!Number.isFinite(value)) return "default";
|
|
92167
|
+
if (value > 0) return "positive";
|
|
92168
|
+
if (value < 0) return "negative";
|
|
92169
|
+
return "default";
|
|
92170
|
+
}
|
|
92147
92171
|
/**
|
|
92148
92172
|
* Calculate lifetime earnings for a user based on provided data from client
|
|
92149
92173
|
* Formula: lifetimeEarnings = currentValue + totalWithdrawals - totalDeposits
|
|
@@ -103923,6 +103947,31 @@ spurious results.`);
|
|
|
103923
103947
|
async getUserRealizedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
103924
103948
|
throw new Error("getUserRealizedAPY not implemented yet for Ekubo CL Vault strategy");
|
|
103925
103949
|
}
|
|
103950
|
+
async getUserPositionCards(input) {
|
|
103951
|
+
const quoteToken = this.metadata.additionalInfo.quoteAsset;
|
|
103952
|
+
const [userTVL, quotePrice] = await Promise.all([
|
|
103953
|
+
this.getUserTVL(input.user),
|
|
103954
|
+
this.pricer.getPrice(quoteToken.symbol)
|
|
103955
|
+
]);
|
|
103956
|
+
const token0IsQuote = userTVL.token0.tokenInfo.address.eq(quoteToken.address);
|
|
103957
|
+
const token1IsQuote = userTVL.token1.tokenInfo.address.eq(quoteToken.address);
|
|
103958
|
+
const token0QuoteAmount = token0IsQuote ? userTVL.token0.amount.toNumber() : userTVL.token0.usdValue / (quotePrice.price || 1);
|
|
103959
|
+
const token1QuoteAmount = token1IsQuote ? userTVL.token1.amount.toNumber() : userTVL.token1.usdValue / (quotePrice.price || 1);
|
|
103960
|
+
const totalQuoteAmount = token0QuoteAmount + token1QuoteAmount;
|
|
103961
|
+
const quoteAmountDisplay = Number.isFinite(totalQuoteAmount) ? totalQuoteAmount.toLocaleString("en-US", {
|
|
103962
|
+
maximumFractionDigits: quoteToken.displayDecimals ?? 2,
|
|
103963
|
+
minimumFractionDigits: 0
|
|
103964
|
+
}) : "0";
|
|
103965
|
+
return [
|
|
103966
|
+
{
|
|
103967
|
+
title: `${quoteToken.symbol} Holdings`,
|
|
103968
|
+
tooltip: `${quoteToken.symbol} Holdings`,
|
|
103969
|
+
value: `${quoteAmountDisplay} ${quoteToken.symbol}`,
|
|
103970
|
+
subValue: `\u2248 ${this.formatUSDForCard(userTVL.usdValue)}`,
|
|
103971
|
+
subValueColor: "positive"
|
|
103972
|
+
}
|
|
103973
|
+
];
|
|
103974
|
+
}
|
|
103926
103975
|
async feeBasedAPY(timeperiod = "24h") {
|
|
103927
103976
|
const feeInfo = await this.getFeeHistory(timeperiod);
|
|
103928
103977
|
const tvlNow = await this.getTVL("latest");
|
|
@@ -115663,6 +115712,9 @@ spurious results.`);
|
|
|
115663
115712
|
async getUserRealizedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
115664
115713
|
throw new Error("getUserRealizedAPY not implemented yet for Sensei strategy");
|
|
115665
115714
|
}
|
|
115715
|
+
async getUserPositionCards(_input) {
|
|
115716
|
+
return [];
|
|
115717
|
+
}
|
|
115666
115718
|
};
|
|
115667
115719
|
var senseiDescription = `Deposit your {{token1}} to automatically loop your funds via Endur ({{token2}}) and Vesu to create a delta neutral position. This strategy is designed to maximize your yield on {{token1}}. Your position is automatically adjusted periodically to maintain a healthy health factor. You receive a NFT as representation for your stake on Troves. You can withdraw anytime by redeeming your NFT for {{token1}}.`;
|
|
115668
115720
|
var vesuProtocol = {
|
|
@@ -115761,7 +115813,7 @@ spurious results.`);
|
|
|
115761
115813
|
tab: "all"
|
|
115762
115814
|
}
|
|
115763
115815
|
],
|
|
115764
|
-
liveStatus: "
|
|
115816
|
+
liveStatus: "Retired" /* RETIRED */,
|
|
115765
115817
|
isPaused: false,
|
|
115766
115818
|
isInMaintenance: false,
|
|
115767
115819
|
isAudited: false,
|
|
@@ -115818,7 +115870,18 @@ spurious results.`);
|
|
|
115818
115870
|
multiplier: 4,
|
|
115819
115871
|
logo: "https://endur.fi/favicon.ico",
|
|
115820
115872
|
toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi."
|
|
115821
|
-
}]
|
|
115873
|
+
}],
|
|
115874
|
+
discontinuationInfo: {
|
|
115875
|
+
info: highlightTextWithLinks(
|
|
115876
|
+
"This strategy is retired. All funds have been moved to Hyper xSTRK.",
|
|
115877
|
+
[
|
|
115878
|
+
{
|
|
115879
|
+
highlight: "Hyper xSTRK",
|
|
115880
|
+
link: "/strategy/hyper_xstrk"
|
|
115881
|
+
}
|
|
115882
|
+
]
|
|
115883
|
+
)
|
|
115884
|
+
}
|
|
115822
115885
|
}
|
|
115823
115886
|
];
|
|
115824
115887
|
|
|
@@ -115833,16 +115896,28 @@ spurious results.`);
|
|
|
115833
115896
|
type: "struct",
|
|
115834
115897
|
name: "core::integer::u256",
|
|
115835
115898
|
members: [
|
|
115836
|
-
{
|
|
115837
|
-
|
|
115899
|
+
{
|
|
115900
|
+
name: "low",
|
|
115901
|
+
type: "core::integer::u128"
|
|
115902
|
+
},
|
|
115903
|
+
{
|
|
115904
|
+
name: "high",
|
|
115905
|
+
type: "core::integer::u128"
|
|
115906
|
+
}
|
|
115838
115907
|
]
|
|
115839
115908
|
},
|
|
115840
115909
|
{
|
|
115841
115910
|
type: "enum",
|
|
115842
115911
|
name: "core::bool",
|
|
115843
115912
|
variants: [
|
|
115844
|
-
{
|
|
115845
|
-
|
|
115913
|
+
{
|
|
115914
|
+
name: "False",
|
|
115915
|
+
type: "()"
|
|
115916
|
+
},
|
|
115917
|
+
{
|
|
115918
|
+
name: "True",
|
|
115919
|
+
type: "()"
|
|
115920
|
+
}
|
|
115846
115921
|
]
|
|
115847
115922
|
},
|
|
115848
115923
|
{
|
|
@@ -115853,10 +115928,13 @@ spurious results.`);
|
|
|
115853
115928
|
name: "data",
|
|
115854
115929
|
type: "core::array::Array::<core::bytes_31::bytes31>"
|
|
115855
115930
|
},
|
|
115856
|
-
{
|
|
115931
|
+
{
|
|
115932
|
+
name: "pending_word",
|
|
115933
|
+
type: "core::felt252"
|
|
115934
|
+
},
|
|
115857
115935
|
{
|
|
115858
115936
|
name: "pending_word_len",
|
|
115859
|
-
type: "core::
|
|
115937
|
+
type: "core::integer::u32"
|
|
115860
115938
|
}
|
|
115861
115939
|
]
|
|
115862
115940
|
},
|
|
@@ -115868,7 +115946,11 @@ spurious results.`);
|
|
|
115868
115946
|
type: "function",
|
|
115869
115947
|
name: "total_supply",
|
|
115870
115948
|
inputs: [],
|
|
115871
|
-
outputs: [
|
|
115949
|
+
outputs: [
|
|
115950
|
+
{
|
|
115951
|
+
type: "core::integer::u256"
|
|
115952
|
+
}
|
|
115953
|
+
],
|
|
115872
115954
|
state_mutability: "view"
|
|
115873
115955
|
},
|
|
115874
115956
|
{
|
|
@@ -115880,7 +115962,11 @@ spurious results.`);
|
|
|
115880
115962
|
type: "core::starknet::contract_address::ContractAddress"
|
|
115881
115963
|
}
|
|
115882
115964
|
],
|
|
115883
|
-
outputs: [
|
|
115965
|
+
outputs: [
|
|
115966
|
+
{
|
|
115967
|
+
type: "core::integer::u256"
|
|
115968
|
+
}
|
|
115969
|
+
],
|
|
115884
115970
|
state_mutability: "view"
|
|
115885
115971
|
},
|
|
115886
115972
|
{
|
|
@@ -115896,7 +115982,11 @@ spurious results.`);
|
|
|
115896
115982
|
type: "core::starknet::contract_address::ContractAddress"
|
|
115897
115983
|
}
|
|
115898
115984
|
],
|
|
115899
|
-
outputs: [
|
|
115985
|
+
outputs: [
|
|
115986
|
+
{
|
|
115987
|
+
type: "core::integer::u256"
|
|
115988
|
+
}
|
|
115989
|
+
],
|
|
115900
115990
|
state_mutability: "view"
|
|
115901
115991
|
},
|
|
115902
115992
|
{
|
|
@@ -115907,9 +115997,16 @@ spurious results.`);
|
|
|
115907
115997
|
name: "recipient",
|
|
115908
115998
|
type: "core::starknet::contract_address::ContractAddress"
|
|
115909
115999
|
},
|
|
115910
|
-
{
|
|
116000
|
+
{
|
|
116001
|
+
name: "amount",
|
|
116002
|
+
type: "core::integer::u256"
|
|
116003
|
+
}
|
|
116004
|
+
],
|
|
116005
|
+
outputs: [
|
|
116006
|
+
{
|
|
116007
|
+
type: "core::bool"
|
|
116008
|
+
}
|
|
115911
116009
|
],
|
|
115912
|
-
outputs: [{ type: "core::bool" }],
|
|
115913
116010
|
state_mutability: "external"
|
|
115914
116011
|
},
|
|
115915
116012
|
{
|
|
@@ -115924,9 +116021,16 @@ spurious results.`);
|
|
|
115924
116021
|
name: "recipient",
|
|
115925
116022
|
type: "core::starknet::contract_address::ContractAddress"
|
|
115926
116023
|
},
|
|
115927
|
-
{
|
|
116024
|
+
{
|
|
116025
|
+
name: "amount",
|
|
116026
|
+
type: "core::integer::u256"
|
|
116027
|
+
}
|
|
116028
|
+
],
|
|
116029
|
+
outputs: [
|
|
116030
|
+
{
|
|
116031
|
+
type: "core::bool"
|
|
116032
|
+
}
|
|
115928
116033
|
],
|
|
115929
|
-
outputs: [{ type: "core::bool" }],
|
|
115930
116034
|
state_mutability: "external"
|
|
115931
116035
|
},
|
|
115932
116036
|
{
|
|
@@ -115937,37 +116041,60 @@ spurious results.`);
|
|
|
115937
116041
|
name: "spender",
|
|
115938
116042
|
type: "core::starknet::contract_address::ContractAddress"
|
|
115939
116043
|
},
|
|
115940
|
-
{
|
|
116044
|
+
{
|
|
116045
|
+
name: "amount",
|
|
116046
|
+
type: "core::integer::u256"
|
|
116047
|
+
}
|
|
116048
|
+
],
|
|
116049
|
+
outputs: [
|
|
116050
|
+
{
|
|
116051
|
+
type: "core::bool"
|
|
116052
|
+
}
|
|
115941
116053
|
],
|
|
115942
|
-
outputs: [{ type: "core::bool" }],
|
|
115943
116054
|
state_mutability: "external"
|
|
115944
116055
|
},
|
|
115945
116056
|
{
|
|
115946
116057
|
type: "function",
|
|
115947
116058
|
name: "name",
|
|
115948
116059
|
inputs: [],
|
|
115949
|
-
outputs: [
|
|
116060
|
+
outputs: [
|
|
116061
|
+
{
|
|
116062
|
+
type: "core::byte_array::ByteArray"
|
|
116063
|
+
}
|
|
116064
|
+
],
|
|
115950
116065
|
state_mutability: "view"
|
|
115951
116066
|
},
|
|
115952
116067
|
{
|
|
115953
116068
|
type: "function",
|
|
115954
116069
|
name: "symbol",
|
|
115955
116070
|
inputs: [],
|
|
115956
|
-
outputs: [
|
|
116071
|
+
outputs: [
|
|
116072
|
+
{
|
|
116073
|
+
type: "core::byte_array::ByteArray"
|
|
116074
|
+
}
|
|
116075
|
+
],
|
|
115957
116076
|
state_mutability: "view"
|
|
115958
116077
|
},
|
|
115959
116078
|
{
|
|
115960
116079
|
type: "function",
|
|
115961
116080
|
name: "decimals",
|
|
115962
116081
|
inputs: [],
|
|
115963
|
-
outputs: [
|
|
116082
|
+
outputs: [
|
|
116083
|
+
{
|
|
116084
|
+
type: "core::integer::u8"
|
|
116085
|
+
}
|
|
116086
|
+
],
|
|
115964
116087
|
state_mutability: "view"
|
|
115965
116088
|
},
|
|
115966
116089
|
{
|
|
115967
116090
|
type: "function",
|
|
115968
116091
|
name: "totalSupply",
|
|
115969
116092
|
inputs: [],
|
|
115970
|
-
outputs: [
|
|
116093
|
+
outputs: [
|
|
116094
|
+
{
|
|
116095
|
+
type: "core::integer::u256"
|
|
116096
|
+
}
|
|
116097
|
+
],
|
|
115971
116098
|
state_mutability: "view"
|
|
115972
116099
|
},
|
|
115973
116100
|
{
|
|
@@ -115979,7 +116106,11 @@ spurious results.`);
|
|
|
115979
116106
|
type: "core::starknet::contract_address::ContractAddress"
|
|
115980
116107
|
}
|
|
115981
116108
|
],
|
|
115982
|
-
outputs: [
|
|
116109
|
+
outputs: [
|
|
116110
|
+
{
|
|
116111
|
+
type: "core::integer::u256"
|
|
116112
|
+
}
|
|
116113
|
+
],
|
|
115983
116114
|
state_mutability: "view"
|
|
115984
116115
|
},
|
|
115985
116116
|
{
|
|
@@ -115994,9 +116125,16 @@ spurious results.`);
|
|
|
115994
116125
|
name: "recipient",
|
|
115995
116126
|
type: "core::starknet::contract_address::ContractAddress"
|
|
115996
116127
|
},
|
|
115997
|
-
{
|
|
116128
|
+
{
|
|
116129
|
+
name: "amount",
|
|
116130
|
+
type: "core::integer::u256"
|
|
116131
|
+
}
|
|
116132
|
+
],
|
|
116133
|
+
outputs: [
|
|
116134
|
+
{
|
|
116135
|
+
type: "core::bool"
|
|
116136
|
+
}
|
|
115998
116137
|
],
|
|
115999
|
-
outputs: [{ type: "core::bool" }],
|
|
116000
116138
|
state_mutability: "external"
|
|
116001
116139
|
}
|
|
116002
116140
|
]
|
|
@@ -116022,7 +116160,10 @@ spurious results.`);
|
|
|
116022
116160
|
name: "exchange_address",
|
|
116023
116161
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116024
116162
|
},
|
|
116025
|
-
{
|
|
116163
|
+
{
|
|
116164
|
+
name: "percent",
|
|
116165
|
+
type: "core::integer::u128"
|
|
116166
|
+
},
|
|
116026
116167
|
{
|
|
116027
116168
|
name: "additional_swap_params",
|
|
116028
116169
|
type: "core::array::Array::<core::felt252>"
|
|
@@ -116037,18 +116178,30 @@ spurious results.`);
|
|
|
116037
116178
|
name: "token_from_address",
|
|
116038
116179
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116039
116180
|
},
|
|
116040
|
-
{
|
|
116181
|
+
{
|
|
116182
|
+
name: "token_from_amount",
|
|
116183
|
+
type: "core::integer::u256"
|
|
116184
|
+
},
|
|
116041
116185
|
{
|
|
116042
116186
|
name: "token_to_address",
|
|
116043
116187
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116044
116188
|
},
|
|
116045
|
-
{
|
|
116046
|
-
|
|
116189
|
+
{
|
|
116190
|
+
name: "token_to_amount",
|
|
116191
|
+
type: "core::integer::u256"
|
|
116192
|
+
},
|
|
116193
|
+
{
|
|
116194
|
+
name: "token_to_min_amount",
|
|
116195
|
+
type: "core::integer::u256"
|
|
116196
|
+
},
|
|
116047
116197
|
{
|
|
116048
116198
|
name: "beneficiary",
|
|
116049
116199
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116050
116200
|
},
|
|
116051
|
-
{
|
|
116201
|
+
{
|
|
116202
|
+
name: "integrator_fee_amount_bps",
|
|
116203
|
+
type: "core::integer::u128"
|
|
116204
|
+
},
|
|
116052
116205
|
{
|
|
116053
116206
|
name: "integrator_fee_recipient",
|
|
116054
116207
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -116063,8 +116216,14 @@ spurious results.`);
|
|
|
116063
116216
|
type: "struct",
|
|
116064
116217
|
name: "contracts_private::strategies::yolo_vault::interface::YoloFeeSettings",
|
|
116065
116218
|
members: [
|
|
116066
|
-
{
|
|
116067
|
-
|
|
116219
|
+
{
|
|
116220
|
+
name: "swap_fee_bps",
|
|
116221
|
+
type: "core::integer::u256"
|
|
116222
|
+
},
|
|
116223
|
+
{
|
|
116224
|
+
name: "performance_fee_bps",
|
|
116225
|
+
type: "core::integer::u256"
|
|
116226
|
+
},
|
|
116068
116227
|
{
|
|
116069
116228
|
name: "fee_receiver",
|
|
116070
116229
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -116075,27 +116234,72 @@ spurious results.`);
|
|
|
116075
116234
|
type: "struct",
|
|
116076
116235
|
name: "contracts_private::strategies::yolo_vault::interface::YoloVaultStatus",
|
|
116077
116236
|
members: [
|
|
116078
|
-
{
|
|
116079
|
-
|
|
116080
|
-
|
|
116081
|
-
|
|
116082
|
-
{
|
|
116083
|
-
|
|
116084
|
-
|
|
116085
|
-
|
|
116237
|
+
{
|
|
116238
|
+
name: "current_epoch",
|
|
116239
|
+
type: "core::integer::u256"
|
|
116240
|
+
},
|
|
116241
|
+
{
|
|
116242
|
+
name: "total_epochs",
|
|
116243
|
+
type: "core::integer::u256"
|
|
116244
|
+
},
|
|
116245
|
+
{
|
|
116246
|
+
name: "remaining_base",
|
|
116247
|
+
type: "core::integer::u256"
|
|
116248
|
+
},
|
|
116249
|
+
{
|
|
116250
|
+
name: "total_second_tokens",
|
|
116251
|
+
type: "core::integer::u256"
|
|
116252
|
+
},
|
|
116253
|
+
{
|
|
116254
|
+
name: "global_second_token_index",
|
|
116255
|
+
type: "core::integer::u256"
|
|
116256
|
+
},
|
|
116257
|
+
{
|
|
116258
|
+
name: "cumulative_spend_index",
|
|
116259
|
+
type: "core::integer::u256"
|
|
116260
|
+
},
|
|
116261
|
+
{
|
|
116262
|
+
name: "total_shares",
|
|
116263
|
+
type: "core::integer::u256"
|
|
116264
|
+
},
|
|
116265
|
+
{
|
|
116266
|
+
name: "base_token_assets_per_share",
|
|
116267
|
+
type: "core::integer::u256"
|
|
116268
|
+
}
|
|
116086
116269
|
]
|
|
116087
116270
|
},
|
|
116088
116271
|
{
|
|
116089
116272
|
type: "struct",
|
|
116090
116273
|
name: "contracts_private::strategies::yolo_vault::interface::UserYoloInfo",
|
|
116091
116274
|
members: [
|
|
116092
|
-
{
|
|
116093
|
-
|
|
116094
|
-
|
|
116095
|
-
|
|
116096
|
-
{
|
|
116097
|
-
|
|
116098
|
-
|
|
116275
|
+
{
|
|
116276
|
+
name: "shares",
|
|
116277
|
+
type: "core::integer::u256"
|
|
116278
|
+
},
|
|
116279
|
+
{
|
|
116280
|
+
name: "claimable_second_tokens",
|
|
116281
|
+
type: "core::integer::u256"
|
|
116282
|
+
},
|
|
116283
|
+
{
|
|
116284
|
+
name: "base_token_balance",
|
|
116285
|
+
type: "core::integer::u256"
|
|
116286
|
+
},
|
|
116287
|
+
{
|
|
116288
|
+
name: "base_token_consumed",
|
|
116289
|
+
type: "core::integer::u256"
|
|
116290
|
+
},
|
|
116291
|
+
{
|
|
116292
|
+
name: "base_consumed_last_index",
|
|
116293
|
+
type: "core::integer::u256"
|
|
116294
|
+
},
|
|
116295
|
+
{
|
|
116296
|
+
name: "second_token_last_index",
|
|
116297
|
+
type: "core::integer::u256"
|
|
116298
|
+
},
|
|
116299
|
+
{
|
|
116300
|
+
name: "second_token_balance",
|
|
116301
|
+
type: "core::integer::u256"
|
|
116302
|
+
}
|
|
116099
116303
|
]
|
|
116100
116304
|
},
|
|
116101
116305
|
{
|
|
@@ -116110,10 +116314,22 @@ spurious results.`);
|
|
|
116110
116314
|
name: "second_token",
|
|
116111
116315
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116112
116316
|
},
|
|
116113
|
-
{
|
|
116114
|
-
|
|
116115
|
-
|
|
116116
|
-
|
|
116317
|
+
{
|
|
116318
|
+
name: "total_epochs",
|
|
116319
|
+
type: "core::integer::u256"
|
|
116320
|
+
},
|
|
116321
|
+
{
|
|
116322
|
+
name: "min_time_per_epoch",
|
|
116323
|
+
type: "core::integer::u64"
|
|
116324
|
+
},
|
|
116325
|
+
{
|
|
116326
|
+
name: "max_spend_units_per_epoch",
|
|
116327
|
+
type: "core::integer::u256"
|
|
116328
|
+
},
|
|
116329
|
+
{
|
|
116330
|
+
name: "base_token_assets_per_share",
|
|
116331
|
+
type: "core::integer::u256"
|
|
116332
|
+
},
|
|
116117
116333
|
{
|
|
116118
116334
|
name: "oracle",
|
|
116119
116335
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -116128,7 +116344,10 @@ spurious results.`);
|
|
|
116128
116344
|
type: "function",
|
|
116129
116345
|
name: "deposit",
|
|
116130
116346
|
inputs: [
|
|
116131
|
-
{
|
|
116347
|
+
{
|
|
116348
|
+
name: "base_token_amount",
|
|
116349
|
+
type: "core::integer::u256"
|
|
116350
|
+
},
|
|
116132
116351
|
{
|
|
116133
116352
|
name: "receiver",
|
|
116134
116353
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -116141,7 +116360,10 @@ spurious results.`);
|
|
|
116141
116360
|
type: "function",
|
|
116142
116361
|
name: "redeem",
|
|
116143
116362
|
inputs: [
|
|
116144
|
-
{
|
|
116363
|
+
{
|
|
116364
|
+
name: "shares",
|
|
116365
|
+
type: "core::integer::u256"
|
|
116366
|
+
},
|
|
116145
116367
|
{
|
|
116146
116368
|
name: "receiver",
|
|
116147
116369
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -116154,7 +116376,10 @@ spurious results.`);
|
|
|
116154
116376
|
type: "function",
|
|
116155
116377
|
name: "execute_swap",
|
|
116156
116378
|
inputs: [
|
|
116157
|
-
{
|
|
116379
|
+
{
|
|
116380
|
+
name: "spend_units",
|
|
116381
|
+
type: "core::integer::u256"
|
|
116382
|
+
},
|
|
116158
116383
|
{
|
|
116159
116384
|
name: "swap_params",
|
|
116160
116385
|
type: "strkfarm_contracts::components::swap::AvnuMultiRouteSwap"
|
|
@@ -116178,10 +116403,31 @@ spurious results.`);
|
|
|
116178
116403
|
{
|
|
116179
116404
|
type: "function",
|
|
116180
116405
|
name: "update_max_spend_units",
|
|
116181
|
-
inputs: [
|
|
116406
|
+
inputs: [
|
|
116407
|
+
{
|
|
116408
|
+
name: "new_max",
|
|
116409
|
+
type: "core::integer::u256"
|
|
116410
|
+
}
|
|
116411
|
+
],
|
|
116182
116412
|
outputs: [],
|
|
116183
116413
|
state_mutability: "external"
|
|
116184
116414
|
},
|
|
116415
|
+
{
|
|
116416
|
+
type: "function",
|
|
116417
|
+
name: "get_swap_amounts",
|
|
116418
|
+
inputs: [
|
|
116419
|
+
{
|
|
116420
|
+
name: "spend_units",
|
|
116421
|
+
type: "core::integer::u256"
|
|
116422
|
+
}
|
|
116423
|
+
],
|
|
116424
|
+
outputs: [
|
|
116425
|
+
{
|
|
116426
|
+
type: "(core::integer::u256, core::integer::u256, core::bool)"
|
|
116427
|
+
}
|
|
116428
|
+
],
|
|
116429
|
+
state_mutability: "view"
|
|
116430
|
+
},
|
|
116185
116431
|
{
|
|
116186
116432
|
type: "function",
|
|
116187
116433
|
name: "get_user_claimable_second_tokens",
|
|
@@ -116191,7 +116437,11 @@ spurious results.`);
|
|
|
116191
116437
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116192
116438
|
}
|
|
116193
116439
|
],
|
|
116194
|
-
outputs: [
|
|
116440
|
+
outputs: [
|
|
116441
|
+
{
|
|
116442
|
+
type: "core::integer::u256"
|
|
116443
|
+
}
|
|
116444
|
+
],
|
|
116195
116445
|
state_mutability: "view"
|
|
116196
116446
|
},
|
|
116197
116447
|
{
|
|
@@ -116203,7 +116453,11 @@ spurious results.`);
|
|
|
116203
116453
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116204
116454
|
}
|
|
116205
116455
|
],
|
|
116206
|
-
outputs: [
|
|
116456
|
+
outputs: [
|
|
116457
|
+
{
|
|
116458
|
+
type: "core::integer::u256"
|
|
116459
|
+
}
|
|
116460
|
+
],
|
|
116207
116461
|
state_mutability: "view"
|
|
116208
116462
|
},
|
|
116209
116463
|
{
|
|
@@ -116215,7 +116469,11 @@ spurious results.`);
|
|
|
116215
116469
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116216
116470
|
}
|
|
116217
116471
|
],
|
|
116218
|
-
outputs: [
|
|
116472
|
+
outputs: [
|
|
116473
|
+
{
|
|
116474
|
+
type: "core::integer::u256"
|
|
116475
|
+
}
|
|
116476
|
+
],
|
|
116219
116477
|
state_mutability: "view"
|
|
116220
116478
|
},
|
|
116221
116479
|
{
|
|
@@ -116271,9 +116529,16 @@ spurious results.`);
|
|
|
116271
116529
|
type: "function",
|
|
116272
116530
|
name: "get_shares_on_deposit",
|
|
116273
116531
|
inputs: [
|
|
116274
|
-
{
|
|
116532
|
+
{
|
|
116533
|
+
name: "base_token_amount",
|
|
116534
|
+
type: "core::integer::u256"
|
|
116535
|
+
}
|
|
116536
|
+
],
|
|
116537
|
+
outputs: [
|
|
116538
|
+
{
|
|
116539
|
+
type: "core::integer::u256"
|
|
116540
|
+
}
|
|
116275
116541
|
],
|
|
116276
|
-
outputs: [{ type: "core::integer::u256" }],
|
|
116277
116542
|
state_mutability: "view"
|
|
116278
116543
|
}
|
|
116279
116544
|
]
|
|
@@ -116317,7 +116582,11 @@ spurious results.`);
|
|
|
116317
116582
|
type: "function",
|
|
116318
116583
|
name: "is_paused",
|
|
116319
116584
|
inputs: [],
|
|
116320
|
-
outputs: [
|
|
116585
|
+
outputs: [
|
|
116586
|
+
{
|
|
116587
|
+
type: "core::bool"
|
|
116588
|
+
}
|
|
116589
|
+
],
|
|
116321
116590
|
state_mutability: "view"
|
|
116322
116591
|
},
|
|
116323
116592
|
{
|
|
@@ -116325,7 +116594,9 @@ spurious results.`);
|
|
|
116325
116594
|
name: "access_control",
|
|
116326
116595
|
inputs: [],
|
|
116327
116596
|
outputs: [
|
|
116328
|
-
{
|
|
116597
|
+
{
|
|
116598
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
116599
|
+
}
|
|
116329
116600
|
],
|
|
116330
116601
|
state_mutability: "view"
|
|
116331
116602
|
}
|
|
@@ -116335,8 +116606,14 @@ spurious results.`);
|
|
|
116335
116606
|
type: "constructor",
|
|
116336
116607
|
name: "constructor",
|
|
116337
116608
|
inputs: [
|
|
116338
|
-
{
|
|
116339
|
-
|
|
116609
|
+
{
|
|
116610
|
+
name: "name",
|
|
116611
|
+
type: "core::byte_array::ByteArray"
|
|
116612
|
+
},
|
|
116613
|
+
{
|
|
116614
|
+
name: "symbol",
|
|
116615
|
+
type: "core::byte_array::ByteArray"
|
|
116616
|
+
},
|
|
116340
116617
|
{
|
|
116341
116618
|
name: "access_control",
|
|
116342
116619
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -116349,16 +116626,34 @@ spurious results.`);
|
|
|
116349
116626
|
name: "second_token",
|
|
116350
116627
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116351
116628
|
},
|
|
116352
|
-
{
|
|
116353
|
-
|
|
116354
|
-
|
|
116355
|
-
|
|
116629
|
+
{
|
|
116630
|
+
name: "total_epochs",
|
|
116631
|
+
type: "core::integer::u256"
|
|
116632
|
+
},
|
|
116633
|
+
{
|
|
116634
|
+
name: "min_time_per_epoch",
|
|
116635
|
+
type: "core::integer::u64"
|
|
116636
|
+
},
|
|
116637
|
+
{
|
|
116638
|
+
name: "max_spend_units_per_epoch",
|
|
116639
|
+
type: "core::integer::u256"
|
|
116640
|
+
},
|
|
116641
|
+
{
|
|
116642
|
+
name: "base_token_assets_per_share",
|
|
116643
|
+
type: "core::integer::u256"
|
|
116644
|
+
},
|
|
116356
116645
|
{
|
|
116357
116646
|
name: "oracle",
|
|
116358
116647
|
type: "core::starknet::contract_address::ContractAddress"
|
|
116359
116648
|
},
|
|
116360
|
-
{
|
|
116361
|
-
|
|
116649
|
+
{
|
|
116650
|
+
name: "swap_fee_bps",
|
|
116651
|
+
type: "core::integer::u256"
|
|
116652
|
+
},
|
|
116653
|
+
{
|
|
116654
|
+
name: "performance_fee_bps",
|
|
116655
|
+
type: "core::integer::u256"
|
|
116656
|
+
},
|
|
116362
116657
|
{
|
|
116363
116658
|
name: "fee_receiver",
|
|
116364
116659
|
type: "core::starknet::contract_address::ContractAddress"
|
|
@@ -116386,7 +116681,11 @@ spurious results.`);
|
|
|
116386
116681
|
type: "core::starknet::contract_address::ContractAddress",
|
|
116387
116682
|
kind: "key"
|
|
116388
116683
|
},
|
|
116389
|
-
{
|
|
116684
|
+
{
|
|
116685
|
+
name: "value",
|
|
116686
|
+
type: "core::integer::u256",
|
|
116687
|
+
kind: "data"
|
|
116688
|
+
}
|
|
116390
116689
|
]
|
|
116391
116690
|
},
|
|
116392
116691
|
{
|
|
@@ -116404,7 +116703,11 @@ spurious results.`);
|
|
|
116404
116703
|
type: "core::starknet::contract_address::ContractAddress",
|
|
116405
116704
|
kind: "key"
|
|
116406
116705
|
},
|
|
116407
|
-
{
|
|
116706
|
+
{
|
|
116707
|
+
name: "value",
|
|
116708
|
+
type: "core::integer::u256",
|
|
116709
|
+
kind: "data"
|
|
116710
|
+
}
|
|
116408
116711
|
]
|
|
116409
116712
|
},
|
|
116410
116713
|
{
|
|
@@ -116511,8 +116814,21 @@ spurious results.`);
|
|
|
116511
116814
|
type: "core::starknet::contract_address::ContractAddress",
|
|
116512
116815
|
kind: "key"
|
|
116513
116816
|
},
|
|
116514
|
-
{
|
|
116515
|
-
|
|
116817
|
+
{
|
|
116818
|
+
name: "receiver",
|
|
116819
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
116820
|
+
kind: "data"
|
|
116821
|
+
},
|
|
116822
|
+
{
|
|
116823
|
+
name: "base_amount",
|
|
116824
|
+
type: "core::integer::u256",
|
|
116825
|
+
kind: "data"
|
|
116826
|
+
},
|
|
116827
|
+
{
|
|
116828
|
+
name: "shares",
|
|
116829
|
+
type: "core::integer::u256",
|
|
116830
|
+
kind: "data"
|
|
116831
|
+
}
|
|
116516
116832
|
]
|
|
116517
116833
|
},
|
|
116518
116834
|
{
|
|
@@ -116525,9 +116841,26 @@ spurious results.`);
|
|
|
116525
116841
|
type: "core::starknet::contract_address::ContractAddress",
|
|
116526
116842
|
kind: "key"
|
|
116527
116843
|
},
|
|
116528
|
-
{
|
|
116529
|
-
|
|
116530
|
-
|
|
116844
|
+
{
|
|
116845
|
+
name: "receiver",
|
|
116846
|
+
type: "core::starknet::contract_address::ContractAddress",
|
|
116847
|
+
kind: "data"
|
|
116848
|
+
},
|
|
116849
|
+
{
|
|
116850
|
+
name: "shares",
|
|
116851
|
+
type: "core::integer::u256",
|
|
116852
|
+
kind: "data"
|
|
116853
|
+
},
|
|
116854
|
+
{
|
|
116855
|
+
name: "base_out",
|
|
116856
|
+
type: "core::integer::u256",
|
|
116857
|
+
kind: "data"
|
|
116858
|
+
},
|
|
116859
|
+
{
|
|
116860
|
+
name: "second_out",
|
|
116861
|
+
type: "core::integer::u256",
|
|
116862
|
+
kind: "data"
|
|
116863
|
+
},
|
|
116531
116864
|
{
|
|
116532
116865
|
name: "performance_fee",
|
|
116533
116866
|
type: "core::integer::u256",
|
|
@@ -116540,11 +116873,31 @@ spurious results.`);
|
|
|
116540
116873
|
name: "contracts_private::strategies::yolo_vault::interface::SwapExecuted",
|
|
116541
116874
|
kind: "struct",
|
|
116542
116875
|
members: [
|
|
116543
|
-
{
|
|
116544
|
-
|
|
116545
|
-
|
|
116546
|
-
|
|
116547
|
-
|
|
116876
|
+
{
|
|
116877
|
+
name: "epoch",
|
|
116878
|
+
type: "core::integer::u256",
|
|
116879
|
+
kind: "data"
|
|
116880
|
+
},
|
|
116881
|
+
{
|
|
116882
|
+
name: "spend_units",
|
|
116883
|
+
type: "core::integer::u256",
|
|
116884
|
+
kind: "data"
|
|
116885
|
+
},
|
|
116886
|
+
{
|
|
116887
|
+
name: "gross_spend",
|
|
116888
|
+
type: "core::integer::u256",
|
|
116889
|
+
kind: "data"
|
|
116890
|
+
},
|
|
116891
|
+
{
|
|
116892
|
+
name: "swap_fee",
|
|
116893
|
+
type: "core::integer::u256",
|
|
116894
|
+
kind: "data"
|
|
116895
|
+
},
|
|
116896
|
+
{
|
|
116897
|
+
name: "net_spend",
|
|
116898
|
+
type: "core::integer::u256",
|
|
116899
|
+
kind: "data"
|
|
116900
|
+
},
|
|
116548
116901
|
{
|
|
116549
116902
|
name: "second_tokens_acquired",
|
|
116550
116903
|
type: "core::integer::u256",
|
|
@@ -116554,6 +116907,11 @@ spurious results.`);
|
|
|
116554
116907
|
name: "new_global_index",
|
|
116555
116908
|
type: "core::integer::u256",
|
|
116556
116909
|
kind: "data"
|
|
116910
|
+
},
|
|
116911
|
+
{
|
|
116912
|
+
name: "cumulative_spend_index",
|
|
116913
|
+
type: "core::integer::u256",
|
|
116914
|
+
kind: "data"
|
|
116557
116915
|
}
|
|
116558
116916
|
]
|
|
116559
116917
|
},
|
|
@@ -116562,7 +116920,11 @@ spurious results.`);
|
|
|
116562
116920
|
name: "contracts_private::strategies::yolo_vault::interface::FeeSettingsUpdated",
|
|
116563
116921
|
kind: "struct",
|
|
116564
116922
|
members: [
|
|
116565
|
-
{
|
|
116923
|
+
{
|
|
116924
|
+
name: "swap_fee_bps",
|
|
116925
|
+
type: "core::integer::u256",
|
|
116926
|
+
kind: "data"
|
|
116927
|
+
},
|
|
116566
116928
|
{
|
|
116567
116929
|
name: "performance_fee_bps",
|
|
116568
116930
|
type: "core::integer::u256",
|
|
@@ -116913,12 +117275,36 @@ spurious results.`);
|
|
|
116913
117275
|
async netAPY() {
|
|
116914
117276
|
return "YOLO";
|
|
116915
117277
|
}
|
|
116916
|
-
|
|
117278
|
+
async getSwapAmounts(spendUnits) {
|
|
117279
|
+
const swapAmounts = await this.contract.call("get_swap_amounts", [spendUnits.toUint256()]);
|
|
117280
|
+
console.log("swapAmounts", swapAmounts);
|
|
116917
117281
|
return {
|
|
116918
|
-
|
|
116919
|
-
|
|
117282
|
+
grossSpend: Web3Number.fromWei(swapAmounts[0].toString(), this.primaryToken.decimals),
|
|
117283
|
+
netSpend: Web3Number.fromWei(swapAmounts[1].toString(), this.primaryToken.decimals),
|
|
117284
|
+
isReadyForNextSwap: swapAmounts[2]
|
|
116920
117285
|
};
|
|
116921
117286
|
}
|
|
117287
|
+
async getUserPositionCards(input) {
|
|
117288
|
+
const userTVL = await this.getUserTVL(input.user);
|
|
117289
|
+
const holdingsTitle = `${this.primaryToken.symbol} Left`;
|
|
117290
|
+
const earningsTitle = `${this.secondaryToken.symbol} Accumulated`;
|
|
117291
|
+
return [
|
|
117292
|
+
{
|
|
117293
|
+
title: holdingsTitle,
|
|
117294
|
+
tooltip: holdingsTitle,
|
|
117295
|
+
value: this.formatTokenAmountForCard(userTVL.token0.amount, userTVL.token0.tokenInfo),
|
|
117296
|
+
subValue: `\u2248 ${this.formatUSDForCard(userTVL.token0.usdValue)}`,
|
|
117297
|
+
subValueColor: "positive"
|
|
117298
|
+
},
|
|
117299
|
+
{
|
|
117300
|
+
title: earningsTitle,
|
|
117301
|
+
tooltip: earningsTitle,
|
|
117302
|
+
value: this.formatTokenAmountForCard(userTVL.token1.amount, userTVL.token1.tokenInfo),
|
|
117303
|
+
subValue: `\u2248 ${this.formatUSDForCard(userTVL.token1.usdValue)}`,
|
|
117304
|
+
subValueColor: "default"
|
|
117305
|
+
}
|
|
117306
|
+
];
|
|
117307
|
+
}
|
|
116922
117308
|
};
|
|
116923
117309
|
var formatPriceLabel = (price) => {
|
|
116924
117310
|
return `${price.toLocaleString("en-US")}`;
|
|
@@ -117069,7 +117455,7 @@ spurious results.`);
|
|
|
117069
117455
|
var wbtc = Global.getDefaultTokens().find((t) => t.symbol === "WBTC");
|
|
117070
117456
|
var btcYoloConfig = {
|
|
117071
117457
|
id: `btc-yolo-31-dec-2026`,
|
|
117072
|
-
address: ContractAddr.from("
|
|
117458
|
+
address: ContractAddr.from("0x018ccdff25a642e211f86ace35ba282ebdf342330319ead98cae37258bc9cce1"),
|
|
117073
117459
|
startDate: "03-MAR-2026",
|
|
117074
117460
|
mainToken: usdc,
|
|
117075
117461
|
secondaryToken: wbtc,
|
|
@@ -119817,6 +120203,53 @@ spurious results.`);
|
|
|
119817
120203
|
) / 1e4;
|
|
119818
120204
|
return apyForGivenBlocks * (365 * 24 * 3600) / timeDiffSeconds;
|
|
119819
120205
|
}
|
|
120206
|
+
async getUserPositionCards(input) {
|
|
120207
|
+
const { user, investmentFlows = [] } = input;
|
|
120208
|
+
const [userTVL, realizedApyRaw] = await Promise.all([
|
|
120209
|
+
this.getUserTVL(user),
|
|
120210
|
+
this.getUserRealizedAPY().catch(() => null)
|
|
120211
|
+
]);
|
|
120212
|
+
const cards = [
|
|
120213
|
+
{
|
|
120214
|
+
title: "Your Holdings",
|
|
120215
|
+
tooltip: "Your Holdings",
|
|
120216
|
+
value: this.formatTokenAmountForCard(userTVL.amount, userTVL.tokenInfo),
|
|
120217
|
+
subValue: `\u2248 ${this.formatUSDForCard(userTVL.usdValue)}`,
|
|
120218
|
+
subValueColor: "positive"
|
|
120219
|
+
}
|
|
120220
|
+
];
|
|
120221
|
+
let lifetimeAmount = userTVL.amount.multipliedBy(0);
|
|
120222
|
+
let lifetimeTokenInfo = userTVL.tokenInfo;
|
|
120223
|
+
let lifetimeUsdValue = 0;
|
|
120224
|
+
if (investmentFlows.length > 0) {
|
|
120225
|
+
try {
|
|
120226
|
+
const earningsResult = this.getLifetimeEarnings(userTVL, investmentFlows);
|
|
120227
|
+
lifetimeAmount = earningsResult.lifetimeEarnings;
|
|
120228
|
+
lifetimeTokenInfo = earningsResult.tokenInfo.tokenInfo;
|
|
120229
|
+
const userAmount = userTVL.amount.toNumber();
|
|
120230
|
+
if (Number.isFinite(userAmount) && userAmount > 0) {
|
|
120231
|
+
const pricePerToken = userTVL.usdValue / userAmount;
|
|
120232
|
+
lifetimeUsdValue = lifetimeAmount.toNumber() * pricePerToken;
|
|
120233
|
+
}
|
|
120234
|
+
} catch (error2) {
|
|
120235
|
+
logger2.warn(`${this.getTag()}::getUserPositionCards lifetime earnings fallback`, error2);
|
|
120236
|
+
}
|
|
120237
|
+
}
|
|
120238
|
+
cards.push({
|
|
120239
|
+
title: "Lifetime Earnings",
|
|
120240
|
+
tooltip: "Lifetime Earnings",
|
|
120241
|
+
value: this.formatTokenAmountForCard(lifetimeAmount, lifetimeTokenInfo),
|
|
120242
|
+
subValue: `\u2248 ${this.formatUSDForCard(lifetimeUsdValue)}`,
|
|
120243
|
+
subValueColor: this.getSubValueColorFromSignedNumber(lifetimeUsdValue)
|
|
120244
|
+
});
|
|
120245
|
+
const realizedApy = typeof realizedApyRaw === "number" ? this.formatPercentForCard(realizedApyRaw) : "N/A";
|
|
120246
|
+
cards.push({
|
|
120247
|
+
title: "Realized APY",
|
|
120248
|
+
tooltip: this.metadata.realizedApyMethodology || "Realized APY is based on past 14 days performance",
|
|
120249
|
+
value: realizedApy
|
|
120250
|
+
});
|
|
120251
|
+
return cards;
|
|
120252
|
+
}
|
|
119820
120253
|
/**
|
|
119821
120254
|
* Calculates the total TVL of the strategy.
|
|
119822
120255
|
* @returns Object containing the total amount in token units and USD value
|
|
@@ -121152,6 +121585,49 @@ spurious results.`);
|
|
|
121152
121585
|
tokenInfo: this.asset()
|
|
121153
121586
|
};
|
|
121154
121587
|
}
|
|
121588
|
+
async getUserPositionCards(input) {
|
|
121589
|
+
const cards = await super.getUserPositionCards(input);
|
|
121590
|
+
const unrealizedCardIndex = cards.findIndex((card) => card.title === "Unrealized Gains");
|
|
121591
|
+
try {
|
|
121592
|
+
const [unrealizedResult, userTVL] = await Promise.all([
|
|
121593
|
+
this.getUserUnrealizedGains(input.user),
|
|
121594
|
+
this.getUserTVL(input.user)
|
|
121595
|
+
]);
|
|
121596
|
+
const amount = unrealizedResult.unrealizedGains;
|
|
121597
|
+
let usdValue = 0;
|
|
121598
|
+
const userAmount = userTVL.amount.toNumber();
|
|
121599
|
+
if (Number.isFinite(userAmount) && userAmount > 0) {
|
|
121600
|
+
usdValue = userTVL.usdValue / userAmount * amount.toNumber();
|
|
121601
|
+
}
|
|
121602
|
+
const unrealizedCard = {
|
|
121603
|
+
title: "Unrealized Gains",
|
|
121604
|
+
tooltip: "Unrealized gains based on current market prices vs realized prices",
|
|
121605
|
+
value: this.formatTokenAmountForCard(amount, unrealizedResult.tokenInfo),
|
|
121606
|
+
subValue: `\u2248 ${this.formatUSDForCard(usdValue)}`,
|
|
121607
|
+
subValueColor: this.getSubValueColorFromSignedNumber(usdValue)
|
|
121608
|
+
};
|
|
121609
|
+
if (unrealizedCardIndex === -1) {
|
|
121610
|
+
cards.push(unrealizedCard);
|
|
121611
|
+
} else {
|
|
121612
|
+
cards[unrealizedCardIndex] = unrealizedCard;
|
|
121613
|
+
}
|
|
121614
|
+
} catch (error2) {
|
|
121615
|
+
logger2.warn(`${this.getTag()}::getUserPositionCards unrealized gains fallback`, error2);
|
|
121616
|
+
if (unrealizedCardIndex === -1) {
|
|
121617
|
+
cards.push({
|
|
121618
|
+
title: "Unrealized Gains",
|
|
121619
|
+
tooltip: "Unrealized gains based on current market prices vs realized prices",
|
|
121620
|
+
value: this.formatTokenAmountForCard(
|
|
121621
|
+
Web3Number.fromWei("0", this.asset().decimals),
|
|
121622
|
+
this.asset()
|
|
121623
|
+
),
|
|
121624
|
+
subValue: `\u2248 ${this.formatUSDForCard(0)}`,
|
|
121625
|
+
subValueColor: "default"
|
|
121626
|
+
});
|
|
121627
|
+
}
|
|
121628
|
+
}
|
|
121629
|
+
return cards;
|
|
121630
|
+
}
|
|
121155
121631
|
//
|
|
121156
121632
|
async _getMinOutputAmountLSTBuy(amountInUnderlying) {
|
|
121157
121633
|
const lstTruePrice = await this.getLSTExchangeRate();
|