Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SavingsDAI #122

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ you are modifying weaviate schema.
cd docker
docker-compose up
```

## Steps to add new widget command
- Update `widgets.txt` with the widget command details
- Bump up the widget index version in `INDEX_NAME` https://github.com/yieldprotocol/chatweb3-backend/blob/dev/index/widgets.py#L9 
- Similarly, bump up the index version in `index_name`  https://github.com/yieldprotocol/chatweb3-backend/blob/dev/config.py#L6
- Run this Python command to update our Weaviate Vector DB with the new widget `python3 -c "from index import widgets; widgets.backfill()"`
- Add the widget's handler function in `replace_match()` https://github.com/yieldprotocol/chatweb3-backend/blob/dev/tools/index_widget.py#L189
10 changes: 10 additions & 0 deletions knowledge_base/widgets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ Required Parameters:
-{token}: token to withdraw
-{amount}: quantity to withdraw
---
Widget magic command: <|savings-dai-deposit({amount})|>
Description of widget: This widget is used when the user wants to deposit DAI into SavingsDAI to get SavingsDAI, that can be later redeemed for a profit.
Required Parameters:
-{amount}: amount of DAI to deposit
---
Widget magic command: <|savings-dai-redeem({amount})|>
Description of widget: This widget is used when the user wants to redeem their SavingsDAI to get DAI, realizing a profit.
Required Parameters:
-{amount}: amount of SavingsDAI to redeem
---
Widget magic command: <|display-yield-farm({project},{network}, {token}, {amount})|>
Description of widget: This widget is only to be used for the Compound project to allow the user to yield farm by putting tokens or depositing tokens of a certain amount into the Compound project
Required Parameters:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SQLAlchemy_Utils==0.39.0
psycopg2-binary==2.9.5
qcore==1.8.0
PyYAML==6.0
web3==6.2.0
web3==6.3.0
gpt_index==0.4.23
transformers==4.26.1
pyWalletConnect==1.3.3
Expand Down
6 changes: 3 additions & 3 deletions tools/index_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ def replace_match(m: re.Match) -> Union[str | Generator]:
return str(fetch_yields(*params))
elif command == aave.AaveSupplyContractWorkflow.WORKFLOW_TYPE:
return str(exec_aave_operation(*params, operation='supply'))
elif command == aave.AaveBorrowUIWorkflow.WORKFLOW_TYPE:
elif command == aave.AaveBorrowContractWorkflow.WORKFLOW_TYPE:
return str(exec_aave_operation(*params, operation='borrow'))
elif command == 'aave-repay':
elif command == aave.AaveRepayContractWorkflow.WORKFLOW_TYPE:
return str(exec_aave_operation(*params, operation='repay'))
elif command == 'aave-withdraw':
elif command == aave.AaveWithdrawContractWorkflow.WORKFLOW_TYPE:
return str(exec_aave_operation(*params, operation='withdraw'))
elif command == 'ens-from-address':
return str(ens_from_address(*params))
Expand Down
3 changes: 1 addition & 2 deletions ui_workflows/aave/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from .ui_integration import AaveSupplyUIWorkflow, AaveBorrowUIWorkflow
from .contract_abi_integration import AaveSupplyContractWorkflow
from .contract_abi_integration import *
Loading