1

I am trying to understand the Zepplin proxy code pattern so i deployed two contracts using remix

  1. Token.sol (logic contract - basic ERC20 contract)
  2. AdminUpgradeabilityProxy.sol (From zepplin)

https://github.com/zeppelinos/zos/blob/master/packages/lib/contracts/upgradeability/AdminUpgradeabilityProxy.sol

In the AdminUpgradeabilityProxy the logic/implementation address is already defined as the address to Token.sol.

Then I try to load the proxied contract instance by essentially loading the implementation contract (Logic.sol) by using the Proxy contract (AdminUpgradeabilityProxy.sol) address.

However, in doing so any functions i call on this proxied contract fails. What is it that I am doing wrong. Any help is appreciated.

EDIT: I have deployed PAXOS Standard token contracts on the Rinkeby network. (https://github.com/paxosglobal/pax-contracts/tree/master/contracts)

Implementation contract:

https://rinkeby.etherscan.io/address/0x075b201c705a2a49cc06c859557ccd63749ada13

Proxy Contract:

https://rinkeby.etherscan.io/address/0xef4360e5e6112e05618c98cbd74947d88139a19b

  • 1
    Can you attach any example transactions to this question? Even better, if you can run them on a public test network and link those transactions and have your contracts verified on EtherScan. – Mikko Ohtamaa Apr 11 at 9:38
  • @MikkoOhtamaa please see the edit. Thank you – stud91 Apr 11 at 10:00
  • Could you verify the contracts on EtherScan, so that one gets human readable output and not just binary mess? etherscan.io/verifyContract2 – Mikko Ohtamaa Apr 11 at 18:10
  • 1
    Still trying to understand why but the error comes from the require statement in the _willFallback() function of the AdminUpgradeabilityProxy contract. I don't know if it's expected behaviour or anormal. If you want to call an admin function in the ERC20 contract through the proxy, it will always fail because of the revert. – Eli Drion Apr 14 at 13:16
  • 1
    I don't think you have to change the admin tho? It's set at the deployement of the contract, and even if you change it, it won't change the issue with willFallback? – Eli Drion Apr 14 at 13:38
1

The admin of the Proxy contract cannot call any functions on the proxied contract as they will NOT fallback. This is shown in the code excerpt of AdminUpgradeabilityProxy.sol below:

modifier ifAdmin() {
   if (msg.sender == _admin()) {
       _;
    } else {
       _fallback();
    }
}

So the solution is to call the proxied contract by some other account e.g. the owner of the implementation contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.