Skip to content

Commit c72c330

Browse files
Merge pull request #5178 from BitGo/GNA-10
feat(statics): add ofc tokens
2 parents d79d1b6 + 9820ff2 commit c72c330

File tree

3 files changed

+185
-0
lines changed

3 files changed

+185
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const PRECISION_7 = '10000000';
88
const PRECISION_8 = '100000000';
99
const PRECISION_9 = '1000000000';
1010
const PRECISION_18 = '1000000000000000000';
11+
const PRECISION_96 = '9.999999999999999e+95';
1112

1213
describe('OFC:', function () {
1314
let bitgo;
@@ -419,4 +420,28 @@ describe('OFC:', function () {
419420
});
420421
});
421422
});
423+
424+
describe('check ofc tokens for ripple', function () {
425+
const tokenTest = 'ofctxrp:rlusd';
426+
describe('for test network', function () {
427+
it(`should have the correct values for ${tokenTest}`, function () {
428+
const ofcCoin = bitgo.coin(tokenTest);
429+
ofcCoin.getChain().should.equal(tokenTest);
430+
ofcCoin.getFullName().should.equal('RLUSD');
431+
ofcCoin.getBaseFactor().should.equal(PRECISION_96);
432+
});
433+
});
434+
});
435+
436+
describe('check ofc tokens for opethErc20', function () {
437+
const tokenMain = 'ofcopeth:op';
438+
describe('for main network', function () {
439+
it(`should have the correct values for ${tokenMain}`, function () {
440+
const ofcCoin = bitgo.coin(tokenMain);
441+
ofcCoin.getChain().should.equal(tokenMain);
442+
ofcCoin.getFullName().should.equal('Optimism');
443+
ofcCoin.getBaseFactor().should.equal(PRECISION_18);
444+
});
445+
});
446+
});
422447
});

