Giter VIP home page Giter VIP logo

pools-subql's Introduction

Centrifuge Subquery

SubQuery

A GraphQL API to query the Centrifuge Parachain on Polkadot.

🌱 Staging

Pipeline

Use GraphQL query endpoint at https://api.subquery.network/sq/embrio-tech/centrifuge-subql or try the API with the SubQuery Playground.

👷‍♂️ Development

We highly recommend to develop using the overarching centrifuge-development repository. It allows to run all required services and databases with Docker Compose.

Environment

  • Typescript are required to compile project and define types.
  • Both SubQuery CLI and generated Project have dependencies and require Node.
    • node: version specified in .nvmrc
  • Yarn

Code generation

To generate the entities based on schema.graphql, run:

yarn codegen

Access

Open your browser and head to http://localhost:3000.

Finally, you should see a GraphQL playground is showing in the explorer and the schemas that are ready to query.

Linter

Automatic Linting

Staged code is linted automatically with a pre-commit hook.

Manual Linting

You can run the linter with

yarn lint

To fix fixable lint errors use

yarn lint:fix

Commit

This repository uses commitlint to enforce commit message conventions. You have to specify the type of the commit in your commit message. Use one of the supported types.

git commit -m "[type]: foo bar"

🗄️ Data Model

!!! Data fields ending with an underscore _ are automatically reset at the end of a period and bust be of type BigInt!!!

