ERC20Loans
ERC20Loans Contract
Constructor
Parameter | Type | Description |
_blake2b | address | BLAKE2b 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
createLoanOffer
Creates a loan offer
Parameters
Parameter | Type | Description |
_secretHashB1 | bytes32 | The hash of secretB1 |
_filLender | bytes | Lender's FIL address |
_principal | uint256 | The principal (amount) of the loan |
_interest | uint256 | The contract address of the token to lock |
_contractAddress | address | The contract address of the ERC20 token |
_loanExpirationPeriod | uint256 | Loan length |
approveRequest
Creates a loan offer
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
_borrower | address | The address of the borrower |
_filBorrower | bytes | The borrower's FIL address |
_secretHashA1 | bytes32 | The lender's hashed secretA1 |
_paymentChannelId | bytes32 | The ID of the FIL Payment Channel |
_collateralAmount | uint256 | The FIL amount used as collateral |
withdraw
Withdraws the loan's principal
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
_secretA1 | bytes32 | The borrower's secretA1 |
payback
Paybacks loan's principal with interests
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
acceptRepayment
Accepts the borrower's repayment of the principal
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
_secretB1 | bytes | Lender's secretB1 |
refundPayback
Refunds the payback amount
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
cancelLoan
Cancels the loan before the borrower withdraws the loan's principal
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
_secretB1 | bytes | Lender's secretB1 |
fetchLoan
Gets information about a loan
Parameters
Parameter | Type | Description |
_loanId | uint256 | The ID of the loan |
modifyAcceptExpirationPeriod
Changes accept expiration period
Parameters
Parameter | Type | Description |
_data | uint256 | The new accept expiration period |
Events
CreateLoanOffer
Emmited when a loan offer is published
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
lender | address | Lender's address |
principal | uint256 | The principal (amount) of the loan |
token | address | The contract address of the token |
ApproveRequest
Emmited when a loan request is approved
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's address |
filBorrower | bytes | The principal (amount) of the loan |
secretHashA1 | bytes32 | The borrower's FIL address |
paymentChannelId | bytes32 | The ID of the FIL Payment Channel |
collateralAmountaddress | uint256 | The FIL amount used as collateral |
Withdraw
Emmited when a loan's principal is withdrawn.
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's address |
amount | uint256 | Principal to withdraw |
token | address | The contract address of the token |
secretA1 | bytes | The borrower's secretA1 |
Payback
Emmited when a loan's principal is paid back.
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's address |
amount | uint256 | Amount to payback |
token | address | The contract address of the token |
AcceptRepayment
Emmited when a repayment of the principal starts.
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
amount | uint256 | Amount to accept |
token | address | The contract address of the token |
RefundPayback
Emmited when the payback amount is refunded.
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
borrower | address | Borrower's address |
amount | uint256 | Amount to payback |
token | address | The contract address of the token |
CancelLoan
Emmited when a loan is cancelled
Parameters
Parameter | Type | Description |
loanId | uint256 | The ID of the loan |
amount | uint256 | Amount to payback |
token | address | The contract address of the token |
secretB1 | bytes | Lender's secretB1 |
Last updated