diff --git a/projects/portal/editions/ununifi/launch/ununifi/firebase-hosting/config.js b/projects/portal/editions/ununifi/launch/ununifi/firebase-hosting/config.js index d7f388c25..f59a9c9e9 100644 --- a/projects/portal/editions/ununifi/launch/ununifi/firebase-hosting/config.js +++ b/projects/portal/editions/ununifi/launch/ununifi/firebase-hosting/config.js @@ -240,6 +240,7 @@ const strategiesInfo = [ name: 'Osmosis ATOM/OSMO LP Strategy', description: '', gitUrl: '', + unbondingTimeSec: '1209600', poolInfo: { type: 'osmosis', poolId: '1', @@ -252,6 +253,7 @@ const strategiesInfo = [ name: 'Osmosis stATOM/ATOM Strategy (ATOM deposit)', description: '', gitUrl: '', + unbondingTimeSec: '1209600', poolInfo: { type: 'osmosis', poolId: '803', @@ -263,6 +265,7 @@ const strategiesInfo = [ name: 'Osmosis ATOM/OSMO strategy (OSMO deposit)', description: '', gitUrl: '', + unbondingTimeSec: '1209600', poolInfo: { type: 'osmosis', poolId: '1', @@ -274,6 +277,7 @@ const strategiesInfo = [ name: 'Osmosis AKT/OSMO strategy (OSMO deposit)', description: '', gitUrl: '', + unbondingTimeSec: '1209600', poolInfo: { type: 'osmosis', poolId: '3', diff --git a/projects/portal/src/app/models/config.service.ts b/projects/portal/src/app/models/config.service.ts index fa74b0177..c8761cb48 100644 --- a/projects/portal/src/app/models/config.service.ts +++ b/projects/portal/src/app/models/config.service.ts @@ -22,7 +22,7 @@ export type Config = { }[]; apps: AppNavigation[]; denomMetadata: cosmosclient.proto.cosmos.bank.v1beta1.IMetadata[]; - strategiesInfo: YieldInfo[]; + strategiesInfo: StrategyInfo[]; certifiedVaults: string[]; externalChains: ChainInfo[]; extension?: { @@ -59,7 +59,7 @@ export type AppNavigation = { icon: string; }; -export type YieldInfo = { +export type StrategyInfo = { id: string; denom?: string; name?: string; @@ -68,6 +68,7 @@ export type YieldInfo = { minApy: number; maxApy?: number; certainty: boolean; + unbondingTimeSec?: string; poolInfo?: | { type: 'osmosis'; diff --git a/projects/portal/src/app/models/yield-aggregators/yield-aggregator.model.ts b/projects/portal/src/app/models/yield-aggregators/yield-aggregator.model.ts index a72f3f93d..d8e20b602 100644 --- a/projects/portal/src/app/models/yield-aggregators/yield-aggregator.model.ts +++ b/projects/portal/src/app/models/yield-aggregators/yield-aggregator.model.ts @@ -1,3 +1,5 @@ +import { StrategyInfo } from '../config.service'; + export type DepositToVaultRequest = { vaultId: string; denom: string; @@ -35,3 +37,15 @@ export type TransferVaultRequest = { vaultId: string; recipientAddress: string; }; + +export type VaultInfo = { + id: string; + symbol?: string; + name?: string; + description?: string; + gitUrl?: string; + minApy: number; + maxApy?: number; + certainty: boolean; + poolInfos: (StrategyInfo & { weight?: string })[]; +}; diff --git a/projects/portal/src/app/models/yield-aggregators/yield-aggregator.service.ts b/projects/portal/src/app/models/yield-aggregators/yield-aggregator.service.ts index 064e99b79..ba8918538 100644 --- a/projects/portal/src/app/models/yield-aggregators/yield-aggregator.service.ts +++ b/projects/portal/src/app/models/yield-aggregators/yield-aggregator.service.ts @@ -1,10 +1,11 @@ -import { Config, YieldInfo } from '../config.service'; +import { Config, StrategyInfo } from '../config.service'; import { getDenomExponent } from '../cosmos/bank.model'; import { BankQueryService } from '../cosmos/bank.query.service'; import { BankService } from '../cosmos/bank.service'; import { TxCommonService } from '../cosmos/tx-common.service'; import { OsmosisPoolAPRs } from './osmosis/osmosis-pool.model'; import { OsmosisPoolService } from './osmosis/osmosis-pool.service'; +import { VaultInfo } from './yield-aggregator.model'; import { Injectable } from '@angular/core'; import cosmosclient from '@cosmos-client/core'; import Long from 'long'; @@ -183,7 +184,7 @@ export class YieldAggregatorService { ); } - async getStrategyAPR(strategyInfo?: YieldInfo): Promise { + async getStrategyAPR(strategyInfo?: StrategyInfo): Promise { if (!strategyInfo) { return { totalAPR: 0 }; } @@ -201,7 +202,7 @@ export class YieldAggregatorService { return { totalAPR: strategyInfo.minApy }; } - async getStrategySuperfluidAPR(strategyInfo?: YieldInfo): Promise { + async getStrategySuperfluidAPR(strategyInfo?: StrategyInfo): Promise { if (!strategyInfo) { return; } @@ -213,22 +214,18 @@ export class YieldAggregatorService { return; } - async calcVaultAPY(vault: Vault200Response, config: Config): Promise { + async calcVaultAPY(vault: Vault200Response, config: Config): Promise { if (!vault.vault?.strategy_weights) { return { id: vault.vault?.id || '', - denom: vault.vault?.symbol || '', - name: vault.vault?.name || '', - description: vault.vault?.description || '', - gitURL: '', minApy: 0, - maxApy: 0, certainty: false, - poolInfo: { type: 'osmosis', poolId: '' }, + poolInfos: [], }; } let vaultAPY = 0; let vaultAPYCertainty = false; + let poolInfos: (StrategyInfo & { weight?: string })[] = []; for (const strategyWeight of vault.vault.strategy_weights) { const strategyInfo = config?.strategiesInfo?.find( @@ -241,6 +238,7 @@ export class YieldAggregatorService { } const poolInfo = strategyInfo.poolInfo; if (poolInfo.type === 'osmosis') { + poolInfos.push({ ...strategyInfo, weight: strategyWeight.weight }); if (poolInfo.apr) { vaultAPY += poolInfo.apr * Number(strategyWeight.weight); continue; @@ -252,14 +250,13 @@ export class YieldAggregatorService { return { id: vault.vault?.id || '', - denom: vault.vault?.symbol || '', - name: vault.vault?.name || '', - description: vault.vault?.description || '', - gitURL: '', + symbol: vault.vault?.symbol, + name: vault.vault?.name, + description: vault.vault?.description, minApy: vaultAPY, maxApy: vaultAPY, certainty: vaultAPYCertainty, - poolInfo: { type: 'osmosis', poolId: '' }, + poolInfos, }; } } diff --git a/projects/portal/src/app/pages/yieldaggregator/strategies/strategy/strategy.component.ts b/projects/portal/src/app/pages/yieldaggregator/strategies/strategy/strategy.component.ts index b13c04732..fd4487c38 100644 --- a/projects/portal/src/app/pages/yieldaggregator/strategies/strategy/strategy.component.ts +++ b/projects/portal/src/app/pages/yieldaggregator/strategies/strategy/strategy.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import cosmosclient from '@cosmos-client/core'; -import { ConfigService, YieldInfo } from 'projects/portal/src/app/models/config.service'; +import { ConfigService, StrategyInfo } from 'projects/portal/src/app/models/config.service'; import { BankQueryService } from 'projects/portal/src/app/models/cosmos/bank.query.service'; import { OsmosisPoolAPRs } from 'projects/portal/src/app/models/yield-aggregators/osmosis/osmosis-pool.model'; import { YieldAggregatorQueryService } from 'projects/portal/src/app/models/yield-aggregators/yield-aggregator.query.service'; @@ -28,7 +28,7 @@ export class StrategyComponent implements OnInit { strategy$: Observable; vaults$: Observable; weights$: Observable<(string | undefined)[]>; - strategyInfo$: Observable; + strategyInfo$: Observable; strategyAPR$: Observable; constructor( diff --git a/projects/portal/src/app/pages/yieldaggregator/vaults/vault/vault.component.ts b/projects/portal/src/app/pages/yieldaggregator/vaults/vault/vault.component.ts index 1771ec287..a8cdd8723 100644 --- a/projects/portal/src/app/pages/yieldaggregator/vaults/vault/vault.component.ts +++ b/projects/portal/src/app/pages/yieldaggregator/vaults/vault/vault.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import cosmosclient from '@cosmos-client/core'; import { BandProtocolService } from 'projects/portal/src/app/models/band-protocols/band-protocol.service'; -import { ConfigService, YieldInfo } from 'projects/portal/src/app/models/config.service'; +import { ConfigService } from 'projects/portal/src/app/models/config.service'; import { getDenomExponent } from 'projects/portal/src/app/models/cosmos/bank.model'; import { BankQueryService } from 'projects/portal/src/app/models/cosmos/bank.query.service'; import { WalletApplicationService } from 'projects/portal/src/app/models/wallets/wallet.application.service'; @@ -11,6 +11,7 @@ import { WalletService } from 'projects/portal/src/app/models/wallets/wallet.ser import { YieldAggregatorApplicationService } from 'projects/portal/src/app/models/yield-aggregators/yield-aggregator.application.service'; import { DepositToVaultRequest, + VaultInfo, WithdrawFromVaultRequest, WithdrawFromVaultWithUnbondingRequest, } from 'projects/portal/src/app/models/yield-aggregators/yield-aggregator.model'; @@ -53,7 +54,7 @@ export class VaultComponent implements OnInit { estimatedDepositedAmount$: Observable; vaultBalance$: Observable; usdDepositAmount$: Observable; - vaultInfo$: Observable; + vaultInfo$: Observable; externalWalletAddress: string | undefined; constructor( diff --git a/projects/portal/src/app/pages/yieldaggregator/vaults/vaults.component.ts b/projects/portal/src/app/pages/yieldaggregator/vaults/vaults.component.ts index 9f551ac77..db02def04 100644 --- a/projects/portal/src/app/pages/yieldaggregator/vaults/vaults.component.ts +++ b/projects/portal/src/app/pages/yieldaggregator/vaults/vaults.component.ts @@ -1,8 +1,9 @@ import { BandProtocolService } from '../../../models/band-protocols/band-protocol.service'; -import { ConfigService, YieldInfo } from '../../../models/config.service'; +import { ConfigService } from '../../../models/config.service'; import { BankQueryService } from '../../../models/cosmos/bank.query.service'; import { StoredWallet } from '../../../models/wallets/wallet.model'; import { WalletService } from '../../../models/wallets/wallet.service'; +import { VaultInfo } from '../../../models/yield-aggregators/yield-aggregator.model'; import { YieldAggregatorQueryService } from '../../../models/yield-aggregators/yield-aggregator.query.service'; import { YieldAggregatorService } from '../../../models/yield-aggregators/yield-aggregator.service'; import { Component, OnInit } from '@angular/core'; @@ -20,7 +21,7 @@ export class VaultsComponent implements OnInit { address$: Observable; vaults$: Observable; symbols$: Observable<{ symbol: string; display: string; img: string }[]>; - vaultsInfo$: Observable; + vaultsInfo$: Observable; totalDeposits$: Observable; keyword$: Observable; sortType$: BehaviorSubject = new BehaviorSubject('id'); @@ -46,7 +47,7 @@ export class VaultsComponent implements OnInit { const symbolMetadataMap$ = this.bankQuery.getSymbolMetadataMap$(); const vaultYieldMap$ = combineLatest([vaults$, config$]).pipe( switchMap(async ([vaults, config]) => { - const results: YieldInfo[] = []; + const results: VaultInfo[] = []; if (!config) { return results; } @@ -57,7 +58,7 @@ export class VaultsComponent implements OnInit { return results; }), map((yields) => { - const yieldMap: { [id: string]: YieldInfo } = {}; + const yieldMap: { [id: string]: VaultInfo } = {}; for (const y of yields) { yieldMap[y.id] = y; } diff --git a/projects/portal/src/app/views/yieldaggregator/strategies/strategy/strategy.component.html b/projects/portal/src/app/views/yieldaggregator/strategies/strategy/strategy.component.html index c7f0c999b..4f7313901 100644 --- a/projects/portal/src/app/views/yieldaggregator/strategies/strategy/strategy.component.html +++ b/projects/portal/src/app/views/yieldaggregator/strategies/strategy/strategy.component.html @@ -57,6 +57,10 @@

}} + + Unbonding time + {{ strategyInfo?.unbondingTimeSec | secondToDate }} Days + diff --git a/projects/portal/src/app/views/yieldaggregator/strategies/strategy/strategy.component.ts b/projects/portal/src/app/views/yieldaggregator/strategies/strategy/strategy.component.ts index 869fde069..b41d3f327 100644 --- a/projects/portal/src/app/views/yieldaggregator/strategies/strategy/strategy.component.ts +++ b/projects/portal/src/app/views/yieldaggregator/strategies/strategy/strategy.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnChanges, OnInit } from '@angular/core'; import cosmosclient from '@cosmos-client/core'; -import { YieldInfo } from 'projects/portal/src/app/models/config.service'; +import { StrategyInfo } from 'projects/portal/src/app/models/config.service'; import { OsmosisPoolAPRs } from 'projects/portal/src/app/models/yield-aggregators/osmosis/osmosis-pool.model'; import { StrategyAll200ResponseStrategiesInner, @@ -30,7 +30,7 @@ export class StrategyComponent implements OnInit, OnChanges { @Input() weights?: (string | undefined)[] | null; @Input() - strategyInfo?: YieldInfo | null; + strategyInfo?: StrategyInfo | null; @Input() strategyAPR?: OsmosisPoolAPRs | null; diff --git a/projects/portal/src/app/views/yieldaggregator/vaults/vault/vault.component.html b/projects/portal/src/app/views/yieldaggregator/vaults/vault/vault.component.html index 5e4e6cf29..b113a51c7 100644 --- a/projects/portal/src/app/views/yieldaggregator/vaults/vault/vault.component.html +++ b/projects/portal/src/app/views/yieldaggregator/vaults/vault/vault.component.html @@ -109,32 +109,6 @@

What is the withdrawal reserve rate?

{{ vault?.vault?.withdraw_reserve_rate | percent : '1.0-2' }} - @@ -378,6 +352,44 @@

Chain that you deposit from

+
+ + + + Available balance: + + +
+
- -
-
- - - - Available balance: - - +
+ +
+
+ +

{{ option.name }}

+

{{ option.description }}

+
+

+ +

+ + + + + + + + + +
{{ pool.unbondingTimeSec | secondToDate }} Days{{ pool.weight | percent : '1.0-2' }}
+
+
+
+ Redeem: {{ estimatedRedeemAmount?.total_amount | coinAmount }} + {{ vault?.vault?.symbol }} +
+
-
+
+ Fee: 0 {{ vault?.vault?.symbol }} +
+
+ Fee: {{ estimatedRedeemAmount?.fee | coinAmount }} + {{ vault?.vault?.symbol }} +
+
+
+
+
OR
+
+
+
-
+
-
+