A guide on how to set up cross-chain royalty payments and arbitrary transactions (like minting a license cross-chain) using deBridge.
dlnHook
that will execute an arbitrary action upon order completion (ex. after $ETH has been swapped for $WIP). 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.
dlnHook
dlnHook
is a JSON object that will be attached to the deBridge API call. It will contain the following information:
evm_transaction_call
)ROYALTY_MODULE
)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. |