Loan Endpoints

The endpoints below allow you to interact with Loan.

Contract Name

  • ApproveTrade

Mainnet Addresses

Network

Contract Address

Arbitrum

0x4d5797F05992c9E81c64a39CEe5A8BA56df8D38e

Base

0x54A70516e9c0223F4a92bE3a4832a06f546e783B

Ethereum

0x54A70516e9c0223F4a92bE3a4832a06f546e783B

Polygon

0x4d5797F05992c9E81c64a39CEe5A8BA56df8D38e

Bitlayer

0x54A70516e9c0223F4a92bE3a4832a06f546e783B

BSC

0x83541A6B4A5c5512624CcbF35E9c77290f4068C0


Smart Contract Interface

1. Get the Nonce of the User's Order

Fetch the nonce of the order created by the user.

  • Function: nonces(address maker) returns (uint256)

Request Parameter

Parameter Name

Required

Type

Description

maker

Yes

address

Creator Address

Response Parameter

Parameter Name

Type

Description

nonce

uint256

User order nonce


2. Calculate the Hash of the Order

Calculate the hash of an order, required when creating the order.

  • Function: hashOrder(Order memory order) returns (bytes32)

Request Parameter

Parameter Name

Required

Type

Description

order

Yes

Order

Order details

Response Parameter

Parameter Name

Type

Description

orderHash

bytes32

User order hash


3. Lend Funds Using the Signed Order Information

Use the borrower's signed order to lend funds.

  • Function: loan(Order memory loanOrder)

Request Parameter

Parameter Name

Required

Type

Description

loanOrder

Yes

Order

Order information from centralized interface

Order Structure

Parameter Name

Required

Type

Description

maker

Yes

address

Borrower Address

taker

Yes

address

Lender address (use 0 address)

asset

Yes

Asset[]

List of collateral assets

currency

Yes

address

Funding token address

price

Yes

uint256

Loan amount

deadline

Yes

uint256

Fundraising deadline

duration

Yes

uint256

Loan duration

interestPerSecond

Yes

uint256

Interest accrued per second after loan

endTime

Yes

uint256

Redemption deadline (use 0 if not applicable)

themselves

Yes

bytes

Signed transaction data


4. Repay Principal and Interest to Redeem Asset

Allows the borrower to repay the principal and interest to reclaim the collateral.

  • Function: redeem(bytes32 orderHash)

Request Parameter

Parameter Name

Required

Type

Description

orderHash

Yes

bytes32

Order hash (from interface)


5. Liquidate Overdue Orders

Allows the lender to liquidate an overdue order and claim the collateral.

  • Function: liquidate(bytes32 orderHash)

Request Parameter

Parameter Name

Required

Type

Description

orderHash

Yes

bytes32

Order hash (from interface)


6. Cancel Order

Allows the creator to cancel an order.

  • Function: cancelOrder(Order memory order)

Request Parameter

Parameter Name

Required

Type

Description

order

Yes

Order

Order information from centralized interface


7. Cancel Multiple Orders

Allows the creator to cancel multiple orders in one call.

  • Function: cancelMultipleOrders(Order[] memory orders)

Request Parameter

Parameter Name

Required

Type

Description

orders

Yes

Order[]

List of order information (from interface)


8. Cancel All Orders

Allows the creator to cancel all orders they have created.

  • Function: cancelAllOrders()

Request Parameters

This function does not take any parameters.


9. Buy Assets Using Signed Order

Allows a buyer to purchase assets using the seller's signed order.

  • Function: buy(Order memory sellOrder)

Request Parameter

Parameter Name

Required

Type

Description

sellOrder

Yes

Order

Order information from centralized interface


10. Sell Assets Using Buyer's Signed Order

Allows a seller to sell assets using the buyer's signed order.

  • Function: sell(Order memory buyOrder)

Request Parameter

Parameter Name

Required

Type

Description

buyOrder

Yes

Order

Order information from centralized interface


11. Get Platform Loan Fee Rate

Returns the platform commission ratio for loans.

  • Function: feeRate() returns (uint256)

Response Parameter

Parameter Name

Type

Description

feeRate

uint256

Platform commission ratio (divide by 10,000)


12. Get Platform Repayment Interest Fee Rate

Returns the platform commission rate for repayment interest.

  • Function: interestFeeRate() returns (uint256)

Response Parameter

Parameter Name

Type

Description

interestFeeRate

uint256

Interest commission ratio (divide by 10,000)


13. Get Minimum Repayment Interest Ratio

Returns the minimum interest rate for repayment.

  • Function: interestFeeRate() returns (uint256)

Response Parameter

Parameter Name

Type

Description

interestFeeRate

uint256

Minimum interest rate (divide by 10,000)

Last updated