erDiagram
    Account ||--o{ TrancheBalance: ""
    Account ||--o{ CurrencyBalance: ""

    Loan ||--|| LoanState: ""
    Loan ||--o{ LoanSnapshot: ""
    LoanState ||..|| LoanSnapshot: "onNewPeriod"

    Pool ||--|| PoolState: ""
    Pool ||--o{ PoolSnapshot: ""
    PoolState ||..|| PoolSnapshot: "onNewPeriod"

    Tranche }o--|| Pool: ""
    Tranche ||--|| TrancheState: ""
    Tranche ||--o{ TrancheSnapshot: ""
    TrancheState ||..|| TrancheSnapshot: "onNewPeriod"

    Epoch }|--|| Pool: ""
    Epoch }o--|| EpochState: ""
    EpochState ||--|| Tranche: ""

    InvestorTransaction }o--|| Account: ""
    InvestorTransaction ||--|| Pool: ""
    InvestorTransaction ||--|| Tranche: ""
    InvestorTransaction ||--|| Epoch: ""

    OutstandingOrder }o--|| Account: ""
    OutstandingOrder ||--|| Pool: ""
    OutstandingOrder ||--|| Tranche: ""
    OutstandingOrder ||--|| Epoch: ""

    BorrowerTransaction }o--|| Account: ""
    BorrowerTransaction ||--|| Epoch: ""
    BorrowerTransaction ||--|| Loan: ""

    Currency ||--|{ Pool: ""
Loading

pools-subql's People

Contributors

filo87 avatar hieronx avatar tibohei avatar astox avatar sophialittlejohn avatar gpmayorga avatar

Stargazers

bageltoes avatar

Watchers

Lucas Vogelsang avatar James Cloos avatar  avatar ilin zweilin avatar Manuel Polzhofer avatar Avi avatar  avatar Nuno avatar Vedhavyas Singareddi avatar Miguel Hervas avatar  avatar  avatar  avatar

pools-subql's Issues

CLI deployments lead to missing entities (investorTransactions)

Summary

Manual and CLI deployments of the same code lead to diferent results. CLI deployments lead to empty investorTransactions.

Description

The same code has been deployed to different slots of pools-multichain project:

  1. Primary deployment has been performed manually using the CID: Qmc6bHPjAEYZtPTexRveNXDnns6PzzT7XvhDj1VzaQeYAw
  2. Stage deployment has been performed using the following action: https://github.com/centrifuge/pools-subql/actions/runs/8982012353/job/24668752775

This leads to the following environments:

  • LEFT: Primary manual deployment (correct)
  • RIGHT: Staging CLI action deployment (several entities missing)

image

When the environments are fully synced, when performing the following query

{investorTransactions {nodes { id } } }

Different results are observed

image

Manual deployment query: https://api.subquery.network/sq/centrifuge/pools-multichain?query={investorTransactions{nodes{id}}}

CLI deployment query: https://api.subquery.network/sq/centrifuge/pools-multichain__Y2Vud?query={investorTransactions{nodes{id}}}

and also the total amount of entries differs:
image

Further observations:

  1. The logs report no particular ERRORS
  2. The two deployments report different flags/parameters in the UI
  3. Clicking on UPDATE DEPLOYMENT on the staging environment leads to an invalid multichain CID
    image

Refactor eth block handler to follow architectural principles

ethHandlers.ts should be refactored to adhere with the following principles:

  • Handlers should contain no direct assignment of Entity values. State alterations must be performed through appropriate Service methods (such as PoolService.ts or LoanService.ts)
  • Avoid use of array iterators methods such as .map() or .foreach() in combination with async functions, as these can lead to the raising of unhandled exceptions. Use for ... of ... instead.
  • Refactor contract calls to be included in the appropriate Service Method

Track remaining asset transaction types

  • When loans.DebtIncreased/Decreased/WrittenOff/Mutated event comes in, create a corresponding asset transaction
enum AssetTransactionType {
  ...
  DEBT_INCREASED
  DEBT_DECREASED
  WRITTEN_OFF
  MUTATED # <= Mutated
}

Track cash transfers as asset transaction type

Extend AssetTransactionType

enum AssetTransactionType {
  CREATED
  BORROWED
  REPAID
  CLOSED
  CASH_DEPOSIT
  CASH_WITHDRAWAL
  CASH_TRANSFER // to/from onchain reserve 
}

Create OnchainCash asset
When pool is created, create an asset by default with type = OnchainCash.

If there is a transfer debt from a non-cash asset to an OffchainCash asset

  • Track repayment amount
  • Create PrincipalRepayment transaction for the non-cash asset, with fromAsset = OffchainCash asset and amount = repaidAmount
  • Create CashDeposit transaction type for the cash asset, with toAsset = non-cash asset and amount = borrowAmount

=> this will show up as a principal repayment in the Cashflows chart

If there is a transfer debt from an OffchainCash asset to non-cash asset

  • Track borrowed/financed amount
  • Create Purchase transaction for the non-cash asset, with fromAsset = OffchainCash asset and amount = borrowAmount
  • Create CashWithdrawal transaction for the cash asset, with toAsset = non-cash asset and amount = repaidAmount

=> this will show up as a purchase in the Cashflows chart

If there is a purchase of an OffchainCash asset

  • Don't track any financing/repayment amounts
  • Create a CashTransfer transaction for the cash asset, with fromAsset = OnchainCash asset

=> this won't show up in the Cashflows chart

If there is a repayment of an OffchainCash asset

  • Don't track any financing/repayment amounts
  • Create a CashTransfer transaction for the cash asset, with toAsset = OnchainCash asset

=> this won't show up in the Cashflows chart

Fix missing purchase data

For the DYF pool (ID: 1655476167), the asset financings are always empty:

Screenshot 2024-08-12 at 14 04 32

This is coming from the PoolSnapshot.sumBorrowedAmountByPeriod property.

However there have been 2 purchases:
Screenshot 2024-08-12 at 14 05 22

Both were of type transfer debt from a cash asset to the assets.

Integration tests: invariants

  • Token price x token supply for each tranche = NAV
  • NAV = sum of present value of each asset + total reserve
  • Portfolio value + offchain cash value + total reserve = NAV
  • Realized profit + unrealized profit + interest payments + unscheduled payments - writeoffs - accrued fees - charged fees + investments - redemptions = NAV delta in period
  • (Off chain cash value + total reserve) change in period = - borrows + repayments + investments - redemptions - paid fees

Add `yieldMTD`, `yieldQTD`, `yieldYTD`

yieldMTD: (token price now - token price day 1 of the month) / token price day 1 of the month

yieldQTD: (token price now - token price day 1 of the quarter) / token price day 1 of the quarter

yieldYTD: (token price now - token price Jan 1) / token price Jan 1

Add unrealized P&L

Separate into

  • unrealizedProfitAtMarketPrice: based on selling current position at current oracle price
  • unrealizedProfitAtNotional: only if notional > 0, based on selling current position at the notional value

Track oracle transactions

  • Track oracleFeed.Fed events
  • Create OracleTransaction entities
type OracleTransaction @entity {
  id: ID! # extrinsic hash
  timestamp: Date!
  key: String!
  value: BigInt!
}

Track investments/redemptions in onchain cash asset

When an epoch is executed, this should create

  • If total investments > 0, an AssetTransaction with type=DepositFromInvestments for asset ID = 0 (onchain cash)
  • If total redemptions > 0, an AssetTransaction with type=WithdrawalForRedemptions for asset ID = 0 (onchain cash)
  • If total fees paid > 0, an AssetTransaction with type=WithdrawalForFees for asset ID = 0 (onchain cash)

Bootstrap smoke tests

Run Smoke tests with jest in CI for release PRs

Block release PR if NOT:

  • NAV at given dates is correct
  • Some Snapshots available for all entities
  • Nodes are synced up to last midnight

ETH indexer fails to attach LP DynamicSource

Summary

centrifuge-subql/src/mappings/handlers/evmHandlers.ts method handleEvmDeployTranche fails to deploy LP dynamic source.

Steps to reproduce

Run multichain indexer on mainnet with the following starting blocks:

[...]
dataSources:
  - kind: ethereum/Runtime
    startBlock: 18721030
    options:
      address: '0x78E9e622A57f70F1E0Ec652A4931E4e278e58142'
      abi: poolManager
[...]
  - kind: ethereum/Runtime
    startBlock: 11063000
    options:
      abi: navFeed

Current behavior

ETHERS throws a call exception for the escrow method whenever starting blocks are as listed above.
By changing BOTH starting block to the most recent value of 18721030, then the escrow() call is successful, and the dynamic source works correctly.

ETHERS throws similar errors in multiple occasions. Not only when attaching the DynamicSource.

Expected behavior

The dynamic source is attached correctly and parses the corresponding ERC20 tokens independently of the chosen starting block.

Relevant logs and/or screenshots

Error when attaching the dynamic source:

subql-node-eth-1  | 2024-05-11T08:01:54.407Z <sandbox> INFO Snapshotting Pool: 0xfc2950dd337ca8496c18dfc0256fb905a7e7e5c6 
subql-node-eth-1  | 2024-05-11T08:01:55.280Z <sandbox> INFO Adding DynamicSource for tranche 4139607887-0x97aa65f23e7be09fcd62d0554d2e9273 token: 0x30baA3BA9D7089fD8D020a994Db75D14CF7eC83b block: 18721033 
subql-node-eth-1  | 2024-05-11T08:01:55.286Z <sandbox> INFO Initialising new currency 1-0x30baA3BA9D7089fD8D020a994Db75D14CF7eC83b with 18 decimals 
subql-node-eth-1  | 2024-05-11T08:01:55.558Z <sandbox> ERROR undefined Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="escrow()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)
subql-node-eth-1  | 2024-05-11T08:01:55.578Z <sandbox> INFO It's a new period on EVM block 18723600: 2023-12-06T00:04:35.000Z 

Other ethers errors:

05/14/2024 02:30:39 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:30:51 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:30:59 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:31:13 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:31:24 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:31:39 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:31:51 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:32:03 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:32:11 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:32:25 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:32:35 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:32:46 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/14/2024 02:33:06 PM
error
sandbox
Error fetching chunk 0: Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441","data":"0x252dba420000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000006c0000000000000000000000000000000000000000000000000000000000000074000000000000000000000000000000000000000000000000000000000000007c0000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008c0000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000ac00000000000000000000000000000000000000000000000000000000000000b400000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000cc00000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000dc00000000000000000000000000000000000000000000000000000000000000e40000000000000000000000000...
05/15/2024 05:48:07 AM
error
sandbox
Failed shelfcontract.token call. Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0x7d057A056939bb96D682336683C10EC89b78D7CE","data":"0x044215c6000000000000000000000000000000000000000000000000000000000000019f","accessList":null}, error={"reason":"bad response","code":"SERVER_ERROR","status":504,"headers":{"server":"openresty","date":"Wed, 15 May 2024 05:48:07 GMT","content-type":"application/json; charset=utf-8","connection":"keep-alive","x-ratelimit-remaining-minute":"49940","x-ratelimit-limit-minute":"50000","ratelimit-remaining":"49940","ratelimit-limit":"50000","ratelimit-reset":"53","content-length":"51","x-continent":"AS","x-cluster":"hk","x-kong-upstream-latency":"60004","x-kong-proxy-latency":"10","via":"kong/2.3.3"},"body":"{\n \"message\":\"The upstream server is timing out\"\n}","requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0x7d057a056939bb96d682336683c10ec89b78d7ce\",\"data\":\"0x044215c6000000000000000000000000000000000000000000000000000000000000019f\"},\"0x12f37d4\"],\"id\":2655,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://eth.api.onfinality.io/ws"}, code=CALL_EXCEPTION, version=providers/5.7.2)
05/15/2024 06:53:56 AM
error
sandbox
Failed shelfcontract.token call. Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0xCFad06aDAcf221f8119995c8bCa25184A6b5A268","data":"0x044215c6000000000000000000000000000000000000000000000000000000000000004f","accessList":null}, error={"reason":"bad response","code":"SERVER_ERROR","status":502,"headers":{"server":"openresty","date":"Wed, 15 May 2024 06:53:56 GMT","content-type":"application/json; charset=utf-8","connection":"keep-alive","x-ratelimit-remaining-minute":"49413","x-ratelimit-limit-minute":"50000","ratelimit-remaining":"49413","ratelimit-limit":"50000","ratelimit-reset":"6","content-length":"75","x-continent":"AS","x-cluster":"hk","x-kong-upstream-latency":"2247","x-kong-proxy-latency":"3","via":"kong/2.3.3"},"body":"{\n \"message\":\"An invalid response was received from the upstream server\"\n}","requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0xcfad06adacf221f8119995c8bca25184a6b5a268\",\"data\":\"0x044215c6000000000000000000000000000000000000000000000000000000000000004f\"},\"0x12f37d4\"],\"id\":279,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://eth.api.onfinality.io/ws"}, code=CALL_EXCEPTION, version=providers/5.7.2)
05/15/2024 07:05:27 AM
error
sandbox
Failed shelfcontract.token call. Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0x7d057A056939bb96D682336683C10EC89b78D7CE","data":"0x044215c60000000000000000000000000000000000000000000000000000000000000122","accessList":null}, error={"reason":"bad response","code":"SERVER_ERROR","status":504,"headers":{"content-type":"text/plain; charset=utf-8","content-length":"163","connection":"keep-alive","x-ratelimit-remaining-minute":"49729","x-ratelimit-limit-minute":"50000","ratelimit-remaining":"49729","ratelimit-limit":"50000","ratelimit-reset":"34","date":"Wed, 15 May 2024 07:05:27 GMT","x-continent":"AS","x-cluster":"hk","x-kong-upstream-latency":"360","x-kong-proxy-latency":"2","via":"kong/2.3.3"},"body":"read tcp 192.168.125.185:58980->104.22.53.246:443: read: connection reset by peer. The gateway cannot get a response, please try again or contact the administrator","requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0x7d057a056939bb96d682336683c10ec89b78d7ce\",\"data\":\"0x044215c60000000000000000000000000000000000000000000000000000000000000122\"},\"0x12f37d4\"],\"id\":3419,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://eth.api.onfinality.io/ws"}, code=CALL_EXCEPTION, version=providers/5.7.2) 

Possible fixes

TBD

Add current price to asset

Differentiate between portfolio V1 and V2

  ActiveLoanInfoV2: {
    activeLoan: 'PalletLoansEntitiesLoansActiveLoan',
    presentValue: 'Balance',
    outstandingPrincipal: 'Balance',
    outstandingInterest: 'Balance',
    currentPrice: 'Option<Balance>',
  },
  ActiveLoanInfoV1: {
    activeLoan: 'PalletLoansEntitiesLoansActiveLoan',
    presentValue: 'Balance',
    outstandingPrincipal: 'Balance',
    outstandingInterest: 'Balance',
}

Track future cashflows per asset

  • Any time the pricing of an asset changes (events: created, borrowed, repaid, priced, written off, ..)
  • Use the cashflows RT API to store cashflows:
type AssetCashflow @entity {
  id: ID! # pool id - asset id - cf timestamp
  asset: Asset! @index

  timestamp: Date!
  principal: BigInt!
  interest: BigInt!
}

In a future ticket: actually link AssetTransactions to AssetCashflows.

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.