I’m currently looking for solution for smart contract upgrades and came across the beacon pattern. I found some good tutorials here in the forum about deploying upgradable porxies with truffle but still those solutions don’t fit my requirements, or at least I don’t see it. So here is my setup and my understanding so far:
I have an api were I can have an endpoint for POST contract/. This endpoint will then trigger a deployment of a new smart contract. I will deploy quite a lot of smart contracts to a private PoA network.
Now I want to integrate the upgradable feature for the smart contract and so far I came across the proxy pattern where each proxy contract delegates the calls to the implementation contract. The thing is if I have a few hundred smart contracts, upgrading all of them requires to iterate over each of one of them. That’s why I found the beacon approach very interesting.
In the plugins for hardhat an truffle exist a function like deployProxy but so far they are only used in the migrations of truffle.
My questions would be if there is a way to deploy new proxies from an route handler and thus outside of the truffle migrations?
I found the beacon proxy in the docs but how do I use it with truffle?
Hey thank you very much for your fast answer. That pointed me directly to what I was looking for Don’t get it why I didn’t find it myself though. Anyway thanks again.
Ideally you would be able to use truffle exec but there are some issues with Truffle that cause the upgrades plugins to not work with truffle exec.
You would be able to use Hardhat's hardhat run to run a script using the upgrades plugin.
Regarding support for beacon proxies in the plugins: they aren't supported yet, I'll let you know once they are updated but we don't have a timeline for it right now.