Skip to content

Commit

Permalink
update logic and add override properties
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyParish69 committed Sep 5, 2024
1 parent 6807ed3 commit 90cbd48
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 58 deletions.
108 changes: 51 additions & 57 deletions .github/workflows/utility/generate_assetlist_functions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -546,37 +546,36 @@ export function setSymbol(asset_data) {
) { return; }
else if (traceTypesNeedingProvider.includes(hop.type)) {
let hop_suffix = hop.provider.symbol_suffix ?? "";
//if it's the canonical bridge of that network, we ignore the suffixes up to that point
if (hop.provider.canonical) {
accumulative_suffix = "." + getNetworkSymbolSuffix(hop.network, asset_data);
} else {

//if not canonical
if (hop_suffix?.startsWith(".e.")) {
if (
accumulative_suffix.slice(symbol.length - 4) === ".eth"
) {
accumulative_suffix = accumulative_suffix.slice(0, accumulative_suffix.length - 4);
}
if (
deepEqual(
asset_data.origin_asset,
({
chain_name: "ethereum",
base_denom: "wei"
})
)
) {
hop_suffix = hop_suffix.slice(2);
}
if (hop_suffix?.startsWith(".e.")) {
if (
accumulative_suffix.slice(accumulative_suffix.length - 4) === ".eth"
) {
accumulative_suffix = accumulative_suffix.slice(0, accumulative_suffix.length - 4);
}
if (
deepEqual(
asset_data.origin_asset,
({
chain_name: "ethereum",
base_denom: "wei"
})
)
) {
hop_suffix = hop_suffix.slice(2);
}
}

//Add Provider Suffix
if (!hop.provider.canonical) {
accumulative_suffix = accumulative_suffix + hop_suffix;
last_suffix_is_network = false;
}

if (!hop.provider.destination_network) {
accumulative_suffix = accumulative_suffix + "." + getNetworkSymbolSuffix(hop.network, asset_data);
last_suffix_is_network = true;
}
//Add Destination Network Suffix whenever the provider suffix is skipped or the destination network isn't assumed
if (!hop.provider.destination_network || hop.provider.canonical) {
accumulative_suffix = accumulative_suffix + "." + getNetworkSymbolSuffix(hop.network, asset_data);
last_suffix_is_network = true;
}
} else { //is IBC
accumulative_suffix = accumulative_suffix + "." + getNetworkSymbolSuffix(hop.network, asset_data);
Expand Down Expand Up @@ -676,40 +675,35 @@ export function setName(asset_data) {
) { return; }
else if (traceTypesNeedingProvider.includes(hop.type)) {

if (hop.provider.canonical) {
accumulative_suffix =
" (" +
getNetworkName(hop.network, asset_data)
+ ")";
} else {

//Some trace providers don't need indication
if (hop.provider.name_suffix) {
this_suffix_is_network = false;
accumulative_suffix = appendNameSuffix(
accumulative_suffix,
hop.provider.name_suffix,
this_suffix_is_network,
last_suffix_is_network
);
last_suffix_is_network = false;
}
//Some trace providers don't need indication
if (hop.provider.name_suffix && !hop.provider.canonical) {
this_suffix_is_network = false;
accumulative_suffix = appendNameSuffix(
accumulative_suffix,
hop.provider.name_suffix,
this_suffix_is_network,
last_suffix_is_network
);
last_suffix_is_network = false;
}

if (
!hop.provider.destination_network
if (
!hop.provider.destination_network
||
!hop.provider.name_suffix
) {
this_suffix_is_network = true;
accumulative_suffix = appendNameSuffix(
accumulative_suffix,
getNetworkName(hop.network, asset_data),
this_suffix_is_network,
last_suffix_is_network
);
last_suffix_is_network = true;
}
hop.provider.canonical
||
!hop.provider.name_suffix
) {
this_suffix_is_network = true;
accumulative_suffix = appendNameSuffix(
accumulative_suffix,
getNetworkName(hop.network, asset_data),
this_suffix_is_network,
last_suffix_is_network
);
last_suffix_is_network = true;
}

} else { //type: ibc and ibc-cw20

this_suffix_is_network = true;
Expand Down
4 changes: 3 additions & 1 deletion osmosis-1/osmosis.zone_assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4973,12 +4973,14 @@
"peg_mechanism": "collateralized",
"osmosis_verified": false,
"override_properties": {
"symbol": "USDT.inj",
"name": "Tether USD (Injective)",
"logo_URIs": {
"svg": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/usdt.inj.svg",
"png": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/usdt.inj.png"
}
},
"_comment": "Tether USD (Ethereum) (Injective) $USDT.eth.inj",
"_comment": "Tether USD (Ethereum via Peggy) $USDT.eth.inj $USDT.inj",
"listing_date_time_utc": "2024-08-21T18:00:00Z",
"categories": [
"stablecoin"
Expand Down

0 comments on commit 90cbd48

Please sign in to comment.