From 070ded071245cd78fcac8b632ea95911c17d90d6 Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Thu, 15 Jun 2023 12:14:58 -0700 Subject: [PATCH 1/4] feat: liquity borrow widget text --- knowledge_base/widgets.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/knowledge_base/widgets.txt b/knowledge_base/widgets.txt index 838f1d66..4c956ec0 100644 --- a/knowledge_base/widgets.txt +++ b/knowledge_base/widgets.txt @@ -237,3 +237,10 @@ Required parameters: -{query}: a standalone question representing information to be retrieved from the index Return value description: -a summarized answer with source citations +--- +Widget magic command: <|liquity-borrow({borrowAmount},{collateralAmount})|> +Description of widget: This widget is used when the user wants to borrow LUSD using ETH as collateral from the Liquity protocol. +Required Parameters: +-{borrowAmount}: amount of LUSD to borrow +-{collateralAmount}: amount of ETH to use as collateral +--- \ No newline at end of file From b33a71690d855207335da27356bcdd58249033ca Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Tue, 27 Jun 2023 11:01:42 -0700 Subject: [PATCH 2/4] feat: liquity adjust --- knowledge_base/widgets.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/knowledge_base/widgets.txt b/knowledge_base/widgets.txt index 47a05516..0d60edec 100644 --- a/knowledge_base/widgets.txt +++ b/knowledge_base/widgets.txt @@ -244,6 +244,19 @@ Required Parameters: -{borrowAmount}: amount of LUSD to borrow -{collateralAmount}: amount of ETH to use as collateral --- +Widget magic command: <|liquity-close()|> +Description of widget: This widget is used when the user wants to close their trove from Liquity protocol. +--- +Widget magic command: <|liquity-adjust({borrowAmount},{repayAmount},{depositCollateral},{withdrawCollateral})|> +Description of widget: This widget is used when the user wants to adjust their trove from Liquity protocol. +Required Parameters: +If the user is trying to borrow more LUSD and/or deposit more collateral +-{borrowAmount}: amount of LUSD to borrow +-{collateralAmount}: amount of ETH to use as collateral +If the user is trying to repay debt and/or withdraw collateral +-{repayAmount}: amount of LUSD to repay +-{withdrawCollateral}: amount of ETH collateral to withdraw +--- Widget magic command: <|display-zksync-deposit({token},{amount})|> Description of widget: This widget is used when the user wants to bridge and deposit tokens from mainnet L1 to zksync L2 Required parameters: From fd30c54453c212a2ad12049d385ab91512e1c634 Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Wed, 28 Jun 2023 07:58:39 -0700 Subject: [PATCH 3/4] fix: put new widget commands at the end --- knowledge_base/widgets.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/knowledge_base/widgets.txt b/knowledge_base/widgets.txt index 0d60edec..9edc1965 100644 --- a/knowledge_base/widgets.txt +++ b/knowledge_base/widgets.txt @@ -238,6 +238,18 @@ Required parameters: Return value description: -a summarized answer with source citations --- +Widget magic command: <|display-zksync-deposit({token},{amount})|> +Description of widget: This widget is used when the user wants to bridge and deposit tokens from mainnet L1 to zksync L2 +Required parameters: +-{token}: token to deposit +-{amount}: quantity to deposit +--- +Widget magic command: <|display-zksync-withdraw({token},{amount})|> +Description of widget: This widget is used when the user wants to withdraw tokens from zksync L2 to mainnet L1 +Required parameters: +-{token}: token to withdraw +-{amount}: quantity to withdraw +--- Widget magic command: <|liquity-borrow({borrowAmount},{collateralAmount})|> Description of widget: This widget is used when the user wants to borrow LUSD using ETH as collateral from the Liquity protocol. Required Parameters: @@ -255,16 +267,4 @@ If the user is trying to borrow more LUSD and/or deposit more collateral -{collateralAmount}: amount of ETH to use as collateral If the user is trying to repay debt and/or withdraw collateral -{repayAmount}: amount of LUSD to repay --{withdrawCollateral}: amount of ETH collateral to withdraw ---- -Widget magic command: <|display-zksync-deposit({token},{amount})|> -Description of widget: This widget is used when the user wants to bridge and deposit tokens from mainnet L1 to zksync L2 -Required parameters: --{token}: token to deposit --{amount}: quantity to deposit ---- -Widget magic command: <|display-zksync-withdraw({token},{amount})|> -Description of widget: This widget is used when the user wants to withdraw tokens from zksync L2 to mainnet L1 -Required parameters: --{token}: token to withdraw --{amount}: quantity to withdraw +-{withdrawCollateral}: amount of ETH collateral to withdraw \ No newline at end of file From b1a758fc959e21eb188e3149be835838912df21c Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Fri, 22 Sep 2023 09:13:44 -0700 Subject: [PATCH 4/4] feat: liquity --- chat/display_widgets.py | 12 ++++++++ knowledge_base/widgets.yaml | 56 +++++++++++++++++++++++++++++++++++++ utils/constants.py | 2 +- 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/chat/display_widgets.py b/chat/display_widgets.py index 2d7fb059..d96bb5c2 100644 --- a/chat/display_widgets.py +++ b/chat/display_widgets.py @@ -201,6 +201,18 @@ def _widgetize_inner(command: str, params: str, depth: int = 0) -> str: elif command == 'withdraw-vault': items = params.split(",") lines.append(f"Withdraw vault action for token: {items[0]}, amount: {items[1]}.") + elif command == 'liquity-borrow': + items = params.split(",") + lines.append(f"Borrow LUSD using ETH on liquity for borrow amount: {items[0]}, and collateral amount: {items[1]}.") + elif command == 'liquity-close': + items = params.split(",") + lines.append(f"Close a trove on liquity.") + elif command == 'liquity-adjust': + items = params.split(",") + lines.append(f"Adjust liquity trove by borrowing more LUSD using ETH for borrow amount: {items[0]}, and collateral amount: {items[1]}.") + elif command == 'liquity-repay': + items = params.split(",") + lines.append(f"Adjust liquity trove by repaying LUSD amount: {items[0]}, and withdrawing collateral amount: {items[1]}.") else: # assert 0, f'unrecognized command: {command}({params})' lines.append(f"An unrecognized command: {command}({params})") diff --git a/knowledge_base/widgets.yaml b/knowledge_base/widgets.yaml index b178db46..bde741a9 100644 --- a/knowledge_base/widgets.yaml +++ b/knowledge_base/widgets.yaml @@ -835,4 +835,60 @@ - amount - vault type: object + return_value_description: '' +- _name_: display_liquity_borrow + description: borrow LUSD using ETH using the liquity protocol + parameters: + properties: + borrowAmount: + description: amount of LUSD to borrow + type: string + collateralAmount: + description: amount of ETH to use as collateral + type: string + required: + - borrowAmount + - collateralAmount + type: object + return_value_description: '' +- _name_: display_liquity_close + description: close a trove, which consists of borrowed LUSD and ETH as collateral + parameters: + properties: + user_wallet_address: + description: wallet address to use, which is inferred + type: string + required: + - user_wallet_address + type: object + return_value_description: '' +- _name_: display_liquity_adjust + description: adjust a liquity trove by borrowing more LUSD using the same or more ETH + parameters: + properties: + borrowAmount: + description: amount of LUSD to borrow + type: string + collateralAmount: + description: amount of ETH to use as collateral, which can be zero additional ETH if no amount specified + type: string + required: + - borrowAmount + - collateralAmount + type: object + return_value_description: '' +- _name_: display_liquity_repay + description: adjust a liquity trove by repaying LUSD and removing ETH if specified, otherwise assume the user doesn't want to remove ETH + parameters: + properties: + repayAmount: + description: amount of LUSD to repay + type: string + withdrawCollateral: + description: amount of ETH collateral to withdraw if provided + type: string + required: + - repayAmount + - withdrawCollateral + type: object return_value_description: '' \ No newline at end of file diff --git a/utils/constants.py b/utils/constants.py index d908deeb..3c9fa714 100644 --- a/utils/constants.py +++ b/utils/constants.py @@ -53,7 +53,7 @@ WIDGET_INFO_TOKEN_LIMIT = 4000 # Widget Index -WIDGET_INDEX_NAME = "WidgetV24" +WIDGET_INDEX_NAME = "WidgetV25" def get_widget_index_name(): if env.is_local():