A guide on how to set up cross-chain license minting using deBridge.
dlnHook
that will execute an arbitrary action upon order completion (ex. after $ETH has been swapped for $IP). This is where the magic happens.
dlnHook
will be a call to mintLicenseTokensCrossChain
, which is a function in this contract that wraps the received $IP to $WIP and then mints a license token on Story.
You can see that mintLicenseTokensCrossChain
looks like this:
approve
the Royalty Module (what pays for the license minting fee) to spend the $WIP?” This is already done for you, since the Royalty Module is already approved to spend on behalf of Multicall.
The reason we had to make a Multicall contract in the first place, instead of simply bridging directly to $WIP and calling mintLicenseTokens
in the Licensing Module, is because the Royalty Module wouldn’t be approved to spend the $WIP. So we utilize the Multicall contract to take care of that for us instead.
dlnHook
dlnHook
is a JSON object that will be attached to the deBridge API call. It will contain the following information:
evm_transaction_call
)DebridgeLicenseTokenMinter.sol
)mintLicenseTokensCrossChain
)dlnHook
, we can construct the whole deBridge API call, including the dlnHook
.
create-tx
endpoint here. I also highly recommend checking out the Swagger UI for the create-tx
endpoint as well.Attribute | Description |
---|---|
srcChainId | The ID of the source blockchain (e.g., Ethereum mainnet is 1). |
srcChainTokenIn | The address of the token being swapped on the source chain (ETH in this case). |
srcChainTokenInAmount | The amount of the source token to swap, set to auto for automatic calculation. |
dstChainId | The ID of the destination blockchain (e.g., Story mainnet is 100000013). |
dstChainTokenOut | The address of the token to receive on the destination chain (WIP token). |
dstChainTokenOutAmount | The amount of the destination token to receive. It should be the same as the amount we’re paying in payRoyaltyOnBehalf in step 1a. |
dstChainTokenOutRecipient | This can just be the same as senderAddress . |
senderAddress | The address initiating the transaction. |
srcChainOrderAuthorityAddress | The address authorized to manage the order on the source chain. This can just be the same as senderAddress . |
dstChainOrderAuthorityAddress | The address authorized to manage the order on the destination chain. This can just be the same as senderAddress . |
enableEstimate | A flag to enable transaction simulation and estimation. |
prependOperatingExpenses | A flag to include operating expenses in the transaction. |
dlnHook | The URL-encoded hook that specifies additional actions to execute post-swap. |