Skip to content

Instantly share code, notes, and snippets.

@MarcoWorms
Created May 5, 2022 03:43
Show Gist options
  • Save MarcoWorms/141ffff04d530490b2a5275556f283b1 to your computer and use it in GitHub Desktop.
Save MarcoWorms/141ffff04d530490b2a5275556f283b1 to your computer and use it in GitHub Desktop.
/**
* @notice Determine whether or not a given target and calldata is valid
* @dev In order to be valid, target and calldata must pass the allowlist conditions tests
* @param targetAddress The target address of the method call
* @param data The raw calldata of the call
* @return isValid True if valid, false if not
*/
function validateCalldataByOrigin(
string memory originName,
address targetAddress,
bytes calldata data
) public view returns (bool isValid) {
address allowlistAddress = allowlistAddressByOriginName[originName];
isValid = CalldataValidation.validateCalldataByAllowlist(
allowlistAddress,
targetAddress,
data
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment