neume-network / strategies

Indexing strategies for the neume network.
GNU General Public License v3.0
11 stars 7 forks source link

Consider single file format for strategy definitions #292

Open neatonk opened 1 year ago

neatonk commented 1 year ago

Implementing a strategy (e.g. to include a new platform) requires code to be written in multiple file locations. This can be quite a hurdle for newcomers.

For example, to implement the zora-drops strategies (and tests), I have added the following files:

src/strategies/zora-drops-call-tokenuri/extractor.mjs
src/strategies/zora-drops-call-tokenuri/transformer.mjs
src/strategies/zora-drops-filter-contracts/transformer.mjs
src/strategies/zora-drops-get-tokenuri/extractor.mjs
src/strategies/zora-drops-get-tokenuri/transformer.mjs
test/strategies/zora-drops-call-tokenuri/extractor_input_data
test/strategies/zora-drops-call-tokenuri/extractor_snapshot.json
test/strategies/zora-drops-call-tokenuri/extractor_test.mjs
test/strategies/zora-drops-call-tokenuri/transformer_test.mjs
test/strategies/zora-drops-filter-contracts/transformer_test.mjs
test/strategies/zora-drops-get-tokenuri/extractor_input_data
test/strategies/zora-drops-get-tokenuri/extractor_snapshot.json
test/strategies/zora-drops-get-tokenuri/extractor_test.mjs
test/strategies/zora-drops-get-tokenuri/transformer_test.mjs

Ideally, this would be reduced to something like:

src/strategies/zora-drops.mjs
src/strategies/zora-drops.test.mjs
TimDaub commented 1 year ago

Understood although probably what I'd prefer is if there was a

that the zora drops strategy can make use of. I think it'll mean thinking more in terms of blueprints and less in terms of strategy factories.