Giter VIP home page Giter VIP logo

yam-api's Introduction

yam-api

The YAM Api

api.yam.finance

yam-api's People

Contributors

ethedev avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

rossgalloway

yam-api's Issues

API: Update treasury assets

Description

For the treasury there are multiple data collection points to account for, should be cached every day. Everything should be converted to USDC for its rate. See yam treasury assets to understand where is it located at, and be able to pull it to then save it into the database and serve it on the endpoints.

Endpoints

/treasury

  • Data should be fetched and saved on the database every 1 day at 01:00 AM UTC.
  • Should return:
    • One object.
{
  timestamp: TIMESTAMP, // time last saved when the data was collected
  values: {
    assets: {
			...
      "USDC": 400000,
      "WETH": 600000,
      "UMA": 100000,
			...
    },
    total: 1100000 // total combined assets value when the data was collected
  }
}

/treasury-history

  • Data should be fetched and saved on the database every 1 day at 01:00 AM UTC.
  • Should return:
    • Multiple objects and each is an average of 7 days data.
    • Maximum objects returned are always the past 52 objects.
{
	...
	{
	  timestamp: TIMESTAMP,
	  values: {
	    assets: {
				...
	      "USDC": 0,
	      "WETH": 0,
	      "UMA": 0,
				...
	    },
	    total: 0
	  }
	},
	{
	  timestamp: TIMESTAMP,
	  values: {
	    assets: {
				...
	      "USDC": 400,
	      "WETH": 600,
	      "UMA": 100,
				...
	    },
	    total: 1100
	  }
	},
	{
	  timestamp: TIMESTAMP,
	  values: {
	    assets: {
				...
	      "USDC": 400000,
	      "WETH": 600000,
	      "UMA": 100000,
				...
	    },
	    total: 1100000
	  }
	},
	...
}

Follow the .env.example to add or use secrets if needed.

Requirements

  • Adding call for the specified endpoints.
  • Caching the data every hour using cron to the mongo database, appending the last cached data for the /treasury endpoint calls.
  • On your PR include examples of what the endpoints are returning.
  • Use your own mongo database for testing.
  • Documenting the code.

Yam API: Update treasury endpoint

Update current treasury endpoint:

  1. rename yyDAI+ to yUSD
  2. split the yUSD value into 3 entries, yUSD, USDC, USTONKSLP
  3. yUSD should be what we have currently on the treasury 0x97990b693835da58a281636296d2bf02787dea17
  4. USDC should be what we have currently on the multisig usdc balance 0x744D16d200175d20E6D8e5f405AEfB4EB7A962d1
  5. USTONKSLP should be the combination of the ustonks and usdc tokens of what we have in the USTONKS SEP pool 0xb9292b40cab08e5208b863ea9c4c4927a2308eee (value should be in usdc)
  6. index should be what we have in the timelock here
  7. updating all the balances to return as a number and not string

issue with treasury values loading

Describe the bug:
Upon connecting to the YAM website and dashboard page, the treasury values do not load initially. When trying just now, the values loaded after a few minutes, without me having done anything.

To Reproduce:
Steps to reproduce the behavior:

Not sure if this is universally reproducible, but it has happened to me multiple times in the last 2 days. Changing wallets sometimes fixes it. Sometimes it fixes itself after a while.

Expected behavior:
Prices and charts load quickly.

Screenshots:
full output from the debugger below

You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3 inpage.js:1:49382
MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect inpage.js:1:43460
MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged inpage.js:1:43460
MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1193 inpage.js:1:43839
MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1193#message inpage.js:1:43460
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
Error parsing prop TypeError: ne[ae].returnValues.signatures[oe].split(...)[1] is undefined
    e https://yam.finance/static/js/main.954b5130.chunk.js:1
    c https://yam.finance/static/js/3.714c6283.chunk.js:2
    _invoke https://yam.finance/static/js/3.714c6283.chunk.js:2
    b https://yam.finance/static/js/3.714c6283.chunk.js:2
    n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
    promise callback*n https://yam.finance/static/js/3.714c6283.chunk.js:2
    s https://yam.finance/static/js/3.714c6283.chunk.js:2
