Skip to content

Commit 00cf9ef

Browse files
committed
feat(statics): added support for bsc cfx and erc20 acx
TICKET: PX-5243
1 parent 1bbb8b4 commit 00cf9ef

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

modules/bitgo/test/v2/unit/coins/ofcToken.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,4 +407,16 @@ describe('OFC:', function () {
407407
});
408408
});
409409
});
410+
411+
describe('check ofc tokens for bsc tokens', function () {
412+
const tokenMain = 'ofcbsc:cfx';
413+
describe('for main network', function () {
414+
it(`should have the correct values for ${tokenMain}`, function () {
415+
const ofcCoin = bitgo.coin(tokenMain);
416+
ofcCoin.getChain().should.equal(tokenMain);
417+
ofcCoin.getFullName().should.equal('BSC Conflux');
418+
ofcCoin.getBaseFactor().should.equal(PRECISION_18);
419+
});
420+
});
421+
});
410422
});

modules/statics/src/coins.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import {
5252
ofcAlgoToken,
5353
ofcArbethErc20,
5454
ofcAvaxErc20,
55+
ofcBscToken,
5556
ofcPolygonErc20,
5657
ofcerc20,
5758
ofcHederaToken,
@@ -13021,6 +13022,7 @@ export const coins = CoinMap.fromCoins([
1302113022
ofcerc20('0ee531d4-6df5-437d-aec5-aa72e33ac775', 'ofceigen', 'Eigen', 18, UnderlyingAsset.EIGEN),
1302213023
ofcerc20('bbe911d8-c900-401c-8dfb-febd98256e75', 'ofcusdy', 'Ondo U.S. Dollar Yield', 18, UnderlyingAsset.USDY),
1302313024
ofcerc20('017c87e8-db41-41f6-8382-c61ad8ced64b', 'ofcfold', 'Manifold Finance', 18, UnderlyingAsset.FOLD),
13025+
ofcerc20('94fcd19b-6dd6-4a8c-8fea-11c73ba9fa48', 'ofcacx', 'Across Protocol', 18, UnderlyingAsset.ACX),
1302413026
ofcArbethErc20(
1302513027
'df2296e6-366e-4707-bab0-bf16ce592601',
1302613028
'ofcarbeth:link',
@@ -13110,6 +13112,7 @@ export const coins = CoinMap.fromCoins([
1311013112
18,
1311113113
UnderlyingAsset['avaxc:link']
1311213114
),
13115+
ofcBscToken('a79933f5-a9d2-4a29-a948-79313a569988', 'ofcbsc:cfx', 'BSC Conflux', 18, UnderlyingAsset['bsc:cfx']),
1311313116
ofcPolygonErc20(
1311413117
'547ce68f-cb4c-4618-bef3-9a0ebe9facd2',
1311513118
'ofcpolygon:sbc',

modules/statics/src/ofc.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,3 +966,54 @@ export function tofcPolygonErc20(
966966
})
967967
);
968968
}
969+
970+
/**
971+
* Factory function for ofc bsc token instances.
972+
*
973+
* @param id uuid v4
974+
* @param name unique identifier of the coin
975+
* @param fullName Complete human-readable name of the coin
976+
* @param network Network object for this coin
977+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
978+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
979+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
980+
* @param prefix? Optional coin prefix. Defaults to empty string
981+
* @param suffix? Optional coin suffix. Defaults to coin name.
982+
* @param isToken? Whether or not this account coin is a token of another coin
983+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
984+
* @param primaryKeyCurve The elliptic curve for this chain/token
985+
*/
986+
export function ofcBscToken(
987+
id: string,
988+
name: string,
989+
fullName: string,
990+
decimalPlaces: number,
991+
asset: UnderlyingAsset,
992+
kind: CoinKind = CoinKind.CRYPTO,
993+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
994+
prefix = '',
995+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
996+
network: OfcNetwork = Networks.main.ofc,
997+
isToken = true,
998+
addressCoin = 'bsc',
999+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
1000+
) {
1001+
return Object.freeze(
1002+
new OfcCoin({
1003+
id,
1004+
name,
1005+
fullName,
1006+
network,
1007+
prefix,
1008+
suffix,
1009+
features,
1010+
decimalPlaces,
1011+
isToken,
1012+
asset,
1013+
kind,
1014+
addressCoin,
1015+
primaryKeyCurve,
1016+
baseUnit: BaseUnit.BSC,
1017+
})
1018+
);
1019+
}

0 commit comments

Comments
 (0)