UNPKG

@agoric/zoe

Version:

Zoe: the Smart Contract Framework for Offer Enforcement

161 lines 6.32 kB
/** * The Notifier that provides notifications that periods have passed. * Since notifiers can't be relied on to produce an output every time * they should, we'll track the time of last payment, and catch up if * any times have been missed. Compound interest will be calculated * using the interestRate. */ type PeriodNotifier = Notifier<import("@agoric/time").TimestampRecord>; /** * The running contract instance for an Autoswap installation. The * publicFacet from the Autoswap * instance is used for producing an invitation to sell the * collateral on liquidation. */ type AutoswapInstance = Instance; type LoanTerms = { /** * - Maintenance Margin Requirement, a Ratio record. * Default is 150% */ mmr: Ratio; autoswapInstance: AutoswapInstance; /** * Used for getting the current value of collateral and setting * liquidation triggers. */ priceAuthority: import("../../../tools/types.js").PriceAuthority; periodNotifier: PeriodNotifier; /** * The rate in basis points that will be multiplied with the debt on * every period to compound interest. */ interestRate: Ratio; interestPeriod: import("@agoric/time").RelativeTime; loanBrand: Brand; collateralBrand: Brand; }; type LenderSeatProperty = { /** * The ZCFSeat representing the lender's position in the contract. */ lenderSeat: import("../../types-index").ZCFSeat; }; /** * The loan now has a lenderSeat, which is added to the config. */ type LoanConfigWithLender = LoanTerms & LenderSeatProperty; type BorrowerConfigProperties = { /** * The ZCFSeat holding the collateral in escrow after the borrower * escrows it */ collateralSeat: import("../../types-index").ZCFSeat; /** * A function to get the current debt */ getDebt: () => Amount<"nat">; /** * PromiseKit that includes a promise that resolves to a PriceQuote * when liquidation is triggered */ liquidationPromiseKit: PromiseRecord<import("../../../tools/types.js").PriceQuote>; }; type BorrowerConfigPropertiesMinusDebt = { /** * The ZCFSeat holding the collateral in escrow after the borrower * escrows it */ collateralSeat: import("../../types-index").ZCFSeat; /** * PromiseKit that includes a promise that resolves to a PriceQuote * when liquidation is triggered */ liquidationPromiseKit: PromiseRecord<import("../../../tools/types.js").PriceQuote>; }; /** * The loan has a lender, a borrower, and collateral escrowed. */ type LoanConfigWithBorrower = LoanConfigWithLender & BorrowerConfigProperties; type LoanConfigWithBorrowerMinusDebt = LoanConfigWithLender & BorrowerConfigPropertiesMinusDebt; type ScheduleLiquidation = (zcf: import("../../types-index").ZCF, config: LoanConfigWithBorrower) => any; type MakeLendInvitation = (zcf: import("../../types-index").ZCF, config: LoanTerms) => Promise<import("../../types-index").Invitation>; type MakeBorrowInvitation = (zcf: import("../../types-index").ZCF, config: LoanConfigWithLender) => Promise<import("../../types-index").Invitation>; type MakeCloseLoanInvitation = (zcf: import("../../types-index").ZCF, config: LoanConfigWithBorrower) => Promise<import("../../types-index").Invitation>; /** * Allows holder to add collateral to the contract. Exits the seat * after adding. */ type MakeAddCollateralInvitation = (zcf: import("../../types-index").ZCF, config: LoanConfigWithBorrower) => Promise<import("../../types-index").Invitation>; type MakeDebtCalculator = (debtCalculatorConfig: DebtCalculatorConfig) => any; type CalcInterestFn = (oldDebt: Amount<"nat">, interestRate: Ratio) => Amount<"nat">; type DebtCalculatorConfig = { /** * A function to calculate the interest, given the debt value and an * interest rate in basis points. */ calcInterestFn: CalcInterestFn; /** * The debt at the start of the loan, in Loan brand */ originalDebt: Amount<"nat">; /** * The AsyncIterable to notify when a period has occurred */ periodNotifier: PeriodNotifier; interestRate: Ratio; /** * the period at which the outstanding debt increases by the interestRate */ interestPeriod: import("@agoric/time").RelativeTime; zcf: import("../../types-index").ZCF; configMinusGetDebt: LoanConfigWithBorrowerMinusDebt; /** * The starting point from which to calculate * interest. */ basetime: import("@agoric/time").Timestamp; }; type ConfigMinusGetDebt = { collateralSeat: import("../../types-index").ZCFSeat; liquidationPromiseKit: PromiseRecord<any>; mmr?: bigint | undefined; autoswapInstance: Handle<"Instance">; priceAuthority: import("../../../tools/types.js").PriceAuthority; periodNotifier: PeriodNotifier; interestRate: bigint; interestPeriod: import("@agoric/time").RelativeTime; lenderSeat: import("../../types-index").ZCFSeat; }; type BorrowFacet = { /** * Make an invitation to close the loan by repaying the debt * (including interest). */ makeCloseLoanInvitation: () => Promise<import("../../types-index").Invitation>; /** * Make an invitation to add collateral to protect against liquidation */ makeAddCollateralInvitation: () => Promise<import("../../types-index").Invitation>; /** * Get a promise for a priceQuote that will resolve if liquidation * occurs. The priceQuote is for the value of the collateral that * triggered the liquidation. This may be lower than expected if the * price is moving quickly. */ getLiquidationPromise: () => Promise<import("../../../tools/types.js").PriceQuote>; /** * Get the timestamp at which the debt was most recently recalculated. */ getLastCalculationTimestamp: () => import("@agoric/time").Timestamp; /** * Get a Notifier that will be updated when the current debt (an Amount with the Loan * Brand) changes. This will increase as interest is added. */ getDebtNotifier: () => Notifier<Amount>; /** * Get a recent report of the amount of collateral in the loan */ getRecentCollateralAmount: () => Amount; }; //# sourceMappingURL=types-ambient.d.ts.map