Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/famous-timers-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'openzeppelin-solidity': minor
---

`ERC2771Forwarder`: Expose the `_isTrustedByTarget` internal function to check whether a target trusts the forwarder.
6 changes: 5 additions & 1 deletion contracts/metatx/ERC2771Forwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,12 @@ 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, users may approve token spending to this contract allowing
* any relayer to transfer their tokens.
*/
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;
Expand Down
Loading