2019-02-28 21:28:57 +01:00
|
|
|
import { Condition } from "./Condition.abstract"
|
2019-03-04 14:34:24 +01:00
|
|
|
import { zeroX } from "../../../utils"
|
2019-03-21 02:56:58 +01:00
|
|
|
import { InstantiableConfig } from "../../../Instantiable.abstract"
|
2019-02-28 21:28:57 +01:00
|
|
|
|
|
|
|
export class EscrowReward extends Condition {
|
|
|
|
|
2019-03-21 02:56:58 +01:00
|
|
|
public static async getInstance(config: InstantiableConfig): Promise<EscrowReward> {
|
|
|
|
return Condition.getInstance(config, "EscrowReward", EscrowReward)
|
2019-02-28 21:28:57 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 21:28:51 +01:00
|
|
|
public hashValues(amount: number, receiver: string, sender: string, lockCondition: string, releaseCondition: string) {
|
2019-03-04 14:34:24 +01:00
|
|
|
return super.hashValues(amount, ...[receiver, sender, lockCondition, releaseCondition].map(zeroX))
|
2019-02-28 21:28:57 +01:00
|
|
|
}
|
|
|
|
|
2019-03-14 21:28:51 +01:00
|
|
|
public fulfill(
|
2019-02-28 21:28:57 +01:00
|
|
|
agreementId: string,
|
|
|
|
amount: number,
|
|
|
|
receiver: string,
|
|
|
|
sender: string,
|
|
|
|
lockCondition: string,
|
|
|
|
releaseCondition: string,
|
|
|
|
from?: string,
|
|
|
|
) {
|
2019-03-04 14:34:24 +01:00
|
|
|
return super.fulfill(agreementId, [amount, ...[receiver, sender, lockCondition, releaseCondition].map(zeroX)], from)
|
2019-02-28 21:28:57 +01:00
|
|
|
}
|
|
|
|
}
|