Hi There,
I thought I would ask here first. Theoretically if I wanted people to come to my dapp and deposit BTC, ETH or USDC and then it be minted behind the scenes what would be the best way of doing that. Is there any tools that currently exist that make this easy? I also want to have auth where the user depositing is given a principal I have generated.
Thanks in advance,
Jake
Here is a high-level architecture that I would try out:
-
In your frontend, integrate IC-SIWE and IC-SIWB on your dapp. These libraries allow users to authenticate with an Ethereum or Bitcoin wallet and get assigned a principal on ICP.
-
You will need to get the assigned principal of the authenticated user. In your frontend, integrate ic-use-actor
. Then, in the backend, you can use a function to call the equivalent of ic.caller()
to get the currently authenticated principal.
-
In your backend, you will need a way to build a signed transaction.
To mint ckUSDC tokens, call the deposit
function on the ckERC20 helper contract at 0x6abDA0438307733FC299e9C229FD3cc074bD8cC0
passing in values to amount
(a numeric value representing the desired amount of ckUSDC tokens) and principal
(a byte32 encoded version of the authenticated user’s principal).
To mint ckETH, call the deposit function on the ckETH helper contract at 0x7574eB42cA208A4f6960ECCAfDF186D627dCC175
passing in values to deposit
(the amount representing the desired quantity of ckETH tokens) and principal
(a byte32 encoded version of the authenticated user’s principal).
Again, this is very high-level. Please let me know if there is an area that you would like me to dive in a bit deeper.