Skip to content

Commit

Permalink
chore(core): remove swap (via loopd) functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
vindard committed Jan 30, 2024
1 parent a918207 commit aa59401
Show file tree
Hide file tree
Showing 47 changed files with 9 additions and 12,383 deletions.
11 changes: 0 additions & 11 deletions core/api/galoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,9 @@ onChainWallet:
scanDepth: 360
scanDepthOutgoing: 2
scanDepthChannelUpdate: 8
swap:
loopOutWhenHotWalletLessThan: 200000000
swapOutAmount: 50000000
swapProviders:
- Loop
lnd1loopRestEndpoint: https://localhost:8081
lnd1loopRpcEndpoint: localhost:11010
lnd2loopRestEndpoint: https://localhost:8082
lnd2loopRpcEndpoint: localhost:11011
feeAccountingEnabled: true
userActivenessMonthlyVolumeThreshold: 100
cronConfig:
rebalanceEnabled: true
swapEnabled: true
captcha:
mandatory: false
skipFeeProbeConfig:
Expand Down
2 changes: 1 addition & 1 deletion core/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"eslint-check": "eslint src test --ext .ts",
"eslint-fix": "eslint src test --ext .ts --fix",
"circular-deps-check": "madge --circular --extensions ts src",
"build": "tsc -p tsconfig-build.json && cp -R src/services/price/protos dist/services/price/ && cp -R src/services/dealer-price/proto dist/services/dealer-price/ && cp -R src/services/loopd/protos dist/services/loopd/ && cp -R src/services/bria/proto dist/services/bria/ && cp -R src/services/notifications/proto dist/services/notifications/ && tscpaths --silent -p tsconfig.json -s ./src -o ./dist",
"build": "tsc -p tsconfig-build.json && cp -R src/services/price/protos dist/services/price/ && cp -R src/services/dealer-price/proto dist/services/dealer-price/ && cp -R src/services/bria/proto dist/services/bria/ && cp -R src/services/notifications/proto dist/services/notifications/ && tscpaths --silent -p tsconfig.json -s ./src -o ./dist",
"trigger": "pnpm run build && node dist/servers/trigger.js | pino-pretty -c -l",
"ws": "pnpm run build && node dist/servers/ws-server.js | pino-pretty -c -l",
"watch": "nodemon -V -e ts,graphql -w ./src -x pnpm run start",
Expand Down
3 changes: 0 additions & 3 deletions core/api/src/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as TransactionsMod from "./transactions"
import * as UsersMod from "./users"
import * as WalletsMod from "./wallets"
import * as PaymentsMod from "./payments"
import * as SwapMod from "./swap"

import { wrapAsyncToRunInSpan } from "@/services/tracing"

Expand All @@ -29,7 +28,6 @@ const allFunctions = {
Users: { ...UsersMod },
Wallets: { ...WalletsMod },
Payments: { ...PaymentsMod },
Swap: { ...SwapMod },
} as const

let subModule: keyof typeof allFunctions
Expand Down Expand Up @@ -59,5 +57,4 @@ export const {
Users,
Wallets,
Payments,
Swap,
} = allFunctions
35 changes: 0 additions & 35 deletions core/api/src/app/swap/get-active-loopd.ts

This file was deleted.

2 changes: 0 additions & 2 deletions core/api/src/app/swap/index.ts

This file was deleted.

52 changes: 0 additions & 52 deletions core/api/src/app/swap/swap-listener.ts

This file was deleted.

87 changes: 0 additions & 87 deletions core/api/src/app/swap/swap-out.ts

This file was deleted.

17 changes: 0 additions & 17 deletions core/api/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
getBriaPartialConfigFromYaml,
MEMO_SHARING_CENTS_THRESHOLD,
MEMO_SHARING_SATS_THRESHOLD,
getCronConfig,
} from "./yaml"
import { env } from "./env"

