Skip to content

Commit

Permalink
#16 added price calculation helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzhak committed Oct 26, 2018
1 parent ce7d1a0 commit aa4881f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ <h1 class="h3 display">For listener</h1>
<div class="row">
<div class="col-md-4">
<input type="number" formControlName="ethSum" class="form-control" placeholder="Amount in ETH">
<span class="text-small text-gray help-block-none">You will get {{ formBuyTokens.controls['ethSum'].value / oneTokenPriceInEth }} DZT for {{ formBuyTokens.controls['ethSum'].value }} ETH</span>
</div>
<div class="col-md-4">
<button [disabled]="!formBuyTokens.valid" (click)="runBuyTokens()" type="button" class="btn btn-primary">Buy</button>
Expand Down
4 changes: 3 additions & 1 deletion src/app/dashboard/outsider-page/outsider-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class OutsiderPageComponent implements OnInit {
becomeGuestStakeInEth = null;
displayBecomeTheNextShowGuestDialog = false;
formBuyTokens: FormGroup;
oneTokenPriceInEth = 0;
params = {};

constructor(
Expand All @@ -40,6 +41,7 @@ export class OutsiderPageComponent implements OnInit {
params => {
this.params = params;
this.becomeGuestStakeInEth = this.web3Service.fromWei(String(this.params['becomeGuestStake']), "ether");
this.oneTokenPriceInEth = this.web3Service.fromWei(String(this.params['oneTokenPriceInWei']), "ether");
},
err => {
this.messageService.add({severity:'error', summary:'Error', detail:'Error on getting DAO params'});
Expand All @@ -55,7 +57,7 @@ export class OutsiderPageComponent implements OnInit {
*/
initForms() {
this.formBuyTokens = this.formBuilder.group({
ethSum: ['0.001', [Validators.required, Validators.min(1 / (10 ** 18))]]
ethSum: ['0.1', [Validators.required, Validators.min(1 / (10 ** 18))]]
});
}

Expand Down

0 comments on commit aa4881f

Please sign in to comment.