@@ -203,6 +203,14 @@ export interface Erc721ConstructorOptions extends AccountConstructorOptions {
203203
204204export interface Erc7984ConstructorOptions extends AccountConstructorOptions {
205205 contractAddress : string ;
206+ /** Plain ERC-20 locked in the wrapper as escrow. */
207+ underlyingErc20Address : string ;
208+ /** On-chain `rate()` as a decimal string (uint256). */
209+ rate : string ;
210+ /** When true, non-zero→non-zero approve may revert (USDT-style); WP must approve(0) first. */
211+ requiresApprovalReset : boolean ;
212+ /** When true, pair is approved for shield/unshield + indexer publish filters. */
213+ isVetted : boolean ;
206214}
207215
208216export interface NFTCollectionIdConstructorOptions extends AccountConstructorOptions {
@@ -415,11 +423,23 @@ export class Erc1155Coin extends ContractAddressDefinedToken {}
415423 * Token balances are stored as FHE-encrypted ciphertexts; transfers use confidentialTransfer()
416424 * instead of the standard ERC-20 transfer(). Balance reads require delegated decryption via ACL.
417425 *
426+ * Wrapper metadata (`underlyingErc20Address`, `rate`, `requiresApprovalReset`, `isVetted`) lives
427+ * on the coin — same pattern as `Nep141Token.storageDepositAmount` / `XrpMptCoin.canTransfer`.
428+ *
418429 * {@link https://eips.ethereum.org/EIPS/eip-7984 EIP-7984}
419430 */
420431export class Erc7984Coin extends ContractAddressDefinedToken {
432+ public underlyingErc20Address : string ;
433+ public rate : string ;
434+ public requiresApprovalReset : boolean ;
435+ public isVetted : boolean ;
436+
421437 constructor ( options : Erc7984ConstructorOptions ) {
422438 super ( options ) ;
439+ this . underlyingErc20Address = options . underlyingErc20Address . toLowerCase ( ) ;
440+ this . rate = options . rate ;
441+ this . requiresApprovalReset = options . requiresApprovalReset ;
442+ this . isVetted = options . isVetted ;
423443 }
424444}
425445
@@ -1259,26 +1279,34 @@ export function terc20(
12591279 * @param name unique identifier of the token (e.g. 'eth:ctkn')
12601280 * @param fullName Complete human-readable name of the token
12611281 * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
1262- * @param contractAddress Contract address of this token
1282+ * @param contractAddress Contract address of this token (wrapper)
1283+ * @param underlyingErc20Address Plain ERC-20 locked in the wrapper as escrow
1284+ * @param rate On-chain `rate()` as a decimal string (uint256)
1285+ * @param requiresApprovalReset USDT-style approve(0) reset required before approve(amount)
12631286 * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
12641287 * @param features? Features of this coin. Defaults to ERC7984_TOKEN_FEATURES
12651288 * @param prefix? Optional token prefix. Defaults to empty string
12661289 * @param suffix? Optional token suffix. Defaults to token name.
12671290 * @param network? Optional token network. Defaults to Ethereum main network.
12681291 * @param primaryKeyCurve The elliptic curve for this chain/token
1292+ * @param isVetted? When true, approved for shield/unshield + indexer publish. Defaults to true.
12691293 */
12701294export function erc7984 (
12711295 id : string ,
12721296 name : string ,
12731297 fullName : string ,
12741298 decimalPlaces : number ,
12751299 contractAddress : string ,
1300+ underlyingErc20Address : string ,
1301+ rate : string ,
1302+ requiresApprovalReset : boolean ,
12761303 asset : UnderlyingAsset ,
12771304 features : CoinFeature [ ] = ERC7984_TOKEN_FEATURES ,
12781305 prefix = '' ,
12791306 suffix : string = name . toUpperCase ( ) ,
12801307 network : EthereumNetwork = Networks . main . ethereum ,
1281- primaryKeyCurve : KeyCurve = KeyCurve . Secp256k1
1308+ primaryKeyCurve : KeyCurve = KeyCurve . Secp256k1 ,
1309+ isVetted = true
12821310) {
12831311 return Object . freeze (
12841312 new Erc7984Coin ( {
@@ -1287,6 +1315,10 @@ export function erc7984(
12871315 fullName,
12881316 network,
12891317 contractAddress,
1318+ underlyingErc20Address,
1319+ rate,
1320+ requiresApprovalReset,
1321+ isVetted,
12901322 prefix,
12911323 suffix,
12921324 features,
@@ -1306,39 +1338,51 @@ export function erc7984(
13061338 * @param name unique identifier of the token (e.g. 'hteth:ctkn')
13071339 * @param fullName Complete human-readable name of the token
13081340 * @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
1309- * @param contractAddress Contract address of this token
1341+ * @param contractAddress Contract address of this token (wrapper)
1342+ * @param underlyingErc20Address Plain ERC-20 locked in the wrapper as escrow
1343+ * @param rate On-chain `rate()` as a decimal string (uint256)
1344+ * @param requiresApprovalReset USDT-style approve(0) reset required before approve(amount)
13101345 * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
13111346 * @param features? Features of this coin. Defaults to ERC7984_TOKEN_FEATURES
13121347 * @param prefix? Optional token prefix. Defaults to empty string
13131348 * @param suffix? Optional token suffix. Defaults to token name.
13141349 * @param network? Optional token network. Defaults to Hoodi test network.
13151350 * @param primaryKeyCurve The elliptic curve for this chain/token
1351+ * @param isVetted? When true, approved for shield/unshield + indexer publish. Defaults to true.
13161352 */
13171353export function terc7984 (
13181354 id : string ,
13191355 name : string ,
13201356 fullName : string ,
13211357 decimalPlaces : number ,
13221358 contractAddress : string ,
1359+ underlyingErc20Address : string ,
1360+ rate : string ,
1361+ requiresApprovalReset : boolean ,
13231362 asset : UnderlyingAsset ,
13241363 features : CoinFeature [ ] = ERC7984_TOKEN_FEATURES ,
13251364 prefix = '' ,
13261365 suffix : string = name . toUpperCase ( ) ,
13271366 network : EthereumNetwork = Networks . test . hoodi ,
1328- primaryKeyCurve : KeyCurve = KeyCurve . Secp256k1
1367+ primaryKeyCurve : KeyCurve = KeyCurve . Secp256k1 ,
1368+ isVetted = true
13291369) {
13301370 return erc7984 (
13311371 id ,
13321372 name ,
13331373 fullName ,
13341374 decimalPlaces ,
13351375 contractAddress ,
1376+ underlyingErc20Address ,
1377+ rate ,
1378+ requiresApprovalReset ,
13361379 asset ,
13371380 features ,
13381381 prefix ,
13391382 suffix ,
13401383 network ,
1341- primaryKeyCurve
1384+ primaryKeyCurve ,
1385+ isVetted
13421386 ) ;
13431387}
13441388
0 commit comments