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

[Refactor] Management of store data #110

Open
jmoreira-valory opened this issue Nov 18, 2023 · 0 comments
Open

[Refactor] Management of store data #110

jmoreira-valory opened this issue Nov 18, 2023 · 0 comments
Labels

Comments

@jmoreira-valory
Copy link
Collaborator

Management of data in store is currently very cumbersome and error-prone. It is currently managed through the methods try_read_storage and create_storage, which need to be called/managed in a tighly-coupled and convoluted way.

Instead, a more manageable and mantainable method is propoded here using a single method called at the begining of the script (we consider variables not required in individual files are stored in .env file, similar to #106 ):

read_storage() {
   if $store folder don't exist -> create folder
   if $store/README.txt don't exist -> create $store/README.txt; fill README.txt
   if $store/.env don't exist -> create $store/.env

   unset RPC
   unset USE_STAKING
   unset AGENT_ID
   source $store/.env

   if variable RPC don't defined -> ask_user_rpc; store RPC on $store/.env
   if variable USE_STAKING don't defined -> ask_user_use_staking; store USE_STAKING on $store/.env
   if variable AGENT_ID not defined -> populate AGENT_ID accordingly

   # From this point on, we also need the autonomy commands.
   if /trader folder don't exist -> clone trader repository, initialize poetry, etc. 

   if $store/keys.json don't exist -> autonomy create keys.json
   if $store/agent_address.txt don't exist -> create agent_address.txt from keys.json (we have a method to do it. do we need this file?)
   if $store/agent_pkey.txt don't exist -> create agent_pkey.txt from keys.json (we have a method)

   if $store/operator_keys.json don't exist -> autonomy create operator_keys.json
   if $store/operator_address.txt don't exist -> create operator_address.txt from operator_keys.json (do we need this file?)
   if $store/operator_pkey.txt don't exist -> create operator_pkey.txt from keys.json (we have a method)

   # Files available_tools_store.json, policy_store.json, possibly not need to initialize here?
   # Files service.id.txt and service_safe_address.txt, possibly not need to initialize here? Store in the .env file instead.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant