@strkfarm/sdk 2.0.0-staging.42 → 2.0.0-staging.45
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 +306 -64
- package/dist/index.browser.mjs +306 -64
- package/dist/index.d.ts +22 -0
- package/dist/index.js +306 -64
- package/dist/index.mjs +306 -64
- package/package.json +1 -1
- package/src/data/yoloVault.abi.json +32 -0
- package/src/interfaces/common.tsx +2 -0
- package/src/strategies/yoloVault.ts +339 -65
|
@@ -116382,6 +116382,38 @@ spurious results.`);
|
|
|
116382
116382
|
outputs: [],
|
|
116383
116383
|
state_mutability: "external"
|
|
116384
116384
|
},
|
|
116385
|
+
{
|
|
116386
|
+
type: "function",
|
|
116387
|
+
name: "deposit_combined",
|
|
116388
|
+
inputs: [
|
|
116389
|
+
{
|
|
116390
|
+
name: "underlying_amount",
|
|
116391
|
+
type: "core::integer::u256"
|
|
116392
|
+
},
|
|
116393
|
+
{
|
|
116394
|
+
name: "receiver",
|
|
116395
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
116396
|
+
}
|
|
116397
|
+
],
|
|
116398
|
+
outputs: [],
|
|
116399
|
+
state_mutability: "external"
|
|
116400
|
+
},
|
|
116401
|
+
{
|
|
116402
|
+
type: "function",
|
|
116403
|
+
name: "redeem_combined",
|
|
116404
|
+
inputs: [
|
|
116405
|
+
{
|
|
116406
|
+
name: "shares",
|
|
116407
|
+
type: "core::integer::u256"
|
|
116408
|
+
},
|
|
116409
|
+
{
|
|
116410
|
+
name: "receiver",
|
|
116411
|
+
type: "core::starknet::contract_address::ContractAddress"
|
|
116412
|
+
}
|
|
116413
|
+
],
|
|
116414
|
+
outputs: [],
|
|
116415
|
+
state_mutability: "external"
|
|
116416
|
+
},
|
|
116385
116417
|
{
|
|
116386
116418
|
type: "function",
|
|
116387
116419
|
name: "execute_swap",
|
|
@@ -117031,6 +117063,38 @@ spurious results.`);
|
|
|
117031
117063
|
}
|
|
117032
117064
|
this.primaryToken = metadata.depositTokens[0];
|
|
117033
117065
|
this.secondaryToken = metadata.depositTokens[1];
|
|
117066
|
+
const ai = metadata.additionalInfo;
|
|
117067
|
+
this.erc4626 = {
|
|
117068
|
+
isBaseERC4626: ai.isBaseERC4626 ?? false,
|
|
117069
|
+
isSecondERC4626: ai.isSecondERC4626 ?? false,
|
|
117070
|
+
baseUnderlying: ai.baseUnderlying,
|
|
117071
|
+
secondUnderlying: ai.secondUnderlying
|
|
117072
|
+
};
|
|
117073
|
+
}
|
|
117074
|
+
tokenForPrimaryPricing() {
|
|
117075
|
+
return this.erc4626.isBaseERC4626 && this.erc4626.baseUnderlying ? this.erc4626.baseUnderlying : this.primaryToken;
|
|
117076
|
+
}
|
|
117077
|
+
tokenForSecondaryPricing() {
|
|
117078
|
+
return this.erc4626.isSecondERC4626 && this.erc4626.secondUnderlying ? this.erc4626.secondUnderlying : this.secondaryToken;
|
|
117079
|
+
}
|
|
117080
|
+
primaryAmountDecimals() {
|
|
117081
|
+
return this.erc4626.isBaseERC4626 && this.erc4626.baseUnderlying ? this.erc4626.baseUnderlying.decimals : this.primaryToken.decimals;
|
|
117082
|
+
}
|
|
117083
|
+
secondaryAmountDecimals() {
|
|
117084
|
+
return this.erc4626.isSecondERC4626 && this.erc4626.secondUnderlying ? this.erc4626.secondUnderlying.decimals : this.secondaryToken.decimals;
|
|
117085
|
+
}
|
|
117086
|
+
async convertWrapperSharesToUnderlying(wrapper, sharesRaw, assetDecimals, blockIdentifier) {
|
|
117087
|
+
const wrapperContract = new Contract({
|
|
117088
|
+
abi: erc4626_abi_default,
|
|
117089
|
+
address: wrapper.address.address,
|
|
117090
|
+
providerOrAccount: this.config.provider
|
|
117091
|
+
});
|
|
117092
|
+
const assets = await wrapperContract.call(
|
|
117093
|
+
"convert_to_assets",
|
|
117094
|
+
[uint256_exports.bnToUint256(sharesRaw.toString())],
|
|
117095
|
+
{ blockIdentifier }
|
|
117096
|
+
);
|
|
117097
|
+
return Web3Number.fromWei(assets.toString(), assetDecimals);
|
|
117034
117098
|
}
|
|
117035
117099
|
// formatTokenAmount(amount: Web3Number, decimals: number): Web3Number {
|
|
117036
117100
|
// const formattedAmount = amount.dividedBy(10 ** decimals);
|
|
@@ -117047,9 +117111,40 @@ spurious results.`);
|
|
|
117047
117111
|
claimable_second_tokens
|
|
117048
117112
|
} = userInfo;
|
|
117049
117113
|
const userShares = new Web3Number(shares.toString(), 0);
|
|
117050
|
-
const
|
|
117051
|
-
const
|
|
117052
|
-
const
|
|
117114
|
+
const baseShares = base_token_balance;
|
|
117115
|
+
const secondShares = second_token_balance;
|
|
117116
|
+
const claimSecondShares = claimable_second_tokens;
|
|
117117
|
+
let baseTokenBalance;
|
|
117118
|
+
if (this.erc4626.isBaseERC4626 && this.erc4626.baseUnderlying) {
|
|
117119
|
+
baseTokenBalance = await this.convertWrapperSharesToUnderlying(
|
|
117120
|
+
this.primaryToken,
|
|
117121
|
+
baseShares,
|
|
117122
|
+
this.erc4626.baseUnderlying.decimals,
|
|
117123
|
+
blockIdentifier
|
|
117124
|
+
);
|
|
117125
|
+
} else {
|
|
117126
|
+
baseTokenBalance = Web3Number.fromWei(baseShares.toString(), this.primaryToken.decimals);
|
|
117127
|
+
}
|
|
117128
|
+
let secondTokenBalance;
|
|
117129
|
+
let claimableSecondTokens;
|
|
117130
|
+
if (this.erc4626.isSecondERC4626 && this.erc4626.secondUnderlying) {
|
|
117131
|
+
const assetDec = this.erc4626.secondUnderlying.decimals;
|
|
117132
|
+
secondTokenBalance = await this.convertWrapperSharesToUnderlying(
|
|
117133
|
+
this.secondaryToken,
|
|
117134
|
+
secondShares,
|
|
117135
|
+
assetDec,
|
|
117136
|
+
blockIdentifier
|
|
117137
|
+
);
|
|
117138
|
+
claimableSecondTokens = await this.convertWrapperSharesToUnderlying(
|
|
117139
|
+
this.secondaryToken,
|
|
117140
|
+
claimSecondShares,
|
|
117141
|
+
assetDec,
|
|
117142
|
+
blockIdentifier
|
|
117143
|
+
);
|
|
117144
|
+
} else {
|
|
117145
|
+
secondTokenBalance = Web3Number.fromWei(secondShares.toString(), this.secondaryToken.decimals);
|
|
117146
|
+
claimableSecondTokens = Web3Number.fromWei(claimSecondShares.toString(), this.secondaryToken.decimals);
|
|
117147
|
+
}
|
|
117053
117148
|
return {
|
|
117054
117149
|
shares: userShares,
|
|
117055
117150
|
primaryTokenBalance: baseTokenBalance,
|
|
@@ -117082,22 +117177,24 @@ spurious results.`);
|
|
|
117082
117177
|
}
|
|
117083
117178
|
async getUserTVL(user, blockIdentifier = "latest") {
|
|
117084
117179
|
try {
|
|
117180
|
+
const price0 = this.tokenForPrimaryPricing();
|
|
117181
|
+
const price1 = this.tokenForSecondaryPricing();
|
|
117085
117182
|
const [{ primaryTokenBalance, claimableSecondaryTokens }, primaryTokenPrice, secondaryTokenPrice] = await Promise.all([
|
|
117086
117183
|
this.getNormalizedUserInfo(user, blockIdentifier),
|
|
117087
|
-
this.pricer.getPrice(
|
|
117088
|
-
this.pricer.getPrice(
|
|
117184
|
+
this.pricer.getPrice(price0.symbol, blockIdentifier),
|
|
117185
|
+
this.pricer.getPrice(price1.symbol, blockIdentifier)
|
|
117089
117186
|
]);
|
|
117090
117187
|
const primaryTokenUsd = primaryTokenBalance.multipliedBy(primaryTokenPrice.price).toNumber();
|
|
117091
117188
|
const secondaryTokenUsd = claimableSecondaryTokens.multipliedBy(secondaryTokenPrice.price);
|
|
117092
117189
|
return {
|
|
117093
117190
|
usdValue: primaryTokenUsd + secondaryTokenUsd.toNumber(),
|
|
117094
117191
|
token0: {
|
|
117095
|
-
tokenInfo:
|
|
117192
|
+
tokenInfo: price0,
|
|
117096
117193
|
amount: primaryTokenBalance,
|
|
117097
117194
|
usdValue: primaryTokenUsd
|
|
117098
117195
|
},
|
|
117099
117196
|
token1: {
|
|
117100
|
-
tokenInfo:
|
|
117197
|
+
tokenInfo: price1,
|
|
117101
117198
|
amount: claimableSecondaryTokens,
|
|
117102
117199
|
usdValue: secondaryTokenUsd.toNumber()
|
|
117103
117200
|
}
|
|
@@ -117107,13 +117204,13 @@ spurious results.`);
|
|
|
117107
117204
|
return {
|
|
117108
117205
|
usdValue: 0,
|
|
117109
117206
|
token0: {
|
|
117110
|
-
tokenInfo: this.
|
|
117111
|
-
amount: new Web3Number("0", this.
|
|
117207
|
+
tokenInfo: this.tokenForPrimaryPricing(),
|
|
117208
|
+
amount: new Web3Number("0", this.primaryAmountDecimals()),
|
|
117112
117209
|
usdValue: 0
|
|
117113
117210
|
},
|
|
117114
117211
|
token1: {
|
|
117115
|
-
tokenInfo: this.
|
|
117116
|
-
amount: new Web3Number("0", this.
|
|
117212
|
+
tokenInfo: this.tokenForSecondaryPricing(),
|
|
117213
|
+
amount: new Web3Number("0", this.secondaryAmountDecimals()),
|
|
117117
117214
|
usdValue: 0
|
|
117118
117215
|
}
|
|
117119
117216
|
};
|
|
@@ -117125,56 +117222,104 @@ spurious results.`);
|
|
|
117125
117222
|
remaining_base: remainingBase,
|
|
117126
117223
|
total_second_tokens: totalSecondTokens
|
|
117127
117224
|
} = vaultStatus;
|
|
117128
|
-
const
|
|
117129
|
-
const
|
|
117225
|
+
const baseShares = BigInt(remainingBase.toString());
|
|
117226
|
+
const secondShares = BigInt(totalSecondTokens.toString());
|
|
117227
|
+
let primaryTokenAmount;
|
|
117228
|
+
if (this.erc4626.isBaseERC4626 && this.erc4626.baseUnderlying) {
|
|
117229
|
+
primaryTokenAmount = await this.convertWrapperSharesToUnderlying(
|
|
117230
|
+
this.primaryToken,
|
|
117231
|
+
baseShares,
|
|
117232
|
+
this.erc4626.baseUnderlying.decimals,
|
|
117233
|
+
"latest"
|
|
117234
|
+
);
|
|
117235
|
+
} else {
|
|
117236
|
+
primaryTokenAmount = Web3Number.fromWei(remainingBase.toString(), this.primaryToken.decimals);
|
|
117237
|
+
}
|
|
117238
|
+
let secondaryTokenAmount;
|
|
117239
|
+
if (this.erc4626.isSecondERC4626 && this.erc4626.secondUnderlying) {
|
|
117240
|
+
secondaryTokenAmount = await this.convertWrapperSharesToUnderlying(
|
|
117241
|
+
this.secondaryToken,
|
|
117242
|
+
secondShares,
|
|
117243
|
+
this.erc4626.secondUnderlying.decimals,
|
|
117244
|
+
"latest"
|
|
117245
|
+
);
|
|
117246
|
+
} else {
|
|
117247
|
+
secondaryTokenAmount = Web3Number.fromWei(totalSecondTokens.toString(), this.secondaryToken.decimals);
|
|
117248
|
+
}
|
|
117249
|
+
const displayPrimary = this.tokenForPrimaryPricing();
|
|
117250
|
+
const displaySecondary = this.tokenForSecondaryPricing();
|
|
117130
117251
|
const [primaryTokenPrice, secondaryTokenPrice] = await Promise.all([
|
|
117131
|
-
this.pricer.getPrice(
|
|
117132
|
-
this.pricer.getPrice(
|
|
117252
|
+
this.pricer.getPrice(displayPrimary.symbol),
|
|
117253
|
+
this.pricer.getPrice(displaySecondary.symbol)
|
|
117133
117254
|
]);
|
|
117134
117255
|
const primaryTokenUsd = primaryTokenAmount.multipliedBy(primaryTokenPrice.price);
|
|
117135
117256
|
const secondaryTokenUsd = secondaryTokenAmount.multipliedBy(secondaryTokenPrice.price);
|
|
117136
117257
|
return [{
|
|
117137
117258
|
amount: primaryTokenAmount,
|
|
117138
117259
|
usdValue: primaryTokenUsd.toNumber(),
|
|
117139
|
-
token:
|
|
117260
|
+
token: displayPrimary,
|
|
117140
117261
|
remarks: "Remaining deposit tokens in the Vault"
|
|
117141
117262
|
}, {
|
|
117142
117263
|
amount: secondaryTokenAmount,
|
|
117143
117264
|
usdValue: secondaryTokenUsd.toNumber(),
|
|
117144
|
-
token:
|
|
117265
|
+
token: displaySecondary,
|
|
117145
117266
|
remarks: "Total swapped tokens in the Vault"
|
|
117146
117267
|
}];
|
|
117147
117268
|
}
|
|
117148
117269
|
async getTVL() {
|
|
117149
117270
|
try {
|
|
117271
|
+
const displayPrimary = this.tokenForPrimaryPricing();
|
|
117272
|
+
const displaySecondary = this.tokenForSecondaryPricing();
|
|
117150
117273
|
const [vaultStatus, primaryTokenPrice, secondaryTokenPrice] = await Promise.all([
|
|
117151
117274
|
this.getVaultStatus(),
|
|
117152
|
-
this.pricer.getPrice(
|
|
117153
|
-
this.pricer.getPrice(
|
|
117275
|
+
this.pricer.getPrice(displayPrimary.symbol),
|
|
117276
|
+
this.pricer.getPrice(displaySecondary.symbol)
|
|
117154
117277
|
]);
|
|
117155
117278
|
const {
|
|
117156
117279
|
remaining_base: remainingBase,
|
|
117157
117280
|
total_second_tokens: totalSecondTokens
|
|
117158
117281
|
} = vaultStatus;
|
|
117159
|
-
let primaryTokenAmount
|
|
117160
|
-
|
|
117282
|
+
let primaryTokenAmount;
|
|
117283
|
+
if (this.erc4626.isBaseERC4626 && this.erc4626.baseUnderlying) {
|
|
117284
|
+
primaryTokenAmount = await this.convertWrapperSharesToUnderlying(
|
|
117285
|
+
this.primaryToken,
|
|
117286
|
+
BigInt(remainingBase.toString()),
|
|
117287
|
+
this.erc4626.baseUnderlying.decimals,
|
|
117288
|
+
"latest"
|
|
117289
|
+
);
|
|
117290
|
+
} else {
|
|
117291
|
+
primaryTokenAmount = Web3Number.fromWei(remainingBase.toString(), this.primaryToken.decimals);
|
|
117292
|
+
}
|
|
117293
|
+
let secondaryTokenAmount;
|
|
117294
|
+
if (this.erc4626.isSecondERC4626 && this.erc4626.secondUnderlying) {
|
|
117295
|
+
secondaryTokenAmount = await this.convertWrapperSharesToUnderlying(
|
|
117296
|
+
this.secondaryToken,
|
|
117297
|
+
BigInt(totalSecondTokens.toString()),
|
|
117298
|
+
this.erc4626.secondUnderlying.decimals,
|
|
117299
|
+
"latest"
|
|
117300
|
+
);
|
|
117301
|
+
} else {
|
|
117302
|
+
secondaryTokenAmount = Web3Number.fromWei(totalSecondTokens.toString(), this.secondaryToken.decimals);
|
|
117303
|
+
}
|
|
117304
|
+
const pDec = displayPrimary.decimals;
|
|
117305
|
+
const sDec = displaySecondary.decimals;
|
|
117161
117306
|
const primaryTokenUsd = new Web3Number(
|
|
117162
|
-
primaryTokenAmount.toFixed(
|
|
117163
|
-
|
|
117307
|
+
primaryTokenAmount.toFixed(pDec),
|
|
117308
|
+
pDec
|
|
117164
117309
|
).multipliedBy(primaryTokenPrice.price);
|
|
117165
117310
|
const secondaryTokenUsd = new Web3Number(
|
|
117166
|
-
secondaryTokenAmount.toFixed(
|
|
117167
|
-
|
|
117311
|
+
secondaryTokenAmount.toFixed(sDec),
|
|
117312
|
+
sDec
|
|
117168
117313
|
).multipliedBy(secondaryTokenPrice.price);
|
|
117169
117314
|
return {
|
|
117170
117315
|
usdValue: primaryTokenUsd.plus(secondaryTokenUsd).toNumber(),
|
|
117171
117316
|
token0: {
|
|
117172
|
-
tokenInfo:
|
|
117317
|
+
tokenInfo: displayPrimary,
|
|
117173
117318
|
amount: primaryTokenAmount,
|
|
117174
117319
|
usdValue: primaryTokenUsd.toNumber()
|
|
117175
117320
|
},
|
|
117176
117321
|
token1: {
|
|
117177
|
-
tokenInfo:
|
|
117322
|
+
tokenInfo: displaySecondary,
|
|
117178
117323
|
amount: secondaryTokenAmount,
|
|
117179
117324
|
usdValue: secondaryTokenUsd.toNumber()
|
|
117180
117325
|
}
|
|
@@ -117184,13 +117329,13 @@ spurious results.`);
|
|
|
117184
117329
|
return {
|
|
117185
117330
|
usdValue: 0,
|
|
117186
117331
|
token0: {
|
|
117187
|
-
tokenInfo: this.
|
|
117188
|
-
amount: new Web3Number("0", this.
|
|
117332
|
+
tokenInfo: this.tokenForPrimaryPricing(),
|
|
117333
|
+
amount: new Web3Number("0", this.primaryAmountDecimals()),
|
|
117189
117334
|
usdValue: 0
|
|
117190
117335
|
},
|
|
117191
117336
|
token1: {
|
|
117192
|
-
tokenInfo: this.
|
|
117193
|
-
amount: new Web3Number("0", this.
|
|
117337
|
+
tokenInfo: this.tokenForSecondaryPricing(),
|
|
117338
|
+
amount: new Web3Number("0", this.secondaryAmountDecimals()),
|
|
117194
117339
|
usdValue: 0
|
|
117195
117340
|
}
|
|
117196
117341
|
};
|
|
@@ -117198,6 +117343,21 @@ spurious results.`);
|
|
|
117198
117343
|
}
|
|
117199
117344
|
async depositCall(amountInfo, receiver) {
|
|
117200
117345
|
try {
|
|
117346
|
+
if (this.erc4626.isBaseERC4626) {
|
|
117347
|
+
if (!this.erc4626.baseUnderlying) {
|
|
117348
|
+
throw new Error("baseUnderlying missing for ERC-4626 base YOLO vault");
|
|
117349
|
+
}
|
|
117350
|
+
const approvalCall2 = new ERC20(this.config).approve(
|
|
117351
|
+
this.erc4626.baseUnderlying.address.address,
|
|
117352
|
+
this.address.address,
|
|
117353
|
+
amountInfo.amount
|
|
117354
|
+
);
|
|
117355
|
+
const depositCall2 = this.contract.populate("deposit_combined", [
|
|
117356
|
+
uint256_exports.bnToUint256(amountInfo.amount.toWei()),
|
|
117357
|
+
receiver.address
|
|
117358
|
+
]);
|
|
117359
|
+
return [approvalCall2, depositCall2];
|
|
117360
|
+
}
|
|
117201
117361
|
const primaryToken = amountInfo.tokenInfo;
|
|
117202
117362
|
const approvalCall = new ERC20(this.config).approve(primaryToken.address.address, this.address.address, amountInfo.amount);
|
|
117203
117363
|
const depositCall = this.contract.populate("deposit", [
|
|
@@ -117232,7 +117392,7 @@ spurious results.`);
|
|
|
117232
117392
|
secondaryTokenAmountToWithdraw
|
|
117233
117393
|
} = withdrawRequest;
|
|
117234
117394
|
if (baseTokenAmountToWithdraw > 0) {
|
|
117235
|
-
const secondaryTokenAmount = redeemableSecondaryTokenAmount.dividedBy(10 ** this.
|
|
117395
|
+
const secondaryTokenAmount = redeemableSecondaryTokenAmount.dividedBy(10 ** this.secondaryAmountDecimals()).multipliedBy(sharesUsedFactor);
|
|
117236
117396
|
return {
|
|
117237
117397
|
token0: {
|
|
117238
117398
|
tokenInfo: amountInfo.token0.tokenInfo,
|
|
@@ -117244,7 +117404,7 @@ spurious results.`);
|
|
|
117244
117404
|
}
|
|
117245
117405
|
};
|
|
117246
117406
|
}
|
|
117247
|
-
const baseTokenAmount = redeemableBaseTokenAmount.dividedBy(10 ** this.
|
|
117407
|
+
const baseTokenAmount = redeemableBaseTokenAmount.dividedBy(10 ** this.primaryAmountDecimals()).multipliedBy(sharesUsedFactor);
|
|
117248
117408
|
return {
|
|
117249
117409
|
token0: {
|
|
117250
117410
|
tokenInfo: amountInfo.token0.tokenInfo,
|
|
@@ -117274,7 +117434,8 @@ spurious results.`);
|
|
|
117274
117434
|
throw new Error("Invalid amount info");
|
|
117275
117435
|
}
|
|
117276
117436
|
const requiredShares = userShares.multipliedBy(withdrawRequest.sharesUsedFactor).floor();
|
|
117277
|
-
|
|
117437
|
+
const redeemFn = this.erc4626.isBaseERC4626 ? "redeem_combined" : "redeem";
|
|
117438
|
+
let withdrawCall = this.contract.populate(redeemFn, [
|
|
117278
117439
|
uint256_exports.bnToUint256(requiredShares.toString()),
|
|
117279
117440
|
receiver.address
|
|
117280
117441
|
]);
|
|
@@ -117298,8 +117459,8 @@ spurious results.`);
|
|
|
117298
117459
|
}
|
|
117299
117460
|
async getUserPositionCards(input) {
|
|
117300
117461
|
const userTVL = await this.getUserTVL(input.user);
|
|
117301
|
-
const holdingsTitle = `${this.
|
|
117302
|
-
const earningsTitle = `${this.
|
|
117462
|
+
const holdingsTitle = `${this.tokenForPrimaryPricing().symbol} Left`;
|
|
117463
|
+
const earningsTitle = `${this.tokenForSecondaryPricing().symbol} Accumulated`;
|
|
117303
117464
|
const cards = [
|
|
117304
117465
|
{
|
|
117305
117466
|
title: "Your Holdings",
|
|
@@ -117308,14 +117469,14 @@ spurious results.`);
|
|
|
117308
117469
|
},
|
|
117309
117470
|
{
|
|
117310
117471
|
title: holdingsTitle,
|
|
117311
|
-
tooltip: `Amount of ${this.
|
|
117472
|
+
tooltip: `Amount of ${this.tokenForPrimaryPricing().symbol} left in the vault, waiting to be swapped`,
|
|
117312
117473
|
value: this.formatTokenAmountForCard(userTVL.token0.amount, userTVL.token0.tokenInfo),
|
|
117313
117474
|
subValue: `\u2248 ${this.formatUSDForCard(userTVL.token0.usdValue)}`,
|
|
117314
117475
|
subValueColor: "positive"
|
|
117315
117476
|
},
|
|
117316
117477
|
{
|
|
117317
117478
|
title: earningsTitle,
|
|
117318
|
-
tooltip: `Amount of ${this.
|
|
117479
|
+
tooltip: `Amount of ${this.tokenForSecondaryPricing().symbol} accumulated in the vault`,
|
|
117319
117480
|
value: this.formatTokenAmountForCard(userTVL.token1.amount, userTVL.token1.tokenInfo),
|
|
117320
117481
|
subValue: `\u2248 ${this.formatUSDForCard(userTVL.token1.usdValue)}`,
|
|
117321
117482
|
subValueColor: "default"
|
|
@@ -117466,18 +117627,45 @@ spurious results.`);
|
|
|
117466
117627
|
description,
|
|
117467
117628
|
vaultTypeDescription: vaultTypeDescription2,
|
|
117468
117629
|
faqs: faqs3,
|
|
117469
|
-
investmentSteps: investmentSteps2
|
|
117630
|
+
investmentSteps: investmentSteps2,
|
|
117631
|
+
parentTitle: `${secondary} YOLO`
|
|
117470
117632
|
};
|
|
117471
117633
|
};
|
|
117472
117634
|
var usdc = Global.getDefaultTokens().find((t) => t.symbol === "USDC");
|
|
117473
117635
|
var wbtc = Global.getDefaultTokens().find((t) => t.symbol === "WBTC");
|
|
117474
|
-
var
|
|
117475
|
-
|
|
117476
|
-
|
|
117477
|
-
|
|
117478
|
-
|
|
117479
|
-
|
|
117480
|
-
|
|
117636
|
+
var xSTRK = Global.getDefaultTokens().find((t) => t.symbol === "xSTRK");
|
|
117637
|
+
var xWBTC = Global.getDefaultTokens().find((t) => t.symbol === "xWBTC");
|
|
117638
|
+
var vesuPrimeUSDC = {
|
|
117639
|
+
address: ContractAddr.from("0x00387e8ddbb1ab36ca08874d9abc702ef4872ad600dcf76b7f240b71d7bc4e65"),
|
|
117640
|
+
symbol: "vUSDC",
|
|
117641
|
+
name: "Vesu Prime USDC",
|
|
117642
|
+
decimals: 18,
|
|
117643
|
+
logo: usdc.logo,
|
|
117644
|
+
displayDecimals: 2
|
|
117645
|
+
};
|
|
117646
|
+
var strk = Global.getDefaultTokens().find((t) => t.symbol === "STRK");
|
|
117647
|
+
function getYoloVaultErc4626Config(mainToken, secondaryToken) {
|
|
117648
|
+
const isVesuPrime = mainToken.address.address.toLowerCase() === vesuPrimeUSDC.address.address.toLowerCase();
|
|
117649
|
+
if (isVesuPrime && secondaryToken.symbol.startsWith("x")) {
|
|
117650
|
+
const secondUnderlying = secondaryToken.symbol === "xWBTC" ? wbtc : secondaryToken.symbol === "xSTRK" ? strk : void 0;
|
|
117651
|
+
if (!secondUnderlying) {
|
|
117652
|
+
throw new Error(
|
|
117653
|
+
`YOLO vault: unsupported x-token ${secondaryToken.symbol} for Vesu Prime USDC pair`
|
|
117654
|
+
);
|
|
117655
|
+
}
|
|
117656
|
+
return {
|
|
117657
|
+
isBaseERC4626: true,
|
|
117658
|
+
isSecondERC4626: true,
|
|
117659
|
+
baseUnderlying: usdc,
|
|
117660
|
+
secondUnderlying
|
|
117661
|
+
};
|
|
117662
|
+
}
|
|
117663
|
+
return {
|
|
117664
|
+
isBaseERC4626: false,
|
|
117665
|
+
isSecondERC4626: false
|
|
117666
|
+
};
|
|
117667
|
+
}
|
|
117668
|
+
var vaultCommonProperties = {
|
|
117481
117669
|
totalEpochs: 1206407,
|
|
117482
117670
|
minEpochDurationSeconds: 21600,
|
|
117483
117671
|
feeBps: 50,
|
|
@@ -117489,14 +117677,61 @@ spurious results.`);
|
|
|
117489
117677
|
{ maxPrice: 5e4, spendPercent: 500 }
|
|
117490
117678
|
]
|
|
117491
117679
|
};
|
|
117492
|
-
var
|
|
117680
|
+
var wbtc_parent = "wbtc-yolo";
|
|
117681
|
+
var xstrk_parent = "xstrk-yolo";
|
|
117682
|
+
var yoloVaultsConfig = [
|
|
117683
|
+
{
|
|
117684
|
+
address: ContractAddr.from("0x018ccdff25a642e211f86ace35ba282ebdf342330319ead98cae37258bc9cce1"),
|
|
117685
|
+
mainToken: usdc,
|
|
117686
|
+
secondaryToken: wbtc,
|
|
117687
|
+
startDate: "03-MAR-2026",
|
|
117688
|
+
expiryDate: "31-DEC-2026",
|
|
117689
|
+
id: `btc-yolo-31-dec-2026`,
|
|
117690
|
+
...vaultCommonProperties,
|
|
117691
|
+
parent_id: wbtc_parent
|
|
117692
|
+
},
|
|
117693
|
+
{
|
|
117694
|
+
address: ContractAddr.from("0x3381380c6cca17c2a20e1167a362d5b939e392311cbcdf2016f9c7c7a23a801"),
|
|
117695
|
+
mainToken: vesuPrimeUSDC,
|
|
117696
|
+
secondaryToken: xWBTC,
|
|
117697
|
+
startDate: "03-APR-2026",
|
|
117698
|
+
expiryDate: "31-MAY-2026",
|
|
117699
|
+
id: `vusdc-xwbct-yolo-31-may-2026`,
|
|
117700
|
+
...vaultCommonProperties,
|
|
117701
|
+
parent_id: wbtc_parent
|
|
117702
|
+
},
|
|
117703
|
+
{
|
|
117704
|
+
address: ContractAddr.from("0x60c8466549a8e51eed0e8c38243fdb57d173c96cfdd4375b49ad1e338ff893"),
|
|
117705
|
+
mainToken: vesuPrimeUSDC,
|
|
117706
|
+
secondaryToken: xSTRK,
|
|
117707
|
+
startDate: "03-APR-2026",
|
|
117708
|
+
expiryDate: "31-MAR-2027",
|
|
117709
|
+
id: `xstrk-yolo-31-mar-2027`,
|
|
117710
|
+
...vaultCommonProperties,
|
|
117711
|
+
parent_id: xstrk_parent
|
|
117712
|
+
},
|
|
117713
|
+
{
|
|
117714
|
+
address: ContractAddr.from("0x62499970196772c18ccf1da09910ece11d85d5df3e8f6d6e41b4d158fcb8e79"),
|
|
117715
|
+
mainToken: vesuPrimeUSDC,
|
|
117716
|
+
secondaryToken: xSTRK,
|
|
117717
|
+
startDate: "03-APR-2026",
|
|
117718
|
+
expiryDate: "30-JUN-2026",
|
|
117719
|
+
id: `xstrk-yolo-30-jun-2026`,
|
|
117720
|
+
...vaultCommonProperties,
|
|
117721
|
+
parent_id: xstrk_parent
|
|
117722
|
+
}
|
|
117723
|
+
];
|
|
117493
117724
|
var yoloRiskFactors = [];
|
|
117494
|
-
var YoloVaultStrategies =
|
|
117495
|
-
|
|
117496
|
-
|
|
117725
|
+
var YoloVaultStrategies = yoloVaultsConfig.map((yoloConfig) => {
|
|
117726
|
+
const yoloCopy = getYoloVaultCopy(yoloConfig);
|
|
117727
|
+
const erc4626Cfg = getYoloVaultErc4626Config(yoloConfig.mainToken, yoloConfig.secondaryToken);
|
|
117728
|
+
return {
|
|
117729
|
+
id: yoloConfig.id,
|
|
117497
117730
|
name: yoloCopy.title,
|
|
117731
|
+
parentName: yoloCopy.parentTitle,
|
|
117732
|
+
parentId: yoloConfig.parent_id,
|
|
117498
117733
|
description: yoloCopy.description,
|
|
117499
|
-
address:
|
|
117734
|
+
address: yoloConfig.address,
|
|
117500
117735
|
vaultType: {
|
|
117501
117736
|
type: "Troves Value Averaging" /* TVA */,
|
|
117502
117737
|
description: yoloCopy.vaultTypeDescription
|
|
@@ -117523,8 +117758,8 @@ spurious results.`);
|
|
|
117523
117758
|
launchBlock: 0,
|
|
117524
117759
|
type: "Other",
|
|
117525
117760
|
depositTokens: [
|
|
117526
|
-
|
|
117527
|
-
|
|
117761
|
+
yoloConfig.mainToken,
|
|
117762
|
+
yoloConfig.secondaryToken
|
|
117528
117763
|
],
|
|
117529
117764
|
protocols: [],
|
|
117530
117765
|
risk: {
|
|
@@ -117532,16 +117767,23 @@ spurious results.`);
|
|
|
117532
117767
|
netRisk: 0,
|
|
117533
117768
|
notARisks: getNoRiskTags(yoloRiskFactors)
|
|
117534
117769
|
},
|
|
117770
|
+
apyMethodology: "Not a primary yield strategy. Funds earn yield when idle, but the main return comes from BTC price appreciation and your conviction to hold. This vault simply helps you accumulate more BTC.",
|
|
117535
117771
|
additionalInfo: {
|
|
117536
|
-
mainToken:
|
|
117537
|
-
secondaryToken:
|
|
117538
|
-
startDate:
|
|
117539
|
-
expiryDate:
|
|
117540
|
-
totalEpochs:
|
|
117541
|
-
minEpochDurationSeconds:
|
|
117542
|
-
spendingLevels:
|
|
117543
|
-
feeBps:
|
|
117772
|
+
mainToken: yoloConfig.mainToken,
|
|
117773
|
+
secondaryToken: yoloConfig.secondaryToken,
|
|
117774
|
+
startDate: yoloConfig.startDate,
|
|
117775
|
+
expiryDate: yoloConfig.expiryDate,
|
|
117776
|
+
totalEpochs: yoloConfig.totalEpochs,
|
|
117777
|
+
minEpochDurationSeconds: yoloConfig.minEpochDurationSeconds,
|
|
117778
|
+
spendingLevels: yoloConfig.spendingLevels,
|
|
117779
|
+
feeBps: yoloConfig.feeBps,
|
|
117544
117780
|
// swap fee bps
|
|
117781
|
+
isBaseERC4626: erc4626Cfg.isBaseERC4626,
|
|
117782
|
+
isSecondERC4626: erc4626Cfg.isSecondERC4626,
|
|
117783
|
+
...erc4626Cfg.isBaseERC4626 && erc4626Cfg.baseUnderlying && erc4626Cfg.secondUnderlying ? {
|
|
117784
|
+
baseUnderlying: erc4626Cfg.baseUnderlying,
|
|
117785
|
+
secondUnderlying: erc4626Cfg.secondUnderlying
|
|
117786
|
+
} : {}
|
|
117545
117787
|
},
|
|
117546
117788
|
faqs: yoloCopy.faqs,
|
|
117547
117789
|
contractDetails: [],
|
|
@@ -117549,7 +117791,7 @@ spurious results.`);
|
|
|
117549
117791
|
settings: {
|
|
117550
117792
|
liveStatus: "Hot & New \u{1F525}" /* HOT */,
|
|
117551
117793
|
isAudited: false,
|
|
117552
|
-
quoteToken:
|
|
117794
|
+
quoteToken: erc4626Cfg.isBaseERC4626 && erc4626Cfg.baseUnderlying ? erc4626Cfg.baseUnderlying : yoloConfig.mainToken,
|
|
117553
117795
|
isTransactionHistDisabled: true,
|
|
117554
117796
|
maxTVL: new Web3Number("200000", 6)
|
|
117555
117797
|
},
|
|
@@ -117557,8 +117799,8 @@ spurious results.`);
|
|
|
117557
117799
|
showApyHistory: false,
|
|
117558
117800
|
noApyHistoryMessage: "APY history is hidden because this is a TVA accumulation vault, not a yield-bearing APY strategy."
|
|
117559
117801
|
}
|
|
117560
|
-
}
|
|
117561
|
-
|
|
117802
|
+
};
|
|
117803
|
+
});
|
|
117562
117804
|
|
|
117563
117805
|
// src/strategies/universal-adapters/common-adapter.ts
|
|
117564
117806
|
var CommonAdapter = class extends BaseAdapter {
|