From c7bf859e40130593b095860b589bc3b55f333744 Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Tue, 27 Aug 2024 13:17:12 -0400 Subject: [PATCH 1/2] refactor: remove release funds from conversion cli command --- packages/cli/source/commands/convert.tsx | 51 ++---------------------- packages/cli/source/state/convert.ts | 2 - 2 files changed, 4 insertions(+), 49 deletions(-) diff --git a/packages/cli/source/commands/convert.tsx b/packages/cli/source/commands/convert.tsx index 11ce82b..f9e181a 100644 --- a/packages/cli/source/commands/convert.tsx +++ b/packages/cli/source/commands/convert.tsx @@ -66,16 +66,6 @@ export const options = zod.object({ ) .optional() .default(false), - releaseFunds: zod - .boolean() - .describe( - option({ - description: "Release funds", - alias: "rf", - }), - ) - .optional() - .default(false), minTradeUsd: zod .number() .describe( @@ -126,24 +116,13 @@ interface Props { * Command to search for and execute token conversions based on parameters */ export default function Convert({ options }: Props) { - const { - minTradeUsd, - maxTradeUsd, - simulate, - releaseFunds, - assetIn, - assetOut, - converter, - profitable, - loop, - debug, - minIncomeBp, - } = options; + const { minTradeUsd, maxTradeUsd, simulate, assetIn, assetOut, converter, profitable, loop, debug, minIncomeBp } = + options; const { exit } = useApp(); const { write: writeStdErr } = useStderr(); - const [{ completed, messages, releasedFunds }, dispatch] = useReducer(reducer, defaultState); + const [{ completed, messages }, dispatch] = useReducer(reducer, defaultState); const [error, setError] = useState(""); useEffect(() => { @@ -160,16 +139,12 @@ export default function Convert({ options }: Props) { assetIn, assetOut, converter, - releaseFunds: !!releaseFunds, + releaseFunds: false, }); if (potentialConversions.length === 0) { setError("No Potential Trades Found"); } - if (releaseFunds) { - // @todo check if we need to release funds or if there are already enough funds to make our trade - await tokenConverter.releaseFundsForConversions(potentialConversions); - } for (const t of potentialConversions) { let amountOut = t.assetOut.balance; @@ -255,24 +230,6 @@ export default function Convert({ options }: Props) { {debug && <Options options={options} />} - {releaseFunds && ( - <Box flexDirection="column" borderStyle="round" borderColor="#3396FF"> - <Box flexDirection="row" marginLeft={1} justifyContent="space-between"> - <Box flexDirection="column"> - <Box flexDirection="row"> - <Text bold color="white"> - Release Funds Steps - </Text> - </Box> - <Box flexDirection="row"> - <Text color="green">{releasedFunds.done ? "✔" : " "}</Text> - <Box marginRight={1} /> - <Text>Release Funds</Text> - </Box> - </Box> - </Box> - </Box> - )} <Box flexDirection="column" flexGrow={1}> <Text bold backgroundColor="#3396FF"> Conversions diff --git a/packages/cli/source/state/convert.ts b/packages/cli/source/state/convert.ts index 334a3c3..359b4c8 100644 --- a/packages/cli/source/state/convert.ts +++ b/packages/cli/source/state/convert.ts @@ -31,13 +31,11 @@ interface TradeError { } interface State { - releasedFunds: { done: boolean }; completed: (TradeSuccess | TradeError)[]; messages: Array<PotentialConversionsMessage | GetBestTradeMessage | ArbitrageMessage | ExecuteTradeMessage>; } export const defaultState = { - releasedFunds: { done: false }, trades: {}, completed: [], messages: [], From eee744dace2e5aa03d5ee0e968898900ea36b35b Mon Sep 17 00:00:00 2001 From: Corey Rice <coreyarice@gmail.com> Date: Tue, 27 Aug 2024 13:22:38 -0400 Subject: [PATCH 2/2] chore: lock deps --- packages/cli/package.json | 2 +- yarn.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 78218c5..f897c9e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -28,7 +28,7 @@ "@graphql-mesh/cli": "^0.90.5", "@graphql-mesh/config": "^0.100.5", "@graphql-mesh/graphql": "^0.98.4", - "@venusprotocol/keeper-bots": "1.0.0-dev.3", + "@venusprotocol/keeper-bots": "1.0.0-dev.4", "@venusprotocol/venus-protocol": "^9.1.0", "dotenv": "^16.3.1", "graphql": "^16.8.1", diff --git a/yarn.lock b/yarn.lock index 4d92ab5..9fcd364 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7013,7 +7013,7 @@ __metadata: "@graphql-mesh/graphql": ^0.98.4 "@sindresorhus/tsconfig": ^3.0.1 "@types/react": ^18.2.55 - "@venusprotocol/keeper-bots": 1.0.0-dev.3 + "@venusprotocol/keeper-bots": 1.0.0-dev.4 "@venusprotocol/venus-protocol": ^9.1.0 ava: ^5.2.0 chalk: ^5.2.0 @@ -7171,7 +7171,7 @@ __metadata: languageName: unknown linkType: soft -"@venusprotocol/keeper-bots@1.0.0-dev.3, @venusprotocol/keeper-bots@workspace:packages/keeper-bots": +"@venusprotocol/keeper-bots@1.0.0-dev.4, @venusprotocol/keeper-bots@workspace:packages/keeper-bots": version: 0.0.0-use.local resolution: "@venusprotocol/keeper-bots@workspace:packages/keeper-bots" dependencies: