Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1858 from SteveMieskoski/mercury
Browse files Browse the repository at this point in the history
ensure toAddress is empty when setting final kyber swap values
  • Loading branch information
gamalielhere authored May 19, 2018
2 parents b7415a2 + 1246743 commit fb6c08c
Show file tree
Hide file tree
Showing 10 changed files with 5,664 additions and 5,189 deletions.
27 changes: 14 additions & 13 deletions app/includes/swap-kyber-modal.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
->
<br/>
<h4 class="text-danger">
{{swapOrder.fromVal}} {{swapOrder.fromCoin}}
{{kyberSwapOrder.fromVal}} {{kyberSwapOrder.fromCoin}}
</h4>
</td>
<td ng-show="kyberEthToToken" class="mono">
Expand Down Expand Up @@ -83,16 +83,16 @@
</td>
</tr>
<tr>
<td class="small text-right">{{swapOrder.toCoin}} Deposit Address:</td>
<td class="small text-left mono">{{swapOrder.toAddress}}</td>
<td class="small text-right">{{kyberSwapOrder.toCoin}} Deposit Address:</td>
<td class="small text-left mono">{{kyberSwapOrder.toAddress}}</td>
</tr>
<tr>
<td class="small text-right">Swapping:</td>
<td class="small text-left mono">{{swapOrder.fromVal}} {{swapOrder.fromCoin}}</td>
<td class="small text-left mono">{{kyberSwapOrder.fromVal}} {{kyberSwapOrder.fromCoin}}</td>
</tr>
<tr>
<td class="small text-right">For:</td>
<td class="small text-left mono"><!--{{swapOrder.toVal}}--> {{swapOrder.fromVal * swapOrder.swapRate}} {{swapOrder.toCoin}}</td>
<td class="small text-left mono"><!--{{kyberSwapOrder.toVal}}--> {{kyberSwapOrder.fromVal * kyberSwapOrder.swapRate}} {{kyberSwapOrder.toCoin}}</td>
</tr>
<tr>
<td class="small text-right">Network:</td>
Expand Down Expand Up @@ -159,11 +159,11 @@
</tr>
<tr>
<td class="small text-right">Token:</td>
<td class="small text-left mono">{{swapOrder.fromCoin}}</td>
<td class="small text-left mono">{{kyberSwapOrder.fromCoin}}</td>
</tr>
<tr>
<td class="small text-right">Token Qty:</td>
<td class="small text-left mono">{{swapOrder.fromVal}} {{swapOrder.fromCoin}}</td>
<td class="small text-left mono">{{kyberSwapOrder.fromVal}} {{kyberSwapOrder.fromCoin}}</td>
</tr>
<tr>
<td class="small text-right">Network:</td>
Expand Down Expand Up @@ -201,7 +201,7 @@
<td class="small text-right">To Address:</td>
<td class="small text-left mono">{{parsedKyberTokenTx.to}}
<br/>
<em><small>The token ({{swapOrder.fromCoin}}) contract address.</small></em>
<em><small>The token ({{kyberSwapOrder.fromCoin}}) contract address.</small></em>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -253,7 +253,7 @@
<td class="small text-right">To Address:</td>
<td class="small text-left mono">{{parsedKyberResetTokenTx.to}}
<br/>
<em><small>The token ({{swapOrder.fromCoin}}) contract address.</small></em>
<em><small>The token ({{kyberSwapOrder.fromCoin}}) contract address.</small></em>
</td>
</tr>
<tr ng-show="kyberTransaction.tokenNeedsReset">
Expand All @@ -266,7 +266,7 @@
</tr>
<tr ng-show="kyberTransaction.tokenNeedsReset">
<td class="small text-right">Current Approve Value:</td>
<td class="small text-left mono">{{kyberTransaction.currentTokenApprovalValue}} {{swapOrder.fromCoin}}</td>
<td class="small text-left mono">{{kyberTransaction.currentTokenApprovalValue}} {{kyberSwapOrder.fromCoin}}</td>
</tr>
<tr ng-show="kyberTransaction.tokenNeedsReset">
<td class="small text-right">Account Balance:</td>
Expand Down Expand Up @@ -335,11 +335,11 @@
</tr>-->
<tr>
<td class="small text-right">Swapping:</td>
<td class="small text-left mono">{{swapOrder.fromVal}} {{swapOrder.fromCoin}}</td>
<td class="small text-left mono">{{kyberSwapOrder.fromVal}} {{kyberSwapOrder.fromCoin}}</td>
</tr>
<tr>
<td class="small text-right">For:</td>
<td class="small text-left mono"><!--{{swapOrder.toVal}}--> {{swapOrder.fromVal * swapOrder.swapRate}} {{swapOrder.toCoin}}</td>
<td class="small text-left mono"><!--{{kyberSwapOrder.toVal}}--> {{kyberSwapOrder.fromVal * kyberSwapOrder.swapRate}} {{kyberSwapOrder.toCoin}}</td>
</tr>
<tr>
<td class="small text-right">Network:</td>
Expand Down Expand Up @@ -397,14 +397,15 @@
<div class="modal-footer" ng-if="!kyberEthToToken">
<h4 class="text-center">
<span translate="SENDModal_Content_1">You are about to send</span>
<strong class="mono">{{swapOrder.fromVal}} {{swapOrder.fromCoin}}</strong>
<strong class="mono">{{kyberSwapOrder.fromVal}} {{kyberSwapOrder.fromCoin}}</strong>
<span translate="SENDModal_Content_2">to address</span>
<strong class="mono">{{parsedKyberTx.to}}.</strong>
</h4>
<p translate="SENDModal_Content_3">
Are you sure you want to do this?
</p>
<br/>

