acalanetwork / defillama-acala-tvl Goto Github PK
View Code? Open in Web Editor NEWScripts for calculating Acala/Karura TVL.
Scripts for calculating Acala/Karura TVL.
In src/loans.js
Calculated by adding all of the collateral for every position together.
const positions = await api.query.loans.positions.entries();
In src/dex.js
Calculated by adding all of the tokens for every pool together, as well as all of tokens in the stable asset pools.
const dexPools = await api.query.dex.liquidityPool.entries();
const stablePools = await api.query.stableAsset.pools.entries();
In src/staking.js
Calculated by adding together all of the bonded tokens in every staking ledger
const ledgers = await api.query.homa.stakingLedgers.entries();
In src/utils
: crowdloanDotToDot
The lcDOT TVL in the stablecoin vaults, and DEX is calculated by multiplying the total amount of lcDOT locked by the lcDOT current discount and then treating it as DOT.
in src/utils
: getLiquidConversionRate
The LDOT/LKSM TVL in the stablecoin vaults, and DEX is calculated by multiplying the total amount of LDOT/LKSM by the conversion rate and then treating them as DOT/KSM.
At time of raising this, when running the repo as per instructions, the script errors due to the KINT
token
When encountering lookup issues with a single token like this, we should throw warning
and continue so that we still return the rest of the TVL of whichever stat we are gathering.
yarn start
Error thrown in log:
(node:2346) UnhandledPromiseRejectionWarning: Error: createType(CurrencyId):: Enum(Token):: Cannot map Enum JSON, unable to find 'KINT' in aca, ausd, dot, ldot, renbtc, cash, kar, kusd, ksm, lksm, bnc, vsksm
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.