main.954b5130.chunk.js:1:331889
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 101 "connect" listeners added. Use emitter.setMaxListeners() to increase limit. inpage.js:8:22131
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 101 "close" listeners added. Use emitter.setMaxListeners() to increase limit. inpage.js:8:22131
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 101 "data" listeners added. Use emitter.setMaxListeners() to increase limit. inpage.js:8:22131
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 101 "error" listeners added. Use emitter.setMaxListeners() to increase limit. inpage.js:8:22131

If applicable, add screenshots to help explain your problem.

Device:

  • Smartphone: no
  • OS: Windows 11
  • Browser: firefox
  • Version 102.01

API: Migrate gas median

Migration of the gas median endpoints from the data api to the api.

3 endpoints to migrate from here:

app.get('/median', mongoFunctions.getLatestMedian);
app.get('/median-history', mongoFunctions.getMedians);
app.get('/median-range', mongoFunctions.getMedianRange);

API: Add apr endpoint

Yam APRs

"/apr" # (returns the below apr objects)
"/apr/yam" # (for yam apr in specific)
"/apr/degenerative" # (for degenerative apr in specific)

Returns

  • "/apr"
{
  "yam": {
    "farm": 55
  },
  "degenerative": {
    "UGAS": {
      "MAR21": 40,
      "JUN21": 40
    }
  }
}
  • "/apr/yam"
{
  "farm": 55
}
  • "/apr/degenerative"
{
  "UGAS": {
    "MAR21": 40,
    "JUN21": 40
  }
}

API: Add tvl endpoint

Yam TVLs

"/tvl" # (for all the tvl)
"/tvl/yam" # (for yam tvl in specific)
"/tvl/umbrella" # (for umbrella tvl in specific)
"/tvl/degenerative" # (for degenerative tvl in specific)

Returns

  • "/tvl"
6000000
  • "/tvl/yam"
{
  "values": {
    "farm": 5356150,
  },
  "total": 5356150,
}
  • "/tvl/degenerative"
{
  "values": {
    "UGAS": {
      "MAR21": 0,
      "JUN21": 0,
    },
    "UVOL": {
      "JUN21": 200,
    },
  },
  "total": 200,
}

Change APR object field for uPUNKS

Describe the bug:
The APR endpoint returns an object like so:
{"UGAS":{"JUN":6.238587054668649},"UPUNKS":{"SEP":0.20185907125184896},"USTONKS":{"JUN":42.196161533799106}}

The issue is that uPUNKS cycle is now denoted as a number (09) instead of the word (SEP).

Please change to either 9 or 09

API: Add gas tx cost, /gas/:tx

Gas / Tx

Gas cost

"/gas"
{
  "slow": 134,
  "normal": 134,
  "fast": 134
}

Transaction data

"/tx/:txHash"
{
  "fees": 0.0345115,
}

API: Fix tvl endpoint

Notes:

  • show even expired synths of yam synths
  • show the synths of yam synths in a separate object synths on the same level of farm

API: Update endpoint

The endpoint /synths/assets should automatically load what exists in the assets.json file populating the assets data in a returned object.

API: Add YAM avg price

Description

We need to add a primary call to the coingecko api with a fallback to a secondary api of public choice, to get the yam 30 days avg price.

  • Coingecko: https://www.coingecko.com/en/coins/yam
  • To calculate it, we need to save 2 values as follows:
    1. 30d should be the last 1 month full number of days, value saved every day for the yam price, averaging it over the days to get the value (from 1st to last day of the month).
    2. now should be the last 30 days from today, value is also saved every day (example today is the 14th of the month, we average it as well over the days from: 14th day of last month - to date, this value is more up to date and not a fixed value).

/30avg

{
	"30d": "2.00",
	"now": "1.63",
}

Follow the .env.example to add or use secrets if needed.

Requirements

  • Adding call for the specified endpoint.
  • Caching the data using cron to the mongo database.
  • Use your own mongo database for testing.
  • On your PR include examples of what the endpoint is returning.
  • Documenting the code.

API: Add gas fees

Description

We need to add a primary call to the etherscan api with a fallback to a secondary api of public choice to get the updated gas fees value of ethereum blockchain.

/gas

{
  "slow": 124,
  "normal": 134,
  "fast": 164
}

Follow the .env.example to add or use secrets if needed.

Requirements

  • Adding call for the specified endpoint.
  • Caching the data using cron every 5 seconds to the mongo database.
  • Making sure to serve the user the cached data and not have them call 3rd parties.
  • On your PR include examples of what the endpoint is returning.
  • Use your own mongo database for testing.
  • Documenting the code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.