Supply

Supply Flow

The supply flow enables users to provide collateral to a third-party lender. The following sections will explain what you need to do to supply successfully.

Transactional Function Sequence

Make sure to run each function in order from top to bottom. Please Click the links inside the module column for further information on the function's output.

Module
Function

InitiateSupply

Step 1: Supply

function initiateSupply(uint256 value, address onBehalf, string lenderName, bytes supplyData,bool isUnprotected,bytes memory loanInfo, uint256 uniqueId)

Parameter
Description

value

Ether Value

onBehalf

The users eth address

lenderName

The name of the lender

supplyData

The supply data for the lender. Note inside the data the lender provider address will be based on the network please check (here) for lender provider addresses. The supply data that will be needed is the following -

bytes memory _supplyBytesData =         abi.encode(collateralToken_, collateralAmount_ in wei, lenderProviderAddress_, onBehalf_);

unique Id

The unique id that points to a users loan id

isUnprotected

The indication we are working with a forecloseable but unprotected asset

loanInfo

The initial supply info. The loan info that will be need is the following -

bytes memory loanData =
            abi.encode(userAddress, lenderName, suppliedAmount in USD, suppliedToken, lender representation token, suppliedTokenDecimals, chainId);

End of supply

Last updated