Skip to content

Commit

Permalink
feat: added STONE token (#1254)
Browse files Browse the repository at this point in the history
* fix: changed key name from wrapUrl to bridgeUrl

* feat: added STONE token
  • Loading branch information
impelcrypto committed Apr 3, 2024
1 parent 6fcaee6 commit a178181
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 32 deletions.
18 changes: 16 additions & 2 deletions src/components/assets/Erc20Currency.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</router-link>

<div v-if="token.isWrappedToken && !token.isXC20">
<a :href="token.wrapUrl" target="_blank" rel="noopener noreferrer">
<a :href="token.bridgeUrl" target="_blank" rel="noopener noreferrer">
<button class="btn btn--icon">
<astar-icon-bridge class="icon--bridge" />
</button>
Expand All @@ -65,7 +65,21 @@
</div>

<div v-if="isZkEvm">
<router-link :to="buildEthereumBridgePageLink()">
<a
v-if="token.bridgeUrl"
:href="token.bridgeUrl"
target="_blank"
rel="noopener noreferrer"
>
<button class="btn btn--icon">
<astar-icon-bridge class="icon--bridge" />
</button>
<span class="text--expand-menu">{{ $t('assets.bridge') }}</span>
<q-tooltip>
<span class="text--tooltip">{{ $t('assets.bridge') }}</span>
</q-tooltip>
</a>
<router-link v-else :to="buildEthereumBridgePageLink()">
<button class="btn btn--icon">
<astar-icon-bridge class="icon--bridge" />
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/config/web3/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export const fetchErc20TokenInfo = async ({
image,
isWrappedToken: false,
isXC20: isXc20Token(address),
wrapUrl: null,
bridgeUrl: null,
bridgedChainId: toChainId,
bridgedTokenAddress,
};
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/bridge/useImportToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const useImportToken = ({
image: zkToken.value?.image,
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: toChainTokenAddress,
bridgedChainId: toChainId,
};
Expand All @@ -141,7 +141,7 @@ export const useImportToken = ({
image: zkToken.value?.image,
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: tokenAddress,
bridgedChainId: fromChainId,
};
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/bridge/useL1Bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ export const useL1Bridge = () => {
toChainBalance: 0,
toChainTokenAddress: it.bridgedTokenAddress,
image: it.image,
bridgeUrl: it.bridgeUrl,
}
: null;
})
.filter((it: Erc20Token) => it !== null);
.filter((it: Erc20Token) => it !== null && !it.bridgeUrl);

let tokens = [];
if (filteredTokens) {
Expand Down
5 changes: 2 additions & 3 deletions src/modules/token/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export interface Erc20Token {
image?: string;
isWrappedToken?: boolean;
isXC20?: boolean;
wrapUrl?: string | null;
bridgeUrl?: string | null;
userBalance?: string;
userBalanceUsd?: string;
Expand All @@ -40,10 +39,10 @@ export const WASTR: Erc20Token = {
decimal: 18,
symbol: 'WASTR',
name: 'Wrapped ASTR',
image: 'https://app.arthswap.org/images/coins/0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720.png',
image: 'https://v2.arthswap.org/images/coins/0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720.png',
isWrappedToken: true,
isXC20: false,
wrapUrl: 'https://app.arthswap.org/#/swap',
bridgeUrl: 'https://app.arthswap.org/#/swap',
};

export const registeredErc20Tokens: Erc20Token[] = [WASTR];
Expand Down
4 changes: 2 additions & 2 deletions src/modules/token/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const castCbridgeToErc20 = ({
image: token.icon,
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
userBalance: token.userBalance,
userBalanceUsd: token.userBalanceUsd,
isCbridgeToken: true,
Expand All @@ -180,7 +180,7 @@ export const getRegisteredErc20Tokens = ({
image: it.logo,
isWrappedToken: false,
isXC20: true,
wrapUrl: null,
bridgeUrl: null,
};
} catch (error) {
console.error(error);
Expand Down
57 changes: 37 additions & 20 deletions src/modules/zk-evm-bridge/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ export const TOKEN_BLACKLIST = [
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
// WETH (Astar zkEVM)
'0xE9CC37904875B459Fa5D0FE37680d36F1ED55e38',
// STONE (Ethereum)
'0x7122985656e38BDC0302Db86685bb972b145bD3C',
// STONE (Astar zkEVM)
'0x80137510979822322193fc997d400d5a6c747bf7',
];

export const addressAstrZkEvm = '0xdf41220C7e322bFEF933D85D01821ad277f90172';
Expand All @@ -18,7 +22,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/325/large/Tether-logo.png?1598003707',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x1E4a5963aBFD975d8c9021ce480b42188849D41d',
bridgedChainId: 3776,
},
Expand All @@ -31,7 +35,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/325/large/Tether-logo.png?1598003707',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
bridgedChainId: 1,
},
Expand All @@ -45,7 +49,7 @@ export const DEFAULT_TOKENS = [
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035',
bridgedChainId: 3776,
},
Expand All @@ -59,7 +63,7 @@ export const DEFAULT_TOKENS = [
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
bridgedChainId: 1,
},
Expand All @@ -72,7 +76,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/18834/standard/wstETH.png?1696518295',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x5D8cfF95D7A57c0BF50B30b43c7CC0D52825D4a9',
bridgedChainId: 3776,
},
Expand All @@ -85,7 +89,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/18834/standard/wstETH.png?1696518295',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
bridgedChainId: 1,
},
Expand All @@ -98,7 +102,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/33033/standard/weETH.png?1701438396',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xcD68DFf4415358c35a28f96Fd5bF7083B22De1D6',
bridgedChainId: 3776,
},
Expand All @@ -111,7 +115,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/33033/standard/weETH.png?1701438396',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee',
bridgedChainId: 1,
},
Expand All @@ -125,7 +129,7 @@ export const DEFAULT_TOKENS = [
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xEA034fb02eB1808C2cc3adbC15f447B93CbE08e1',
bridgedChainId: 3776,
},
Expand All @@ -139,7 +143,7 @@ export const DEFAULT_TOKENS = [
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
bridgedChainId: 1,
},
Expand All @@ -153,7 +157,7 @@ export const DEFAULT_TOKENS = [
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xC5015b9d9161Dca7e18e32f6f25C4aD850731Fd4',
bridgedChainId: 3776,
},
Expand All @@ -167,7 +171,7 @@ export const DEFAULT_TOKENS = [
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f',
bridgedChainId: 1,
},
Expand All @@ -180,7 +184,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/4713/standard/polygon.png?1698233745',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xa2036f0538221a77A3937F1379699f44945018d0',
bridgedChainId: 3776,
},
Expand All @@ -193,7 +197,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/4713/standard/polygon.png?1698233745',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0',
bridgedChainId: 1,
},
Expand All @@ -206,7 +210,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/22617/standard/astr.png?1696521933',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x90bE3031Ffbf419881D205d81483aeF9640c31C3',
bridgedChainId: 1,
},
Expand All @@ -219,7 +223,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/22617/standard/astr.png?1696521933',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0xdf41220C7e322bFEF933D85D01821ad277f90172',
bridgedChainId: 3776,
},
Expand All @@ -232,7 +236,7 @@ export const DEFAULT_TOKENS = [
image: '',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x3Fe1220e5CB4cED5747245191CF0c4a2786dF4D3',
bridgedChainId: 6038361,
},
Expand All @@ -245,7 +249,7 @@ export const DEFAULT_TOKENS = [
image: '',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x80e01ecc2f1c73025b177dbacc928580fdc562be',
bridgedChainId: 11155111,
},
Expand All @@ -258,7 +262,7 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/34706/standard/vASTR.png?1705893008',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x362e5b2CbE72f1A164F61dfAACCb9B1Ab0Cb0802',
bridgedChainId: 1,
},
Expand All @@ -271,8 +275,21 @@ export const DEFAULT_TOKENS = [
image: 'https://assets.coingecko.com/coins/images/34706/standard/vASTR.png?1705893008',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
bridgedTokenAddress: '0x7746ef546d562b443AE4B4145541a3b1a3D75717',
bridgedChainId: 3776,
},
{
srcChainId: 3776,
address: '0x80137510979822322193fc997d400d5a6c747bf7',
decimal: '18',
symbol: 'STONE',
name: 'StakeStone Ether',
image: 'https://assets.coingecko.com/coins/images/33103/standard/200_200.png?1702602672',
isWrappedToken: false,
isXC20: false,
bridgeUrl: 'https://app.stakestone.io/u/bridge',
bridgedTokenAddress: '',
bridgedChainId: 1,
},
];
2 changes: 1 addition & 1 deletion src/v2/repositories/implementations/XvmRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class XvmRepository implements IXvmRepository {
image: '',
isWrappedToken: false,
isXC20: false,
wrapUrl: null,
bridgeUrl: null,
};

const { balUsd, userBalance } = await this.evmAssetsRepository.updateTokenBalanceHandler({
Expand Down

0 comments on commit a178181

Please sign in to comment.