Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Allow Smart Contracts to Make Loans #25

Closed
AntonioJuliano opened this issue Jan 18, 2018 · 2 comments
Closed

Allow Smart Contracts to Make Loans #25

AntonioJuliano opened this issue Jan 18, 2018 · 2 comments
Assignees

Comments

@AntonioJuliano
Copy link
Member

We want to allow smart contracts to be lenders for a loan. Right now each lender must sign their own loan offering. Because smart contracts cannot make signatures, smart contracts can't be lenders right now.

We need to separate lender into two fields: lender and signer. If nonzero then the signer will be the one that has the signature checked. We also need to implement an interface for smart contracts to approve loans if they are the lender.

This is a very similar problem to the one 0x is trying to solve with allowing smart contracts to be makers for an order. I've been talking to Will and Amir about the best ways to implement this.

@AntonioJuliano
Copy link
Member Author

AntonioJuliano commented Jan 29, 2018

Proposal:

Add address signer to loan offering message format

If signer is zero, then just the lender is just the signer. If signer is nonzero, then that address must be used to do the ECDSA signature for the loan offering.

We also will add a standard interface that contracts can implement to approve of loans being made on their behalf by a signer. The interface will be as follows:

// Interface a contract would need to implement to verify an off-chain order
contract LoanOfferingVerifier {
    function verifyLoanOffering(
         address[8] addresses, // Add one address for signer field
         uint[9] values256,
         uint32[3] values32,
         bytes32 shortId
         // Signature unnecessary as it is checked by short sell contract
    ) returns (bool _isValid) { // However the contract wants to verify the order }
 ...

contract ShortSell {
   function short(...) {
        ...
        require(
            loanOffering.signer == address(0)
            || LoanOfferingVerifier(loanOffering.maker).verifyLoanOffering(// args)
        );
    ...

@AntonioJuliano
Copy link
Member Author

This issue is related to 0xProject/ZEIPs#1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant