Closed tmigone closed 2 days ago
Module parameters are great but sometimes you can have multiple modules requiring the exact same parameter which can become a bit tedious to manage.
For example, if I wanted to set the owner for a bunch of contracts on different modules I would have a config file like this:
{ "GraphProxyAdmin": { "owner": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0", "pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC" }, "Controller": { "owner": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0", }, "RewardsManager": { "owner": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0", "issuancePerBlock": "114155251141552511415n" } }
It would be nice to have global parameters that could be accessed from any module. Maybe use the global keyword to group them.
global
The config file in this case would be much cleaner, and the global parameters would immediately be recognized as such:
{ "global": { "owner": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0", "pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC" }, "RewardsManager": { "issuancePerBlock": "114155251141552511415n" } }
Then for accessing the global parameters the API could be something like:
const owner = m.getGlobalParameter('owner')
global, parameter, module parameter
For future reference: https://github.com/graphprotocol/contracts/pull/1025#discussion_r1761943147
Describe the feature
Problem
Module parameters are great but sometimes you can have multiple modules requiring the exact same parameter which can become a bit tedious to manage.
For example, if I wanted to set the owner for a bunch of contracts on different modules I would have a config file like this:
Solution
It would be nice to have global parameters that could be accessed from any module. Maybe use the
global
keyword to group them.The config file in this case would be much cleaner, and the global parameters would immediately be recognized as such:
Then for accessing the global parameters the API could be something like:
Search terms
global, parameter, module parameter