Skip to content

Commit 489aa32

Browse files
Merge pull request #5276 from BitGo/GNA-10
feat: add ofcxrp mainnet support and update ofcsol tokens
2 parents 87a80dc + 5eef4a9 commit 489aa32

File tree

4 files changed

+70
-4
lines changed

4 files changed

+70
-4
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,16 @@ describe('OFC:', function () {
422422
});
423423

424424
describe('check ofc tokens for ripple', function () {
425+
const tokenMain = 'ofcxrp:rlusd';
425426
const tokenTest = 'ofctxrp:rlusd';
427+
describe('for main network', function () {
428+
it(`should have the correct values for ${tokenMain}`, function () {
429+
const ofcCoin = bitgo.coin(tokenMain);
430+
ofcCoin.getChain().should.equal(tokenMain);
431+
ofcCoin.getFullName().should.equal('Ripple USD');
432+
ofcCoin.getBaseFactor().should.equal(PRECISION_96);
433+
});
434+
});
426435
describe('for test network', function () {
427436
it(`should have the correct values for ${tokenTest}`, function () {
428437
const ofcCoin = bitgo.coin(tokenTest);

modules/statics/src/base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,10 +2307,14 @@ export enum UnderlyingAsset {
23072307
'sol:bonk' = 'sol:bonk',
23082308
'jto' = 'jto',
23092309
'jup' = 'jup',
2310+
'sol:jup' = 'sol:jup',
23102311
'sol:honey' = 'sol:honey',
23112312
'mobile' = 'mobile',
2313+
'sol:mobile' = 'sol:mobile',
23122314
'wif' = 'wif',
2315+
'sol:wif' = 'sol:wif',
23132316
'natix' = 'natix',
2317+
'sol:natix' = 'sol:natix',
23142318
'sol:ks' = 'sol:ks',
23152319
'sol:apusdt' = 'sol:apusdt',
23162320
'sol:acusd' = 'sol:acusd',

modules/statics/src/coins.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import {
6262
ofcsolToken,
6363
ofcStellarToken,
6464
ofcTronToken,
65+
ofcXrpToken,
6566
tofc,
6667
tofcAlgoToken,
6768
tofcArbethErc20,
@@ -1638,23 +1639,23 @@ export const coins = CoinMap.fromCoins([
16381639
'ofcsol:natix',
16391640
'NATIX Network ',
16401641
6,
1641-
UnderlyingAsset['natix'],
1642+
UnderlyingAsset['sol:natix'],
16421643
SOL_TOKEN_FEATURES
16431644
),
16441645
ofcsolToken(
16451646
'abbdcf44-ac44-46be-b4e9-8a760d44b79a',
16461647
'ofcsol:mobile',
16471648
'Helium Mobile',
16481649
6,
1649-
UnderlyingAsset['mobile'],
1650+
UnderlyingAsset['sol:mobile'],
16501651
SOL_TOKEN_FEATURES
16511652
),
16521653
ofcsolToken(
16531654
'94e55bde-f57f-4817-9984-b461a5d6bcd0',
16541655
'ofcsol:jup',
16551656
'Jupiter',
16561657
6,
1657-
UnderlyingAsset['jup'],
1658+
UnderlyingAsset['sol:jup'],
16581659
SOL_TOKEN_FEATURES
16591660
),
16601661
ofcsolToken(
@@ -1670,7 +1671,7 @@ export const coins = CoinMap.fromCoins([
16701671
'ofcsol:wif',
16711672
'dogwifhat',
16721673
6,
1673-
UnderlyingAsset['wif'],
1674+
UnderlyingAsset['sol:wif'],
16741675
SOL_TOKEN_FEATURES
16751676
),
16761677
ofcsolToken(
@@ -1756,6 +1757,7 @@ export const coins = CoinMap.fromCoins([
17561757
),
17571758
tofcTronToken('937efe97-a17a-4d2a-aaf2-0ffdb529a943', 'ofcttrx:usdt', 'Tether USD', 6, UnderlyingAsset['ttrx:usdt']),
17581759
ofcTronToken('94b00b66-68a4-45ed-b772-77e5bca1e34c', 'ofctrx:usdt', 'Tether USD', 6, UnderlyingAsset['trx:usdt']),
1760+
ofcXrpToken('6a173023-5faf-4a0a-af38-b8be98abe94f', 'ofcxrp:rlusd', 'Ripple USD', 96, UnderlyingAsset['xrp:rlusd']),
17591761
tofcXrpToken('bd406dab-3b55-4ab5-b0a5-74b9f94268a3', 'ofctxrp:rlusd', 'RLUSD', 96, UnderlyingAsset['txrp:rlusd']),
17601762
ofc('837f0cab-cad1-4510-a8e4-f2c60e1a8760', 'ofcusd', 'USD', 2, UnderlyingAsset.USD, CoinKind.FIAT),
17611763
ofc('798f2a7c-23fd-4e16-9fe5-6bf47ca438a0', 'ofceur', 'Euro', 2, UnderlyingAsset.EUR, CoinKind.FIAT),

modules/statics/src/ofc.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,57 @@ export function ofcBscToken(
10181018
);
10191019
}
10201020

1021+
/**
1022+
* Factory function for mainnet ofc xrp 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 ofcXrpToken(
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.main.ofc,
1048+
isToken = true,
1049+
addressCoin = 'xrp',
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+
10211072
/**
10221073
* Factory function for testnet ofc xrp token instances.
10231074
*

0 commit comments

Comments
 (0)