Expand Down Expand Up @@ -66,22 +65,6 @@ export const getGeetestConfig = () => {

export const isRunningJest = typeof jest !== "undefined"

export const getLoopConfig = () => {
if (getCronConfig().swapEnabled) {
if (!LND1_LOOP_TLS) throw new ConfigError("Missing LND1_LOOP_TLS config")
if (!LND2_LOOP_TLS) throw new ConfigError("Missing LND2_LOOP_TLS config")
if (!LND1_LOOP_MACAROON) throw new ConfigError("Missing LND1_LOOP_MACAROON config")
if (!LND2_LOOP_MACAROON) throw new ConfigError("Missing LND2_LOOP_MACAROON config")
return {
lnd1LoopTls: LND1_LOOP_TLS,
lnd1LoopMacaroon: LND1_LOOP_MACAROON,
lnd2LoopTls: LND2_LOOP_TLS,
lnd2LoopMacaroon: LND2_LOOP_MACAROON,
}
}
throw new ConfigError("getLoopConfig() was called though swapEnabled is false")
}

export const memoSharingConfig = {
memoSharingSatsThreshold: MEMO_SHARING_SATS_THRESHOLD,
memoSharingCentsThreshold: MEMO_SHARING_CENTS_THRESHOLD,
Expand Down
32 changes: 1 addition & 31 deletions core/api/src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,45 +555,16 @@ export const configSchema = {
scanDepthChannelUpdate: 8,
},
},
swap: {
type: "object",
properties: {
loopOutWhenHotWalletLessThan: { type: "integer" },
lnd1loopRestEndpoint: { type: "string" },
lnd2loopRestEndpoint: { type: "string" },
lnd1loopRpcEndpoint: { type: "string" },
lnd2loopRpcEndpoint: { type: "string" },
swapOutAmount: { type: "integer" },
swapProviders: {
type: "array",
items: { enum: ["Loop"] },
uniqueItems: true,
},
feeAccountingEnabled: { type: "boolean" },
},
default: {
loopOutWhenHotWalletLessThan: 200000000,
swapOutAmount: 50000000,
swapProviders: ["Loop"],
lnd1loopRestEndpoint: "https://localhost:8081",
lnd1loopRpcEndpoint: "localhost:11010",
lnd2loopRestEndpoint: "https://localhost:8082",
lnd2loopRpcEndpoint: "localhost:11011",
feeAccountingEnabled: true,
},
},
userActivenessMonthlyVolumeThreshold: { type: "integer", default: 100 },
cronConfig: {
type: "object",
properties: {
rebalanceEnabled: { type: "boolean" },
swapEnabled: { type: "boolean" },
},
required: ["rebalanceEnabled", "swapEnabled"],
required: ["rebalanceEnabled"],
additionalProperties: false,
default: {
rebalanceEnabled: true,
swapEnabled: true,
},
},
captcha: {
Expand Down Expand Up @@ -658,7 +629,6 @@ export const configSchema = {
"ipRecording",
"fees",
"onChainWallet",
"swap",
"userActivenessMonthlyVolumeThreshold",
"cronConfig",
"captcha",
Expand Down
11 changes: 0 additions & 11 deletions core/api/src/config/schema.types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,9 @@ type YamlSchema = {
scanDepthOutgoing: number
scanDepthChannelUpdate: number
}
swap: {
loopOutWhenHotWalletLessThan: number
lnd1loopRestEndpoint: string
lnd2loopRestEndpoint: string
lnd1loopRpcEndpoint: string
lnd2loopRpcEndpoint: string
swapOutAmount: number
swapProviders: Array<SwapProvider>
feeAccountingEnabled: boolean
}
userActivenessMonthlyVolumeThreshold: number
cronConfig: {
rebalanceEnabled: boolean
swapEnabled: boolean
}
captcha: {
mandatory: boolean
Expand Down
1 change: 0 additions & 1 deletion core/api/src/config/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ type Levels = number[]

type CronConfig = {
rebalanceEnabled: boolean
swapEnabled: boolean
}

type CaptchaConfig = {
Expand Down
17 changes: 0 additions & 17 deletions core/api/src/config/yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,23 +324,6 @@ export const getAccountsOnboardConfig = (config = yamlConfig): AccountsOnboardCo
}
}

export const getSwapConfig = (): SwapConfig => {
const config = yamlConfig.swap
return {
loopOutWhenHotWalletLessThan: {
amount: BigInt(config.loopOutWhenHotWalletLessThan),
currency: WalletCurrency.Btc,
},
swapOutAmount: { amount: BigInt(config.swapOutAmount), currency: WalletCurrency.Btc },
lnd1loopRestEndpoint: config.lnd1loopRestEndpoint,
lnd2loopRestEndpoint: config.lnd2loopRestEndpoint,
lnd1loopRpcEndpoint: config.lnd1loopRpcEndpoint,
lnd2loopRpcEndpoint: config.lnd2loopRpcEndpoint,
swapProviders: config.swapProviders,
feeAccountingEnabled: config.feeAccountingEnabled,
}
}

export const getSmsAuthUnsupportedCountries = (): CountryCode[] => {
return yamlConfig.smsAuthUnsupportedCountries as CountryCode[]
}
Expand Down
14 changes: 0 additions & 14 deletions core/api/src/domain/swap/errors.ts

This file was deleted.

Loading

0 comments on commit aa59401

Please sign in to comment.