Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Loan

Representation of a GetLine Loan indexed by the system and running on the blockchain.

Hierarchy

  • Loan

Index

Constructors

constructor

Properties

address

address: Address

Ethereum address at which loan is deployed.

Private blockchain

blockchain: Blockchain

blockchainState

blockchainState: object

State of the loan on the blockchain. These change with time. updateStateFromBlockchain should be called to update this data with the freshest state from the blockchain.

Type declaration

  • amountGathered: BigNumber

    Value of loan token gathered in fundraising.

  • defaulted: boolean

    Whether the loan has defaulted, ie. the liege has not paid back in time.

  • fundraising: boolean

    Whether the loan is currently raising funds from investors.

  • loanState: LoanState

    State of Loan contract.

  • paidback: boolean

    Whether the loan has been paid back succesfully.

Private contract

contract: Contract

description

description: string

User-given description of the loan.

owner

owner: Address

Ethereum address of owner/liege of loan.

parameters

parameters: object

Parameters with which the loan got created on the blockchain. These are always available and constant through the life of a loan.

Type declaration

  • amountWanted: BigNumber

    Amount of loan token wanted.

  • collateralToken: Token

    Address of ERC20-compatible token used as collateral for the loan.

  • fundraisingDeadline: Moment

    Date by which the loan needs to have all investment gathered.

  • interestPermil: number

    Interest of loan, in permil.

  • loanToken: Token

    Address of ERC20-compatible token used as loan.

  • paybackDeadline: Moment

    Date by which loan needs to be fully repaid.

shortId

shortId: string

A short identifier that is used to lookup the loan in the Getline index system (metabackend). Opaque.

Methods

isOwner

  • isOwner(): Promise<boolean>
  • Returns whether the current API client is the owner/liege of the loan.

    Returns Promise<boolean>

    Whether the current API client is the owner/liege of the loan.

loadFromProto

  • loadFromProto(proto: pb.LoanCache): Promise<void>
  • Private method used by the library to load data from a metabackend protobuf.

    Parameters

    • proto: pb.LoanCache

    Returns Promise<void>

sendCollateral

  • sendCollateral(amount: BigNumber): Promise<void>
  • Sends collateral to the loan and starts fundraising process. This is non-reversible as it advances the state of the smart contract.

    This function will block until the new state is saved on the blockchain.

    Parameters

    • amount: BigNumber

    Returns Promise<void>

updateStateFromBlockchain

  • updateStateFromBlockchain(): Promise<void>
  • Loads the newest state of the loan from the blockchain.

    Returns Promise<void>

Generated using TypeDoc