r0gue-io / pop-cli

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

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

Open peterwht opened 5 days ago

peterwht commented 5 days ago

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 5 days ago

Codecov Report

Attention: Patch coverage is 76.36364% with 39 lines in your changes missing coverage. Please review.

Project coverage is 70.03%. Comparing base (209024b) to head (fbd9f50).

@@            Coverage Diff             @@
##             main     #226      +/-   ##
==========================================
- Coverage   70.07%   70.03%   -0.04%     
==========================================
  Files          44       44              
  Lines        6596     6565      -31     
  Branches     6596     6565      -31     
==========================================
- Hits         4622     4598      -24     
+ Misses       1236     1230       -6     
+ Partials      738      737       -1     
Files Coverage Δ
crates/pop-common/src/errors.rs 0.00% <ø> (ø)
crates/pop-contracts/src/templates.rs 97.67% <100.00%> (+7.07%) :arrow_up:
crates/pop-contracts/src/utils/helpers.rs 78.72% <100.00%> (ø)
crates/pop-parachains/src/errors.rs 0.00% <ø> (ø)
crates/pop-cli/src/commands/mod.rs 0.00% <0.00%> (ø)
crates/pop-cli/src/commands/new/contract.rs 50.00% <80.00%> (ø)
crates/pop-contracts/src/call.rs 69.84% <0.00%> (ø)
crates/pop-contracts/src/up.rs 63.80% <0.00%> (ø)
crates/pop-parachains/src/new_parachain.rs 81.81% <75.00%> (ø)
crates/pop-parachains/src/templates.rs 97.91% <97.77%> (+6.80%) :arrow_up:
... and 3 more

... and 2 files with indirect coverage changes

peterwht commented 3 days ago

Comments resolved! Seems much better now :)