Simple Loan Offer

1. Summary

PWNSimpleLoanOffer.sol is an abstract contract inherited by Simple Offer types.

GitHub

3. Contract details

  • PWNSimpleLoanOffer.sol is written in Solidity version 0.8.16

Features

  • Implements _makeOffer for lenders to be able to make on-chain offer

  • Provides a way to revoke offers

Inherited contracts, implemented Interfaces and ERCs

Functions

_makeOffer

Overview

A function to make an on-chain offer.

This function takes two arguments supplied by the offer type:

  • bytes32offerStructHash - Hash of a proposed offer

  • addresslender - Address of an offer proposer (lender)

Implementation

function _makeOffer(bytes32 offerStructHash, address lender) internal {
    // Check that caller is a lender
    if (msg.sender != lender)
        revert CallerIsNotStatedLender(lender);

    // Mark offer as made
    offersMade[offerStructHash] = true;

    emit OfferMade(offerStructHash, lender);
}
revokeOfferNonce

Overview

Revokes supplied offer nonce for msg.sender.

This function takes one argument supplied by the caller:

  • uint256offerNonce - Offer nonce to revoke

Implementation

function revokeOfferNonce(uint256 offerNonce) external {
    revokedOfferNonce.revokeNonce(msg.sender, offerNonce);
}

Events

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

event OfferMade(bytes32 indexed offerHash, address indexed lender);
OfferMade

OfferMade event is emitted when a lender creates an on-chain offer.

This event has two parameters:

  • bytes32 indexedofferStructHash - Hash of a proposed offer

  • address indexedlender - Address of an offer proposer (lender)

Last updated