modules/statics/src/coins.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ import {
6767
tofcsolToken,
6868
tofcStellarToken,
6969
tofcPolygonErc20,
70+
ofcOpethErc20,
71+
tofcXrpToken,
7072
} from './ofc';
7173
import { utxoCoins } from './utxo';
7274
import { lightningCoins } from './lightning';
@@ -1618,6 +1620,46 @@ export const coins = CoinMap.fromCoins([
16181620
UnderlyingAsset['natix'],
16191621
SOL_TOKEN_FEATURES
16201622
),
1623+
ofcsolToken(
1624+
'abbdcf44-ac44-46be-b4e9-8a760d44b79a',
1625+
'ofcsol:mobile',
1626+
'Helium Mobile',
1627+
6,
1628+
UnderlyingAsset['mobile'],
1629+
SOL_TOKEN_FEATURES
1630+
),
1631+
ofcsolToken(
1632+
'94e55bde-f57f-4817-9984-b461a5d6bcd0',
1633+
'ofcsol:jup',
1634+
'Jupiter',
1635+
6,
1636+
UnderlyingAsset['jup'],
1637+
SOL_TOKEN_FEATURES
1638+
),
1639+
ofcsolToken(
1640+
'989eec31-a0d5-4cdc-b4de-6fca30cde366',
1641+
'ofcsol:popcat',
1642+
'POPCAT',
1643+
9,
1644+
UnderlyingAsset['sol:popcat'],
1645+
SOL_TOKEN_FEATURES
1646+
),
1647+
ofcsolToken(
1648+
'ca2a2bc9-ed79-426f-8378-96f9c9568526',
1649+
'ofcsol:wif',
1650+
'dogwifhat',
1651+
6,
1652+
UnderlyingAsset['wif'],
1653+
SOL_TOKEN_FEATURES
1654+
),
1655+
ofcsolToken(
1656+
'ab833723-8b40-4fc4-8dd1-f5ea9a07c76c',
1657+
'ofcsol:goat',
1658+
'Goatseus Maximus',
1659+
6,
1660+
UnderlyingAsset['sol:goat'],
1661+
SOL_TOKEN_FEATURES
1662+
),
16211663
tofcsolToken(
16221664
'24d678cf-e0f0-4cde-a338-d754289c5b27',
16231665
'ofctsol:slnd',
@@ -1691,6 +1733,7 @@ export const coins = CoinMap.fromCoins([
16911733
UnderlyingAsset['sol:hnt'],
16921734
SOL_TOKEN_FEATURES
16931735
),
1736+
tofcXrpToken('bd406dab-3b55-4ab5-b0a5-74b9f94268a3', 'ofctxrp:rlusd', 'RLUSD', 96, UnderlyingAsset['txrp:rlusd']),
16941737
ofc('837f0cab-cad1-4510-a8e4-f2c60e1a8760', 'ofcusd', 'USD', 2, UnderlyingAsset.USD, CoinKind.FIAT),
16951738
ofc('798f2a7c-23fd-4e16-9fe5-6bf47ca438a0', 'ofceur', 'Euro', 2, UnderlyingAsset.EUR, CoinKind.FIAT),
16961739
ofc('f37bbb72-adfe-4d06-90dc-afd0aa34aadd', 'ofcgbp', 'Pound Sterling', 2, UnderlyingAsset.GBP, CoinKind.FIAT),
@@ -13043,6 +13086,20 @@ export const coins = CoinMap.fromCoins([
1304313086
ofcerc20('bbe911d8-c900-401c-8dfb-febd98256e75', 'ofcusdy', 'Ondo U.S. Dollar Yield', 18, UnderlyingAsset.USDY),
1304413087
ofcerc20('017c87e8-db41-41f6-8382-c61ad8ced64b', 'ofcfold', 'Manifold Finance', 18, UnderlyingAsset.FOLD),
1304513088
ofcerc20('94fcd19b-6dd6-4a8c-8fea-11c73ba9fa48', 'ofcacx', 'Across Protocol', 18, UnderlyingAsset.ACX),
13089+
ofcerc20('b5f3afea-f69a-4a05-87f9-965476ad77de', 'ofclpt', 'Livepeer Token', 18, UnderlyingAsset.LPT),
13090+
ofcerc20('567b571f-6f79-40e4-adff-3e0e3c6ba959', 'ofcethfi', 'ether.fi governance token', 18, UnderlyingAsset.ETHFI),
13091+
ofcerc20('cba66dc6-31eb-46c4-b73f-8cb77eb7ef5b', 'ofcgal', 'Project Galaxy', 18, UnderlyingAsset.GAL),
13092+
ofcerc20('0c6e4b19-d748-477c-9507-6c0f51142b07', 'ofcfdusd', 'First Digital USD', 18, UnderlyingAsset.FDUSD),
13093+
ofcerc20('80c3e860-f589-4227-a0f5-2aa6b18293c5', 'ofcrune', 'THORChain ETH.RUNE', 18, UnderlyingAsset.RUNE),
13094+
ofcerc20('db35feb4-9cdb-447a-a698-e0e944ca6869', 'ofckcs', 'KuCoin', 6, UnderlyingAsset.KCS),
13095+
ofcerc20('519ab013-f634-41f4-9d31-6f9368de5b09', 'ofcbeam', 'Beam', 18, UnderlyingAsset.BEAM),
13096+
ofcerc20('4030e0fa-fa80-4e30-8c0f-9168ec65c731', 'ofcmog', 'Mog Coin', 18, UnderlyingAsset.MOG),
13097+
ofcerc20('1a7fdcc6-8a6c-4780-b483-c6aaf990e461', 'ofcgt', 'GateChainToken', 18, UnderlyingAsset.GT),
13098+
ofcerc20('969180cc-5af9-49c5-ad19-d8e8de755467', 'ofckas', 'Kaspa', 8, UnderlyingAsset.KAS),
13099+
ofcerc20('eb54ecb6-7312-42c0-926a-1600d61a50dc', 'ofcbgb', 'Bitget', 18, UnderlyingAsset.BGB),
13100+
ofcerc20('a4e0613e-1d1b-477c-9da5-7c553ff787b7', 'ofcmew', 'MEW coin', 18, UnderlyingAsset.MEW),
13101+
ofcerc20('ba2c8abb-6375-4207-9262-8b907a1dbf1b', 'ofcusdd', 'USDD', 18, UnderlyingAsset.USDD),
13102+
ofcerc20('cbb73d46-ce0d-4045-822b-8aa0d6fb8ad4', 'ofcw', 'Wormhole Token', 18, UnderlyingAsset.W),
1304613103
ofcArbethErc20(
1304713104
'df2296e6-366e-4707-bab0-bf16ce592601',
1304813105
'ofcarbeth:link',
@@ -13132,6 +13189,7 @@ export const coins = CoinMap.fromCoins([
1313213189
18,
1313313190
UnderlyingAsset['avaxc:link']
1313413191
),
13192+
ofcOpethErc20('10259b23-2e2e-4574-b146-b49f1119600f', 'ofcopeth:op', 'Optimism', 18, UnderlyingAsset['opeth:op']),
1313513193
ofcBscToken('a79933f5-a9d2-4a29-a948-79313a569988', 'ofcbsc:cfx', 'BSC Conflux', 18, UnderlyingAsset['bsc:cfx']),
1313613194
ofcPolygonErc20(
1313713195
'547ce68f-cb4c-4618-bef3-9a0ebe9facd2',

modules/statics/src/ofc.ts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,3 +1017,105 @@ export function ofcBscToken(
10171017
})
10181018
);
10191019
}
1020+
1021+
/**
1022+
* Factory function for testnet ofc xrp token instances.
1023+
*
1024+
* @param id uuid v4
1025+
* @param name unique identifier of the coin
1026+
* @param fullName Complete human-readable name of the coin
1027+
* @param network Network object for this coin
1028+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
1029+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1030+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
1031+
* @param prefix? Optional coin prefix. Defaults to empty string
1032+
* @param suffix? Optional coin suffix. Defaults to coin name.
1033+
* @param isToken? Whether or not this account coin is a token of another coin
1034+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
1035+
* @param primaryKeyCurve The elliptic curve for this chain/token
1036+
*/
1037+
export function tofcXrpToken(
1038+
id: string,
1039+
name: string,
1040+
fullName: string,
1041+
decimalPlaces: number,
1042+
asset: UnderlyingAsset,
1043+
kind: CoinKind = CoinKind.CRYPTO,
1044+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
1045+
prefix = '',
1046+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
1047+
network: OfcNetwork = Networks.test.ofc,
1048+
isToken = true,
1049+
addressCoin = 'txrp',
1050+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
1051+
) {
1052+
return Object.freeze(
1053+
new OfcCoin({
1054+
id,
1055+
name,
1056+
fullName,
1057+
network,
1058+
prefix,
1059+
suffix,
1060+
features,
1061+
decimalPlaces,
1062+
isToken,
1063+
asset,
1064+
kind,
1065+
addressCoin,
1066+
primaryKeyCurve,
1067+
baseUnit: BaseUnit.XRP,
1068+
})
1069+
);
1070+
}
1071+
1072+
/**
1073+
* Factory function for ofc opetherc20 token instances.
1074+
*
1075+
* @param id uuid v4
1076+
* @param name unique identifier of the coin
1077+
* @param fullName Complete human-readable name of the coin
1078+
* @param network Network object for this coin
1079+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
1080+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1081+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
1082+
* @param prefix? Optional coin prefix. Defaults to empty string
1083+
* @param suffix? Optional coin suffix. Defaults to coin name.
1084+
* @param isToken? Whether or not this account coin is a token of another coin
1085+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
1086+
* @param primaryKeyCurve The elliptic curve for this chain/token
1087+
*/
1088+
export function ofcOpethErc20(
1089+
id: string,
1090+
name: string,
1091+
fullName: string,
1092+
decimalPlaces: number,
1093+
asset: UnderlyingAsset,
1094+
kind: CoinKind = CoinKind.CRYPTO,
1095+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
1096+
prefix = '',
1097+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
1098+
network: OfcNetwork = Networks.main.ofc,
1099+
isToken = true,
1100+
addressCoin = 'opeth',
1101+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
1102+
) {
1103+
return Object.freeze(
1104+
new OfcCoin({
1105+
id,
1106+
name,
1107+
fullName,
1108+
network,
1109+
prefix,
1110+
suffix,
1111+
features,
1112+
decimalPlaces,
1113+
isToken,
1114+
asset,
1115+
kind,
1116+
addressCoin,
1117+
primaryKeyCurve,
1118+
baseUnit: BaseUnit.ETH,
1119+
})
1120+
);
1121+
}

0 commit comments

Comments
 (0)