Collateral Manager

The CollateralManager contract manages loans and their underlying collateral. It is accessible only by the LendingPool contract and is responsible for the deposit/withdraw of collateral to open/close positions.

Methods

createBorrow()

function createBorrow(address initiator, address onBehalfOf, address collateral, uint256 tokenId, uint256 tokenValue, address asset, uint256 amount, uint256 duration, uint256 borrowIndex, uint256 reserveId)

Deposits NFT(s) in escrow and creates a borrow position.

Parameter NameTypeDescription

initiator

address

address of the initiator of the transaction

onBehalfOf

address

address to receive the loan

collateral

address

address of the NFT to be used as collateral

tokenId

uint256

tokenId of the NFT to be used as collateral

tokenValue

uint256

amount of ERC1155 tokens to be used, 0 if ERC721

asset

address

address of currency to be borrowed

amount

uint256

amount of currency to be borrowed

duration

uint256

duration of the loan

borrowIndex

uint256

the current borrow index

reserveId

uint256

id of the target reserve

updateBorrow()

function updateBorrow(address initiator, uint256 borrowId, uint256 amountAdded, uint256 amountTaken, uint256 borrowIndex)

Updates a borrow position.

Parameter NameTypeDescription

initiator

address

address of the initiator of the transaction

borrowId

uint256

id of the targeted borrow

amountAdded

uint256

amount of currency added to the borrow position

amountTaken

uint256

amount of currency taken from the borrow position

borrowIndex

uint256

the current borrow index

repayBorrow()

function repayBorrow(address initiator, uint256 borrowId, uint256 amount, uint256 borrowIndex)

Repays a borrow position to retrieve the underlying collateral.

Parameter NameTypeDescription

initiator

address

address of the initiator of the transaction

borrowId

uint256

id of the targeted borrow

amount

uint256

amount of currency to repay the borrow position

borrowIndex

uint256

the current borrow index

refinanceBorrow()

function refinanceBorrow(address initiator, uint256 borrowId, uint256 borrowAmount, uint256 amountAdded, uint256 amountTaken, uint256 duration)

Refinances a borrow position.

Parameter NameTypeDescription

initiator

address

address of the initiator of the transaction

borrowId

uint256

id of the targeted borrow

borrowAmount

uint256

current borrow position

amountAdded

uint256

amount of currency added to the borrow position

amountTaken

uint256

amount of currency taken from the borrow position

duration

uint256

duration of the new loan from moment of refinance

liquidateBorrow()

function liquidateBorrow(uint256 borrowId)

Liquidates a borrow position.

Parameter NameTypeDescription

borrowId

uint256

id of the targeted borrow

setBorrowAuctionCall()

function setBorrowAuctionCall(uint256 borrowId, uint256 auctionStartPrice, uint256 auctionEndPrice, uint256 auctionTimestamp, address auctionCaller)

Calls a liquidation auction on a defaulted borrow. Accessible by the LendingPool, only.

Parameter NameTypeDescription

borrowId

uint256

id of the targeted borrow

auctionStartPrice

uint256

start price of the Dutch auction

auctionEndPrice

uint256

end price of the Dutch auction

auctionTimestamp

uint256

timestamp of the auction

auctionCaller

address

address of the auction caller, to receive bonus

setBorrowStatus()

function setBorrowStatus(uint256 borrowId, DataTypes.BorrowStatus status)

Sets the status of a borrow. Accessible by the LendingPool, only.

Parameter NameTypeDescription

borrowId

uint256

id of the targeted borrow

status

DataTypes.BorrowStatus status

status of the borrow: None, // Default zero Active, // Open Repaid, // Closed, repaid Auction, // In Auction Liquidated, // Closed, Defaulted

setBlacklisted()

function setBorrowStatus(address collateral, uint256 tokenId, bool isBlacklisted)

Blacklists a collateral tokenId.

Parameter NameTypeDescription

collateral

address

address of the NFT to be used as collateral

tokenId

uint256

tokenId of the NFT to be used as collateral

isBlacklisted

bool

true if collateral tokenId is blacklisted, default: false

View Methods

getBorrowAmount()

function getBorrowAmount(uint256 borrowId)

Returns the amount borrowed within a loan.

Parameter NameTypeDescription

borrowId

uint256

id of the targeted borrow

getScaledAmount()

function getScaledAmount(uint256 borrowId)

Returns the scaledAmount, i.e. the number of debtTokens against a borrow (not accounting for the normalised variable debt).

getBorrowNumTokens()

function getBorrowNumTokens(uint256 borrowId)

