Code for reserve.mento.org
For more information about the Reserve please refer to:
The following is where the numbers displayed on reserve.mento.org comes from. These are not used by the reserve itself.
Data | Frequency | Notes |
---|---|---|
Reserve Contract | 20 Seconds | |
Stable Tokens | 20 Seconds | |
Celo Custody | 30 Minutes | Practically only change daily |
BTC, ETH, DAI balances | 30 Minutes | Practically only change daily |
euro conversion rate | 4 Hours | source rates updated once a day |
Asset prices | 5 Minutes |
For Celo on chain balances, an instance of @celo/contractKit
is connected to a node at forno.celo.org
. See src/providers/Celo.ts for how this works.
For ETH and BTC balances we use 2 data providers each: blockchain.com and blockstreams's esplora for BTC and etherscan and ethplorer for Ethereum.
For CELO the on change exchange price (which itself is an aggregation of the price on several exchanges) is used again via @celo/contractKit
For other crypto assets two data providers are used. If one provider fails to respond then the other is used and if both fail a cache of the last successful fetch is used until new data is fetched. For BTC these are blockchain.com's getAccountByTypeAndCurrency and Coinbase's Data Api spot price. For ETH these are Etherscan.io ETHER Last Price and Coinbase's Data Api spot price. For CMCO2, coinmarketcap api and ubeswaps subgraph are used for the price.
All stable token amounts are the total amount in circulation. This can be verified with
import { newKit } from '@celo/contractkit'
const kit = newKit('forno.celo.org')
const stableToken = await kit.contracts.getStableToken()
stableToken.totalSupply()
#### Currency Conversions
For stable coins other than cUSD exchangeratesapi.io is used to convert value to USD to compare and sum values
Reserve rebalancings figures are updated manually at the moment. However they can be verified by using a block explorer to check the historic balances of the reserve addresses.
To update Content edit the Markdown files in src/content Changes to these require a redeployment and to wait for the page cache to expire (5min)
yarn
gcloud auth login
.env
via yarn secrets:get
PERMISSION DENIED
you'll need to request permissions in GCloud from an adminyarn dev
see release.md