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 #1934 from kvhnuke/devop/remove-console
Browse files Browse the repository at this point in the history
Devop/remove console
  • Loading branch information
gamalielhere authored Jun 28, 2018
2 parents 0ba7f7b + 8ef7a63 commit c373e30
Show file tree
Hide file tree
Showing 30 changed files with 24,708 additions and 6,220 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Release v3.21.15
### Devop
- Remove console logs and rebuild [#1934](https://github.com/kvhnuke/etherwallet/pull/1934)

### Release v3.21.14
### New
- Add DCC and QNT tokens [#1932](https://github.com/kvhnuke/etherwallet/pull/1932)
Expand Down
2 changes: 0 additions & 2 deletions app/scripts/controllers/onboardingCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ var onboardingCtrl = function($scope, globalService, $translate, $sce) {
$scope.showOnboardSlide = $scope.onboardStatus // set the slide to the last slide they viewed
$scope.onboardMsg = true // show a msg explaining they need to finish it
$scope.onboardModal.open() // show the modal
//console.log( $scope.onboardStatus )
}

// otherwise, show the modal (starts at slide 1 by default, above)
Expand All @@ -30,7 +29,6 @@ var onboardingCtrl = function($scope, globalService, $translate, $sce) {
$scope.setOnboardStatus = function( slideNum ) {
$scope.showOnboardSlide = slideNum // show the slide indicated
globalFuncs.localStorage.setItem("onboardStatus", JSON.stringify( slideNum )) // save number to localStorage for later
//console.log( "setOnboardStatus " + slideNum )
}

$scope.setOnboardStatus( $scope.onboardStatus )
Expand Down
34 changes: 1 addition & 33 deletions app/scripts/controllers/swapCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
tokensymbol: $scope.orderResult.input.currency == 'ETH' ? '' : $scope.orderResult.input.currency,
readOnly: true
}
// console.log(document.getElementById('sendTransaction')); //todo remove dev item
//new Modal(document.getElementById('sendTransaction'));
$scope.showStage3Eth = true;
}
}
Expand Down Expand Up @@ -508,7 +506,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
$scope.displayKyberErrorMessage("unAvailable");
return false;
}
// console.log($scope.kyber.kyberRates); //todo remove dev item
// if ($scope.kyber.kyberRates[kyber.toPairKey($scope.kyberSwapOrder.fromCoin, $scope.kyberSwapOrder.toCoin)] == 0 ||
// $scope.kyber.kyberRates[kyber.toPairKey($scope.kyberSwapOrder.fromCoin, $scope.kyberSwapOrder.toCoin)] == "0") {
// $scope.displayKyberErrorMessage("unAvailable");
Expand Down Expand Up @@ -629,7 +626,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
// todo: or just provide the message and don't 'route' to the next page (I like this better)
$scope.kyberSwapOrder.finalRate = finalRate;
// $scope.swapOrder.swapRate = finalRate;
// console.log("final rate", $scope.swapOrder.finalRate); //todo remove dev item
if (isFrom) {
$scope.receiveDecimals = $scope.kyber.tokenDetails[$scope.swapOrder.toCoin].decimals < bity.decimals ? $scope.kyber.tokenDetails[$scope.swapOrder.toCoin].decimals : bity.decimals;
let _toVal = finalRate * $scope.swapOrder.fromVal;
Expand Down Expand Up @@ -693,24 +689,20 @@ var swapCtrl = function ($scope, $sce, walletService) {
$scope.kyber.allowance($scope.kyberSwapOrder.fromCoin, _address, function (data) {
if (data.error) $scope.notifier.danger(data.msg);
else {
// console.log("auth value", data); //todo remove dev item

// data = data.data;
if (data.data > 0) {
let allocationNeeded = $scope.kyber.convertToTokenBase($scope.kyberSwapOrder.toVal, $scope.kyberSwapOrder.toCoin);
$scope.kyberTransaction.currentTokenApprovalValue = $scope.kyber.convertToTokenBase(data.data, $scope.kyberSwapOrder.fromCoin);
console.log("$scope.kyberTransaction.currentTokenApprovalValue", $scope.kyberTransaction.currentTokenApprovalValue); // todo remove dev item
if($scope.kyberTransaction.currentTokenApprovalValue > allocationNeeded){

callback("bypass")
} else {
$scope.kyberTransaction.currentTokenApprovalValue = $scope.kyber.convertToTokenBase(data.data, $scope.kyberSwapOrder.fromCoin);
// console.log("auth value exists", data); //todo remove dev item
callback(true);
}

} else {
// console.log("no auth value exists", data); //todo remove dev item
callback(false);
}
// if (data >= checkValue) {
Expand Down Expand Up @@ -746,7 +738,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
};

$scope.checkIfUserCanDo = function (_userAddress) {
// console.log("checkIfUserCanDo 1", $scope.checkTokenBalance); //todo remove dev item
try {

if ($scope.checkTokenBalance) {
Expand All @@ -759,21 +750,17 @@ var swapCtrl = function ($scope, $sce, walletService) {
checkUserCap(_userAddress, function (result) {
if (!result.error) {
$scope.kyber.getBalance($scope.kyberSwapOrder.fromCoin, _userAddress, function (_result) {
// console.log(_result); //todo remove dev item
let userTokenBalance = new BigNumber($scope.kyber.convertToTokenBase(_result.data, $scope.kyberSwapOrder.fromCoin));
let enoughTokens = userTokenBalance.gte($scope.kyberSwapOrder.fromVal);
// console.log(userTokenBalance); //todo remove dev item
if (enoughTokens) {
checkForPriorTokenApproval($scope.walletKyber.getAddressString(), (_data) => {
console.log("_data", _data); // todo remove dev item
if(typeof _data === 'boolean'){
if (_data) {
$scope.balanceOk = true;
$scope.kyberTransaction.tokenNeedsReset = true;

clearInterval(makeIndicator);
} else {
// console.log("no priorApproval"); //todo remove dev item
clearInterval(makeIndicator);
$scope.kyberTransaction.tokenNeedsReset = false;
$scope.balanceOk = true;
Expand Down Expand Up @@ -824,12 +811,10 @@ var swapCtrl = function ($scope, $sce, walletService) {

// document.addEventListener("unload", function(event){
// alert("warning warning");
// console.log(event); //todo remove dev item
// return "Leaving the page before your swap completes may cause your swap to fail."
// })
//
// document.addEventListener("beforeunload", function(event){
// console.log(event); //todo remove dev item
// alert("warning warning");
// return "Leaving the page before your swap completes may cause your swap to fail."
// })
Expand Down Expand Up @@ -864,7 +849,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
// }
try {
// $scope.kyberSwapOrder.destinationAddress =
// console.log("startKyber 1", walletService.wallet); //todo remove dev item
// Enable checking if user can proceed
$scope.checkTokenBalance = true;
$scope.wd = false;
Expand All @@ -875,7 +859,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
}
$scope.kyberModal = new Modal(document.getElementById('kyberTransaction'));
if ($scope.availableTokens.indexOf($scope.kyberSwapOrder.fromCoin) >= 0) {
// console.log("startKyber 2"); //todo remove dev item

$scope.showStage2Kyber = false;
$scope.showStage3Kyber = true;
Expand All @@ -900,7 +883,6 @@ var swapCtrl = function ($scope, $sce, walletService) {

// Stage 3 'Start Swap'. Based on selected swap pair determine which processing flow to follow
$scope.openKyberOrder = function (wallet) {
// console.log($scope.walletKyber); //todo remove dev item
$scope.wallet = walletService.wallet;
if ($scope.availableTokens.indexOf($scope.swapOrder.fromCoin) >= 0) {
$scope.checkForResetApproveTokenKyber();
Expand Down Expand Up @@ -929,7 +911,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
$scope.addressString = $scope.walletKyber.getAddressString();
$scope.tx = $scope.buildTransactionObject($scope.kyber.getTradeData($scope.kyberSwapOrder, $scope.kyberSwapOrder.finalRate), $scope.kyber.getKyberNetworkAddress(), $scope.kyberSwapOrder.fromVal);
var txData = uiFuncs.getTxData($scope);
// console.log("openKyberEthOrder", txData); // todo remove dev item
txData.nonce = txData.gasprice = null;

$scope.generateKyberTransaction(txData, "OPEN_ETH");
Expand All @@ -944,12 +925,10 @@ var swapCtrl = function ($scope, $sce, walletService) {
// Build the Approve transaction to send to the Token Contract of the 'from' Token

$scope.checkForResetApproveTokenKyber = function () {
// console.log($scope.kyberSwapOrder); // todo remove dev item
try {
if ($scope.kyberTransaction.tokenNeedsReset) {
$scope.tx = $scope.buildTransactionObject($scope.kyber.approveKyber($scope.kyberSwapOrder.fromCoin, 0), $scope.kyber.getTokenAddress($scope.kyberSwapOrder.fromCoin));
var txData = uiFuncs.getTxData($scope);
// console.log("checkForResetApproveTokenKyber", txData); // todo remove dev item
txData.nonce = txData.gasPrice = null;
$scope.generateKyberTransaction(txData, $scope.kyberStatus.token.resetApprove);
} else {
Expand All @@ -969,7 +948,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
try {
$scope.tx = $scope.buildTransactionObject($scope.kyber.approveKyber($scope.kyberSwapOrder.fromCoin, $scope.kyberSwapOrder.fromVal), $scope.kyber.getTokenAddress($scope.kyberSwapOrder.fromCoin));
var txData = uiFuncs.getTxData($scope);
// console.log("approveTokenKyber", txData); // todo remove dev item
if (nonce && gasPrice) {
let newNonce = parseInt(ethFuncs.hexToDecimal(nonce));
txData.nonce = "0x" + ethFuncs.decimalToHex(newNonce + 1);
Expand All @@ -987,7 +965,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
try {
$scope.tx = $scope.buildTransactionObject($scope.kyber.getTradeData($scope.kyberSwapOrder, $scope.kyberSwapOrder.finalRate), $scope.kyber.getKyberNetworkAddress());
var txData = uiFuncs.getTxData($scope);
// console.log("openKyberTokenOrder", txData); // todo remove dev item
if (nonce) {
let newNonce = parseInt(ethFuncs.hexToDecimal(nonce));
txData.nonce = "0x" + ethFuncs.decimalToHex(newNonce + 1);
Expand Down Expand Up @@ -1037,8 +1014,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
$scope.kyberTransaction.kyberMaxGas = true;
txData.kyberGasPrice = "0xba43b7400"
}
// console.log("gasPrice", val); // todo remove dev item
// console.log("txData 11", txData); // todo remove dev item
}

txData.kyber = true;
Expand Down Expand Up @@ -1097,8 +1072,6 @@ var swapCtrl = function ($scope, $sce, walletService) {

// Trigger the opening of the modal for user review and authorization to proceed
$scope.sendKyberModal = function () {
// console.log($scope.kyberTransaction); // todo remove dev item
// console.log($scope.kyberOrderResult.progress.status); //todo remove dev item
try {
switch ($scope.kyberOrderResult.progress.status) {
case "APPROVE_TOKENS":
Expand Down Expand Up @@ -1185,7 +1158,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
let notCustomNode = $scope.ajaxReq.type != nodes.nodeTypes.Custom;
switch ($scope.kyberOrderResult.progress.status) {
case "RESET_TOKEN_APPROVAL":
// console.log("send reset token approval", $scope.kyberOrderResult.progress.status); //todo remove dev item
$scope.kyberTransaction.tokenResetTxHash = notCustomNode ? resp.data : "";
$scope.kyberTransaction.tokenResetTxLink = $scope.ajaxReq.blockExplorerTX.replace("[[txHash]]", resp.data);
// $scope.displayTxHashPopup(resp, $scope.kyberTransaction.tokenResetTxLink);
Expand All @@ -1194,15 +1166,13 @@ var swapCtrl = function ($scope, $sce, walletService) {
$scope.checkForTokenResetKyber($scope.walletKyber.getAddressString());
break;
case "TOKENS_APPROVED":
// console.log("TOKENS_APPROVED", $scope.kyberOrderResult.progress.status); //todo remove dev item

$scope.kyberTransaction.tokenTxHash = notCustomNode ? resp.data : "";
$scope.kyberTransaction.tokenTxLink = $scope.ajaxReq.blockExplorerTX.replace("[[txHash]]", resp.data);
$scope.displayTxHashPopup(resp, $scope.kyberTransaction.tokenTxLink);
$scope.kyberOrderResult.progress.bar = getProgressBarArr(5, 5);
break;
case "AWAITING_TOKEN_APPROVAL":
// console.log("AWAITING_TOKEN_APPROVAL", $scope.kyberOrderResult.progress.status); //todo remove dev item

$scope.kyberTransaction.tokenApproveTxHash = notCustomNode ? resp.data : "";
$scope.kyberTransaction.tokenApproveTxLink = $scope.ajaxReq.blockExplorerTX.replace("[[txHash]]", resp.data);
Expand Down Expand Up @@ -1404,8 +1374,6 @@ var swapCtrl = function ($scope, $sce, walletService) {
if (walletService.wallet == null) return null;
return walletService.wallet.getAddressString();
}, function (oldVal, newVal, scpe) {
// console.log("$watch", oldVal); //todo remove dev item
// console.log("$watch", newVal); //todo remove dev item
if (walletService.wallet == null) return;
if (oldVal) {
$scope.wd = true;
Expand All @@ -1430,4 +1398,4 @@ var swapCtrl = function ($scope, $sce, walletService) {
setOrderFromStorage();
}
};
module.exports = swapCtrl;
module.exports = swapCtrl;
8 changes: 1 addition & 7 deletions app/scripts/kyber.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ kyberFuncs.prototype.getMainNetAddress = function(){
var _this = this;
let ens = new window.ens();
ens.getAddress("kybernetwork.eth", function(data){
console.log(data); // todo remove dev item
_this.KyberNetworkAddress = data.data;
})
}
Expand Down Expand Up @@ -262,7 +261,6 @@ kyberFuncs.prototype.getBalance = async function (_token, userAddress, callback)
return i.type;
});

// console.log(ethFuncs.hexToDecimal(data.data)); //todo remove dev item
console.log(data.data);
// was returning a number rounded, thus
// data.data = ethUtil.solidityCoder.decodeParams(outTypes, data.data.replace('0x', ''))[0].toNumber();
Expand Down Expand Up @@ -326,7 +324,6 @@ kyberFuncs.prototype.checkUserCap = function(_userAddress, swapValue /* In ETH o
let weiValue = _this.convertToTokenWei(swapValue, "ETH");

_this.getUserCapInWei(_userAddress, function(data) {
// console.log(data); //todo remove dev item
let numberAsBN = new BigNumber(weiValue);
let nineFivePct = data.data.times(0.95);
let nineFivePctUserCap = _this.convertToTokenWei(nineFivePct, "ETH");
Expand Down Expand Up @@ -419,16 +416,13 @@ kyberFuncs.prototype.allowance = function (_srcToken, userAddress, callback) {

kyberFuncs.prototype.getTradeData = function (swapOrder, minRate) {
var _this = this;
// console.log("minRate", minRate); //todo remove dev item
if (minRate && minRate > 0) {
var funcABI = _this.kyberNetworkABI.trade;
var srcTokenAddress = _this.getTokenAddress(swapOrder.fromCoin);
var destTokenAddress = _this.getTokenAddress(swapOrder.toCoin);
let walletId = "0xDECAF9CD2367cdbb726E904cD6397eDFcAe6068D";
let minConversionRate = _this.convertToTokenWei(minRate, "ETH"); // Uses slippagePrice with fallback to MarketRate. 1 => Market Rate, but we could also set this as the quoted rate
// console.log("minConversionRate", minRate); //todo remove dev item
let srcAmount = _this.convertToTokenWei(swapOrder.fromVal, swapOrder.fromCoin); //etherUnits.toWei(swapOrder.fromVal, "ether");
// console.log("srcAmount", srcAmount); //todo remove dev item
let maxDestAmount = 2 ** 200; //100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; // Really big number (like a googol)

if (swapOrder.toAddress) {
Expand All @@ -441,4 +435,4 @@ kyberFuncs.prototype.getTradeData = function (swapOrder, minRate) {
}
};

module.exports = kyberFuncs;
module.exports = kyberFuncs;
5 changes: 1 addition & 4 deletions app/scripts/uiFuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ uiFuncs.generateTx = function(txData, callback) {
try {
uiFuncs.isTxDataValid(txData);
var genTxWithInfo = function(data) {
// console.log("genTxWithInfo", data); // todo remove dev item
var rawTx = {
nonce: ethFuncs.sanitizeHex(data.nonce),
gasPrice: data.isOffline ? ethFuncs.sanitizeHex(data.gasprice) : ethFuncs.sanitizeHex(ethFuncs.addTinyMoreToGas(data.gasprice)),
Expand All @@ -163,7 +162,6 @@ uiFuncs.generateTx = function(txData, callback) {
if(txData.kyberGasPrice){
rawTx.gasPrice = txData.kyberGasPrice;
}
console.log("rawTx to Sign", rawTx); // todo remove dev item
if (ajaxReq.eip155) rawTx.chainId = ajaxReq.chainId;
rawTx.data = rawTx.data == '' ? '0x' : rawTx.data;
var eTx = new ethUtil.Tx(rawTx);
Expand Down Expand Up @@ -246,7 +244,6 @@ uiFuncs.generateTx = function(txData, callback) {
}
}
uiFuncs.sendTx = function(signedTx, callback) {
console.log("signedTx", signedTx); // todo remove dev item
// check for web3 late signed tx
if (signedTx.slice(0, 2) !== '0x') {
var txParams = JSON.parse(signedTx)
Expand Down Expand Up @@ -343,4 +340,4 @@ uiFuncs.notifier = {
}
},
}
module.exports = uiFuncs;
module.exports = uiFuncs;
2 changes: 1 addition & 1 deletion chrome-extension/contest.html
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ <h5> <i aria-hidden="true">👫</i> You can support us by supporting our blockch
<div class="footer__pill-wrap footer__pill-custom-wrap">
<a class="footer__pill" href="https://www.ledgerwallet.com/r/fa4b?path=/products/" target="_blank" rel="noopener">Ledger Wallet</a>
<a class="footer__pill" href="https://trezor.io/?a=myetherwallet.com" target="_blank" rel="noopener">TREZOR</a>
<a class="footer__pill" href="https://digitalbitbox.com/?ref=mew" target="_blank" rel="noopener">Digital Bitbox</a>
<a class="footer__pill" href="http://shiftcrypto.ositracker.com/91316/7114" target="_blank" rel="noopener">Digital Bitbox</a>
<a class="footer__pill" href="https://ether.cards/?utm_source=mew&utm_medium=cpm&utm_campaign=site" target="_blank" rel="noopener">ether.card</a>
<a class="footer__pill" href="https://thehodlwallet.com?aff=15" target="_blank" rel="noopener">HODL Wallet</a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions chrome-extension/cx-wallet.html
Original file line number Diff line number Diff line change
Expand Up @@ -3612,7 +3612,7 @@ <h5>{{kyberTransaction.tokenTxHash}}</h5>
</a>
</div>

<div class="col-sm-12" ng-if="!kyberEthToToken && !bypassTokenApprove">
<div class="col-sm-12" ng-if="!kyberEthToToken && !kyberTransaction.bypassTokenApprove">
<span>
Track your token authorization transaction:
</span>
Expand Down Expand Up @@ -8127,7 +8127,7 @@ <h5> <i aria-hidden="true">👫</i> You can support us by supporting our blockch
<div class="footer__pill-wrap footer__pill-custom-wrap">
<a class="footer__pill" href="https://www.ledgerwallet.com/r/fa4b?path=/products/" target="_blank" rel="noopener">Ledger Wallet</a>
<a class="footer__pill" href="https://trezor.io/?a=myetherwallet.com" target="_blank" rel="noopener">TREZOR</a>
<a class="footer__pill" href="https://digitalbitbox.com/?ref=mew" target="_blank" rel="noopener">Digital Bitbox</a>
<a class="footer__pill" href="http://shiftcrypto.ositracker.com/91316/7114" target="_blank" rel="noopener">Digital Bitbox</a>
<a class="footer__pill" href="https://ether.cards/?utm_source=mew&utm_medium=cpm&utm_campaign=site" target="_blank" rel="noopener">ether.card</a>
<a class="footer__pill" href="https://thehodlwallet.com?aff=15" target="_blank" rel="noopener">HODL Wallet</a>
</div>
Expand Down
Loading

0 comments on commit c373e30

Please sign in to comment.