Skip to content

Commit

Permalink
add default icons for exchange contracts (multiversx#1250)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfaur09 authored and IosifGabriel committed May 22, 2024
1 parent 71172e7 commit 899e345
Showing 1 changed file with 33 additions and 24 deletions.
57 changes: 33 additions & 24 deletions src/common/assets/assets.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,47 +248,47 @@ export class AssetsService {

if (pairs) {
for (const pair of pairs) {
allAssets[pair.address] = new AccountAssets({
name: `xExchange: ${pair.baseSymbol}/${pair.quoteSymbol} Liquidity Pool`,
tags: ['xexchange', 'liquiditypool'],
});
allAssets[pair.address] = this.createAccountAsset(
`xExchange: ${pair.baseSymbol}/${pair.quoteSymbol} Liquidity Pool`,
['xexchange', 'liquiditypool']
);
}
}

if (farms) {
for (const farm of farms) {
allAssets[farm.address] = new AccountAssets({
name: `xExchange: ${farm.name} Farm`,
tags: ['xexchange', 'farm'],
});
allAssets[farm.address] = this.createAccountAsset(
`xExchange: ${farm.name} Farm`,
['xexchange', 'farm']
);
}
}

if (mexSettings) {
for (const [index, wrapContract] of mexSettings.wrapContracts.entries()) {
allAssets[wrapContract] = new AccountAssets({
name: `ESDT: WrappedEGLD Contract Shard ${index}`,
tags: ['xexchange', 'wegld'],
});
allAssets[wrapContract] = this.createAccountAsset(
`ESDT: WrappedEGLD Contract Shard ${index}`,
['xexchange', 'wegld']
);
}

allAssets[mexSettings.lockedAssetContract] = new AccountAssets({
name: `xExchange: Locked asset Contract`,
tags: ['xexchange', 'lockedasset'],
});
allAssets[mexSettings.lockedAssetContract] = this.createAccountAsset(
`xExchange: Locked asset Contract`,
['xexchange', 'lockedasset']
);

allAssets[mexSettings.distributionContract] = new AccountAssets({
name: `xExchange: Distribution Contract`,
tags: ['xexchange', 'lockedasset'],
});
allAssets[mexSettings.distributionContract] = this.createAccountAsset(
`xExchange: Distribution Contract`,
['xexchange', 'lockedasset']
);
}

if (stakingProxies) {
for (const stakingProxy of stakingProxies) {
allAssets[stakingProxy.address] = new AccountAssets({
name: `xExchange: ${stakingProxy.dualYieldTokenName} Contract`,
tags: ['xexchange', 'metastaking'],
});
allAssets[stakingProxy.address] = this.createAccountAsset(
`xExchange: ${stakingProxy.dualYieldTokenName} Contract`,
['xexchange', 'metastaking']
);
}
}

Expand All @@ -310,4 +310,13 @@ export class AssetsService {
// if the tokenIdentifier key exists in the dictionary, return the associated value, else undefined
return assets[tokenIdentifier];
}

createAccountAsset(name: string, tags: string[]): AccountAssets {
return new AccountAssets({
name: name,
tags: tags,
iconSvg: 'https://raw.githubusercontent.com/multiversx/mx-assets/master/accounts/icons/xexchange.svg',
iconPng: 'https://raw.githubusercontent.com/multiversx/mx-assets/master/accounts/icons/xexchange.png',
});
}
}

0 comments on commit 899e345

Please sign in to comment.