Operating Mechanism of beraBTC
1. System Overview
System Architecture Diagram

2. Core Function Modules
2.1 mint
Enter the amount of beraBTC to mint, obtain the BTC price through the Pyth oracle, and stake HONEY to mint beraBTC.
// function openPosition(uint256 amount) external {}
2.2 burn
Enter the NFT ID of the beraBTC to be minted, burn the beraBTC to redeem HONEY.
// function closePosition(uint256 tokenId) external {}
2.3 Settlement
Enter the NFT ID of the beraBTC to be settled. Settle beraBTC by using the pledged honey to purchase an equivalent amount of BTC through Atomic swap using the Pyth oracle, and return the remaining HONEY.
// function deliveryPosition(uint256 tokenId) external {}
2.4 Passive Delivery Triggered by Price
When the BTC price exceeds the delivery price of beraBTC, passive delivery is triggered. Using the Pyth oracle, the pledged HONEY is used to purchase an equivalent amount of BTC through Atomic swap, and the remaining HONEY is returned.
// function liquidateDeliveryPosition(uint256[] memory tokenIdList) external{}
function liquidatePosition(uint256[] memory tokenIdList,address redeemer, bytes32 secretHash,bytes memory receiveBtcAddr) external{}
function liquidatePositionFinish(uint256[] memory tokenIdList,bytes32 deliverySecretHash) external{}
3. Frontend-Backend Contract Interaction
3.1 Mint beraBTC
Frontend calls the beraBTC trading contract, inputs the amount of beraBTC to mint and deposits 120% of the current equivalent beraBTC value in HONEY to the berachain beraBTC contract.Contract mints beraBTC and a beraBTC NFT.
3.2 Burn beraBTC
Frontend calls the beraBTC trading contract, inputs the NFT ID of the beraBTC to burn and authorizes the corresponding mint amount of beraBTC, sends the transaction to the beraBTC contract.Contract burns the corresponding beraBTC and returns the staked HONEY.
3.3 Delivery beraBTC
Frontend calls the beraBTC trading contract, inputs the NFT ID of the beraBtc to be delivered and sends the transaction to the beraBTC contract.Uses Atomic swap to purchase the corresponding mint amount of beraBTC, deducts 1% fee and returns the remaining HONEY to the user's address.
3.4 Platform Delivery beraBTC
Backend calls when BTC price exceeds the delivery price of minted beraBTC, triggering platform delivery.Uses Atomic swap to purchase the corresponding mint amount of beraBTC, deducts 1% fee and returns the remaining HONEY to the user's address.
Last updated