<button class="btn btn-default" data-dismiss="modal" translate="SENDModal_No">
No, get me out of here!
</button>
Expand Down
38 changes: 23 additions & 15 deletions app/includes/swap-kyber.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
<!-- Info Row -->
<section class="order-info-wrap row">
<div class="col-sm-4 order-info">
<h4> {{swapOrder.fromVal}} {{swapOrder.fromCoin}} </h4>
<h4> {{kyberSwapOrder.fromVal}} {{kyberSwapOrder.fromCoin}} </h4>
<p translate="SWAP_send_amt"> Amount to send </p>
</div>
<div class="col-sm-4 order-info">

<h4> <!--{{swapOrder.toVal | number: receiveDecimals}}--> {{swapOrder.fromVal * swapOrder.swapRate | number: receiveDecimals}} {{swapOrder.toCoin}} </h4>
<h4> <!--{{kyberSwapOrder.toVal | number: receiveDecimals}}--> {{kyberSwapOrder.fromVal * kyberSwapOrder.swapRate | number: receiveDecimals}} {{kyberSwapOrder.toCoin}} </h4>
<p translate="SWAP_rec_amt"> Amount to receive </p>
</div>
<div class="col-sm-4 order-info">
<h4> {{swapOrder.swapRate | number: 6}} {{swapOrder.swapPair}} </h4>
<h4> {{kyberSwapOrder.swapRate | number: 6}} {{kyberSwapOrder.swapPair}} </h4>
<p translate="SWAP_your_rate"> Your rate </p>
</div>
</section>
Expand All @@ -47,15 +47,15 @@

<div class="col-sm-8 col-xs-12">
<label><span translate="SWAP_rec_add">Your Receiving Address </span>
<strong>({{swapOrder.toCoin}})</strong></label>
<strong>({{kyberSwapOrder.toCoin}})</strong></label>
<!-- todo should I just wait for the wallet unlock and not ask for an address first. then if wallet uplock calculation proves false at send tx. present option to return to start???-->
<address-field placeholder="0xDECAF9CD2367cdbb726E904cD6397eDFcAe6068D"
var-name="swapOrder.toAddress"></address-field>
var-name="kyberSwapOrder.toAddress"></address-field>
</div>
</section>
<!-- /Your Address -->
<!-- CTA -->
<section class="row text-center" ng-if="swapOrder.toAddress">
<section class="row text-center" ng-if="kyberSwapOrder.toAddress">

<a ng-click="startKyber()" class="btn btn-primary btn-lg"><span
translate="SWAP_start_CTA"> Start Swap </span></a>
Expand Down Expand Up @@ -88,11 +88,11 @@
<!-- Order Info -->
<section class="row order-info-wrap">
<div class="col-sm-6 order-info">
<h4><!--{{kyberOrderResult.output.amount | number: receiveDecimals}}--> {{swapOrder.fromVal * swapOrder.swapRate | number: receiveDecimals}} {{kyberOrderResult.output.currency}}</h4>
<h4><!--{{kyberOrderResult.output.amount | number: receiveDecimals}}--> {{kyberSwapOrder.fromVal * kyberSwapOrder.swapRate | number: receiveDecimals}} {{kyberOrderResult.output.currency}}</h4>
<p translate="SWAP_rec_amt">Amount to receive</p>
</div>
<div class="col-sm-6 order-info">
<h4>{{swapOrder.swapRate | number: 6}} {{swapOrder.swapPair}}</h4>
<h4>{{kyberSwapOrder.swapRate | number: 6}} {{kyberSwapOrder.swapPair}}</h4>
<p translate="SWAP_your_rate">Your rate</p>
</div>
</section>
Expand Down Expand Up @@ -199,9 +199,9 @@
</h5> <!-- todo: add translate -->

