diff --git a/examples/sample/ignition/modules/LockModule.js b/examples/sample/ignition/modules/LockModule.js index 4f800dc97..37b466b66 100644 --- a/examples/sample/ignition/modules/LockModule.js +++ b/examples/sample/ignition/modules/LockModule.js @@ -8,7 +8,7 @@ const TEN_YEARS_IN_FUTURE = currentTimestampInSeconds + TEN_YEAR_IN_SECS; const ONE_GWEI = BigInt(hre.ethers.parseUnits("1", "gwei")); module.exports = buildModule("LockModule", (m) => { - const unlockTime = m.getParameter("unlockTime", TEN_YEARS_IN_FUTURE); + const unlockTime = m.getParameter("unlockTime"); const lockedAmount = m.getParameter("lockedAmount", ONE_GWEI); const lock = m.contract("Lock", [unlockTime], { diff --git a/examples/sample/parameters.json b/examples/sample/parameters.json new file mode 100644 index 000000000..1ef991d30 --- /dev/null +++ b/examples/sample/parameters.json @@ -0,0 +1,5 @@ +{ + "$global": { + "unlockTime": 1987909200 + } +} diff --git a/packages/core/src/internal/validation/futures/validateArtifactContractAt.ts b/packages/core/src/internal/validation/futures/validateArtifactContractAt.ts index 4408fff9e..6d9d6e615 100644 --- a/packages/core/src/internal/validation/futures/validateArtifactContractAt.ts +++ b/packages/core/src/internal/validation/futures/validateArtifactContractAt.ts @@ -18,6 +18,7 @@ export async function validateArtifactContractAt( if (isModuleParameterRuntimeValue(future.address)) { const param = deploymentParameters[future.address.moduleId]?.[future.address.name] ?? + deploymentParameters.$global[future.address.name] ?? future.address.defaultValue; if (param === undefined) { errors.push( diff --git a/packages/core/src/internal/validation/futures/validateArtifactContractDeployment.ts b/packages/core/src/internal/validation/futures/validateArtifactContractDeployment.ts index d45f7ee3a..9ef6e9640 100644 --- a/packages/core/src/internal/validation/futures/validateArtifactContractDeployment.ts +++ b/packages/core/src/internal/validation/futures/validateArtifactContractDeployment.ts @@ -55,6 +55,7 @@ export async function validateArtifactContractDeployment( const missingParams = moduleParams.filter( (param) => deploymentParameters[param.moduleId]?.[param.name] === undefined && + deploymentParameters.$global[param.name] === undefined && param.defaultValue === undefined ); @@ -69,6 +70,7 @@ export async function validateArtifactContractDeployment( if (isModuleParameterRuntimeValue(future.value)) { const param = deploymentParameters[future.value.moduleId]?.[future.value.name] ?? + deploymentParameters.$global[future.value.name] ?? future.value.defaultValue; if (param === undefined) { errors.push( diff --git a/packages/core/src/internal/validation/futures/validateNamedContractAt.ts b/packages/core/src/internal/validation/futures/validateNamedContractAt.ts index 6e09a5d54..e75078a10 100644 --- a/packages/core/src/internal/validation/futures/validateNamedContractAt.ts +++ b/packages/core/src/internal/validation/futures/validateNamedContractAt.ts @@ -33,6 +33,7 @@ export async function validateNamedContractAt( if (isModuleParameterRuntimeValue(future.address)) { const param = deploymentParameters[future.address.moduleId]?.[future.address.name] ?? + deploymentParameters.$global[future.address.name] ?? future.address.defaultValue; if (param === undefined) { errors.push( diff --git a/packages/core/src/internal/validation/futures/validateNamedContractCall.ts b/packages/core/src/internal/validation/futures/validateNamedContractCall.ts index 31e081b62..473b608ea 100644 --- a/packages/core/src/internal/validation/futures/validateNamedContractCall.ts +++ b/packages/core/src/internal/validation/futures/validateNamedContractCall.ts @@ -65,7 +65,8 @@ export async function validateNamedContractCall( const missingParams = moduleParams.filter( (param) => - deploymentParameters[param.moduleId]?.[param.name] === undefined && + (deploymentParameters[param.moduleId]?.[param.name] === undefined && + deploymentParameters.$global[param.name]) === undefined && param.defaultValue === undefined ); @@ -80,6 +81,7 @@ export async function validateNamedContractCall( if (isModuleParameterRuntimeValue(future.value)) { const param = deploymentParameters[future.value.moduleId]?.[future.value.name] ?? + deploymentParameters.$global[future.value.name] ?? future.value.defaultValue; if (param === undefined) { errors.push( diff --git a/packages/core/src/internal/validation/futures/validateNamedContractDeployment.ts b/packages/core/src/internal/validation/futures/validateNamedContractDeployment.ts index f10b72b86..7244ac85b 100644 --- a/packages/core/src/internal/validation/futures/validateNamedContractDeployment.ts +++ b/packages/core/src/internal/validation/futures/validateNamedContractDeployment.ts @@ -65,7 +65,8 @@ export async function validateNamedContractDeployment( const missingParams = moduleParams.filter( (param) => - deploymentParameters[param.moduleId]?.[param.name] === undefined && + (deploymentParameters[param.moduleId]?.[param.name] === undefined && + deploymentParameters.$global[param.name]) === undefined && param.defaultValue === undefined ); @@ -80,6 +81,7 @@ export async function validateNamedContractDeployment( if (isModuleParameterRuntimeValue(future.value)) { const param = deploymentParameters[future.value.moduleId]?.[future.value.name] ?? + deploymentParameters.$global[future.value.name] ?? future.value.defaultValue; if (param === undefined) { errors.push( diff --git a/packages/core/src/internal/validation/futures/validateNamedEncodeFunctionCall.ts b/packages/core/src/internal/validation/futures/validateNamedEncodeFunctionCall.ts index 25b75a030..da9158998 100644 --- a/packages/core/src/internal/validation/futures/validateNamedEncodeFunctionCall.ts +++ b/packages/core/src/internal/validation/futures/validateNamedEncodeFunctionCall.ts @@ -61,7 +61,8 @@ export async function validateNamedEncodeFunctionCall( const missingParams = moduleParams.filter( (param) => - deploymentParameters[param.moduleId]?.[param.name] === undefined && + (deploymentParameters[param.moduleId]?.[param.name] === undefined && + deploymentParameters.$global[param.name]) === undefined && param.defaultValue === undefined ); diff --git a/packages/core/src/internal/validation/futures/validateNamedStaticCall.ts b/packages/core/src/internal/validation/futures/validateNamedStaticCall.ts index 4d41d063d..f3bcb2055 100644 --- a/packages/core/src/internal/validation/futures/validateNamedStaticCall.ts +++ b/packages/core/src/internal/validation/futures/validateNamedStaticCall.ts @@ -77,7 +77,8 @@ export async function validateNamedStaticCall( const missingParams = moduleParams.filter( (param) => - deploymentParameters[param.moduleId]?.[param.name] === undefined && + (deploymentParameters[param.moduleId]?.[param.name] === undefined && + deploymentParameters.$global[param.name]) === undefined && param.defaultValue === undefined ); diff --git a/packages/core/src/internal/validation/futures/validateSendData.ts b/packages/core/src/internal/validation/futures/validateSendData.ts index 9a941117b..a9ecd378a 100644 --- a/packages/core/src/internal/validation/futures/validateSendData.ts +++ b/packages/core/src/internal/validation/futures/validateSendData.ts @@ -33,6 +33,7 @@ export async function validateSendData( if (isModuleParameterRuntimeValue(future.to)) { const param = deploymentParameters[future.to.moduleId]?.[future.to.name] ?? + deploymentParameters.$global[future.to.name] ?? future.to.defaultValue; if (param === undefined) { errors.push( @@ -54,6 +55,7 @@ export async function validateSendData( if (isModuleParameterRuntimeValue(future.value)) { const param = deploymentParameters[future.value.moduleId]?.[future.value.name] ?? + deploymentParameters.$global[future.value.name] ?? future.value.defaultValue; if (param === undefined) { errors.push(