From 4e4e5bf10cb885e26dc3853ed67f6316dd84ce1d Mon Sep 17 00:00:00 2001 From: moebius <0xmoebius@protonmail.com> Date: Tue, 12 Dec 2023 15:26:06 -0300 Subject: [PATCH] feat: parameter validation for modules --- solidity/contracts/Module.sol | 3 +++ solidity/interfaces/IModule.sol | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/solidity/contracts/Module.sol b/solidity/contracts/Module.sol index de5233c..be016f0 100644 --- a/solidity/contracts/Module.sol +++ b/solidity/contracts/Module.sol @@ -27,6 +27,9 @@ abstract contract Module is IModule { address _finalizer ) external virtual onlyOracle {} + /// @inheritdoc IModule + function validateParameters(bytes calldata _encodedParameters) external pure virtual returns (bool _valid) {} + /** * @notice Computes the id a given request * diff --git a/solidity/interfaces/IModule.sol b/solidity/interfaces/IModule.sol index cd1c9a4..185f610 100644 --- a/solidity/interfaces/IModule.sol +++ b/solidity/interfaces/IModule.sol @@ -67,6 +67,14 @@ interface IModule { address _finalizer ) external; + /** + * @notice Validates parameters prior to creating a request + * + * @param _encodedParameters The encoded parameters for the request + * @param _valid Boolean indicating if the parameters are valid or not + */ + function validateParameters(bytes memory _encodedParameters) external pure returns (bool _valid); + /** * @notice Returns the name of the module. *