@@ -366,40 +366,37 @@ Generated by [AVA](https://avajs.dev).
366366 pragma solidity ^0.8.27;␊
367367 ␊
368368 import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";␊
369- import {ERC20Allowlist} from "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Allowlist.sol";␊
370369 import {ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";␊
370+ import {ERC20Restricted} from "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Restricted.sol";␊
371371 import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";␊
372372 ␊
373- contract MyStablecoin is ERC20, ERC20Permit, ERC20Allowlist , Ownable {␊
373+ contract MyStablecoin is ERC20, ERC20Permit, ERC20Restricted , Ownable {␊
374374 constructor(address initialOwner)␊
375375 ERC20("MyStablecoin", "MST")␊
376376 ERC20Permit("MyStablecoin")␊
377377 Ownable(initialOwner)␊
378378 {}␊
379+ ␊
380+ function isUserAllowed(address user) public view override returns (bool) {␊
381+ return getRestriction(user) == Restriction.ALLOWED;␊
382+ }␊
379383 ␊
380384 function allowUser(address user) public onlyOwner {␊
381385 _allowUser(user);␊
382386 }␊
383387 ␊
384388 function disallowUser(address user) public onlyOwner {␊
385- _disallowUser (user);␊
389+ _resetUser (user);␊
386390 }␊
387391 ␊
388392 // The following functions are overrides required by Solidity.␊
389393 ␊
390394 function _update(address from, address to, uint256 value)␊
391395 internal␊
392- override(ERC20, ERC20Allowlist )␊
396+ override(ERC20, ERC20Restricted )␊
393397 {␊
394398 super._update(from, to, value);␊
395399 }␊
396- ␊
397- function _approve(address owner, address spender, uint256 value, bool emitEvent)␊
398- internal␊
399- override(ERC20, ERC20Allowlist)␊
400- {␊
401- super._approve(owner, spender, value, emitEvent);␊
402- }␊
403400 }␊
404401 `
405402
@@ -412,11 +409,11 @@ Generated by [AVA](https://avajs.dev).
412409 pragma solidity ^0.8.27;␊
413410 ␊
414411 import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";␊
415- import {ERC20Blocklist} from "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Blocklist.sol";␊
416412 import {ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";␊
413+ import {ERC20Restricted} from "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Restricted.sol";␊
417414 import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";␊
418415 ␊
419- contract MyStablecoin is ERC20, ERC20Permit, ERC20Blocklist , Ownable {␊
416+ contract MyStablecoin is ERC20, ERC20Permit, ERC20Restricted , Ownable {␊
420417 constructor(address initialOwner)␊
421418 ERC20("MyStablecoin", "MST")␊
422419 ERC20Permit("MyStablecoin")␊
@@ -428,24 +425,17 @@ Generated by [AVA](https://avajs.dev).
428425 }␊
429426 ␊
430427 function unblockUser(address user) public onlyOwner {␊
431- _unblockUser (user);␊
428+ _resetUser (user);␊
432429 }␊
433430 ␊
434431 // The following functions are overrides required by Solidity.␊
435432 ␊
436433 function _update(address from, address to, uint256 value)␊
437434 internal␊
438- override(ERC20, ERC20Blocklist )␊
435+ override(ERC20, ERC20Restricted )␊
439436 {␊
440437 super._update(from, to, value);␊
441438 }␊
442- ␊
443- function _approve(address owner, address spender, uint256 value, bool emitEvent)␊
444- internal␊
445- override(ERC20, ERC20Blocklist)␊
446- {␊
447- super._approve(owner, spender, value, emitEvent);␊
448- }␊
449439 }␊
450440 `
451441
@@ -594,17 +584,17 @@ Generated by [AVA](https://avajs.dev).
594584 import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";␊
595585 import {ERC1363} from "@openzeppelin/contracts/token/ERC20/extensions/ERC1363.sol";␊
596586 import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";␊
597- import {ERC20Allowlist} from "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Allowlist.sol";␊
598587 import {ERC20Bridgeable} from "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Bridgeable.sol";␊
599588 import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";␊
600589 import {ERC20Custodian} from "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Custodian.sol";␊
601590 import {ERC20FlashMint} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20FlashMint.sol";␊
602591 import {ERC20Pausable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";␊
603592 import {ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";␊
593+ import {ERC20Restricted} from "@openzeppelin/community-contracts/token/ERC20/extensions/ERC20Restricted.sol";␊
604594 import {ERC20Votes} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";␊
605595 import {Nonces} from "@openzeppelin/contracts/utils/Nonces.sol";␊
606596 ␊
607- contract MyStablecoin is ERC20, ERC20Bridgeable, AccessControl, ERC20Burnable, ERC20Pausable, ERC1363, ERC20Permit, ERC20Votes, ERC20FlashMint, ERC20Custodian, ERC20Allowlist {␊
597+ contract MyStablecoin is ERC20, ERC20Bridgeable, AccessControl, ERC20Burnable, ERC20Pausable, ERC1363, ERC20Permit, ERC20Votes, ERC20FlashMint, ERC20Custodian, ERC20Restricted {␊
608598 bytes32 public constant TOKEN_BRIDGE_ROLE = keccak256("TOKEN_BRIDGE_ROLE");␊
609599 error Unauthorized();␊
610600 bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");␊
@@ -646,30 +636,27 @@ Generated by [AVA](https://avajs.dev).
646636 function _isCustodian(address user) internal view override returns (bool) {␊
647637 return hasRole(CUSTODIAN_ROLE, user);␊
648638 }␊
639+ ␊
640+ function isUserAllowed(address user) public view override returns (bool) {␊
641+ return getRestriction(user) == Restriction.ALLOWED;␊
642+ }␊
649643 ␊
650644 function allowUser(address user) public onlyRole(LIMITER_ROLE) {␊
651645 _allowUser(user);␊
652646 }␊
653647 ␊
654648 function disallowUser(address user) public onlyRole(LIMITER_ROLE) {␊
655- _disallowUser (user);␊
649+ _resetUser (user);␊
656650 }␊
657651 ␊
658652 // The following functions are overrides required by Solidity.␊
659653 ␊
660654 function _update(address from, address to, uint256 value)␊
661655 internal␊
662- override(ERC20, ERC20Pausable, ERC20Votes, ERC20Custodian, ERC20Allowlist )␊
656+ override(ERC20, ERC20Pausable, ERC20Votes, ERC20Custodian, ERC20Restricted )␊
663657 {␊
664658 super._update(from, to, value);␊
665659 }␊
666- ␊
667- function _approve(address owner, address spender, uint256 value, bool emitEvent)␊
668- internal␊
669- override(ERC20, ERC20Allowlist)␊
670- {␊
671- super._approve(owner, spender, value, emitEvent);␊
672- }␊
673660 ␊
674661 function supportsInterface(bytes4 interfaceId)␊
675662 public␊
0 commit comments