FreedomCoop / valuenetwork

Fork coming from NRP-Sensorica to use and work for FREEDOM COOP
http://fair.coop
GNU Affero General Public License v3.0
31 stars 12 forks source link

Decoupling faircoin (new faircoin app) #290

Open XaviP opened 7 years ago

XaviP commented 7 years ago

Trying to find a doable road map. A (very schematic and simple) proposal:

  1. Create new faircoin app
    • Move all faircoin stuff to a new app.
    • Simplify faircoin_account and faircoin_history to only call inside app, and less calls to wallet.
    • Use conditionals for importing and use anything from faircoin app ( if 'faircoin' in settings.INSTALLED_APPS)
    • Testing and deploy.

(Edit: point 1 is done, merged and deployed)

  1. Decoupling fields and methods
    • Create two faircoin app models with the fields and methods used in valueaccounting/models.py (EconomicResource and EconomicEvent) with OneToOne relation with the objects which contain those fields.
    • Copy from production db the content in those fields in valueaccounting app to the faircoin app two models new fields.
    • Change all references to those fields and methods to the new ones in all code.
    • Testing and deploy.
XaviP commented 7 years ago
XaviP commented 7 years ago
XaviP commented 7 years ago

Initial commit wallet app: https://github.com/FreedomCoop/valuenetwork/commit/29449692a9561bb4c421c6c0f45b73f3e352497b Two notes:

XaviP commented 7 years ago

Related to this issue, working in faircoin decoupling in branch new_faircoin_app, with this main goals:

This way, all related to faircoin will be in a separated app. https://github.com/FreedomCoop/valuenetwork/tree/new_faircoin_app

XaviP commented 7 years ago

The branch new_faircoin_app is ready to test in testocp. The wallet is working ok, but to test further than faircoin_account and faircoin_history pages is needed, as I don't really know the implications inside valueaccounting and work apps that these movements of code have. Another change done: valueaccounting/faircoin_utils.py is merged into faircoin/utils.py, and all imports in valueaccountig and work apps are changed to point there. Edit: merged into master and deployed in production.

XaviP commented 7 years ago

Transfering specific faircoin stuff from valueaccounting/models.py to faircoin/models.py: https://github.com/FreedomCoop/valuenetwork/blob/faircoin_models/faircoin/models.py It's not working yet, it's only a draft.

@bhaugen @fosterlynn @bum2 , can you take a look? Am I missing something? Do you catch my purpose? Do you agree?

Edit: The ultimate goal of all this would be that valueaccountig and work apps interact with a common interface to make currency movements, through gateways for the faircoin wallet, for chipchap api, for freecoin api, etc.. That is, the @escanda last proposals, draft in wallet app branch with an object factory: https://github.com/FreedomCoop/valuenetwork/blob/wallet_app/wallet/__init__.py

bhaugen commented 7 years ago

I took a look. I think I catch the purpose: FaircoinAddress is oneToOne with EconomicResource, which is where faircoin addresses have been held before. So it is factoring out all the faircoin-specific behaviors from the valueaccounting app, and then you will be able to add more behaviors for different currencies behind other gateways.

FaircoinTransaction does the same for EconomicEvent.

Is that what you had in mind?

I didn't see any corresponding changes in https://github.com/FreedomCoop/valuenetwork/blob/faircoin_models/valuenetwork/valueaccounting/models.py though. Are those yet to come?

The first part makes sense to me, if the corresponding changes in valueaccounting and work apps are smooth enough.

XaviP commented 7 years ago

Is that what you had in mind?

Yes.

I didn't see any corresponding changes in https://github.com/FreedomCoop/valuenetwork/blob/faircoin_models/valuenetwork/valueaccounting/models.py though. Are those yet to come?

Yes, when everything goes fine, I'll erase the fields/functions from valueaccounting

The first part makes sense to me, if the corresponding changes in valueaccounting and work apps are smooth enough.

Yes, I'll try that smoothness :-)

bhaugen commented 7 years ago

I'll erase the fields/functions from valueaccounting

Won't you need to add some new functions (or redo some of those that exist), at least for EconomicAgent? (But I'll wait and see what comes next.)

XaviP commented 7 years ago

Hey, too complex, so I'm going to work in two fases:

bhaugen commented 7 years ago

Find a secure way to migrate db data from valueaccounting app tables to faircoin app new tables in testocp and production dbs.

Data migrations might work.

XaviP commented 7 years ago
XaviP commented 7 years ago