IMagnifyCashV1

Git Source

Functions

initializeNewLendingDesk

Creates a new lending desk

Emits an {NewLendingDeskInitialized} event.

function initializeNewLendingDesk(address _erc20, uint256 _depositAmount, LoanConfig[] calldata _loanConfigs)
    external;

Parameters

Creates a new lending configuration

Emits an {LendingDeskLoanConfigsSet} event.

function setLendingDeskLoanConfigs(uint256 _lendingDeskId, LoanConfig[] calldata _loanConfigs) external;

Parameters

Removes a new lending configuration

Emits an {LendingDeskLoanConfigsSet} event.

function removeLendingDeskLoanConfig(uint256 _lendingDeskId, address _nftCollection) external;

Parameters

This function is called to add liquidity to a lending desk

Emits an {LendingDeskLiquidityDeposited} event.

function depositLendingDeskLiquidity(uint256 _lendingDeskId, uint256 _amount) external;

Parameters

This function is called to cash out a lending desk

Emits an {LendingDeskLiquidityWithdrawn} event.

function withdrawLendingDeskLiquidity(uint256 _lendingDeskId, uint256 _amount) external;

Parameters

This function can be called by the lending desk owner in order to freeze it

Emits an {LendingDeskStateSet} event.

function setLendingDeskState(uint256 _lendingDeskId, bool _freezed) external;

Parameters

This function can be called by a borrower to create a loan

Emits an {NewLoanInitialized} event

function initializeNewLoan(
    uint64 _lendingDeskId,
    address _nftCollection,
    uint64 _nftId,
    uint32 _duration,
    uint256 _amount,
    uint32 _maxInterestAllowed
) external;

Parameters

This function can be called by anyone to get the remaining due amount of a loan

function getLoanAmountDue(uint256 _loanId) external view returns (uint256 amount);

Parameters

This function can be called by the obligation note holder to pay a loan and get the collateral back

Emits an {LoanPaymentMade} event.

function makeLoanPayment(uint256 _loanId, uint256 _amount, bool _resolve) external;

Parameters

This function is called by the desk owner in order to liquidate a loan and claim the NFT collateral

Emits an {LiquidatedOverdueLoan} event.

function liquidateDefaultedLoan(uint256 _loanId) external;

Parameters

Allows the admin of the contract to modify loan origination fee.

Emits an {LoanOriginationFeeSet} event.

function setLoanOriginationFee(uint256 _loanOriginationFee) external;

Parameters

Allows the admin of the contract to set the platform wallet where platform fees will be sent to

Emits an {PlatformWalletSet} event.

function setPlatformWallet(address _platformWallet) external;

Parameters

Allows the admin of the contract to pause the contract as an emergency response.

Emits either a {Paused} or {Unpaused} event.

function setPaused(bool _paused) external;

Parameters

Struct used to store loans

struct Loan {
    uint256 amount;
    uint256 amountPaidBack;
    address nftCollection;
    uint64 startTime;
    uint64 nftId;
    uint64 lendingDeskId;
    uint32 duration;
    uint32 interest;
    LoanStatus status;
    bool nftCollectionIsErc1155;
}

Struct used to store loan config set by the shop owner for an NFT collection

struct LoanConfig {
    address nftCollection;
    bool nftCollectionIsErc1155;
    uint256 minAmount;
    uint256 maxAmount;
    uint32 minInterest;
    uint32 maxInterest;
    uint32 minDuration;
    uint32 maxDuration;
}

Struct used to store lending desks on this contract

struct LendingDesk {
    address erc20;
    uint256 balance;
    LendingDeskStatus status;
}

LendingDeskStatus used to store lending desk status

Active Default status when a lending desk is created

Frozen Used when a lender pauses or 'freezes' their desk

enum LendingDeskStatus {
    Active,
    Frozen
}

LoanStatus used to store loan status

Active Default status when a loan is issued

Resolved Used when a loan is fully paid back by borrower

Defaulted Used when a loan is liquidated by lender

enum LoanStatus {
    Active,
    Resolved,
    Defaulted
}

Last updated