GithubHelp home page GithubHelp logo

defillama-acala-tvl's People

Contributors

brettkolodny avatar nnnnnnnnnni avatar qwer951123 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

pinkdiamond1

defillama-acala-tvl's Issues

TVL Calculations

Acala/Karura TVL

Stablecoin Vault

In src/loans.js

Calculated by adding all of the collateral for every position together.
const positions = await api.query.loans.positions.entries();

DEX

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();

Liquid Staking

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();

lcDOT

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.

LDOT/LKSM

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.

Handle empty tokens gracefully

Description

At time of raising this, when running the repo as per instructions, the script errors due to the KINT token
image

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.

Steps to recreate

  1. Run yarn start
  2. wait for Karura stats to be processed

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

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.