import { BigNumber } from "bignumber.js" ; import * as Units from "../../../../test_utils/units" ; import { SimpleInterestContractTerms } from "../../../../factories/terms_contract_parameters" ; import { DummyTokenContract } from "../../../../../../types/generated/dummy_token" ; import { SignedDebtOrder } from "../../../../../../types/kernel/debt_order" ; const DEFAULT_SCENARIO_TERMS = { principalAmount : Units . ether ( 1 ) , interestRateFixedPoint : Units . interestRateFixedPoint ( 2.5 ) , amortizationUnitType : new BigNumber ( 1 ) , termLengthUnits : new BigNumber ( 4 ) , debtorFee : Units . ether ( 0.001 ) , succeeds : true , reverts : false , isCryptoKitty : false , principalTokenInRegistry : true , collateralTokenInRegistry : true , } ; export const DEFAULT_REGISTER_TERM_START_ARGS = { ... DEFAULT_SCENARIO_TERMS , collateralToken : "REP" , collateralId : new BigNumber ( 0 ) , invokedByDebtKernel : true , permissionToCollateralize : true , } ; export const DEFAULT_RETURN_COLLATERAL_ARGS = { ... DEFAULT_SCENARIO_TERMS , repaymentAmount : Units . ether ( 1.29 ) , collateralToken : "MET" , collateralId : new BigNumber ( 0 ) , repaymentToken : ( principalToken , otherToken ) => principalToken , debtOrder : ( debtOrder ) => debtOrder , principalTokenInRegistry : true , collateralTokenInRegistry : true , } ; export const DEFAULT_SEIZE_COLLATERAL_ARGS = { ... DEFAULT_SCENARIO_TERMS , repaymentAmount : Units . ether ( 1.29 ) , collateralToken : "MET" , collateralId : new BigNumber ( 0 ) , repaymentToken : ( principalToken , otherToken ) => principalToken , debtOrder : ( debtOrder ) => debtOrder , secondsSinceFill : 0 , } ; export const DEFAULT_REGISTER_REPAYMENT_ARGS = { ... DEFAULT_SCENARIO_TERMS , repaymentAmount : Units . ether ( 1.29 ) , collateralToken : "MET" , collateralId : new BigNumber ( 0 ) , repaymentToken : ( principalToken , otherToken ) => principalToken , debtOrder : ( debtOrder ) => debtOrder , repayFromRouter : true , } ; interface BaseScenario { description : string ; principalAmount : BigNumber ; interestRateFixedPoint : BigNumber ; amortizationUnitType : BigNumber ; termLengthUnits : BigNumber ; debtorFee : BigNumber ; collateralId : BigNumber ; collateralToken : string ; principalTokenInRegistry : boolean ; collateralTokenInRegistry : boolean ; succeeds : boolean ; isCryptoKitty : boolean ; reverts : boolean ; } export interface RegisterRepaymentScenario extends BaseScenario { repaymentToken : ( principalToken : DummyTokenContract , otherToken : DummyTokenContract ) => DummyTokenContract ; repaymentAmount : BigNumber ; debtOrder : ( debtOrder : SignedDebtOrder ) => SignedDebtOrder ; repayFromRouter : boolean ; } export interface ReturnCollateralScenario extends BaseScenario { repaymentToken : ( principalToken : DummyTokenContract , otherToken : DummyTokenContract ) => DummyTokenContract ; debtOrder : ( debtOrder : SignedDebtOrder ) => SignedDebtOrder ; repaymentAmount : BigNumber ; } export interface SeizeCollateralScenario extends BaseScenario { repaymentToken : ( principalToken : DummyTokenContract , otherToken : DummyTokenContract ) => DummyTokenContract ; debtOrder : ( debtOrder : SignedDebtOrder ) => SignedDebtOrder ; repaymentAmount : BigNumber ; secondsSinceFill : number ; } export interface RegisterTermStartScenario extends BaseScenario { permissionToCollateralize : boolean ; invokedByDebtKernel : boolean ; } export interface UnpackParametersFromBytesScenario { input : string ; expectedTerms : SimpleInterestContractTerms ; }