Provider

To provide offers using the provider included in our sdk, you'll need to:

  1. clone the provider example repository
  2. run yarn to install the dependencies
  3. create a .env file at the project's root with the private key of the provider
  4. update the instructions file used to define the offers you want to provide
  5. (if necessary) update the NFTs metadata file if you're providing NFTs for collections out of this list
  6. run the provider by running yarn provide

Creating the .env file

The .env file is used to define PROVIDER_PKEY: the private key used to sign the offers

Here is an example:

PROVIDER_PKEY=abc123...

Creating the instructions file

The instructions file is a JSON file containing all the information used to create the offers. It must contain the following fields:

FieldDescription
chainIdThe chain id of the network you want to provide offers on
availabilitySpanInMinutesThe period of time during which the offers will be available to borrowers
collectionConfigsA mapping of collection aliases of your choice to their address, floor price (in ETH) and trancheId. These aliases will be used in the offers instructions
assetConfigsA mapping of asset aliases of your choice to their address. These aliases will be used in the offers instructions
offersInstructionsThe list of offers instructions. See the offers instructions section for more details

Here is an example:

{
  "chainId": 1,
  "availabilitySpanInMinutes": 10080,
  "collectionConfigs": {
    "Azuki": {
      "address": "0xED5AF388653567Af2F388E6224dC7C4b3241C544",
      "floorPrice": 0.1,
      "trancheId": 1
    },
    "BAYC": {
      "address": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
      "floorPrice": 50,
      "trancheId": 0
    }
  },
  "assetConfigs": {
    "WETH": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
    "DAI": "0x6B175474E89094C44Da98b954EedeAC495271d0F"
  },
  "offersInstructions": [
    {
      "offerType": "amountForTrait",
      "contract": "Azuki",
      "durationInDays": 18,
      "assetToLend": "WETH",
      "traitType": "Type",
      "traitValue": "Red",
      "amountToLend": 1
    },
    {
      "offerType": "floorMultiplierForTrait",
      "contract": "Azuki",
      "durationInDays": 30,
      "assetToLend": "WETH",
      "traitType": "Hair",
      "traitValue": "Pink Flowy",
      "floorMultiplier": 1.3
    },
    {
      "durationInDays": 30,
      "assetToLend": "DAI",
      "offerType": "collection",
      "contract": "BAYC",
      "amountToLend": 3
    },
  ]
}

Offers instructions

The offers instructions define the offers you want to provide. Each offer instruction can create multiple offers, up to one per NFT in the collection. Each offer instruction must contain at least the following fields:

  • offerType: the type of offer you want to provide. See the offer types section for more details
  • contract: the alias of the collection you want to provide offers for
  • durationInDays: the duration of the offer in days
  • assetToLend: the alias of the asset you want to lend

Other fields are required depending on the offer type:

  • amountForTrait:
FieldDescriptionExample value
traitTypeThe trait type you want to provide offers for"Background"
traitValueThe trait value you want to provide offers for"Red"
amountToLend(= loan to value) The amount in ethers you want to lend per offer1
  • floorMultiplierForTrait:
FieldDescriptionExample value
traitTypeThe trait type you want to provide offers for"Background"
traitValueThe trait value you want to provide offers for"Red"
floorMultiplierThe floor multiplier you want to apply to the floor price of the collection1.3
  • collection:
FieldDescriptionExample value
amountToLend(= loan to value) The amount in ethers you want to lend per offer1

How to choose trancheId

The trancheId represents the interest rate identifier applied to your offers. A few tranches are defined in the protocol, each one with a different interest rate. For example, trancheId 0 corresponds to a 40% APR, trancheId 1 to a 20% APR.

However for now, you can't really choose, the trancheId is imposed by our API for each collection. You still need to provide it in the instructions file to ensure you're aware of it.

To check the trancheId of a let's say Bored Ape Yacht Club collection and Azuki collections, you can use our API by running the following command:

curl -X GET "https://api.kairos.loan/api/tranche_of?chainId=1&collections=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&collections=0xED5AF388653567Af2F388E6224dC7C4b3241C544"

Providing on Goërli

To provide offers on Goërli, you need to do the same steps as for mainnet, in addition to replacing the environment param of provide from Environment.Mainnet to Environment.Goerli in the src/index.ts file.