-
Notifications
You must be signed in to change notification settings - Fork 20
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
Hotfix BRC20 assertion contents when data is empty #2649
Conversation
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.
I left a couple of comments but looking good to me overall.
btw, the breaking-change
may not be needed, at least not for clients.
// Keep all name in lowercase here by purpose | ||
const BRC20_TOKENS: [&str; 7] = ["ordi", "sats", "rats", "mmss", "long", "cats", "btcs"]; | ||
const BRC20_TOKENS: [&str; 7] = ["ordi", "sats", "rats", "MMSS", "long", "cats", "BTCs"]; |
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.
should we remove the comment on line 29 or are we missing something?
|
||
response_items | ||
.iter() | ||
.filter(|&item| BRC20_TOKENS.contains(&item.tick.as_str())) |
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.
should we compare using lowercases to forget about it? e.g., data provider changes the case for cats
-> CATs
@@ -72,30 +79,60 @@ pub trait BRC20AmountHolderCredential { | |||
|
|||
impl BRC20AmountHolderCredential for Credential { | |||
fn update_brc20_amount_holder_credential(&mut self, response_items: &[ResponseItem]) { | |||
for item in response_items { | |||
if BRC20_TOKENS.contains(&item.tick.to_lowercase().as_str()) { |
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.
should we keep to_lowercase()
for simplicity? then the above BRC20_TOEKN doesn't need to change.
Ok, keep |
Regarding the case of an empty response, there are two modifications:
["ordi", "sats", "rats", "MMSS", "long", "cats", "BTCs"]
, with all balances set to 0.0. The effect is as shown below.true
, because regardless of the balance amount, it will always fall within a certain range.