-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Labels
priority:mediumDo it soonDo it soon
Description
We need to update the 'zenlink_id_to_currency_id' function to something that can also derive our Spacewalk currencies (as we also want to use Spacewalk/Stellar assets on Zenlink).
Now when we define the conversion from a zenlink to a local currency ID, right now we always assume the provided asset_index to be the XCM index. But we somehow have to link to our Stellar assets in this conversion function because we have to be able to derive it from the ZenlinkAssetId.
Since the asset_index is of type u64 but the XCM index we use in our CurrencyId can only be u8 I'd say it's safe to start assigning Stellar assets with 256 (because u8 only ranges from 0-255)
match asset_id.asset_type {
NATIVE => Ok(CurrencyId::Native),
LOCAL => {
let foreign_id: u8 = asset_id.asset_index.try_into().map_err(|_| {
log::error!("{} has no Foreign Currency Id match.", asset_id.asset_index);
()
})?;
if foreign_id <= u8::MAX {
Ok(XCM(foreign_id))
} else {
// TODO add some hard-coded lookup
match foreign_id {
256 => Stellar::StellarNative,
257 => yadda yadda ....
_ => None
}
},
other => {
log::error!("Unsupported asset type index:{other}");
Err(())
},
}
Metadata
Metadata
Assignees
Labels
priority:mediumDo it soonDo it soon