I have two smart contracts (A, B), which are extended from ERC721
. Is it possible to create a function in B
to call setApprovalForAll
on A
from a user Z
?
this is in contract B
: testApprove(A)
as user Z
function testApprove(address _contract) public payable {
bytes memory payload = abi.encodeWithSignature("setApprovalForAll(address,bool)", address(this), true);
(bool success,) = address(_contract).delegatecall(payload);
require(success);
bool result = ERC721(_contract).isApprovedForAll(msg.sender, address(this));
require(result, "Approve not set!");
}
success
is true,
and there was no error because it ran OK. But when I check if contract B
is approved, it's not!
Am I doing something wrong?
Thanks