Skip to content

Commit

Permalink
feat: guide user for contract creation and add 4 contract templates (#…
Browse files Browse the repository at this point in the history
…201)

* feat: ux user guide for contract creation and list contract templates

* refactor: add template structure when creating parachain and flipper by default

* chore: add git functions to clone repository in pop-contracts

* feat: clone repository and extract only template files

* feat: rename smart contract

* chore: check contract naming

* refactor: consistent messaging with parachain generation

* docs: add contract templates info in README

* fix: fixes ans small refactors

* test: add unit tests

* test: few more unit test for templates and git

* fix: build issue

* fix: placeholder for contract and enum_variants error

* docs: fix feedback

* refactor: pop_common crate

* refactor: remove newline and add after license

* test: test and docs for replace_in_file and canonicalized_path function

* docs: fix links and comments

* fix: link

* refactor: remove unused dependencies

* refactor: remove unused errors in pop_parachain

* refactor: include replace_in_file in common crate

* feat(new): improve new contract with a ContractType for categorization (#220)

* feat(new): update templates in new contract with ContractType

* fix(new): shorter name and test fix

* refactor: rename flag to contract_type

* docs: apply feedback

---------

Co-authored-by: Peter White <[email protected]>
  • Loading branch information
AlexD10S and peterwht authored Jun 25, 2024
1 parent a14186d commit e95c42b
Show file tree
Hide file tree
Showing 49 changed files with 931 additions and 275 deletions.
30 changes: 24 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ sp-core = "31"
sp-weights = "30"
contract-build = "4.1"
contract-extrinsics = "4.1"
heck = "0.5.0"

# parachains
askama = "0.12"
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,31 @@ pop up parachain -f ./tests/networks/pop.toml --cmd ./path/to/my/script

### Contracts

Use `pop` to create a new Smart Contract project:
Use `pop` to create a new Smart Contract project.
To be guided through the entire contract creation process, simply execute

```sh
pop new contract
```

If no guidance is needed, proceed with:

```sh
# Create a minimal Smart Contract
pop new contract my_contract
```

`pop-cli` supports different contract templates and can be used with`--template`:

```sh
# Create an ERC-20 standard in ink!
pop new contract my_contract -t erc20
# Create an ERC-721 standard in ink!
pop new contract my_contract -t erc721
# Create an ERC-1155 standard in ink!
pop new contract my_contract -t erc1155
```

Test the Smart Contract:

```sh
Expand Down Expand Up @@ -291,7 +309,7 @@ cargo test
Pop CLI would not be possible without these awesome crates!

- Local network deployment powered by [zombienet-sdk](https://github.com/paritytech/zombienet-sdk)
- [cargo contract](https://github.com/paritytech/cargo-contract) a setup and deployment tool for developing Wasm based
- [cargo contract](https://github.com/use-ink/cargo-contract) a setup and deployment tool for developing Wasm based
Smart Contracts via ink!

## License
Expand Down
3 changes: 3 additions & 0 deletions crates/pop-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ git2.workspace = true
# telemetry
pop-telemetry = { path = "../pop-telemetry", version = "0.2.0", optional = true }

# common
pop-common = { path = "../pop-common", version = "0.2.0" }

[dev-dependencies]
assert_cmd.workspace = true
predicates.workspace = true
Expand Down
Loading

0 comments on commit e95c42b

Please sign in to comment.