M1Pool
M1Pool
The M1Pool.sol
contract is the main user facing contract of the protocol. It exposes the liquidity management methods that can be invoked using either Solidity or Web3 libraries.
Write Methods
borrowM1
User can borrow the amount
of asset
by collateral the collateralAddress
asset to M1Pool
When borrowM1
, the M1Pool contract must have** allowance()
to spend funds on behalf of msg.sender ** for at-least** amount ** for the** asset **being supplied. This can be done via the standard ERC20/ERC721 approve()
method on the underlying token contract.
Referral program is currently inactive, you can pass 0 as referralCode
. This program may be activated in the future through an Aave governance proposal.
Call Params
Name | Type | Description |
---|---|---|
collateralAddress | address | Contract address of collateral assets |
collateralAmount | uint256 | The number of collateral, send in the tokenId when it is uniswapV3, and send in the number of collateral to be deposit for the others |
asset | address | address of the underlying asset |
amount | uint256 | amount to be borrowed, expressed in wei units |
interestRateMode | uint256 | the type of borrow debt. Stable: 1, Variable: 2 |
referralCode | uint16 | referral code for our referral program. Use 0 for no referral code. |
onBehalfOf | address | address of user who will incur the asset. Use msg.sender when not calling on behalf of a different user. |
addCollateral
Call Params
Name | Type | Description |
---|---|---|
userRecordId | uint256 | Record ID generated after collateralizing assets |
collateralAmount | uint256 | Increase in the amount of collateral assets |
reduceCollateral
Call Params
Name | Type | Description |
---|---|---|
userRecordId | uint256 | Record ID generated after collateralizing assets |
collateralAmount | uint256 | Reducing the amount of collateral assets |
extraBorrowM1
Call Params
Name | Type | Description |
---|---|---|
userRecordId | uint256 | Record ID generated after collateralizing assets |
amount | uint256 | The amount of new borrow needs |
onBehalfOf | address | address of user who will incur the asset. |
repayM1
Call Params
Name | Type | Description |
---|---|---|
collateralAddress | address | contract address of the collateral asset |
userRecordId | uint256 | Record ID generated after collateralizing assets |
asset | address | The contract address of the borrowing asset |
amount | uint256 | the amount of reapy |
onBehalfOf | address | the receiver of the collateral, when fully repaid |
liquidationCallM1
Liquidation operation based on the record ID generated by the collateral, anyone can call this interface when the collateral record triggers the liquidation.
Call Params
Name | Type | Description |
---|---|---|
recordId | uint256 | Record ID generated after collateralizing assets |
View Methods
checkCanLiquidation
Check if the collateral record has been liquidated against the record ID
Return Values
Name | Type | Description |
---|---|---|
currentCollateralValueInBaseCurrency | uint256 | Current value of the collateral |
collateralDebt | uint256 | current debt of the collateral |
collateralDebtInBaseCurrency | uint256 | current debt value of the collateral |
liquidationThreshold | uint256 | Liquidation threshold |
collateralCurrentRatio | uint256 | Current Loan risk, when its bigger than Liquidation threshold, the liquidation method can be call. |
getUserRecordIds
Get information about how many collateral records the user has based on the user's address
Call Params
Name | Type | Description |
---|---|---|
user | address | user address |
Return Values
Type | Description |
---|---|
uint256[] | current collateral record of user |
getRecordDetails
Get the collateral details based on the collateral record ID.
getM1UserTotalLoadAssetInfo
Get the total number of debts for which the user borrowed a certain asset
Last updated