Issues Executing approve and transfer Methods in Custom ERC20 Contract with AccessManager

Hello OpenZeppelin Community,

I am facing issues executing the approve and transfer methods in my custom ERC20 smart contract. I have configured the appropriate roles in the AccessManager (passed as initialAuthority to the constructor of my contract), but the methods still revert with an AccessManagerUnauthorized error.

Here is the code for my ERC20 contract:

// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/manager/AccessManaged.sol";

contract MyPumpkinToken is ERC20, AccessManaged {
    constructor(address initialAuthority)
        ERC20("MyPumpToken", "MPTK")

    function mint(address to, uint256 amount) public restricted {
        _mint(to, amount);

    function transfer(address recipient, uint256 amount) public override restricted returns (bool) {
        return super.transfer(recipient, amount);

    function approve(address spender, uint256 value) public override restricted returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;

I have followed these steps:

  1. Deploy AccessManager Contract: The AccessManager contract is deployed correctly.
  2. Deploy MyPumpkinToken Contract: The MyPumpkinToken contract is deployed with the AccessManager as the initialAuthority.
  3. Grant Role: I granted the required role (role ID 3) to the account trying to call the functions.
  4. Set Function Selector: I set the function selectors for approve and transfer to be restricted by role ID 3.

However, despite setting these configurations, the approve and transfer methods are not executing as expected. Below is a screenshot of the error message I am encountering:

Can anyone help identify what might be going wrong or provide guidance on resolving this issue?

Thank you for your assistance!