astroport-fi / astroport-core

Astroport DEX core contracts
https://astroport.fi/
GNU General Public License v3.0
153 stars 105 forks source link

Impl From Asset/AssetInfo for cw-asset::Asset/AssetInfo #398

Closed Rhaki closed 9 months ago

Rhaki commented 9 months ago

This pull request would implement type conversation for Asset / AssetInfo with cw-asset::Asset / cw-asset::AssetInfo.

Given the popularity of the cw-asset, when dealing with astroport, conversions between the two similar types must be done manually, or implement traits to extend one of the two types.

In particular is implemented:

use cw_asset::{Asset as CwAsset, AssetInfo as CwAssetInfo};

impl From<Asset> for CwAsset;
impl TryFrom<CwAsset> for Asset;
impl From<AssetInfo> for CwAssetInfo;
impl TryFrom<CwAssetInfo> for AssetInfo;

New changes are also full tested.