Expose _isTrustedByTarget internally in ERC2771Forwarder (#5416)

This commit is contained in:
Ernesto García
2025-01-10 14:59:14 -06:00
committed by GitHub
parent 13781c1f49
commit 96b40d02c3
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---
`ERC2771Forwarder`: Expose the `_isTrustedByTarget` internal function to check whether a target trusts the forwarder.

View File

@ -302,8 +302,11 @@ contract ERC2771Forwarder is EIP712, Nonces {
*
* This function performs a static call to the target contract calling the
* {ERC2771Context-isTrustedForwarder} function.
*
* NOTE: Consider the execution of this forwarder is permissionless. Without this check, anyone may transfer assets
* that are owned by, or are approved to this forwarder.
*/
function _isTrustedByTarget(address target) private view returns (bool) {
function _isTrustedByTarget(address target) internal view virtual returns (bool) {
bytes memory encodedParams = abi.encodeCall(ERC2771Context.isTrustedForwarder, (address(this)));
bool success;