โ๏ธBabypie's Architecture
1. Register Wallet: User sends the following values to the Babypie Manager:
Userโs BTC address
Userโs EVM address
Signature generated using the Bitcoin wallet by passing the EVM address as the message.
2. Babypie Manager Action: The Babypie Manager calls the Chainlink Functions Consumer contract, passing the three values it received from the user.
Babypie Manager: One of Babypieโs smart contracts.
Functions Consumer: A smart contract that can send Functions requests to the Chainlink Oracle Network, where the oracle network returns the results of decentralized computation.
3. Chainlink Functions Consumer Contract Action: The Chainlink Functions Consumer contract sends a request to the Chainlink DON to run the script to verify the user's signature, using the EVM address as the message string.
4. Verification Result: The DON returns the result of the verification to the Chainlink Functions Consumer contract by calling it with the result (this process takes around 30 seconds).
5. Update User Mapping: The Chainlink Functions Consumer contract calls the Babypie Manager contract to update the user's BTC to EVM mapping if the signature is valid.
Now, the user can transfer native BTC to Babypieโs MPC wallet (This step can even be done by user before mapping their BTC->EVM address)
6. BTC Transfer: The user calls the Babypie Manager with the transaction hash of the BTC transfer to Babypieโs MPC wallet and the BTC address used for the transfer.
7. Requests to initiate mBTC mint for BTC transfer: User calls babypie manager to initiate verification of user's BTC transfer in txn and mint mBTC to user's mapped EVM address.
8. Babypie Manager Action: The Babypie Manager calls another Chainlink Functions Consumer contract with the transaction hash and the userโs BTC chain address.
9. BTC Amount Retrieval: The Chainlink Functions Consumer contract sends a request to the Chainlink DON to run a script that will get the amount of BTC transferred to the Babypie MPC wallet in the transaction.
10. Amount Confirmation: The Chainlink Functions Consumer contract receives the result (amount of BTC transferred) of the script from the Chainlink DON.
11. Validation and Processing: The Chainlink Functions Consumer contract checks if the amount is greater than 0. If yes, it calls the Babypie Manager with the result.
12. Mark txn paid: The Babypie Manager will mark the txn as paid and call the mint function of the mBTC contract with value equal to BTC transferred by user.
13. mBTC mint: mBTC token will be minted to the user.
Last updated