How to read flows?

Below is an example of what a typical flow would look like.

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);

Now lets break it down to what your seeing. The first thing you will see is the step these steps will tell you where you will start with the integration.

Step 1: Supply

The next thing you will see is the function this is the function that is going to be called

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

This is what matters when you are integrating with the smart contracts please follow the parameters and the function name as the following description box is there to explain what the parameters are.

From there you will see the description box of the parameters

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);

The description box will explain what each parameter is that should be passed to the function.

Last updated