Closed arboleya closed 1 month ago
At face value I think this should work out of the box with addContracts
however we'll get type errors, consider the following example:
const myContract = new Contract('0x01', MyContractAbi, wallet);
const myProxyContract = new Contract('0x02', MyProxyAbi, wallet);
await myContract.functions.myContractXyz().addContracts([myProxyContract]).call();
The proxy and it's ABI is added to the call so can use it and it's logs. However, the ABI is only really useful for logged types. For proxy calls, we also want to be able to call methods available to myProxyContact
.
The solution addProxyContract
should perform everything addContracts
can, but also allow us to safely perform functions from the proxy.
await myContract.functions.myProxyContractXyz().addProxyContracts([myProxyContract]).call();
I'd recommend testing this first with a proxy contract and seeing how it works with the current SDK before informing the solution.
It turns out that proxy contracts are supported out of the box.
The only thing that needs handling is proxy deployments:
We should provide a type-safe API that can work behind proxied contracts.
This should go in tandem with:
Original request:
contractA.functions.someRandomFunc().call()
. However, they're saying for the proxy contract, there isn't any way to call a particular function (say, "someRandomFunc") that is defined in the implementation because the base proxy contract has essentially just a "fallback" method. They've found this, but it mentions the usage of forc that isn't ideal for their use case.