ERC20CollateralLock
Collateral Lock Contract
Constructor
Parameter | Type | Description |
_blake2b | address | BLAKE2b contract address |
_priceFeed | address | PriceAggregator contract address |
Properties
Property | Type | Description |
loanIdCounter | uint256 | Loans count |
userLoans | mapping(address => uint256[]) | Loans of each account |
userLoansCount | mapping(address => uint256) | Loan count of each account |
Functions
createBorrowRequest
Creates a FIL borrow request
Parameters
Parameter | Type | Description |
_secretHashA1 | bytes32 | SecretA1's hash |
_filBorrower | bytes | Borrower's FIL address |
_collateralAmount | uint256 | The amount of collateral to lock |
_contractAddress | address | The contract address of the token to lock |
_principalAmount | uint256 | The interest rate requested |
_interestRate | uint256 | The requested amount to borrow |
_loanExpirationPeriod | uint256 | Loan length |
cancelBorrowRequest
Cancels a FIL borrow request
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan to cancel |
_secretA1 | bytes | SecretA1's hash |
acceptOffer
Sets the lender and accept FIL loan offer
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan to cancel |
_lender | address | The address of the lender |
_filLender | bytes | The lender's FIL address |
_secretHashB1 | bytes32 | The lender's hashed secretB1 |
_paymentChannelId | bytes32 | The ID of the FIL Payment Channel |
_principalAmount | uint256 | The FIL amount to borrow |
unlockCollateral
Used when the Lender accepts the payback or cancels the loan
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
_secretB1 | bytes | Lender's secretB1 |
seizeCollateral
Can be used after the loan expiration to seize part of the collateral (lender) and return the remainder to the borrower
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
_secretB1 | bytes | Borrower's secretA1 |
fetchLoan
Gets information about a loan
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
getAccountLoans
Gets account loans of an account
Parameters
Parameter | Type | Description |
_account | address | User account |
modifyPriceFeed
Modifies the price feed
Parameters
Parameter | Type | Description |
_newPriceFeed | address | The new price feed address |
Events
CreateBorrowRequest
Emmited when a borrow request started.
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's address |
collateralAmount | uint256 | The amount of collateral to lock |
token | address | The contract address of the token to lock |
AcceptOffer
Emmited when an offer is accepted.
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
lender | address | The address of the lender |
filLender | bytes | The lender's FIL address |
secretHashB1 | bytes32 | The lender's hashed secretB1 |
paymentChannelId | bytes32 | The ID of the FIL Payment Channel |
principalAmount | uint256 | The FIL amount to borrow |
UnlockCollateral
Emmited when an offer is accepted.
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's FIL address |
collateralAmount | uint256 | The amount of collateral to unlock |
token | address | The contract address of the token to unlock |
SeizeCollateral
Emmited after the loan expiration
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
lender | address | Lender's FIL address |
amount | uint256 | The amount of collateral to seize |
token | address | The contract address of the token to unlock |
UnlockRefundableCollateral
Emmited after the loan expiration
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's FIL address |
amount | uint256 | The amount of collateral to seize |
token | address | The contract address of the token to unlock |
UnlockRefundableCollateral
Emmited after the loan expiration
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's FIL address |
amount | uint256 | The amount of collateral to seize |
token | address | The contract address of the token to unlock |
CancelBorrowRequest
Emmited when is cancelled a FIL borrow request.
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's FIL address |
collateralAmount | uint256 | The amount of collateral to seize |
token | address | The contract address of the token to unlock |
secretA1 | bytes | SecretA1's hash |
Last updated