0

I have deployed a smart contract to a public network like binance smart chain network that is viewable on a blockchain explorer like bscscan.

The deployed smart contract was developed with Openzeppelin upgrades plugin to be upgradable.

Once deployed, how can I interact with the smart contract to call public methods on it without building a frontend web3 application?

Typically, all public methods on the contract are exposed on bscscan under the Contract tab as shown in the attached image, however, since the Openzeppelin upgrades plugin uses a proxy contract to manage upgrades, it's only the public methods on the proxy (manager) contract that are visible on bscscan.

Are there any dApps that facilitate communicating with an upgradable contract deployed in this way, or are there some other methods can can be used to facilitate interacting with an upgradable contract?

attached image

goonerify
  • 1,668
  • 25
  • 27

2 Answers2

0

Assuming the implementation contract is verified on the blockchain explorer, you can use the Read as Proxy and Write as Proxy tabs.

They allow you to interact with the proxy contract using the ABI of the implementation contract the same way as you can interact with a regular (non-proxy) contract using the Read Contract and Write Contract tabs.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • Unfortunately, it seems that the methods that are exposed on `Read as Proxy` and `Write as Proxy` tabs on the blockchain explorer are still from a process of the proxy openzeppelin contract. None of the public methods from the original contract are exposed on blockchain explorer except for some core methods from the openzeppelin upgradable contracts like `OwnableUpgradeable`, `Initializable` etc – goonerify Dec 15 '21 at 00:25
0

You call a public method, of the logic contract, on the proxy contract, which has none of that method. The proxy has then to redirect the call to its fallback function, which, in turn, delegates/forward the call to the registered, current logic contract, which runs the code of that method against the state data stored in the proxy contract. (The proxy contract effectively borrows the code of the given method from the registered, current logic contract.) When you upgrade the upgradeable contract, the proxy manager simply deploy the new contract and overridingly register the contract as the current logic contract, while keeping the state data stored in the proxy. Two concepts that work here:

  1. the fallback function, which is invoked if a non-existing function is called, on a contract,
  2. and call delegation, which calls a public function of another, logic, contract so that the function works on the state data kept in the proxy not in the logic contract.
Mike
  • 1