r0gue-io / pop-cli

An all-in-one tool for Polkadot development.
GNU General Public License v3.0
69 stars 20 forks source link

refactor(templates): Make templates and providers generic #221

Closed peterwht closed 3 months ago

peterwht commented 3 months ago

Prereq: https://github.com/r0gue-io/pop-cli/pull/201 <- please merge this first. This one will update to point to main after the above is merged.

With the introduction of contract generation, with specific types (ERC, Examples, etc), duplicate code was introduced for Template types (such as Provider and ContractTypes and parachain & contract templates).

This PR introduces two traits to simplify template handling:

For example: ERC -> TemplateType has many types ERC20, ERC721 Pop -> TemplateType has many types Assets, Contracts, EVM

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 74.36975% with 61 lines in your changes missing coverage. Please review.

Project coverage is 66.00%. Comparing base (a763f35) to head (22da325). Report is 1 commits behind head on alex/contracts-template.

@@                     Coverage Diff                     @@
##           alex/contracts-template     #221      +/-   ##
===========================================================
+ Coverage                    65.82%   66.00%   +0.18%     
===========================================================
  Files                           41       42       +1     
  Lines                         5308     5395      +87     
  Branches                      5308     5395      +87     
===========================================================
+ Hits                          3494     3561      +67     
- Misses                        1258     1277      +19     
- Partials                       556      557       +1     
Files Coverage Δ
crates/pop-common/src/errors.rs 0.00% <ø> (ø)
crates/pop-contracts/src/test.rs 0.00% <ø> (ø)
crates/pop-contracts/src/utils/helpers.rs 61.70% <100.00%> (ø)
crates/pop-parachains/src/errors.rs 0.00% <ø> (ø)
crates/pop-cli/src/commands/mod.rs 0.00% <0.00%> (ø)
crates/pop-contracts/src/templates.rs 97.77% <98.11%> (+3.93%) :arrow_up:
crates/pop-parachains/src/new_parachain.rs 81.81% <75.00%> (ø)
crates/pop-parachains/src/templates.rs 98.14% <98.27%> (+7.03%) :arrow_up:
crates/pop-cli/src/commands/new/parachain.rs 45.91% <61.11%> (ø)
crates/pop-contracts/src/new.rs 80.10% <68.96%> (+1.53%) :arrow_up:
... and 2 more

... and 1 file with indirect coverage changes