Learn how to tip an IP Asset using the SDK and Smart Contracts.
commercialRevShare = 50
) with the parent. Someone else (a 3rd party user) comes along and wants to send the derivative 2 $WIP for being really cool.
For the purposes of this example, we will assume the child is already registered as a derivative IP Asset. If you want help learning this, check out Register a Derivative.
0x42595dA29B541770D9F9f298a014bF912655E183
0xeaa4Eed346373805B377F5a4fe1daeFeFB3D182a
.env
file:.env
file. You can just use the public default one we provide:utils.ts
file, add the following code to set up your Story Config:
main.ts
file. We will use the payRoyaltyOnBehalf
function to pay the derivative asset.
You will be paying the IP Asset with $WIP. Note that if you don’t have enough $WIP, the function will auto wrap an equivalent amount of $IP into $WIP for you. If you don’t have enough of either, it will fail.
payRoyaltyOnBehalf
function. In this case:
receiverIpId
is the ipId
of the derivative (child) assetpayerIpId
is zeroAddress
because the payer is a 3rd party (someone that thinks Mickey Mouse with a hat on him is cool), and not necessarily another IP Assettoken
is the address of $WIP, which can be found hereamount
is 2, since the person tipping wants to send 2 $WIPcommercialRevenue = 50
in the license terms.
The child IP can claim its 1 $WIP by calling the claimAllRevenue
function:
ancestorIpId
is the ipId
we’re claiming revenue forcurrencyTokens
is an array that contains the address of $WIP, which can be found hereclaimer
is the address that holds the royalty tokens associated with the child’s IP Royalty Vault. By default, they are in the IP Account, which is just the ipId
of the child asset.commercialRevShare = 50
in the license terms.
We will use the claimAllRevenue
function to claim the due revenue tokens.
ancestorIpId
is the ipId
of the parent (“ancestor”) assetclaimer
is the address that holds the royalty tokens associated with the parent’s IP Royalty Vault. By default, they are in the IP Account, which is just the ipId
of the parent assetchildIpIds
will have the ipId
of the child assetroyaltyPolicies
will contain the address of the royalty policy. As explained in Royalty Module, this is either RoyaltyPolicyLAP
or RoyaltyPolicyLRP
, depending on the license terms. In this case, let’s assume the license terms specify a RoyaltyPolicyLAP
. Simply go to Deployed Smart Contracts and find the correct address.currencyTokens
is an array that contains the address of $WIP, which can be found heretransferErc20
function (it will not work
if you run it for someone else’s IP obviously).
claimAllRevenue
before, our SDK would automatically transfer the revenue
to the IP owner’s wallet for convenience.