Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: psp22 trait contract example with drink tests #300

Open
wants to merge 164 commits into
base: main
Choose a base branch
from

Conversation

chungquantin
Copy link
Collaborator

@chungquantin chungquantin commented Sep 19, 2024

Description

Example contract for the fungible use case that applies the PSP22 traits from #297. The PR includes:

Daanvdplas and others added 30 commits May 19, 2024 17:38
# This is the 1st commit message:

refactor: general

# This is the commit message #2:

init

# This is the commit message #3:

begin refactor

# This is the commit message #4:

refactor: error handling

# This is the commit message #5:

tests: add error handling tests

# This is the commit message #6:

WIP

# This is the commit message #7:

finalise error handling

# This is the commit message #8:

refactor: easier review
Co-authored-by: Frank Bell <frank@r0gue.io>
Copy link
Collaborator Author

@chungquantin chungquantin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of concerns / TODOs I have from my end.

pop-api/examples/fungibles/lib.rs Show resolved Hide resolved
pop-api/examples/fungibles/lib.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Daanvdplas Daanvdplas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helper functions are a lot better! Still some things to do. Next time we should take the pallet tests as reference because that is already reviewed and we implement those tests and how to write them much faster.

pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/lib.rs Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Show resolved Hide resolved
Copy link
Collaborator

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example largely looks great, a few improvements can be made imo. Whilst it is awesome that the drink tests are working, I feel that the implementation of the tests is too complex and can be made much more digestible with some refactoring.

Some stuff can be moved to pop-drink, some stuff to eliminate the some initialisation in each test etc. We want to eliminate as much boilerplate as possible, so the example tests showcase how easy it is to write tests using the API. As it stands, there is considerable effort required for the developer.

pop-api/src/v0/fungibles/traits.rs Outdated Show resolved Hide resolved
pallets/api/src/fungibles/mod.rs Outdated Show resolved Hide resolved
pallets/api/src/fungibles/mod.rs Outdated Show resolved Hide resolved
pallets/api/src/fungibles/mod.rs Outdated Show resolved Hide resolved
pop-api/integration-tests/src/fungibles/mod.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/tests.rs Show resolved Hide resolved
Daanvdplas and others added 2 commits October 1, 2024 15:07
@chungquantin chungquantin changed the base branch from chore/tests_with_drink to main October 3, 2024 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Pop API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants