Skip to content

Commit e4ab52e

Browse files
feat(statics): add ofc txrp and opeth token
Ticket: PX-5243
1 parent 4f0d3aa commit e4ab52e

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-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: 4 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';
@@ -1687,6 +1689,7 @@ export const coins = CoinMap.fromCoins([
16871689
UnderlyingAsset['sol:hnt'],
16881690
SOL_TOKEN_FEATURES
16891691
),
1692+
tofcXrpToken('bd406dab-3b55-4ab5-b0a5-74b9f94268a3', 'ofctxrp:rlusd', 'RLUSD', 96, UnderlyingAsset['txrp:rlusd']),
16901693
ofc('837f0cab-cad1-4510-a8e4-f2c60e1a8760', 'ofcusd', 'USD', 2, UnderlyingAsset.USD, CoinKind.FIAT),
16911694
ofc('798f2a7c-23fd-4e16-9fe5-6bf47ca438a0', 'ofceur', 'Euro', 2, UnderlyingAsset.EUR, CoinKind.FIAT),
16921695
ofc('f37bbb72-adfe-4d06-90dc-afd0aa34aadd', 'ofcgbp', 'Pound Sterling', 2, UnderlyingAsset.GBP, CoinKind.FIAT),
@@ -13128,6 +13131,7 @@ export const coins = CoinMap.fromCoins([
1312813131
18,
1312913132
UnderlyingAsset['avaxc:link']
1313013133
),
13134+
ofcOpethErc20('10259b23-2e2e-4574-b146-b49f1119600f', 'ofcopeth:op', 'Optimism', 18, UnderlyingAsset['opeth:op']),
1313113135
ofcBscToken('a79933f5-a9d2-4a29-a948-79313a569988', 'ofcbsc:cfx', 'BSC Conflux', 18, UnderlyingAsset['bsc:cfx']),
1313213136
ofcPolygonErc20(
1313313137
'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)