-
Notifications
You must be signed in to change notification settings - Fork 80
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
[token] Add is_deleted to token datas (v2 nfts only) #359
Conversation
How big of an effort is it to index |
If we can disregard fungible v1 tokens, then we can do it. Actually it's a good point they might want for v1 as well. |
@bowenyang007 yeah just disregard fungible tokens because the logic will be separated after my PR anyway |
@rtso not v1 fungible tokens lol. v1 fungible tokens look the same as v1 nfts. |
Ok confirmed with stakeholders that we only need v2 for now |
b45c40c
to
31e462a
Compare
}, | ||
))) | ||
} else { | ||
Ok(None) | ||
} | ||
} | ||
|
||
/// This handles the case where token is burned but objectCore is still there | ||
pub async fn get_burned_nft_v2_from_write_resource( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this case already covered by get_burned_nft_v2_from_delete_resource
below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. this is write resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when a token gets burnt won't it always have a delete resource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it's a partial burn and there are resources left?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't the token resource get deleted so there will always be a delete resource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no that's not how it works. unless the resource group is entirely destroyed it'll emit a write resource event :(
@@ -893,6 +945,22 @@ async fn parse_v2_token( | |||
); | |||
} | |||
|
|||
// Add burned NFT handling for token datas (can probably be merged with below) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah can we merge this with below since it's doing the same thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue is that the code below is more complex than needed here b/c it needs previous owner as well. I'm hoping that as you guys look at sdk you can also rewrite this whole logic. The logic has kind of ballooned out of control a bit. For now I don't see a clean way to merge the paths so just leaving a comment for future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i'll take a stab at refactoring this for sdk
60e4f28
to
3138773
Compare
* add is_deleted to token datas * lint * comment to avoid confusion * delete works for historical events too * rebase * lint
Summary
For context we want to be able to know if a token was deleted from the current_token_datas_v2 table. This only works for v2 tokens because v1 tokens can be fungible and non fungible interchangeably so it's impossible to get this field accurately.
Backfill
Testnet: 553151941
Mainnet: 199271122
Testing
is_deleted_v2 in!