Returns the number of ERC1155 tokens used as collateral, 0 if ERC721.

borrowerOf

function borrowerOf(uint256 borrowId)

Returns the address of the original loan borrower.

As opposed to the original borrower, the current borrower is the holder of the obligation receipt.

getBorrowId()

function getBorrowId(address collateral, uint256 tokenId)

Returns the borrowId of a loan.

getLastBorrowId()

function getLastBorrowId()

Returns the last borrowId.

getNumNftBorrows()

function getNumNftBorrows(address collataral)

Returns the number of borrows for a given NFT collateral.

getNumUserNftBorrows()

function getNumUserNftBorrows(address user, address collateral)

Returns the number of borrows for a given user, using a given NFT collateral.

getBorrow()

function getBorrow(uint256 borrowId)

Returns borrowData for a given id.

Returns

Parameter NameTypeDescription

borrowData

DataTypes.Borrow memory

borrow data: status collateral auction borrower erc20Token borrowAmount scaledAmount timestamp duration reserveId tokenizedId

getAuctionPrice()

function getAuctionPrice(uint256 borrowId)

Returns the current Dutch auction price for the underlying collateral of a defaulted loan in auction.

isBlacklisted()

function isBlacklisted(address collateral, uint256 tokenId)

Returns true if the specific NFT is blacklisted.

ABI

