-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat(deployment): auto top up custodial deployment with available amount
closes #524
- console-web/v2.31.0
- console-web/v2.30.1
- console-web/v2.30.0
- console-web/v2.29.2
- console-web/v2.29.1
- console-web/v2.29.0
- console-web/v2.28.3
- console-web/v2.28.2
- console-web/v2.28.1
- console-web/v2.28.0
- console-web/v2.27.10
- console-web/v2.27.9
- console-web/v2.27.8
- console-web/v2.27.7
- console-web/v2.27.6
- console-web/v2.27.5
- console-web/v2.27.4
- console-web/v2.27.3
- console-web/v2.27.2
- console-web/v2.27.0
- console-web/v2.26.0
- console-web/v2.25.4
- console-web/v2.25.4-beta.0
- console-api/v2.50.1
- console-api/v2.50.0
- console-api/v2.49.0
- console-api/v2.48.0
- console-api/v2.47.0
- console-api/v2.46.0
- console-api/v2.45.0
- console-api/v2.44.4
- console-api/v2.44.3
- console-api/v2.44.2
- console-api/v2.44.1
- console-api/v2.44.0
- console-api/v2.43.4
- console-api/v2.43.3
- console-api/v2.43.2
- console-api/v2.43.1
- console-api/v2.43.0
- console-api/v2.42.0
- console-api/v2.41.1
- console-api/v2.41.0
- console-api/v2.40.0
- console-api/v2.39.0
- console-api/v2.38.0
- console-api/v2.38.0-beta.2
- console-api/v2.38.0-beta.1
1 parent
8ab84e2
commit 0792a36
Showing
4 changed files
with
151 additions
and
39 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
.../api/src/deployment/services/top-up-custodial-balance/top-up-custodial-balance.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
interface Balances { | ||
denom: string; | ||
feesLimit: number; | ||
deploymentLimit: number; | ||
balance: number; | ||
feesBalance?: number; | ||
} | ||
|
||
export class TopUpCustodialBalanceService { | ||
constructor(readonly balances: Balances) {} | ||
|
||
recordTx(amount: number, fees: number) { | ||
this.balances.deploymentLimit -= amount; | ||
this.balances.balance -= amount; | ||
this.balances.feesLimit -= fees; | ||
|
||
if (this.balances.denom === "uakt") { | ||
this.balances.balance -= fees; | ||
} else { | ||
this.balances.feesBalance -= fees; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters