Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (closingPrice[1].gt(0) || currentAuctionIndex.gt(index)) return { status: AuctionStatus.ENDED }
// this should show theoretically auctions as ENDED and allow to claim,
// which internally closes the auction with a 0 buy order
// TODO: consider if (currentAuctionIndex < index && auction has sell volume) return AuctionStatus.PLANNED
if (currentAuctionIndex.lt(index)) return { status: AuctionStatus.PLANNED }
if (auctionStart.equals(1)) return { status: AuctionStatus.INIT }
if (currentAuctionIndex.equals(index) && closingPrice[0].equals(0) && outstandingVolume.eq(0)) {
console.log('Theoretically closed')
return { status: AuctionStatus.ENDED, theoretically: true }
}
if (!price[1].equals(0)) return { status: AuctionStatus.ACTIVE }
return { status: AuctionStatus.INACTIVE }
}
export const getTimingApproximations = ({ auctionStart, status, now }: TimingApprox) => {
if (status === Status.ENDED || status === Status.INACTIVE) return null
now = now * 1000
// auction is in 10 min waiting period
if (auctionStart.eq(1)) {
if (status === Status.INIT) { return {
willStart: 'soon',
runFor: 'approx. 6h',
claim: 'in approx. 6h',
}}
// Produces in AuctionStatus(
// <p>
// The auction will start soon and run for approx. 6 hours
// <br>
// <br>
// {userParticipates && `You may claim your ${bToken} in approx. 6 hours`}</p>
}
// const getTimeStr = (timestamp: number) => {
// const date = new Date(timestamp)
// const hh = date.getUTCHours()
// const mm = date.getUTCMinutes()
// const ss = date.getUTCSeconds()
// return `${hh ? `${hh} hour(s) ` : ''}${mm ? `${mm} minute(s) ` : ''}${ss ? `${ss} second(s) ` : ''}`
// }
const statusText: { [T in Status]: string } = {
[Status.ACTIVE]: 'Ongoing',
[Status.ENDED]: 'Ended',
// WHAT should Status.INACTIVE be?
[Status.INACTIVE]: 'Inactive ',
[Status.INIT]: 'Not Started',
[Status.PLANNED]: 'Not Started',
}
const translateStatus2Text = (str: string) => statusText[str] || str
const ShowStatus: React.SFC {} }> = ({
// timeLeft,
sellAmount,
buyAmount,
buyToken,
status,
claimTokens,
isClaiming,
}) => {
switch (status) {
const getProgressStep = ({ status, sellerBalance }: ProgressStepArgs) => {
if (sellerBalance.lte(0) || status === AuctionStatus.INACTIVE) return 0
if (status === AuctionStatus.INIT || status === AuctionStatus.PLANNED) return 1
if (status === AuctionStatus.ACTIVE) return 2
if (status === AuctionStatus.ENDED) return 3
return 0
}