HelloBTU
  • Welcome
  • Getting Started
    • Quick Start
    • HelloBTU Protocol
    • Stable Vault
    • External Participants
    • Price Stability Mechanisms
  • User GUIDE
    • User Manual
  • Dev Guide
    • Developer Manual
    • Contract ABI
    • Contract Address
    • Channel Account
    • Self Custody
  • Governance
    • Module
      • Chief
      • Pause
      • Spell
  • Resources
    • Stablecoin
    • CDP
Powered by GitBook
On this page
  • Channel
  • BTCC
  • BTU
  • Oracle
  • Vault
  • Liquidation
  1. Dev Guide

Contract ABI

PreviousDeveloper ManualNextContract Address

Last updated 4 months ago

Channel

To proceed, you must identify the consumer contract linked to the particular user channel (each channel is uniquely paired with a consumer contract). Subsequently, call the withdraw method function of the contract.

Contract address:

Check the consumer contract address of Pro User Channel as following.

Unstake


function withdraw(
        uint256 amount,
        bytes calldata recipient,
        address refundAddress
    ) external payable override whenNotPaused(PausedType.Withdraw) nonReentrant 

To withdraw from the pro user channel with multi-signature function, you must first enable the signData requests function on your wallet like Unisat Wallet.

Release

Release the BTC assets which locked in the user channel to the escape channel.


function release(
        uint256 amount,
        bytes calldata releaseAddress
    ) external whenNotPaused(PausedType.Withdraw) nonReentrant 

Get Channel Fee


function getTotalWithdrawFee(
        uint256 amount,
        bytes calldata recipient
    ) public view override returns (uint256 bridgeFee_, uint256 withdrawFee_)

Get BTCC Contract


function getTokenAddress() public view returns (address) 

BTCC

Contract address:

0xFf6002e78Ed2e2D279f7CD42FD0aDffA81Dabe0d

Borrow (BTCC → BTU)


// Function
function deposit(uint256 _amount, uint256 _time) public onlyWhenLive

// Parameters
_amount: The quantity of BTU you require to borrow.
_time: The duration for which you need to borrow BTU, measured in seconds.

// Exmaple
deposit(100000,3600)

A borrowing order can only exist for an address if it has not been liquidated or fully repaid. Multiple borrowing orders per address are not allowed.

Increase Collateral (BTCC)


// Function
function inc(address _usr, uint256 _amount) public onlyWhenLive

// Parameters
_user: The user address involved in increasing their BTCC position.
_amount: The amount of BTCC collateral that the user adds.

// Exmaple
inc(0x2da..,100000)

Redeem (BTCC → BTC)

Withdraw BTC asset by using the escape channel.


// Function
function withdraw(uint256 _amount, bytes memory btc_address) public onlyWhenLive

// Parameters
_amount: User's Bitcoin withdrawal amount
btc_address: User's Bitcoin wallet address

// Exmaple
withdraw(10000,tp1p.....)

BTU

Contract address:

0x001Fec5fB9Cd00dbA462e9adF9Bb5CAd83A18615

Repay / Prepay (BTU → BTCC)


// Function
function withdraw(uint256 _amount) public onlyWhenLive

// Parameters
_amount: The quantity of BTU you require to repay/prepay.

// Exmaple
withdraw(100000)

Liquidate (BTU → BTCC)


// Function
function liquidate(address _liqAddress) public onlyWhenLive

// Parameters
_liqAddress: The target user address for liquidation.

// Exmaple
liquidate(0x1100....)

Oracle

Contract address:

0x59B9bAfa4Dc97F533699B203C45B4B8aFf0F7665

Update Currency

The system necessitates a real-time oracle service that can automatically fetch and update the latest BTC/USDT price data. This data will be used for calculating margin requirements, executing trades and etc.


// Function
function update(uint256 price_, uint32 time_) external onlyOracle

// Parameters
price_: The BTC/USDT market prices with four decimal places of precision.
time_: The timestamp when the price updates.

// Exmaple
update(52000000,1735362497)

Vault

Contract address:

0x3aeA39F795c31275Fe8594599841e2E66498B8ef

Get Bill Records


function getliqRecord(
        uint256 begin,
        uint256 end
    ) external view returns (uint256 length, Record[] memory recordList)
    
return:
// Number
length
// List
Record {
        address borrower;
        address payer;
        uint256 startTime;
        uint256 endTime;
        uint256 terminal;
        uint256 interest_rate;
        Status status;
        uint256 btcc_amount;
        uint256 btu_amount;
        uint256 initial_btu_amount;
        uint256 interest;
        uint256 fee;
    }
enum Status {
        Null,
        Activated,
        Completed,
        Devalued,
        Expired
    }

Get Liquidation Index


function getRecordLiquidationHistoryIndex(
        address addr_
    ) public view returns (uint256[] memory)

return:
The index array of the liquidation records

Important: 
the index should be used as (index_ - 1) as a funtion parameter.

Get Bill Detail


function getRecord(uint256 index_) public view returns (Record memory) 

return: 
// Record detail
Record {
        address borrower;
        address payer;
        uint256 startTime;
        uint256 endTime;
        uint256 terminal;
        uint256 interest_rate;
        Status status;
        uint256 btcc_amount;
        uint256 btu_amount;
        uint256 initial_btu_amount;
        uint256 interest;
        uint256 fee;
    }

Get Debt Detail


function getDebt(address addr_) public view returns (uint256, uint256)

return: 
The collateralized amount of BTCC and the outstanding BTU debt

Get All Index


function getRecordHistoryIndex(
        address addr_
    ) public view returns (uint256[] memory)

return: 
The index array of all the records

Important: 
the index should be used as (index_ - 1) as a funtion parameter.

Get Bill Index


function getRecordIndex(address addr_) public view returns (uint256) 

return: 
The index of the current record

Important: 
the index should be used as (index_ - 1) as a funtion parameter.

Get Currency


function getPrice() public view returns (uint256)

return: 
The market price of the BTC/USDT token pair

Get LTV Rate


function getCurLtvRate(address addr_) public view returns (uint256)

return: 
Loan-to-value Ratio

Get All Rates


function getAllRate()
        public
        view
        returns (uint256 ltv_rate_, uint256 liq_rate_, uint256 interest_rate_)
        
return:
Loan-to-value Ratio(LTV), Liquidation Margin Ratio(LR), Annual Interest Rate(IR)

Get Service Fee


function getFee() public view returns (uint256)

return: 
The fixed service fee (default: 1 BTU)

Liquidation

Contract address:

0xE5A730ebaD97cBB9303e30A95dE7790920895f85

Get Rewards Rate


function getRewardsRate() external view returns (uint256) {
        return rewardsRate;
    }

return:
The incentive rate paid to liquidators (default: 0.2%)

Get LMR


function getLiquidationRate() external view returns (uint256) {
        return liquidationRate;
    }
    
return:
Liquidation Margin Ratio (default: 120%)

Get Delay Period


function getBufferPeriod() external view returns (uint256) {
        return buffer_period;
    }

return:
The delay period for past-due debts (default: 7 days)

The location of the consumer contract