peatio icon indicating copy to clipboard operation
peatio copied to clipboard

Dynamic models, controllers, routes, and code itself for currencies

Open yivo opened this issue 8 years ago • 4 comments

yivo avatar Mar 08 '18 10:03 yivo

What do you think about shell script for automated adding new currencies. Maybe with those steps:

  1. Put configuration (coin name,rpc, on which coin it's based...)
  2. Clone currency on which new currency is based
  3. Rename files and content of new (cloned) currency with $SED -i After running script only thing left to do will be create pairs and test everything.

I know current files will need changes but this script can save alot of time when adding new currencies.

tzman89 avatar Mar 08 '18 11:03 tzman89

Hi @tzman89

Adding new currencies is based on three steps:

  1. Add currency config to config/seed/currencies.yml
  2. rake db:seed
  3. Code API client

That's all. We are going away from peatio/peatio way of duplicating tons of lines of code. We recently refactored the whole project to be able to fetch currencies from database, not ActiveYAMLBase.

yivo avatar Mar 08 '18 11:03 yivo

The idea it to unify all of these into three: image

  • BaseController
  • BanksController
  • CoinsController

yivo avatar Mar 08 '18 11:03 yivo

I see, thanks for explanation I wasn't sure how currencies in db thing works but now it's much clear.

So as I understand controllers for other currencies should be the same if the currency is based on any of the current ones,we can use key from currencies.yml to determine new currency controller.

I'm following your work here and you did a great job with this, you got it to almost perfect platform. It will be fantastic when you implement ActionCable and also only Monero is left to add and it will have all currency types.

tzman89 avatar Mar 08 '18 13:03 tzman89