Skip to content

Commit

Permalink
feat: add exclusivity period check (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
krboktv authored Jun 6, 2024
1 parent 72f9b0e commit 38d0fc0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/fusion-order/fusion-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,13 @@ export class FusionOrder {
wallet
)
}

/**
* Check if the auction has exclusive resolver, and it is in the exclusivity period
*/
public isExclusivityPeriod(time = now()): boolean {
return this.fusionExtension.postInteractionData.isExclusivityPeriod(
time
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {IntegratorFee, SettlementSuffixData} from './types'
import {isHexBytes} from '../../validations'
import {add0x} from '../../utils'
import {UINT_16_MAX} from '../../constants'
import {now} from '../../utils/time'

export class SettlementPostInteractionData {
public readonly whitelist: WhitelistItem[]
Expand Down Expand Up @@ -226,6 +227,18 @@ export class SettlementPostInteractionData {
return false
}

public isExclusivityPeriod(time = now()): boolean {
if (this.whitelist.length === 1) {
return true
}

if (this.whitelist[0].delay === this.whitelist[1].delay) {
return false
}

return time <= this.resolvingStartTime + this.whitelist[0].delay
}

public isExclusiveResolver(wallet: Address): boolean {
const addressHalf = wallet.toString().slice(-20)

Expand Down

0 comments on commit 38d0fc0

Please sign in to comment.