squid-js/src/keeper/contracts/conditions/EscrowReward.ts

46 lines
1.2 KiB
TypeScript
Raw Normal View History

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