Skip to content

Conversation

vikiival
Copy link
Contributor

For magical reasons there are four events and two of them has different name for collection.


/// Event emitted when a new child is added.
#[ink(event)]
pub struct ChildAdded {
Copy link
Member

Choose a reason for hiding this comment

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

It was not changed here but seems a good opportunity to improve. We name this ChildProposed on EVM, because it must be accepted. So "Added" might be confusing.

pub struct ChildAdded {
#[ink(topic)]
to: Id,
parent: Id,
Copy link
Member

Choose a reason for hiding this comment

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

We call this tokenId since the context is the current collection and event is named Child so this token being the parent can be implied. I'd prefer consistency but parent also makes it more explicit so I'm fine with either.

I have mixed thoughts about whether to include "Id" in the names, in general. Here it seems obvious since type is Id, but when calling it, it might not be so obvious. Again, no strong position here, up for discussion.

parent: Id,
#[ink(topic)]
child_collection: AccountId,
collection: AccountId,
Copy link
Member

Choose a reason for hiding this comment

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

I would definitely keep child_collection in the name, here you can't know if this collections is about the parent or the child, both present on the event.

/// Event emitted when a child is removed.
#[ink(event)]
pub struct ChildRemoved {
#[ink(topic)]
Copy link
Member

Choose a reason for hiding this comment

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

This event is probably legacy. "Removing" a child became "Transferring" a child so event should be ChildTransferred. Since it can happen from pending (rejecting) or active (removing). Maybe we need an issue for this change, I haven't checked nesting lego yet 😞

@vikiival
Copy link
Contributor Author

Continue as #38

@vikiival vikiival closed this Jan 18, 2023
@vikiival vikiival deleted the name-the-child branch January 23, 2023 11:47
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.

2 participants