Collateral Manager ABI
{
  "abi": [
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "onBehalfOf",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "tokenValue",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "asset",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "duration",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "borrowIndex",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "tokenizedId",
          "type": "uint256"
        }
      ],
      "name": "BorrowCreated",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "asset",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "borrowIndex",
          "type": "uint256"
        }
      ],
      "name": "BorrowLiquidated",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "asset",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "borrowAmount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amountAdded",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amountTaken",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "duration",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "timestamp",
          "type": "uint256"
        }
      ],
      "name": "BorrowRefinanced",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "asset",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "borrowIndex",
          "type": "uint256"
        }
      ],
      "name": "BorrowRepaid",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "asset",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amountAdded",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amountTaken",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "borrowIndex",
          "type": "uint256"
        }
      ],
      "name": "BorrowUpdated",
      "type": "event"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        }
      ],
      "name": "borrowerOf",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "onBehalfOf",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "tokenValue",
          "type": "uint256"
        },
        {
          "internalType": "address",
          "name": "asset",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "duration",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "borrowIndex",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "reserveId",
          "type": "uint256"
        }
      ],
      "name": "createBorrow",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "tokenizedId",
          "type": "uint256"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        }
      ],
      "name": "getAuctionPrice",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        }
      ],
      "name": "getBorrow",
      "outputs": [
        {
          "components": [
            {
              "internalType": "enum DataTypes.BorrowStatus",
              "name": "status",
              "type": "uint8"
            },
            {
              "components": [
                {
                  "internalType": "enum DataTypes.CollateralType",
                  "name": "collateralType",
                  "type": "uint8"
                },
                {
                  "internalType": "address",
                  "name": "collateral",
                  "type": "address"
                },
                {
                  "internalType": "uint256",
                  "name": "tokenId",
                  "type": "uint256"
                },
                {
                  "internalType": "uint256",
                  "name": "value",
                  "type": "uint256"
                }
              ],
              "internalType": "struct DataTypes.Collateral",
              "name": "collateral",
              "type": "tuple"
            },
            {
              "components": [
                {
                  "internalType": "address",
                  "name": "caller",
                  "type": "address"
                },
                {
                  "internalType": "uint256",
                  "name": "startPrice",
                  "type": "uint256"
                },
                {
                  "internalType": "uint256",
                  "name": "endPrice",
                  "type": "uint256"
                },
                {
                  "internalType": "uint256",
                  "name": "timestamp",
                  "type": "uint256"
                }
              ],
              "internalType": "struct DataTypes.Auction",
              "name": "auction",
              "type": "tuple"
            },
            {
              "internalType": "address",
              "name": "borrower",
              "type": "address"
            },
            {
              "internalType": "address",
              "name": "erc20Token",
              "type": "address"
            },
            {
              "internalType": "uint256",
              "name": "borrowAmount",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "scaledAmount",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "timestamp",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "duration",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "reserveId",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "tokenizedId",
              "type": "uint256"
            }
          ],
          "internalType": "struct DataTypes.Borrow",
          "name": "",
          "type": "tuple"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        }
      ],
      "name": "getBorrowAmount",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        },
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        }
      ],
      "name": "getBorrowId",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        }
      ],
      "name": "getBorrowNumTokens",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        }
      ],
      "name": "getNumNftBorrows",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "user",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        }
      ],
      "name": "getNumUserNftBorrows",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        }
      ],
      "name": "getScaledAmount",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        }
      ],
      "name": "isBlacklisted",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        }
      ],
      "name": "liquidateBorrow",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "borrowAmount",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "amountAdded",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "amountTaken",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "duration",
          "type": "uint256"
        }
      ],
      "name": "refinanceBorrow",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "borrowIndex",
          "type": "uint256"
        }
      ],
      "name": "repayBorrow",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "collateral",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        },
        {
          "internalType": "bool",
          "name": "isBlacklisted_",
          "type": "bool"
        }
      ],
      "name": "setBlacklisted",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "auctionStartPrice",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "auctionEndPrice",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "auctionTimestamp",
          "type": "uint256"
        },
        {
          "internalType": "address",
          "name": "auctionCaller",
          "type": "address"
        }
      ],
      "name": "setBorrowAuctionCall",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "internalType": "enum DataTypes.BorrowStatus",
          "name": "status",
          "type": "uint8"
        }
      ],
      "name": "setBorrowStatus",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "initiator",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "borrowId",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "amountAdded",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "amountTaken",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "borrowIndex",
          "type": "uint256"
        }
      ],
      "name": "updateBorrow",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }
  ],
  "bytecode": {
    "object": "0x",
    "sourceMap": "",
    "linkReferences": {}
  },
  "deployedBytecode": {
    "object": "0x",
    "sourceMap": "",
    "linkReferences": {}
  },
  "methodIdentifiers": {
    "borrowerOf(uint256)": "2a24d53d",
    "createBorrow(address,address,address,uint256,uint256,address,uint256,uint256,uint256,uint256)": "7f1acb01",
    "getAuctionPrice(uint256)": "917d009e",
    "getBorrow(uint256)": "b176e311",
    "getBorrowAmount(uint256)": "01667623",
    "getBorrowId(address,uint256)": "4dad3a3e",
    "getBorrowNumTokens(uint256)": "d5300890",
    "getNumNftBorrows(address)": "b02d58b9",
    "getNumUserNftBorrows(address,address)": "073fa0b7",
    "getScaledAmount(uint256)": "3c613456",
    "isBlacklisted(address,uint256)": "e7571483",
    "liquidateBorrow(uint256)": "34613dab",
    "refinanceBorrow(address,uint256,uint256,uint256,uint256,uint256)": "7130d10e",
    "repayBorrow(address,uint256,uint256,uint256)": "2d18159a",
    "setBlacklisted(address,uint256,bool)": "09f4cf3f",
    "setBorrowAuctionCall(uint256,uint256,uint256,uint256,address)": "60e2c78f",
    "setBorrowStatus(uint256,uint8)": "e8a7cfff",
    "updateBorrow(address,uint256,uint256,uint256,uint256)": "da1e2134"
  },
  "rawMetadata": "{\"compiler\":{\"version\":\"0.8.16+commit.07a7930e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"onBehalfOf\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenizedId\",\"type\":\"uint256\"}],\"name\":\"BorrowCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"}],\"name\":\"BorrowLiquidated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountAdded\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountTaken\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"BorrowRefinanced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"}],\"name\":\"BorrowRepaid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountAdded\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amountTaken\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"}],\"name\":\"BorrowUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"}],\"name\":\"borrowerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"onBehalfOf\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenValue\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveId\",\"type\":\"uint256\"}],\"name\":\"createBorrow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenizedId\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"}],\"name\":\"getAuctionPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"}],\"name\":\"getBorrow\",\"outputs\":[{\"components\":[{\"internalType\":\"enum DataTypes.BorrowStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"enum DataTypes.CollateralType\",\"name\":\"collateralType\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"struct DataTypes.Collateral\",\"name\":\"collateral\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"startPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"endPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"internalType\":\"struct DataTypes.Auction\",\"name\":\"auction\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"borrower\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"erc20Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"scaledAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"reserveId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"tokenizedId\",\"type\":\"uint256\"}],\"internalType\":\"struct DataTypes.Borrow\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"}],\"name\":\"getBorrowAmount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getBorrowId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"}],\"name\":\"getBorrowNumTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"}],\"name\":\"getNumNftBorrows\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"}],\"name\":\"getNumUserNftBorrows\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"}],\"name\":\"getScaledAmount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"isBlacklisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"}],\"name\":\"liquidateBorrow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrowAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAdded\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTaken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"duration\",\"type\":\"uint256\"}],\"name\":\"refinanceBorrow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"}],\"name\":\"repayBorrow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isBlacklisted_\",\"type\":\"bool\"}],\"name\":\"setBlacklisted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"auctionStartPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"auctionEndPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"auctionTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"auctionCaller\",\"type\":\"address\"}],\"name\":\"setBorrowAuctionCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"internalType\":\"enum DataTypes.BorrowStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"setBorrowStatus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"borrowId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountAdded\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amountTaken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"borrowIndex\",\"type\":\"uint256\"}],\"name\":\"updateBorrow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"BorrowCreated(address,address,uint256,address,uint256,uint256,address,uint256,uint256,uint256,uint256)\":{\"details\":\"Emitted when a borrow is created\",\"params\":{\"initiator\":\"The address initiating the action\"}},\"BorrowLiquidated(address,uint256,address,uint256,address,uint256,uint256)\":{\"details\":\"Emitted when a borrow is liquidate by the liquidator\",\"params\":{\"initiator\":\"The address initiating the action\"}},\"BorrowRefinanced(address,uint256,address,uint256,address,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Emitted when a borrow is refinanced by the borrower\",\"params\":{\"initiator\":\"The address initiating the action\"}},\"BorrowRepaid(address,uint256,address,uint256,address,uint256,uint256)\":{\"details\":\"Emitted when a borrow is repaid by the borrower\",\"params\":{\"initiator\":\"The address initiating the action\"}},\"BorrowUpdated(address,uint256,address,uint256,address,uint256,uint256,uint256)\":{\"details\":\"Emitted when a borrow is updated\",\"params\":{\"initiator\":\"The address initiating the action\"}}},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/interfaces/ICollateralManager.sol\":\"ICollateralManager\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@chainlink/=lib/chainlink/\",\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":chainlink/=lib/chainlink/integration-tests/contracts/ethereum/src/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\"]},\"sources\":{\"src/interfaces/ICollateralManager.sol\":{\"keccak256\":\"0xdcb90cae810d15c23e0606ef3d9b30feec7d35e956082b88c1f35c5d6caf6438\",\"license\":\"AGPL-3.0\",\"urls\":[\"bzz-raw://c45a3cf14add38004018f32987cab971436cfd2e679eea71f2383f845bd68647\",\"dweb:/ipfs/QmPd9df3JmDFMHnhreYWw8tjmRGEQAtERnqj2YREXB5aP5\"]},\"src/protocol/libraries/types/DataTypes.sol\":{\"keccak256\":\"0x070f7865fe84ce4c9ebd86bbe24771607fbdb4e8777510b46cb5064e4d9b90a3\",\"license\":\"AGPL-3.0\",\"urls\":[\"bzz-raw://504fd0c937cc69cc0737c4ef5dcec477017ccbff609b45b210274fd7bf0792cf\",\"dweb:/ipfs/QmeW1TkAHib7XRBVmgMRTdmsa4Rg9HVToTMnifEE1C7mTi\"]}},\"version\":1}",
  "metadata": {
    "compiler": {
      "version": "0.8.16+commit.07a7930e"
    },
    "language": "Solidity",
    "output": {
      "abi": [
        {
          "inputs": [
            {
              "internalType": "address",
              "name": "initiator",
              "type": "address",
              "indexed": true
            },
            {
              "internalType": "address",
              "name": "onBehalfOf",
              "type": "address",
              "indexed": true
            },
            {
              "internalType": "uint256",
              "name": "borrowId",
              "type": "uint256",
              "indexed": true
            },
            {
              "internalType": "address",
              "name": "collateral",
              "type": "address",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "tokenId",
              "type": "uint256",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "tokenValue",
              "type": "uint256",
              "indexed": false
            },
            {
              "internalType": "address",
              "name": "asset",
              "type": "address",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "amount",
              "type": "uint256",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "duration",
              "type": "uint256",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "borrowIndex",
              "type": "uint256",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "tokenizedId",
              "type": "uint256",
              "indexed": false
            }
          ],
          "type": "event",
          "name": "BorrowCreated",
          "anonymous": false
        },
        {
          "inputs": [
            {
              "internalType": "address",
              "name": "initiator",
              "type": "address",
              "indexed": true
            },
            {
              "internalType": "uint256",
              "name": "borrowId",
              "type": "uint256",
              "indexed": true
            },
            {
              "internalType": "address",
              "name": "collateral",
              "type": "address",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "tokenId",
              "type": "uint256",
              "indexed": false
            },
            {
              "internalType": "address",
              "name": "asset",
              "type": "address",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "amount",
              "type": "uint256",
              "indexed": false
            },
            {
              "internalType": "uint256",
              "name": "borrowIndex",