Skip to content

Instantly share code, notes, and snippets.

@kvhnuke
Created April 23, 2018 21:24
Show Gist options
  • Save kvhnuke/1028d800ec087a9e6ff47c08a0e143fd to your computer and use it in GitHub Desktop.
Save kvhnuke/1028d800ec087a9e6ff47c08a0e143fd to your computer and use it in GitHub Desktop.
swap
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