On the BSC testnet I have created the following Proxy (upgradeable) contract:
0xe73585adad24f0994b794eb276561303e1f46a9a
with a related implementation contract: 0x63d68a352ae2201a8ebb399801ea6f796f50d807
.
I am using web3js to contact the contract using this setup:
const proxyAddress = "0xe73585adAd24f0994b794eB276561303E1F46A9a";
const abi = [{
inputs: [],
name: "migrate",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "payable",
type: "function",
}]
const contract = new web3.eth.Contract(abi, proxyAddress);
const contract = contract ;
const sender = localStorage.getItem(TOKEN_KEY);
contract.methods
.migrate()
.send({
from: sender,
})
.then((res) => {
console.log("Success", res);
})
.catch((err) => {
console.log(err);
});
The abi is taken from the implementation contract - so I am using the proxy contract to envoke the web3.eth.Contract method and the abi from the implementation contract.
I get the following error:
I have tried to use contract.methods.implementation().migrate()
and contract.functions.implementation().migrate()
. But without any luck
I am currently using web3 v. 1.7.3
.
I might be misunderstanding something but I am quite sure that you need to use the proxy contract address but the abi from the implementation contract?