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: implement ICS-721 NFT transfer application #1053

Merged
merged 9 commits into from
Jan 24, 2024
Merged

Conversation

Farhad-Shabani
Copy link
Member

@Farhad-Shabani Farhad-Shabani commented Jan 23, 2024

Closes: #346

Description

This PR introduces the implementation of the ICS-721 NFT transfer application on the current feat/ics721-impl feature branch to the main. It encompasses the following PRs:


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

Farhad-Shabani and others added 8 commits January 5, 2024 16:21
* chore: establish ics721 boilerplate, ready for new additions

* nit
* WIP: add types and contexts

* WIP: add events

* WIP: implement modules

* add send_transfer

* add recv and refund handlers

* add tests

* fix send and recv

* fix context and add tests

* fix fmt

* fix for CI

* fix messages and serde

* fix comments
…i` types (#1027)

* WIP: add types and contexts

* WIP: add events

* WIP: implement modules

* add send_transfer

* add recv and refund handlers

* add tests

* fix send and recv

* fix context and add tests

* fix fmt

* fix for CI

* fix messages and serde

* fix comments

* Stub out DataValue Borsh unit test

* Add basic borsh (de)ser roundtrip tests

* Add basic serde roundtrip tests for DataValue

* Add json (de)serialization tests

* Add roundtrip tests for TokenUri

* Add roundtrip tests for ClassUri

* Remove ignore statement on a test

* Resolve clippy warning

* Change packet data dummy json strings to use camel case

* Configure nft-transfer app under std feature flag

* Move cfg statement

* Add nft-transfer feature

* Add nft-transfer feature

* Remove nft-transfer feature from default features

* Remove `optional = true` from `http` dependency

---------

Co-authored-by: yito88 <yuji@phact-columba.com>
* trace hash with class ID and token ID

* add serde flag
* fix encoding for ClassData and TokenData

* fix Cargo.toml
* skip validation, make some data optional

* check the length of token_uri and token_data

* fix to set TokenData and TokenUri at once

* imp: add validate_basic method for PacketData

* imp: allow any format for Data + define parse_as_ics721_data method

* fmt and clippy

* custom serde packet data with option

* add a test

* restore conversions

---------

Co-authored-by: Farhad Shabani <farhad.shabani@gmail.com>
@Farhad-Shabani Farhad-Shabani marked this pull request as ready for review January 23, 2024 15:30
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 1402 lines in your changes are missing coverage. Please review.

Comparison is base (ee92645) 71.30% compared to head (9333f77) 67.39%.

Files Patch % Lines
...s/ics721-nft-transfer/src/handler/send_transfer.rs 0.00% 201 Missing ⚠️
ibc-apps/ics721-nft-transfer/src/module.rs 36.56% 196 Missing ⚠️
...c/testapp/ibc/applications/nft_transfer/context.rs 2.15% 136 Missing ⚠️
ibc-apps/ics721-nft-transfer/types/src/packet.rs 39.72% 132 Missing ⚠️
ibc-apps/ics721-nft-transfer/types/src/class.rs 66.76% 118 Missing ⚠️
ibc-apps/ics721-nft-transfer/types/src/events.rs 0.00% 116 Missing ⚠️
.../ics721-nft-transfer/src/handler/on_recv_packet.rs 0.00% 106 Missing ⚠️
...rc/testapp/ibc/applications/nft_transfer/module.rs 0.00% 84 Missing ⚠️
...pps/ics721-nft-transfer/types/src/msgs/transfer.rs 0.00% 67 Missing ⚠️
ibc-apps/ics721-nft-transfer/types/src/token.rs 57.14% 63 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1053      +/-   ##
==========================================
- Coverage   71.30%   67.39%   -3.92%     
==========================================
  Files         187      205      +18     
  Lines       18507    20584    +2077     
==========================================
+ Hits        13196    13872     +676     
- Misses       5311     6712    +1401     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Farhad-Shabani Farhad-Shabani added this to the 0.50.0 milestone Jan 23, 2024
Copy link
Collaborator

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

LGTM 👍

I approved the PR but I think the changes in ics20 source code are mistakes.

ibc-apps/ics20-transfer/types/src/msgs/transfer.rs Outdated Show resolved Hide resolved
ibc-apps/ics20-transfer/types/src/msgs/transfer.rs Outdated Show resolved Hide resolved
ibc-apps/ics721-nft-transfer/Cargo.toml Outdated Show resolved Hide resolved
@Farhad-Shabani Farhad-Shabani merged commit 91b632c into main Jan 24, 2024
15 checks passed
@Farhad-Shabani Farhad-Shabani deleted the feat/ics721-impl branch January 24, 2024 01:40
Farhad-Shabani added a commit that referenced this pull request Sep 9, 2024
* feat: establish ICS-721 boilerplate, ready for new additions (#1012)

* chore: establish ics721 boilerplate, ready for new additions

* nit

* Implement ICS-721 NFT transfer (#1020)

* WIP: add types and contexts

* WIP: add events

* WIP: implement modules

* add send_transfer

* add recv and refund handlers

* add tests

* fix send and recv

* fix context and add tests

* fix fmt

* fix for CI

* fix messages and serde

* fix comments

* Add (de)serialization tests for `DataValue`, `TokenUri`, and `ClassUri` types (#1027)

* WIP: add types and contexts

* WIP: add events

* WIP: implement modules

* add send_transfer

* add recv and refund handlers

* add tests

* fix send and recv

* fix context and add tests

* fix fmt

* fix for CI

* fix messages and serde

* fix comments

* Stub out DataValue Borsh unit test

* Add basic borsh (de)ser roundtrip tests

* Add basic serde roundtrip tests for DataValue

* Add json (de)serialization tests

* Add roundtrip tests for TokenUri

* Add roundtrip tests for ClassUri

* Remove ignore statement on a test

* Resolve clippy warning

* Change packet data dummy json strings to use camel case

* Configure nft-transfer app under std feature flag

* Move cfg statement

* Add nft-transfer feature

* Add nft-transfer feature

* Remove nft-transfer feature from default features

* Remove `optional = true` from `http` dependency

---------

Co-authored-by: yito88 <yuji@phact-columba.com>

* fix: calculate trace hash from both class ID and token ID (#1032)

* trace hash with class ID and token ID

* add serde flag

* Fix ClassData and TokenData encoding in NonFungiblePacketData (#1038)

* fix encoding for ClassData and TokenData

* fix Cargo.toml

* Support ClassData and TokenData not according to ICS-721 spec (#1039)

* skip validation, make some data optional

* check the length of token_uri and token_data

* fix to set TokenData and TokenUri at once

* imp: add validate_basic method for PacketData

* imp: allow any format for Data + define parse_as_ics721_data method

* fmt and clippy

* custom serde packet data with option

* add a test

* restore conversions

---------

Co-authored-by: Farhad Shabani <farhad.shabani@gmail.com>

* chore: add unclog

* nit: fix docstrings

---------

Co-authored-by: Yuji Ito <yito88@users.noreply.github.com>
Co-authored-by: Sean Chen <seanchen11235@gmail.com>
Co-authored-by: yito88 <yuji@phact-columba.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Implement ICS 721: NFT transfer on ibc-rs
4 participants