Skip to content

Commit

Permalink
Mark tokens as incompatible with ICRC1 if they have a non-zero burn f…
Browse files Browse the repository at this point in the history
…ee (#6143)
  • Loading branch information
hpeebles authored Jul 30, 2024
1 parent e9e7a5b commit 37f99e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions backend/canisters/registry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Changed

- Mark tokens as incompatible with ICRC1 if they have a non-zero burn fee ([#6143](https://github.com/open-chat-labs/open-chat/pull/6143))

## [[2.0.1250](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1250-registry)] - 2024-07-25

### Changed
Expand Down
8 changes: 4 additions & 4 deletions backend/canisters/registry/impl/src/metadata_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ impl MetadataHelper {
let mut symbol = None;
let mut decimals = None;
let mut fee = None;
let mut burn_fee = None;
let mut logo = None;
let mut is_icrc1_compatible = true;

Expand All @@ -26,9 +25,10 @@ impl MetadataHelper {
("icrc1:symbol", MetadataValue::Text(s)) => symbol = Some(s),
("icrc1:decimals", MetadataValue::Nat(n)) => decimals = u8::try_from(n.0).ok(),
("icrc1:fee", MetadataValue::Nat(n)) => fee = u128::try_from(n.0).ok(),
("icrc1:burn_fee", MetadataValue::Nat(n)) => burn_fee = u128::try_from(n.0).ok(),
("icrc1:logo", MetadataValue::Text(s)) => logo = Some(s),
("icrc1:transfer_fee_rate" | "icrc1:burn_fee_rate", MetadataValue::Nat(n)) if n > Nat::default() => {
("icrc1:burn_fee | icrc1:transfer_fee_rate" | "icrc1:burn_fee_rate", MetadataValue::Nat(n))
if n > Nat::default() =>
{
is_icrc1_compatible = false
}
_ => {}
Expand All @@ -40,7 +40,7 @@ impl MetadataHelper {
name: n,
symbol: s,
decimals: d,
fee: f + burn_fee.unwrap_or_default(),
fee: f,
logo,
is_icrc1_compatible,
}),
Expand Down

0 comments on commit 37f99e5

Please sign in to comment.