Swap at least $10 on Lynex

Curated by

Lynex

ID Type

EVM ADDRESS

Cred Type

GRAPHQL

Last Update Time

06/26/2024, 18:57:08

Query

query info($address: String!) {
  swaps(where: {origin: $address}) {
    id
    price
    amountUSD
    sender
    recipient
    amount0
    amount1
    origin
    token0 {
      id
      symbol
    }
    token1 {
      id
      symbol
    }
  }
}

Expression

function(res) {
  const THRESHOLD_USD = 10
	const NUMBER_OF_SWAPS = 1 

	if (res.swaps.length < NUMBER_OF_SWAPS) {
		return 0
	}

  let amount = 0
  res.swaps.forEach(item => {
    if (item.amountUSD !== "") {
      amount += +item.amountUSD
    }
  })

  if (amount >= THRESHOLD_USD) {
    return 1
  }
  return 0
}