|
8 | 8 | CANTON_TOKEN_FEATURES, |
9 | 9 | CELO_TOKEN_FEATURES, |
10 | 10 | COSMOS_SIDECHAIN_FEATURES, |
| 11 | + ERC7984_TOKEN_FEATURES, |
11 | 12 | TEMPO_FEATURES, |
12 | 13 | } from './coinFeatures'; |
13 | 14 |
|
@@ -294,6 +295,15 @@ export class Erc721Coin extends ContractAddressDefinedToken {} |
294 | 295 | */ |
295 | 296 | export class Erc1155Coin extends ContractAddressDefinedToken {} |
296 | 297 |
|
| 298 | +/** |
| 299 | + * ERC-7984 is the confidential token standard for fhEVM-enabled blockchains (Zama). |
| 300 | + * Token balances are stored as FHE-encrypted ciphertexts; transfers use confidentialTransfer() |
| 301 | + * instead of the standard ERC-20 transfer(). Balance reads require delegated decryption via ACL. |
| 302 | + * |
| 303 | + * {@link https://eips.ethereum.org/EIPS/eip-7984 EIP-7984} |
| 304 | + */ |
| 305 | +export class Erc7984Coin extends ContractAddressDefinedToken {} |
| 306 | + |
297 | 307 | /** |
298 | 308 | * The TRON blockchain supports tokens of the ERC20 standard similar to ETH ERC20 tokens. |
299 | 309 | */ |
@@ -1087,6 +1097,99 @@ export function terc20( |
1087 | 1097 | return erc20(id, name, fullName, decimalPlaces, contractAddress, asset, features, prefix, suffix, network); |
1088 | 1098 | } |
1089 | 1099 |
|
| 1100 | +/** |
| 1101 | + * Factory function for ERC-7984 confidential token instances (Zama fhEVM). |
| 1102 | + * |
| 1103 | + * ERC-7984 tokens store balances as FHE-encrypted ciphertexts. Transfers use |
| 1104 | + * confidentialTransfer() and balance reads require ACL delegation to BitGo. |
| 1105 | + * |
| 1106 | + * @param id uuid v4 |
| 1107 | + * @param name unique identifier of the token (e.g. 'eth:ctkn') |
| 1108 | + * @param fullName Complete human-readable name of the token |
| 1109 | + * @param decimalPlaces Number of decimal places this token supports (divisibility exponent) |
| 1110 | + * @param contractAddress Contract address of this token |
| 1111 | + * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. |
| 1112 | + * @param features? Features of this coin. Defaults to ERC7984_TOKEN_FEATURES |
| 1113 | + * @param prefix? Optional token prefix. Defaults to empty string |
| 1114 | + * @param suffix? Optional token suffix. Defaults to token name. |
| 1115 | + * @param network? Optional token network. Defaults to Ethereum main network. |
| 1116 | + * @param primaryKeyCurve The elliptic curve for this chain/token |
| 1117 | + */ |
| 1118 | +export function erc7984( |
| 1119 | + id: string, |
| 1120 | + name: string, |
| 1121 | + fullName: string, |
| 1122 | + decimalPlaces: number, |
| 1123 | + contractAddress: string, |
| 1124 | + asset: UnderlyingAsset, |
| 1125 | + features: CoinFeature[] = ERC7984_TOKEN_FEATURES, |
| 1126 | + prefix = '', |
| 1127 | + suffix: string = name.toUpperCase(), |
| 1128 | + network: EthereumNetwork = Networks.main.ethereum, |
| 1129 | + primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1 |
| 1130 | +) { |
| 1131 | + return Object.freeze( |
| 1132 | + new Erc7984Coin({ |
| 1133 | + id, |
| 1134 | + name, |
| 1135 | + fullName, |
| 1136 | + network, |
| 1137 | + contractAddress, |
| 1138 | + prefix, |
| 1139 | + suffix, |
| 1140 | + features, |
| 1141 | + decimalPlaces, |
| 1142 | + asset, |
| 1143 | + isToken: true, |
| 1144 | + primaryKeyCurve, |
| 1145 | + baseUnit: BaseUnit.ETH, |
| 1146 | + }) |
| 1147 | + ); |
| 1148 | +} |
| 1149 | + |
| 1150 | +/** |
| 1151 | + * Factory function for testnet ERC-7984 confidential token instances (Zama fhEVM). |
| 1152 | + * |
| 1153 | + * @param id uuid v4 |
| 1154 | + * @param name unique identifier of the token (e.g. 'hteth:ctkn') |
| 1155 | + * @param fullName Complete human-readable name of the token |
| 1156 | + * @param decimalPlaces Number of decimal places this token supports (divisibility exponent) |
| 1157 | + * @param contractAddress Contract address of this token |
| 1158 | + * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. |
| 1159 | + * @param features? Features of this coin. Defaults to ERC7984_TOKEN_FEATURES |
| 1160 | + * @param prefix? Optional token prefix. Defaults to empty string |
| 1161 | + * @param suffix? Optional token suffix. Defaults to token name. |
| 1162 | + * @param network? Optional token network. Defaults to Hoodi test network. |
| 1163 | + * @param primaryKeyCurve The elliptic curve for this chain/token |
| 1164 | + */ |
| 1165 | +export function terc7984( |
| 1166 | + id: string, |
| 1167 | + name: string, |
| 1168 | + fullName: string, |
| 1169 | + decimalPlaces: number, |
| 1170 | + contractAddress: string, |
| 1171 | + asset: UnderlyingAsset, |
| 1172 | + features: CoinFeature[] = ERC7984_TOKEN_FEATURES, |
| 1173 | + prefix = '', |
| 1174 | + suffix: string = name.toUpperCase(), |
| 1175 | + network: EthereumNetwork = Networks.test.hoodi, |
| 1176 | + primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1 |
| 1177 | +) { |
| 1178 | + return erc7984( |
| 1179 | + id, |
| 1180 | + name, |
| 1181 | + fullName, |
| 1182 | + decimalPlaces, |
| 1183 | + contractAddress, |
| 1184 | + asset, |
| 1185 | + features, |
| 1186 | + prefix, |
| 1187 | + suffix, |
| 1188 | + network, |
| 1189 | + primaryKeyCurve |
| 1190 | + ); |
| 1191 | +} |
| 1192 | + |
1090 | 1193 | /** |
1091 | 1194 | * Factory function for erc721 token instances. |
1092 | 1195 | * |
|
0 commit comments