You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If users create similar patterns of Futures, they would naturally want to avoid that repetition, and that can be done using normal javascript functions. The only special consideration that you have to take is that you don't want your IDs to be repeated every time you call the helper. Otherwise, they will class.
Let's create a short guide explaining this.
Good example of a helper
inspired in The Graph's modules
/** * Deploys an upgradable instance of `contractName` * * @param m The module builder * @param contractName The contract name to deploy (i.e. its initial implementation) * @param instanceName A name should be given to this contract instance if you deploy multiple of them within the same module. **/exportfunctionmyProxy(m: IgnitionModuleBuilder,contactName: string,instanceName=""){constimplementation=m.contract(contractName,{id: `${contractName}${instanceName}`});constproxy=m.contract("MyProxy",{id: `MyProxy_${contractName}${instanceName}`});// ...return{proxy, implementation};}
This version can only be called once per module, as it will use "MyProxy" to generate the proxy's id. And, if we were to fix only that ID, it could only be called once per module and contractName, which could also be problematic.
For future reference
This pattern is already being used by The Graph here.
Search terms
No response
The text was updated successfully, but these errors were encountered:
Describe the feature
If users create similar patterns of
Future
s, they would naturally want to avoid that repetition, and that can be done using normal javascript functions. The only special consideration that you have to take is that you don't want your IDs to be repeated every time you call the helper. Otherwise, they will class.Let's create a short guide explaining this.
Good example of a helper
inspired in The Graph's modules
Bad example of a helper
This is the thing that want to avoid
This version can only be called once per module, as it will use "MyProxy" to generate the proxy's id. And, if we were to fix only that ID, it could only be called once per module and
contractName
, which could also be problematic.For future reference
This pattern is already being used by The Graph here.
Search terms
No response
The text was updated successfully, but these errors were encountered: