Protect Loan
The purpose of this loan is to add a protection mechanism to an existing loan.
Frontend Requests Protection For Loan
struct Protection {
uint256 openingFee;
bool active;
uint256 cancellationFee;
uint256 premium;
uint256 totalCreditOffered;
uint256 startDate;
ProtectionStatus protectionStatus; -> OPEN, CLOSED, LTV_PROTECT
}
struct ProtectionUpdate {
uint256 endDate;
uint256 availableCredit;
uint256 interestRate;
}
****API ENDPOINT****
Params
Type
Name
Description
String
userAddress
The address of the user getting protection
Backend Gets Protection Params from Pricing engine
TBD by backend team
Backend Sends Protection Params to Frontend
struct Protection {
uint256 openingFee;
bool active;
uint256 cancellationFee;
uint256 premium;
uint256 totalCreditOffered;
uint256 startDate;
ProtectionStatus protectionStatus; -> OPEN, CLOSED, LTV_PROTECT
}
struct ProtectionUpdate {
[uint256 endDate;
uint256 availableCredit;
uint256 interestRate;]
}
Return Data
Frontend Confirms Protection Request
Step 1: Create Action Data (Protection)
protectionData = encode(
[uint256, uint256, uint256, uint256],
[openingFee,
cancellationFee,
premium,
totalCreditOffered]
);
Step 2: Create Action Data (Protection Update)
protectionUpdateData = encode(
[uint256, uint256, uint256],
[endDate, totalCreditOffered, interestRate]
);
Step 3: Create Call Data
addProtectionData = contract.encodeABI(
fn_name="addProtectionToLoan",
args=[
protectionData,
protectionUpdateData,
userAddress,
uniqueId,
openingFee,
tokenAddress
]
)
Step 4: Execute Transaction
protocol.execute(
"LoanBrokerageModule",
0 ether,
addProtectionData,
Enum.Operation.Call
);
Last updated