Created
April 23, 2018 21:24
-
-
Save kvhnuke/1028d800ec087a9e6ff47c08a0e143fd to your computer and use it in GitHub Desktop.
swap
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
let doAssignment = true; | |
$scope.kyberSwapRateDisplay(); | |
let bityOptions = ["ETH", "BTC", "REP"]; | |
let kyberOptions = $scope.availableTokens; | |
let isBity = (_coin) => { | |
return bityOptions.indexOf(_coin) > -1; | |
} | |
if (isFrom) { | |
$scope.availableToOptions = [] | |
if (isBity(coin)) { | |
bityOptions.forEach((_item) => { | |
if (_item != coin) $scope.availableToOptions.push(_item) | |
}) | |
if (coin == "ETH") { | |
kyberOptions.forEach((_item) => { | |
$scope.availableToOptions.push(_item) | |
}) | |
} | |
} else { | |
$scope.availableToOptions = ["ETH"] | |
} | |
} else { | |
$scope.availableFromOptions = [] | |
if (isBity(coin)) { | |
if (coin == "ETH") { | |
bityOptions.forEach((_item) => { | |
if (_item != coin && _item != "REP") $scope.availableFromOptions.push(_item) | |
}) | |
kyberOptions.forEach((_item) => { | |
$scope.availableFromOptions.push(_item) | |
}) | |
} else { | |
bityOptions.forEach((_item) => { | |
if (_item != coin && _item != "REP") $scope.availableFromOptions.push(_item) | |
}) | |
} | |
} else { | |
$scope.availableToOptions = ["ETH"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment