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

implement callbacks #13

Closed
wants to merge 15 commits into from
Closed

implement callbacks #13

wants to merge 15 commits into from

Conversation

Art3miX
Copy link
Collaborator

@Art3miX Art3miX commented Nov 19, 2023

#10

packages/ics721/src/helpers.rs Show resolved Hide resolved
packages/ics721/src/helpers.rs Outdated Show resolved Hide resolved
/// You must verify this message was called by an approved ICS721 contract, either by code_id or address.
#[cw_serde]
pub struct Ics721ReceiveMsg {
pub original_packet: NonFungibleTokenPacketData,
Copy link
Member

Choose a reason for hiding this comment

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

I'd just name it packet or nft_data.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would like to keep the original here, to make it obvious that this is the original packet that was sent, and not anything else.

packages/ics721/src/helpers.rs Outdated Show resolved Hide resolved
packages/ics721/src/types.rs Show resolved Hide resolved
/// Being called on receiving the NFT after transfer was completed. (destination side)
/// `on_recieve` hook
/// Note - Failing this message will fail the transfer.
ReceiveNftIcs721(Ics721ReceiveMsg),
Copy link
Member

Choose a reason for hiding this comment

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

Would rename this to Ics721ReceiveNft.

Would also rename:
Ics721Callback -> Ics721CallbackNft
Ics721ReceiveMsg -> Ics721ReceiveNftMsg
Ics721CallbackMsg -> Ics721CallbackNftMsg

Would make naming more consistent.

Out of consistenty

Copy link
Collaborator Author

@Art3miX Art3miX Nov 26, 2023

Choose a reason for hiding this comment

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

What you think about this:

pub enum ReceiverExecuteMsg {
    Ics721ReceiveCallback(Ics721ReceiveCallbackMsg),
    Ics721AckCallback(Ics721AckCallbackMsg),
}

I want to make it clear we have 2 type of callbacks (hooks).

  1. Receive callback: is being called on the target (receiver) chain, after NFT was transferred successfully.
  2. Ack callback: is being called on the source (sender) chain after transfer, letting the contract know of the status of the transfer (succeed or failed).

Copy link
Member

Choose a reason for hiding this comment

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

Perfect!

packages/ics721/src/ibc.rs Outdated Show resolved Hide resolved
packages/ics721/src/testing/ibc_tests.rs Outdated Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
e2e/callback_test.go Show resolved Hide resolved
@taitruong
Copy link
Member

LGTM. Only minor renaming suggestions - for better understanding.

packages/ics721/src/types.rs Outdated Show resolved Hide resolved
packages/ics721/src/types.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants