How to use the globals.AuctionStatus.INACTIVE function in globals

To help you get started, we’ve selected a few globals examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gnosis / dx-react / src / components / AuctionStateHOC / index.tsx View on Github external
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 }
}
github gnosis / dx-react / src / utils / timings.ts View on Github external
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 &amp;&amp; `You may claim your ${bToken} in approx. 6 hours`}</p>
github gnosis / dx-react / src / components / AuctionStatus / index.tsx View on Github external
}

// const getTimeStr = (timestamp: number) =&gt; {
//   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) =&gt; statusText[str] || str

const ShowStatus: React.SFC {} }&gt; = ({
  // timeLeft,
  sellAmount,
  buyAmount,
  buyToken,
  status,
  claimTokens,
  isClaiming,
}) =&gt; {
  switch (status) {
github gnosis / dx-react / src / components / AuctionStateHOC / index.tsx View on Github external
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
}