Skip to content

Commit ab0890b

Browse files
feat: story (ip) tesnet usdc token onboarding + few code improvements
Ticket: WIN-7914
1 parent 02590c5 commit ab0890b

File tree

6 files changed

+77
-1
lines changed

6 files changed

+77
-1
lines changed

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':

modules/statics/src/tokenConfig.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ export interface Tokens {
269269
mon: {
270270
tokens: EthLikeTokenConfig[];
271271
};
272+
ip: {
273+
tokens: EthLikeTokenConfig[];
274+
};
272275
xdc: {
273276
tokens: EthLikeTokenConfig[];
274277
};
@@ -316,6 +319,9 @@ export interface Tokens {
316319
mon: {
317320
tokens: EthLikeTokenConfig[];
318321
};
322+
ip: {
323+
tokens: EthLikeTokenConfig[];
324+
};
319325
xdc: {
320326
tokens: EthLikeTokenConfig[];
321327
};
@@ -805,6 +811,25 @@ const getFormattedXdcTokens = (customCoinMap = coins) =>
805811
return acc;
806812
}, []);
807813

814+
function getEthLikeTokenConfig(coin: EthLikeERC20Token): EthLikeTokenConfig {
815+
return {
816+
type: coin.name,
817+
coin: coin.network.type === NetworkType.MAINNET ? coin.name : 't'.concat(coin.name),
818+
network: coin.network.type === NetworkType.MAINNET ? 'Mainnet' : 'Testnet',
819+
name: coin.fullName,
820+
tokenContractAddress: coin.contractAddress.toString().toLowerCase(),
821+
decimalPlaces: coin.decimalPlaces,
822+
};
823+
}
824+
825+
const getFormattedEthLikeTokenConfig = (customCoinMap = coins) =>
826+
customCoinMap.reduce((acc: EthLikeTokenConfig[], coin) => {
827+
if (coin instanceof EthLikeERC20Token) {
828+
acc.push(getEthLikeTokenConfig(coin));
829+
}
830+
return acc;
831+
}, []);
832+
808833
function getFlowTokenConfig(coin: EthLikeERC20Token): EthLikeTokenConfig {
809834
return {
810835
type: coin.name,
@@ -1313,6 +1338,9 @@ export const getFormattedTokens = (coinMap = coins): Tokens => {
13131338
xdc: {
13141339
tokens: getFormattedXdcTokens(coinMap).filter((token) => token.network === 'Mainnet'),
13151340
},
1341+
ip: {
1342+
tokens: getFormattedEthLikeTokenConfig(coinMap).filter((token) => token.network === 'Mainnet'),
1343+
},
13161344
lineaeth: {
13171345
tokens: getFormattedLineaethTokens(coinMap).filter((token) => token.network === 'Mainnet'),
13181346
},
@@ -1435,6 +1463,9 @@ export const getFormattedTokens = (coinMap = coins): Tokens => {
14351463
mon: {
14361464
tokens: getFormattedMonadTokens(coinMap).filter((token) => token.network === 'Testnet'),
14371465
},
1466+
ip: {
1467+
tokens: getFormattedEthLikeTokenConfig(coinMap).filter((token) => token.network === 'Testnet'),
1468+
},
14381469
xdc: {
14391470
tokens: getFormattedXdcTokens(coinMap).filter((token) => token.network === 'Testnet'),
14401471
},

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@
108108
"request": "npm:@cypress/[email protected]",
109109
"**/avalanche/store2": "2.14.4",
110110
"webpack-dev-server": "5.2.1",
111-
"memfs": "4.46.0"
111+
"memfs": "4.46.0",
112+
"**/lerna/**/glob": "11.1.0",
113+
"**/yeoman-generator/**/glob": "11.1.0",
114+
"**/cacache/glob": "11.1.0",
115+
"**/pacote/glob": "11.1.0"
112116
},
113117
"workspaces": [
114118
"modules/*"

0 commit comments

Comments
 (0)