hardhat-ignition icon indicating copy to clipboard operation
hardhat-ignition copied to clipboard

`Future` after `IgnitionModule`

Open alcuadrado opened this issue 5 months ago • 0 comments

Describe the feature

Problem

In some situations, a user needs to express that a Future should only be executed after an IgnitionModule has been executed.

We have already covered this for one case, where the Future depends on a ContractFuture exported by the IgnitionModule, as the Future implicitly depends on the entire IgnitionModule (what we jokingly call The Malaga rule).

There are cases where no ContractFuture is exported from the IgnitionModule, and you still need to be able to express this. Right now, this leads to a workaround where a ContractFuture is unnecessarily defined and exported, as shown by The Graph's module definitions.

Solution

We could have an explicit way to express "after module".

A possible syntax could be something like:

const MyModule = require("./module.js");

// ...
const foo = m.contract("Foo", [], {after: [MyModule]});

This could be quickly done by adding all the futures as dependencies of foo, but it is probably worth making it a first-class citizen to be able to properly communicate and display it in the visualize task.

For future reference

I already validated this with the team at The Graph here.

Search terms

modules

alcuadrado avatar Sep 23 '24 21:09 alcuadrado