Simple Loan Request

1. Summary

PWNSimpleLoanRequest.sol is an abstract contract inherited by Simple Loan Request types.

3. Contract details

  • PWNSimpleLoanRequest.sol is written in Solidity version 0.8.16

Features

  • Implements _makeRequest for borrowers to be able to make on-chain loan request

  • Provides a way to revoke loan requests

Inherited contracts, implemented Interfaces and ERCs

Functions

_makeRequest

Overview

A function to make an on-chain loan request.

This function takes two arguments supplied by the loan request type:

  • bytes32requestStructHash - Hash of a proposed loan request

  • addressborrower - Address of a loan request proposer (borrower)

Implementation

function _makeRequest(bytes32 requestStructHash, address borrower) internal {
    // Check that caller is a borrower
    if (msg.sender != borrower)
        revert CallerIsNotStatedBorrower(borrower);

    // Mark request as made
    requestsMade[requestStructHash] = true;

    emit RequestMade(requestStructHash, borrower);
}
revokeRequestNonce

Overview

Revokes supplied loan request nonce for msg.sender.

This function takes one argument supplied by the caller:

  • uint256offerNonce - Loan request nonce to revoke

Implementation

function revokeRequestNonce(uint256 requestNonce) external {
    revokedRequestNonce.revokeNonce(msg.sender, requestNonce);
}

Events

The PWN Simple Loan Request contract defines one event and no custom errors.

event RequestMade(bytes32 indexed requestHash, address indexed borrower);
RequestMade

RequestMade event is emitted when a borrower creates an on-chain loan request.

This event has two parameters:

  • bytes32 indexedrequestHash - Hash of a proposed loan request

  • address indexedborrower - Address of a loan request proposer (borrower)

Last updated