Skip to content

Commit

Permalink
Merge pull request #156 from galacticcouncil/yield-dca-lifecycle-fix
Browse files Browse the repository at this point in the history
Fixed lifecycle issues in DCA Yield
  • Loading branch information
nohaapav authored Dec 4, 2024
2 parents 70846e4 + d9f8dac commit e11afe8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-suits-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@galacticcouncil/apps': minor
---

Fixed lifecycle issues in DCA Yield
22 changes: 15 additions & 7 deletions packages/apps/src/app/yield/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,21 @@ export class YieldApp extends PoolApp {
const minInvestment = minGain / (apyMultiplier - 1);

if (minInvestment > Number(amountIn)) {
this.dca.error['minInvestmentTooLow'] = i18n.t(
'error.minInvestmentTooLow',
{
amount: humanizeAmount(minInvestment),
asset: assetIn.symbol,
this.dca = {
...this.dca,
error: {
...this.dca.error,
minInvestmentTooLow: i18n.t('error.minInvestmentTooLow', {
amount: humanizeAmount(minInvestment),
asset: assetIn.symbol,
}),
},
);
};
} else {
delete this.dca.error['minInvestmentTooLow'];
}

this.requestUpdate();
}

notificationTemplate(dca: DcaState, tKey: string): TxMessage {
Expand Down Expand Up @@ -431,7 +436,10 @@ export class YieldApp extends PoolApp {
}

protected onIntervalChange({ detail }: CustomEvent) {
this.dca.interval = detail.value;
this.dca = {
...this.dca,
interval: detail.value,
};
this.updateTradeSize();
this.validateMinInvestment();
}
Expand Down

0 comments on commit e11afe8

Please sign in to comment.