import { ReturnCollateralScenario } from "../runners/" ; import { BigNumber } from "bignumber.js" ; import * as moment from "moment" ; import * as Units from "../../../test_utils/units" ; const defaultArgs = { succeeds : true , debtAgreementExists : true , debtAgreementCollateralized : true , termsContract : ( collateralizedContract , attacker ) => collateralizedContract , termEndTimestamp : ( latestBlockTime ) => moment . unix ( latestBlockTime ) . subtract ( 5 , "days" ) . unix ( ) , } ; export const SUCCESSFUL_RETURN_SCENARIOS = [ { description : "Debt's term has lapsed and debt has been repaid" , ... defaultArgs , collateralAmount : Units . ether ( 3 ) , gracePeriodInDays : new BigNumber ( 7 ) , valueRepaidToDate : Units . ether ( 1 ) , expectedRepaymentValueSchedule : [ { timestamp : ( latestBlockTime ) => moment . unix ( latestBlockTime ) . subtract ( 14 , "days" ) . unix ( ) , expectedRepaymentValue : Units . ether ( 0.5 ) , } , { timestamp : ( latestBlockTime ) => moment . unix ( latestBlockTime ) . subtract ( 7 , "days" ) . unix ( ) , expectedRepaymentValue : Units . ether ( 1 ) , } , ] , from : ( collateralizer , other ) => collateralizer , agreementId : web3 . sha3 ( "Arbitrary 32 byte string for successful return scenario #1" ) , } , { description : "Debt's term has lapsed and debt has been more than repaid, called by non-collateralizer" , ... defaultArgs , collateralAmount : Units . ether ( 0.5 ) , gracePeriodInDays : new BigNumber ( 3 ) , valueRepaidToDate : Units . ether ( 3 ) , expectedRepaymentValueSchedule : [ { timestamp : ( latestBlockTime ) => moment . unix ( latestBlockTime ) . subtract ( 7 , "days" ) . unix ( ) , expectedRepaymentValue : Units . ether ( 2 ) , } , ] , from : ( collateralizer , other ) => other , agreementId : web3 . sha3 ( "Arbitrary 32 byte string for successful return scenario #2" ) , } , { description : "Debt's term has not yet lapsed, and debt has been fully repaid, called by non-collateralizer" , ... defaultArgs , collateralAmount : Units . ether ( 0.5 ) , gracePeriodInDays : new BigNumber ( 3 ) , valueRepaidToDate : Units . ether ( 3 ) , expectedRepaymentValueSchedule : [ { timestamp : ( latestBlockTime ) => moment . unix ( latestBlockTime ) . add ( 1 , "days" ) . unix ( ) , expectedRepaymentValue : Units . ether ( 2 ) , } , ] , from : ( collateralizer , other ) => other , termEndTimestamp : ( latestBlockTime ) => moment . unix ( latestBlockTime ) . add ( 1 , "days" ) . unix ( ) , agreementId : web3 . sha3 ( "Arbitrary 32 byte string for unsuccessful return scenario #3" ) , } , ] ;