Lending Registry

Address: [-------------]

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░█████╗░██╗░░░░░░█████╗░░██████╗██╗░░██╗░█████╗░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██╔══██╗██║░░░░░██╔══██╗██╔════╝██║░██╔╝██╔══██╗░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░███████║██║░░░░░███████║╚█████╗░█████═╝░███████║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██╔══██║██║░░░░░██╔══██║░╚═══██╗██╔═██╗░██╔══██║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██║░░██║███████╗██║░░██║██████╔╝██║░╚██╗██║░░██║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░ ░░░░
░░░░ █░░ █▀▀ █▄░█ █▀▄ █ █▄░█ █▀▀   █▀█ █▀▀ █▀▀ █ █▀ ▀█▀ █▀█ █▄█ ░░░░
░░░░ █▄▄ ██▄ █░▀█ █▄▀ █ █░▀█ █▄█   █▀▄ ██▄ █▄█ █ ▄█ ░█░ █▀▄ ░█░ ░░░░
░░░░ ░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

IDL

type Time = int;
type Loan =
record {
cleared: bool;
created_at: Time;
created_by: principal;
id: nat;
loan_for: principal;
metadata: text;
reason: text;
star: nat;
tx_id: nat;
updated_at: Time;
uri: text;
};
type LendingRegistry =
service {
clearCredit: (ClearCredit) -> (LendId);
clearLoan: (ClearLoan) -> (LendId);
deployToAlaska: () -> ();
getCredit: (LendId) -> (opt Credit) query;
getLoan: (LendId) -> (opt Loan) query;
getProfileCreditScore: (principal) -> (float64) query;
getProfileCreditVSLoanStore: (principal) -> (float64) query;
getProfileCredits: (principal) -> (vec opt Credit) query;
getProfileLoanScore: (principal) -> (float64) query;
getProfileLoans: (principal) -> (vec opt Loan) query;
issueCredit: (IssueCredit) -> (LendId);
issueLoan: (IssueLoan) -> (LendId);
whoami: () -> (principal);
};
type LendId = nat;
type IssueLoan =
record {
created_by: principal;
loan_for: principal;
metadata: text;
reason: text;
star: nat;
tx_id: nat;
uri: text;
};
type IssueCredit =
record {
credit_for: principal;
metadata: text;
reason: text;
star: nat;
tx_id: nat;
uri: text;
};
type Credit =
record {
cleared: bool;
created_at: Time;
created_by: principal;
credit_for: principal;
id: nat;
metadata: text;
reason: text;
star: nat;
tx_id: nat;
updated_at: Time;
uri: text;
};
type ClearLoan = record {id: nat;};
type ClearCredit = record {id: nat;};
service : (text) -> LendingRegistry

Getters

getCredit

Returns a Credit with Specific ID.
@returns ?T.Credit
@parameters (id: T.LendId)

getLoan

Returns a Loan with specific ID.
@returns ?T.Loan
@parameters (id: T.LendId)

getProfileCredits

Returns all Credits of a User.
@returns [?(T.Credit)]
@parameters (p: Principal)

getProfileLoans

Returns all Loans of a USer.
@returns [?(T.Loan)]
@parameters (p: Principal)

getProfileCreditScore

Returns a User Credit score.
@returns (p: Principal)
@parameters Float

getProfileLoanScore

Returns a User Loan score.
@returns Float
@parameters (p: Principal)

getProfileCreditVSLoanStore

Returns a divide of a User Loan & Credit Score.
@returns Float
@parameters (p: Principal)

Setters

issueCredit

Create a Credit for a User.
@returns T.LendId
@parameters (credit_data: T.IssueCredit)

issueLoan

Create a User for a User.
@returns T.LendId
@parameters (loan_data: T.IssueLoan)

clearCredit

Clear a Credit for a User.
@returns T.LendId
@parameters (data: T.ClearCredit)

clearLoan

Clear a Loan for a User.
@returns T.LendId
@parameters (data: T.ClearLoan)