Skip to content

Commit 9930923

Browse files
feat: adding ofc support for WORLDERC20 tokens
Ticket: WIN-6406 TICKET: WIN-6406
1 parent 520d70d commit 9930923

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

modules/statics/src/ofc.ts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,3 +1694,105 @@ export function tofcnep141Token(
16941694
})
16951695
);
16961696
}
1697+
1698+
/**
1699+
* Factory function for ofc WorldErc20 token instances.
1700+
*
1701+
* @param id uuid v4
1702+
* @param name unique identifier of the coin
1703+
* @param fullName Complete human-readable name of the coin
1704+
* @param network Network object for this coin
1705+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
1706+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1707+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
1708+
* @param prefix? Optional coin prefix. Defaults to empty string
1709+
* @param suffix? Optional coin suffix. Defaults to coin name.
1710+
* @param isToken? Whether or not this account coin is a token of another coin
1711+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
1712+
* @param primaryKeyCurve The elliptic curve for this chain/token
1713+
*/
1714+
export function ofcWorldErc20(
1715+
id: string,
1716+
name: string,
1717+
fullName: string,
1718+
decimalPlaces: number,
1719+
asset: UnderlyingAsset,
1720+
kind: CoinKind = CoinKind.CRYPTO,
1721+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
1722+
prefix = '',
1723+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
1724+
network: OfcNetwork = Networks.main.ofc,
1725+
isToken = true,
1726+
addressCoin = 'world',
1727+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
1728+
) {
1729+
return Object.freeze(
1730+
new OfcCoin({
1731+
id,
1732+
name,
1733+
fullName,
1734+
network,
1735+
prefix,
1736+
suffix,
1737+
features,
1738+
decimalPlaces,
1739+
isToken,
1740+
asset,
1741+
kind,
1742+
addressCoin,
1743+
primaryKeyCurve,
1744+
baseUnit: BaseUnit.ETH,
1745+
})
1746+
);
1747+
}
1748+
1749+
/**
1750+
* Factory function for testnet ofc WorldErc20 token instances.
1751+
*
1752+
* @param id uuid v4
1753+
* @param name unique identifier of the coin
1754+
* @param fullName Complete human-readable name of the coin
1755+
* @param network Network object for this coin
1756+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
1757+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
1758+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
1759+
* @param prefix? Optional coin prefix. Defaults to empty string
1760+
* @param suffix? Optional coin suffix. Defaults to coin name.
1761+
* @param isToken? Whether or not this account coin is a token of another coin
1762+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
1763+
* @param primaryKeyCurve The elliptic curve for this chain/token
1764+
*/
1765+
export function tofcWorldErc20(
1766+
id: string,
1767+
name: string,
1768+
fullName: string,
1769+
decimalPlaces: number,
1770+
asset: UnderlyingAsset,
1771+
kind: CoinKind = CoinKind.CRYPTO,
1772+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
1773+
prefix = '',
1774+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
1775+
network: OfcNetwork = Networks.test.ofc,
1776+
isToken = true,
1777+
addressCoin = 'tworld',
1778+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
1779+
) {
1780+
return Object.freeze(
1781+
new OfcCoin({
1782+
id,
1783+
name,
1784+
fullName,
1785+
network,
1786+
prefix,
1787+
suffix,
1788+
features,
1789+
decimalPlaces,
1790+
isToken,
1791+
asset,
1792+
kind,
1793+
addressCoin,
1794+
primaryKeyCurve,
1795+
baseUnit: BaseUnit.ETH,
1796+
})
1797+
);
1798+
}

0 commit comments

Comments
 (0)