Learn how to pay an IP Asset and claim revenue in Solidity.
payRoyaltyOnBehalf
function. When this happens, the Royalty Module automatically handles the different payment flows such that parent IP Assets who have negotiated a certain commercialRevShare
with the IPA being paid can claim their due share.
payRoyaltyOnBehalf
function from the Royalty Module.
You will be paying the IP Asset with MockERC20. Usually you would pay with $WIP, but because we need to mint some tokens to test, we will use MockERC20.
To help with the following scenarios, let’s say we have a parent IP Asset that has negotiated a 50% commercialRevShare
with its child IP Asset.
childIpId
’s IP Royalty Vault. From there, the child can claim revenue. In the next section, you’ll see a working version of this.
payRoyaltyOnBehalf
, you have to approve the royalty module to spend the tokens for you. In the section below, you will see that we call MERC20.approve(address(ROYALTY_MODULE), 10);
or else it will not work.test/5_Royalty.t.sol
to see it work and verify the results:
forge build
. If everything is successful, the command should successfully compile.
Now run the test by executing the following command: