Cannot use delegate in ERC1967Proxy

Hello I'm trying to test the ERC1967Proxy to delegate calls to a implementation.
However I don't understand why I cannot use it.

Here my proxy code:

// SPDX-License-Identifier: AGPL-3
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";

contract AProxy is ERC1967Proxy {
    constructor(address _impl) ERC1967Proxy(_impl, "") {}

Here the code of the implementation:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract DummyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("DummyToken", "DTK") {
        _mint(msg.sender, initialSupply);

Here the code of the test

const AProxy = artifacts.require("AProxy")
const DummyToken = artifacts.require("DummyToken")

contract("Proxy", (accounts) => {

    it("delegate call", async () => {

        const DummyTokenInstance = await'1000'))
        const ProxyInstance = await

        assert.equal(web3.utils.toWei('1000'), await DummyTokenInstance.totalSupply())

        const methodCall = DummyTokenInstance.contract.methods.totalSupply().encodeABI()

        const response = await{ to: ProxyInstance.address, data: methodCall, from: accounts[2] })

        // Returns 0x0000000000000000000000000000000000000000000000000000000000000000
        // Expect 1000 tokens


I'm sure you can help to resolve my issue, please let me know ^^

You're not saying what error you're getting.

Sorry I have not been clear, but the thing is as I described in the comments in the test file, I expect the Proxy to call my token by delegating calls, but it turns out it doesn't call the token properly.

By using a direct call I can get the totalSupply in that example, but if I use the proxy call I do not get the same value.

But probably because the token was deployed before and its state is not replicated on the proxy' state

That's correct, you've initialized the token implementation state, but the proxy will ignore that state.

Please see Using with Upgrades or our upgrades related content in general.

You will see that you have to use the token from the @openzeppelin/contracts-upgradeable package.

You can use our Upgrades Plugins to deploy the proxy, but if you want to do it manually, you will need to specifiy the initialization function call when you deploy the proxy. It's what you set as the empty string here:

contract AProxy is ERC1967Proxy {
    constructor(address _impl) ERC1967Proxy(_impl, "") {}