Closed bpolania closed 2 months ago
The ERC20InsufficientAllowance
error occurs when the child IP owner hasn't approved the RoyaltyPolicy to transfer ERC20 tokens from their wallet to the parent IP owners' wallets. We cannot rely solely on delegate calls for all cases. For instance, the SDK's mintLicenseTokens
function, which directly calls the protocol core, also requires ERC20 approval from the user.
Reference:
mintLicenseTokens
function: SDK CodeWe should adopt a unified approach to handle scenarios requiring ERC20 approval, such as the following example from the licensing integration test:
erc20.approve(address(royaltyPolicyLAP), 100);
Reference:
@sebsadface Please looked at the issue.
I think to fix the issue we need to make change into SPG that:
in the function registerIpAndMakeDerivative
do following:
Description and context
In SPG, after minting and registering an IP asset with PIL terms, registering a derivate IP asset fails and throws the error
ERC20InsufficientAllowance(address,uint256,uint256)
, https://openchain.xyz/signatures?query=0xfb8f41b2The primary problem appears to be that
msg.sender
changes from an externally owned account (EOA) to the SPG address when SPG calls ILicensingModule.registerDerivative.Steps to reproduce
Follow this guide to reproduce https://www.notion.so/storyprotocol/SPG-register-derivate-IP-with-commercial-license-term-fail-33faabd2cca344ea9a7f3b7dff679ee3
Experienced behavior
Transaction fails with
ERC20InsufficientAllowance
errorExpected behavior
It should be possible to register derivative IPs with commercial licenses
Proposed Solutions
57Blocks team suggests using delegate calls to call the
registerDerivative
function so themsg.sender
is preserved in subsequent sub-calls: