Lend FIL - ERC20 Tokens as Collateral

In this section, we describe the process to enable the creation of native to native debt instruments across blockchains with FIL as principal and ERC20 tokens as collateral.

ERC20 Token backed FIL Loan

Normal Flow

Step 1: Create Loan Request & Lock Collateral

  • Actor: Borrower

  • Blockchain: Ethereum (or EVM compatible blockchain)

  • Action: Create Loan Request & Lock Collateral

  • Description: The borrower locks collateral (ERC20 tokens) in a solidity smart contract and enters details such as a hashed preimage (secretHashA1), the loan expiration date and his FIL address.

Step 2: Create Payment Channel

  • Actor: Lender

  • Blockchain: Filecoin

  • Action: Create Payment Channel

  • Description: The Lender creates a Payment Channel to the Borrower's FIL address and locks a percentage of the collateral's value in FIL tokens.

Step 3: Assign Lender

  • Actor: Borrower

  • Blockchain: Ethereum (or EVM compatible blockchains)

  • Action: Assign Lender

  • Description: The Borrower assigns the lender to the Loan Request by entering the Lender's ETH based address and hashed preimage (secretHashB1).

Step 4: Create Voucher

  • Actor: Lender

  • Blockchain: Filecoin

  • Action: Create Voucher

  • Description: The Lender creates a Voucher with the Borrower's secretHashA1. This voucher can only be redeemed by the Borrower by revealing his first preimage (secretA1). This secret can then be used by the Lender to seize part of the collateral in case of default.

Step 5: Withdraw principal

  • Actor: Borrower

  • Blockchain: Filecoin

  • Action: Redeem Voucher & Collect (Payment Channel) to withdraw principal

  • Description: The Borrower redeems a voucher by revealing secretA1 and then calls the Collectmethod in the Payment Channel to transfer the funds from the Lender to the Borrower's FIL address to withdraw the loan's principal.

Step 6: Payback Payment Channel

  • Actor: Borrower

  • Blockchain: Filecoin

  • Action: Payback Payment Channel

  • Description: The Borrower creates a Payment Channel to the Lender's FIL address to pay back the loan's principal + interests.

Step 7: Create Voucher

  • Actor: Borrower

  • Blockchain: Filecoin

  • Action: Create Voucher

  • Description: The Borrower creates a Voucher with the Lender's secretHashB1. This Voucher can only be redeemed by the Lender by revealing his preimage (secretB1). This secret can then be used by the Borrower to unlock his collateral.

Step 8: Accept Payback

  • Actor: Lender

  • Blockchain: Filecoin

  • Action: Accept Payback | Redeem Voucher & Collect (Payment Channel).

  • Description: The Lender redeems the voucher by revealing secretB1 and then calls the Collect method in the Payment Channel to transfer the funds from the Borrower to the Lender's address to accept the payback.

Step 9: Unlock Collateral

  • Actor: Borrower

  • Blockchain: Ethereum (or EVM compatible blockchains)

  • Action: Unlock Collateral

  • Description: The Borrower uses secretB1 to unlock the collateral locked in the smart contract.

Borrower Defaults or Lender Fails to Accept Payback Flow

Step 1: Create Loan Request & Lock Collateral

  • Actor: Borrower

  • Blockchain: Ethereum (or EVM compatible blockchain)

  • Action: Create Loan Request & Lock Collateral

  • Description: The borrower locks collateral (ERC20 tokens) in a solidity smart contract and enters details such as a hashed preimage (secretHashA1), the loan expiration date and his FIL address.

Step 2: Create Payment Channel

  • Actor: Lender

  • Blockchain: Filecoin

  • Action: Create Payment Channel

  • Description: The Lender creates a Payment Channel to the Borrower's FIL address and locks a percentage of the collateral's value in FIL tokens.

Step 3: Assign Lender

  • Actor: Borrower

  • Blockchain: Ethereum (or EVM compatible blockchains)

  • Action: Assign Lender

  • Description: The Borrower assigns the lender to the Loan Request by entering the Lender's ETH based address and hashed preimage (secretHashB1).

Step 4: Create Voucher

  • Actor: Lender

  • Blockchain: Filecoin

  • Action: Create Voucher

  • Description: The Lender creates a Voucher with the Borrower's secretHashA1. This voucher can only be redeemed by the Borrower by revealing his first preimage (secretA1). This secret can then be used by the Lender to seize part of the collateral in case of default.

Step 5: Withdraw principal

  • Actor: Borrower

  • Blockchain: Filecoin

  • Action: Redeem Voucher & Collect (Payment Channel) to withdraw principal

  • Description: The Borrower redeems a voucher by revealing secretA1 and then calls the Collectmethod in the Payment Channel to transfer the funds from the Lender to the Borrower's FIL address to withdraw the loan's principal.

Step 6: Seize Collateral

  • Actor: Borrower or Lender

  • Blockchain: Ethereum (or EVM compatible blockchains)

  • Action: Seize Collateral

  • Description: Once the loan period expires and the loan's principal was withdrawn by the borrower with secretA1, the Borrower or Lender can call the SeizeCollateral method in the EVM based smart contract with secretA1 to automatically send part of the collateral to the Lender to make him whole again, and send the remainder to the Borrower.

Last updated