Skip to content

Commit 2851167

Browse files
committed
feat: ofc tokens for nep141
Ticket: [COIN-4909]
1 parent abc39d4 commit 2851167

File tree

2 files changed

+126
-0
lines changed

2 files changed

+126
-0
lines changed

modules/statics/src/coins/ofcCoins.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import {
2525
tofcHederaToken,
2626
ofcaptToken,
2727
tofcStxToken,
28+
ofcnep141Token,
29+
tofcnep141Token,
2830
} from '../ofc';
2931
import { UnderlyingAsset, CoinKind } from '../base';
3032

@@ -2722,4 +2724,22 @@ export const ofcCoins = [
27222724
),
27232725
ofcStxToken('b4ef967b-7aa3-4252-9366-bbcffffd1c4d', 'ofcstx:usdh', 'USDH', 8, UnderlyingAsset['stx:usdh']),
27242726
ofcStxToken('511fc482-d962-4c29-9921-4a7d99405e64', 'ofcstx:welsh', 'Welsh', 6, UnderlyingAsset['stx:welsh']),
2727+
2728+
//Nep141
2729+
ofcnep141Token('ae7413e9-147d-4f72-a180-e9d1ed4bb885', 'ofcnear:usdc', 'USD Coin', 6, UnderlyingAsset['near:usdc']),
2730+
ofcnep141Token('8e2467c9-f261-4e2e-abc6-cf08655359f8', 'ofcnear:usdt', 'Tether USD', 6, UnderlyingAsset['near:usdt']),
2731+
tofcnep141Token(
2732+
'a3a47204-c114-42d7-b673-0a5f60ca0d9e',
2733+
'ofctnear:tnep24dp',
2734+
'Test NEP141 Token 24 Decimals',
2735+
24,
2736+
UnderlyingAsset['tnear:tnep24dp']
2737+
),
2738+
tofcnep141Token(
2739+
'09ebe08e-8b56-4d28-bf51-7c328e903aff',
2740+
'ofctnear:usdc',
2741+
'USD Coin',
2742+
6,
2743+
UnderlyingAsset['tnear:usdc']
2744+
),
27252745
];

modules/statics/src/ofc.ts

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,3 +1587,109 @@ export function tofcaptToken(
15871587
})
15881588
);
15891589
}
1590+
1591+
/**
1592+
* Factory function for ofc nep141 token instances.
1593+
*
1594+
* @param id uuid v4
1595+
* @param name unique identifier of the coin
1596+
* @param fullName Complete human-readable name of the coin
1597+
* @param features
1598+
* @param prefix
1599+
* @param suffix
1600+
* @param network Network object for this coin
1601+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
1602+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1603+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
1604+
* @param isToken
1605+
* @param addressCoin
1606+
* @param primaryKeyCurve The elliptic curve for this chain/token
1607+
*/
1608+
1609+
export function ofcnep141Token(
1610+
id: string,
1611+
name: string,
1612+
fullName: string,
1613+
decimalPlaces: number,
1614+
asset: UnderlyingAsset,
1615+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
1616+
kind: CoinKind = CoinKind.CRYPTO,
1617+
prefix = '',
1618+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
1619+
network: OfcNetwork = Networks.main.ofc,
1620+
isToken = true,
1621+
addressCoin = 'near',
1622+
primaryKeyCurve: KeyCurve = KeyCurve.Ed25519
1623+
) {
1624+
return Object.freeze(
1625+
new OfcCoin({
1626+
id,
1627+
name,
1628+
fullName,
1629+
network,
1630+
prefix,
1631+
suffix,
1632+
features,
1633+
decimalPlaces,
1634+
isToken,
1635+
asset,
1636+
kind,
1637+
addressCoin,
1638+
primaryKeyCurve,
1639+
baseUnit: BaseUnit.NEAR,
1640+
})
1641+
);
1642+
}
1643+
1644+
/**
1645+
* Factory function for tofc nep141 token instances.
1646+
*
1647+
* @param id uuid v4
1648+
* @param name unique identifier of the coin
1649+
* @param fullName Complete human-readable name of the coin
1650+
* @param features
1651+
* @param prefix
1652+
* @param suffix
1653+
* @param network Network object for this coin
1654+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
1655+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1656+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
1657+
* @param isToken
1658+
* @param addressCoin
1659+
* @param primaryKeyCurve The elliptic curve for this chain/token
1660+
*/
1661+
1662+
export function tofcnep141Token(
1663+
id: string,
1664+
name: string,
1665+
fullName: string,
1666+
decimalPlaces: number,
1667+
asset: UnderlyingAsset,
1668+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
1669+
kind: CoinKind = CoinKind.CRYPTO,
1670+
prefix = '',
1671+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
1672+
network: OfcNetwork = Networks.test.ofc,
1673+
isToken = true,
1674+
addressCoin = 'tnear',
1675+
primaryKeyCurve: KeyCurve = KeyCurve.Ed25519
1676+
) {
1677+
return Object.freeze(
1678+
new OfcCoin({
1679+
id,
1680+
name,
1681+
fullName,
1682+
network,
1683+
prefix,
1684+
suffix,
1685+
features,
1686+
decimalPlaces,
1687+
isToken,
1688+
asset,
1689+
kind,
1690+
addressCoin,
1691+
primaryKeyCurve,
1692+
baseUnit: BaseUnit.NEAR,
1693+
})
1694+
);
1695+
}

0 commit comments

Comments
 (0)