I have one proxy contract and one implementation contact written in solidity. The steps I take is (I used Remix):
- deploy the implementation contract, get the contract address.
- go to compile details and found the initialize() function's bytecode, which is "8129fc1c": "initialize()"
- put the implementation contact address into the
_LOGIC field
, put the my wallet address that used to deploy the proxy contract in the_ADMIN field
, then put0x8129fc1c
into the_DATA
field. Then I deploy the proxy contract. - After both contracts are deployed. I go to the implementation contract, but put the proxy contract address into the
at address
field, so I can run the implementation contract via the proxy contract.
*There is one weird thing during the deployment: so the proxy contract deployment transaction is successful on the chain, but it is forever showing pending in the Remix console log.
Here is the problem:
- many of the functions are greyed out when I do step 4. see screenshot below:
- whenever I try any function, it returns the
error: Fail with error 'TransparentUpgradeableProxy: admin cannot fallback to proxy target'
Question: Is there any steps I did is wrong? did I miss anything or ?
p.s. I do have an initialize func in the implementation contract, so when deploy the proxy contract, I put the 0x8129fc1c
into the _DATA field to initialize it. This is the initialize function:
function initialize() public initializer {
__ERC20_init("MSBT", "SBT");
__ERC20Burnable_init();
__ERC20Snapshot_init();
__AccessControl_init();
__Pausable_init();
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(OWNER_ROLE, msg.sender);
_grantRole(PAUSER_ROLE, msg.sender);
_grantRole(BURNER_ROLE, msg.sender);
_grantRole(MINTER_ROLE, msg.sender);
_grantRole(SNAPSHOT_ROLE, msg.sender);
_setRoleAdmin(PAUSER_ROLE, OWNER_ROLE);
_setRoleAdmin(BURNER_ROLE, OWNER_ROLE);
_setRoleAdmin(MINTER_ROLE, OWNER_ROLE);
_setRoleAdmin(SNAPSHOT_ROLE, OWNER_ROLE);
cap = 1e27;
_pause();
}