From 1bb6ca6db7654b3b2e83fd161d16f6568ab6dc15 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 14 Nov 2023 23:35:37 +0900 Subject: [PATCH 01/22] feat: package --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index c57fc7c02..7f028ec3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "tslib": "^2.3.0", - "ununifi-client": "^4.0.0-rc6", + "ununifi-client": "^4.0.0-rc7", "zone.js": "~0.11.4" }, "devDependencies": { @@ -30119,9 +30119,9 @@ } }, "node_modules/ununifi-client": { - "version": "4.0.0-rc6", - "resolved": "https://registry.npmjs.org/ununifi-client/-/ununifi-client-4.0.0-rc6.tgz", - "integrity": "sha512-Vj0LIFtYlP2oR43P3ZJpcHp0UTYdOuypcj7UVEBQVztJiLj9+hKlZ/ZVRzaq5AN4xRbItA/VROGTBmheJkOr5A==", + "version": "4.0.0-rc7", + "resolved": "https://registry.npmjs.org/ununifi-client/-/ununifi-client-4.0.0-rc7.tgz", + "integrity": "sha512-blgkXJdSPx+v1kmUTr8PjvlwAD5zla74eCLuNupvWwbb4+A/Q7EP0z38VxUF5J69L9ygpHqj3w05/33UTTpPLg==", "dependencies": { "axios": "^0.21.1", "protobufjs": "^6.11.2" @@ -50659,9 +50659,9 @@ "dev": true }, "ununifi-client": { - "version": "4.0.0-rc6", - "resolved": "https://registry.npmjs.org/ununifi-client/-/ununifi-client-4.0.0-rc6.tgz", - "integrity": "sha512-Vj0LIFtYlP2oR43P3ZJpcHp0UTYdOuypcj7UVEBQVztJiLj9+hKlZ/ZVRzaq5AN4xRbItA/VROGTBmheJkOr5A==", + "version": "4.0.0-rc7", + "resolved": "https://registry.npmjs.org/ununifi-client/-/ununifi-client-4.0.0-rc7.tgz", + "integrity": "sha512-blgkXJdSPx+v1kmUTr8PjvlwAD5zla74eCLuNupvWwbb4+A/Q7EP0z38VxUF5J69L9ygpHqj3w05/33UTTpPLg==", "requires": { "axios": "^0.21.1", "protobufjs": "^6.11.2" diff --git a/package.json b/package.json index 19a67a499..d4f568bd7 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "tslib": "^2.3.0", - "ununifi-client": "^4.0.0-rc6", + "ununifi-client": "^4.0.0-rc7", "zone.js": "~0.11.4" }, "devDependencies": { From ac7744b14536d2ae5e4cef99dde400d467bdcef8 Mon Sep 17 00:00:00 2001 From: Senna46 <29295263+Senna46@users.noreply.github.com> Date: Tue, 14 Nov 2023 23:36:10 +0900 Subject: [PATCH 02/22] feat: vault creation --- .../yield-aggregator.application.service.ts | 4 +-- .../yield-aggregator.model.ts | 2 +- .../yield-aggregator.service.ts | 14 +++++----- .../vaults/create/create.component.html | 4 +-- .../vaults/create/create.component.ts | 15 ++++++----- .../vaults/create/create.component.html | 26 +++++++------------ .../vaults/create/create.component.ts | 25 +++++++++--------- 7 files changed, 44 insertions(+), 46 deletions(-) diff --git a/projects/portal/src/app/models/yield-aggregators/yield-aggregator.application.service.ts b/projects/portal/src/app/models/yield-aggregators/yield-aggregator.application.service.ts index f7f3bc14d..f5d0fb561 100644 --- a/projects/portal/src/app/models/yield-aggregators/yield-aggregator.application.service.ts +++ b/projects/portal/src/app/models/yield-aggregators/yield-aggregator.application.service.ts @@ -125,7 +125,7 @@ export class YieldAggregatorApplicationService { async createVault( name: string, - denom: string, + symbol: string, description: string, strategies: { id: string; weight: number }[], commissionRate: number, @@ -142,7 +142,7 @@ export class YieldAggregatorApplicationService { const msg = this.yieldAggregatorService.buildMsgCreateVault( address, - denom, + symbol, name, description, strategies, 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 7058d68d6..44f26f70e 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 @@ -12,7 +12,7 @@ export type WithdrawFromVaultRequest = { export type CreateVaultRequest = { name: string; - denom: string; + symbol: string; description: string; strategies: { id: string; weight: number }[]; commissionRate: number; 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 1367ae735..ba7ab366e 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 @@ -62,7 +62,7 @@ export class YieldAggregatorService { buildMsgCreateVault( senderAddress: string, - denom: string, + symbol: string, name: string, description: string, strategies: { id: string; weight: number }[], @@ -82,7 +82,7 @@ export class YieldAggregatorService { const decReserve = this.txCommonService.numberToDecString(reserveRate / 100); const msg = new ununificlient.proto.ununifi.yieldaggregator.MsgCreateVault({ sender: senderAddress, - denom: denom, + symbol: symbol, name: name, description: description, commission_rate: decCommission, @@ -119,7 +119,7 @@ export class YieldAggregatorService { mintAmount: number, ): Observable { const lpDenom = 'yieldaggregator/vaults/' + vault?.vault?.id; - const exponent = getDenomExponent(vault.vault?.denom); + const exponent = getDenomExponent(vault.vault?.symbol); const mintDenomAmount = mintAmount * Math.pow(10, exponent); const totalAmountInVault = Number(vault.total_bonded_amount) + @@ -142,7 +142,7 @@ export class YieldAggregatorService { vault: Vault200Response, burnAmount: number, ): Observable { - const denom = vault.vault?.denom; + const denom = vault.vault?.symbol; const lpDenom = 'yieldaggregator/vaults/' + vault?.vault?.id; const exponent = getDenomExponent(lpDenom); const burnDenomAmount = burnAmount * Math.pow(10, exponent); @@ -223,7 +223,7 @@ export class YieldAggregatorService { if (!vault.vault?.strategy_weights) { return { id: vault.vault?.id || '', - denom: vault.vault?.denom || '', + denom: vault.vault?.symbol || '', name: vault.vault?.name || '', description: vault.vault?.description || '', gitURL: '', @@ -240,7 +240,7 @@ export class YieldAggregatorService { const strategyInfo = config?.strategiesInfo?.find( (strategyInfo) => strategyInfo.id === strategyWeight.strategy_id && - strategyInfo.denom === vault.vault?.denom, + strategyInfo.denom === vault.vault?.symbol, ); if (!strategyInfo || !strategyInfo.poolInfo) { continue; @@ -265,7 +265,7 @@ export class YieldAggregatorService { return { id: vault.vault?.id || '', - denom: vault.vault?.denom || '', + denom: vault.vault?.symbol || '', name: vault.vault?.name || '', description: vault.vault?.description || '', gitURL: '', diff --git a/projects/portal/src/app/pages/yieldaggregator/vaults/create/create.component.html b/projects/portal/src/app/pages/yieldaggregator/vaults/create/create.component.html index b09604c62..9327f0089 100644 --- a/projects/portal/src/app/pages/yieldaggregator/vaults/create/create.component.html +++ b/projects/portal/src/app/pages/yieldaggregator/vaults/create/create.component.html @@ -1,6 +1,6 @@ diff --git a/projects/portal/src/app/pages/yieldaggregator/vaults/create/create.component.ts b/projects/portal/src/app/pages/yieldaggregator/vaults/create/create.component.ts index 09c3e1eec..3c79adf24 100644 --- a/projects/portal/src/app/pages/yieldaggregator/vaults/create/create.component.ts +++ b/projects/portal/src/app/pages/yieldaggregator/vaults/create/create.component.ts @@ -18,7 +18,7 @@ import { StrategyAll200ResponseStrategiesInner } from 'ununifi-client/esm/openap }) export class CreateComponent implements OnInit { address$: Observable; - denom$: Observable; + symbol$: Observable; availableTokens$: Observable; strategies$: Observable; denomBalancesMap$: Observable<{ [symbol: string]: cosmosclient.proto.cosmos.base.v1beta1.ICoin }>; @@ -41,8 +41,11 @@ export class CreateComponent implements OnInit { filter((wallet): wallet is StoredWallet => wallet !== undefined && wallet !== null), map((wallet) => wallet.address), ); - this.denom$ = this.route.queryParams.pipe(map((params) => params.denom)); - this.strategies$ = this.denom$.pipe(mergeMap((denom) => this.iyaQuery.listStrategies$(denom))); + + this.symbol$ = this.route.queryParams.pipe(map((params) => params.symbol)); + // todo fix query + // this.strategies$ = this.denom$.pipe(mergeMap((denom) => this.iyaQuery.listStrategies$(denom))); + this.strategies$ = this.iyaQuery.listStrategies$(); const allStrategies$ = this.iyaQuery.listStrategies$(); this.denomBalancesMap$ = this.address$.pipe( mergeMap((address) => this.bankQuery.getDenomBalanceMap$(address)), @@ -64,11 +67,11 @@ export class CreateComponent implements OnInit { ngOnInit(): void {} - onChangeDenom(denom: string): void { + onChangeSymbol(symbol: string): void { this.router.navigate([], { relativeTo: this.route, queryParams: { - denom: denom, + symbol: symbol, }, queryParamsHandling: 'merge', }); @@ -77,7 +80,7 @@ export class CreateComponent implements OnInit { onCreate(data: CreateVaultRequest) { this.iyaApp.createVault( data.name, - data.denom, + data.symbol, data.description, data.strategies, data.commissionRate, diff --git a/projects/portal/src/app/views/yieldaggregator/vaults/create/create.component.html b/projects/portal/src/app/views/yieldaggregator/vaults/create/create.component.html index 061cb1470..2049d193c 100644 --- a/projects/portal/src/app/views/yieldaggregator/vaults/create/create.component.html +++ b/projects/portal/src/app/views/yieldaggregator/vaults/create/create.component.html @@ -30,9 +30,9 @@ [class]="{ 'select-error': assetNgModelRef.errors }" - [(ngModel)]="denom" + [(ngModel)]="symbol" name="symbol" - (change)="onChangeDenom()" + (change)="onChangeSymbol()" [disabled]="!availableTokens?.length" > - - + + @@ -309,25 +309,19 @@

What is the strategies?