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.
Last updated
Was this helpful?
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.
Last updated
Was this helpful?
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.
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.
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
).
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.
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 Collect
method in the Payment Channel to transfer the funds from the Lender to the Borrower's FIL address to withdraw the loan's principal.
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.
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.
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.
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.
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.
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.
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
).
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.
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 Collect
method in the Payment Channel to transfer the funds from the Lender to the Borrower's FIL address to withdraw the loan's principal.
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.