Skip to content

Commit c36b30c

Browse files
(feat+refactor): ip token onboarding + code optimisation for erc20
Ticket: WIN-7914
1 parent 02590c5 commit c36b30c

6 files changed

Lines changed: 270 additions & 462 deletions

File tree

modules/bitgo/src/v2/coinFactory.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,16 @@ export function getCoinConstructor(coinName: string): CoinConstructor | undefine
903903
}
904904
}
905905

906+
const ethLikeChainToTestnetMap: Record<string, string> = {
907+
ip: 'tip',
908+
};
906909
export function getTokenConstructor(tokenConfig: TokenConfig): CoinConstructor | undefined {
910+
if (tokenConfig.coin in ethLikeChainToTestnetMap) {
911+
return EthLikeErc20Token.createTokenConstructor(tokenConfig as EthLikeTokenConfig, {
912+
Mainnet: tokenConfig.coin,
913+
Testnet: ethLikeChainToTestnetMap[tokenConfig.coin],
914+
});
915+
}
907916
switch (tokenConfig.coin) {
908917
case 'eth':
909918
case 'hteth':

modules/statics/src/allCoinsAndTokens.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,7 @@ export const allCoinsAndTokens = [
15961596
CoinFeature.EVM_COMPATIBLE_UI,
15971597
CoinFeature.EVM_NON_BITGO_RECOVERY,
15981598
CoinFeature.EVM_UNSIGNED_SWEEP_RECOVERY,
1599+
CoinFeature.SUPPORTS_ERC20,
15991600
]
16001601
),
16011602
account(
@@ -1615,6 +1616,7 @@ export const allCoinsAndTokens = [
16151616
CoinFeature.EVM_NON_BITGO_RECOVERY,
16161617
CoinFeature.EVM_UNSIGNED_SWEEP_RECOVERY,
16171618
CoinFeature.STAKING,
1619+
CoinFeature.SUPPORTS_ERC20,
16181620
]
16191621
),
16201622
account(
@@ -2677,6 +2679,28 @@ export const allCoinsAndTokens = [
26772679
Networks.main.mon
26782680
),
26792681

2682+
// Story testnet tokens
2683+
erc20Token(
2684+
'f9a9c36f-8938-4206-bf0d-5016a861c58f',
2685+
'tip:usdc',
2686+
'Testnet Story USDC',
2687+
6,
2688+
'0x8c7c52eabb0fcbcaebce2556d9a719d539ea02d8',
2689+
UnderlyingAsset['tip:usdc'],
2690+
Networks.test.ip
2691+
),
2692+
2693+
// Story Mainnet tokens
2694+
erc20Token(
2695+
'832c10c5-5bea-481f-948c-dbf6dd1560e5',
2696+
'ip:aria',
2697+
'Story Aria',
2698+
18,
2699+
'0xc9cbbd8f211300dd0e7a3933b7aeedac6f61dd52',
2700+
UnderlyingAsset['ip:aria'],
2701+
Networks.main.ip
2702+
),
2703+
26802704
hederaCoin(
26812705
'98aad956-27ee-45dd-aa43-6a23c9a1d1d0',
26822706
'hbar',

modules/statics/src/base.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,6 +2897,12 @@ export enum UnderlyingAsset {
28972897
'xdc:srx' = 'xdc:srx',
28982898
'xdc:weth' = 'xdc:weth',
28992899

2900+
// Story testnet tokens
2901+
'tip:usdc' = 'tip:usdc',
2902+
2903+
// Story mainnet tokens
2904+
'ip:aria' = 'ip:aria',
2905+
29002906
// Arbitrum testnet tokens
29012907
'tarbeth:link' = 'tarbeth:link',
29022908
'tarbeth:xsgd' = 'tarbeth:xsgd',

modules/statics/src/coins.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export function createToken(token: AmsTokenConfig): Readonly<BaseCoin> | undefin
6060
seievm: erc20Token,
6161
mon: erc20Token,
6262
xdc: erc20Token,
63+
ip: erc20Token,
6364
bsc: bscToken,
6465
celo: celoToken,
6566
cosmos: cosmosToken,
@@ -125,6 +126,7 @@ export function createToken(token: AmsTokenConfig): Readonly<BaseCoin> | undefin
125126
case 'seievm':
126127
case 'mon':
127128
case 'xdc':
129+
case 'ip':
128130
case 'celo':
129131
case 'eth':
130132
case 'opeth':

0 commit comments

Comments
 (0)