<section class="row text-center" ng-if="kyberReturnToStart">
<h5 class="text-warning">The swap value of {{swapOrder.fromVal}} {{swapOrder.fromCoin}} is Greater
than your current {{swapOrder.fromCoin}} Balance of
{{userTokenBalanceChecked}} {{swapOrder.fromCoin}}</h5>
<h5 class="text-warning">The swap value of {{kyberSwapOrder.fromVal}} {{kyberSwapOrder.fromCoin}} is Greater
than your current {{kyberSwapOrder.fromCoin}} Balance of
{{userTokenBalanceChecked}} {{kyberSwapOrder.fromCoin}}</h5>
<a ng-click="returnToStart()" class="btn btn-primary btn-lg"><span> Return to Swap Selector </span></a>
<!-- todo: add translate -->
</section>
Expand All @@ -213,9 +213,17 @@
<section class="row text-center" ng-show="wallet!=null && balanceOk">
<a ng-click="openKyberOrder(wallet)" class="btn btn-primary btn-lg"><span
translate="SWAP_start_CTA"> Start Swap </span></a>

<!--{{kyberSwapOrder.toAddress}}-->
<!--{{wallet.getAddressString()}}-->
<div ng-if="kyberSwapOrder.toAddress.toLowerCase() != wallet.getAddressString().toLowerCase() ">
<h4 style="color: red">WAIT! The Address you are sending to is not the wallet address you unlocked. <br> If this is not what you intended please review your receiving address.</h4>
<a ng-click="returnToSetDestinationAddress()" class="btn btn-primary btn-lg"><span> Return to Set Receiving Address </span></a>
</div>
</section>



<!-- Included Because sendTxCtrl.js looks for it via querySelector and throws if it is not present (and destroys the layout in the process)-->
<div id="sendTransaction"></div>

Expand Down Expand Up @@ -251,11 +259,11 @@
<!-- Order Info -->
<section class="row order-info-wrap">
<div class="col-sm-6 order-info">
<h4><!--{{kyberOrderResult.output.amount | number: receiveDecimals}}--> {{swapOrder.fromVal * swapOrder.swapRate | number: receiveDecimals}} {{kyberOrderResult.output.currency}}</h4>
<h4><!--{{kyberOrderResult.output.amount | number: receiveDecimals}}--> {{kyberSwapOrder.fromVal * kyberSwapOrder.swapRate | number: receiveDecimals}} {{kyberOrderResult.output.currency}}</h4>
<p translate="SWAP_rec_amt">Amount to receive</p>
</div>
<div class="col-sm-6 order-info">
<h4>{{swapOrder.swapRate | number: 6}} {{swapOrder.swapPair}}</h4>
<h4>{{kyberSwapOrder.swapRate | number: 6}} {{kyberSwapOrder.swapPair}}</h4>
<p translate="SWAP_your_rate">Your rate</p>
</div>
</section>
Expand Down Expand Up @@ -311,11 +319,11 @@
<p>Amount sent</p>
</div>
<div class="col-sm-12">
<h4><!--{{kyberOrderResult.output.amount | number: receiveDecimals}}--> {{swapOrder.fromVal * swapOrder.swapRate | number: receiveDecimals}} {{kyberOrderResult.output.currency}}</h4>
<h4><!--{{kyberOrderResult.output.amount | number: receiveDecimals}}--> {{kyberSwapOrder.fromVal * kyberSwapOrder.swapRate | number: receiveDecimals}} {{kyberOrderResult.output.currency}}</h4>
<p translate="SWAP_rec_amt">Amount to receive</p>
</div>
<div class="col-sm-12">
<h4>{{swapOrder.swapRate | number: 6}} {{swapOrder.swapPair}}</h4>
<h4>{{kyberSwapOrder.swapRate | number: 6}} {{kyberSwapOrder.swapPair}}</h4>
<p translate="SWAP_your_rate">Your rate</p>
</div>
<hr>
Expand Down
2 changes: 2 additions & 0 deletions app/layouts/helpers.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!--email_off-->
@@include( '../includes/header.tpl', { "site": "mew" } )

<section class="container" style="min-height: 50%" ng-controller='viewCtrl'>
Expand All @@ -14,3 +15,4 @@
</section>

@@include( '../includes/footer.tpl', { "site": "mew" } )
<!--/email_off-->
Loading

0 comments on commit fb6c08c

Please sign in to comment.