Provider
To provide offers using the provider included in our sdk, you'll need to:
- clone the provider example repository
- run
yarn
to install the dependencies - create a
.env
file at the project's root with the private key of the provider - update the instructions file used to define the offers you want to provide
- (if necessary) update the NFTs metadata file if you're providing NFTs for collections out of this list
- 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:
Field | Description |
---|---|
chainId | The chain id of the network you want to provide offers on |
availabilitySpanInMinutes | The period of time during which the offers will be available to borrowers |
collectionConfigs | A 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 |
assetConfigs | A mapping of asset aliases of your choice to their address. These aliases will be used in the offers instructions |
offersInstructions | The 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 detailscontract
: the alias of the collection you want to provide offers fordurationInDays
: the duration of the offer in daysassetToLend
: the alias of the asset you want to lend
Other fields are required depending on the offer type:
amountForTrait
:
Field | Description | Example value |
---|---|---|
traitType | The trait type you want to provide offers for | "Background" |
traitValue | The trait value you want to provide offers for | "Red" |
amountToLend | (= loan to value) The amount in ethers you want to lend per offer | 1 |
floorMultiplierForTrait
:
Field | Description | Example value |
---|---|---|
traitType | The trait type you want to provide offers for | "Background" |
traitValue | The trait value you want to provide offers for | "Red" |
floorMultiplier | The floor multiplier you want to apply to the floor price of the collection | 1.3 |
collection
:
Field | Description | Example value |
---|---|---|
amountToLend | (= loan to value) The amount in ethers you want to lend per offer | 1 |
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.