Closed bvotteler closed 1 year ago
Merging #139 (e810ea9) into master (3ae2c58) will not change coverage. The diff coverage is
25.71%
.:exclamation: Current head e810ea9 differs from pull request most recent head f6c6e13. Consider uploading reports for the commit f6c6e13 to get more accurate results
@@ Coverage Diff @@
## master #139 +/- ##
======================================
Coverage 6.05% 6.05%
======================================
Files 34 34
Lines 2131 2131
Branches 484 484
======================================
Hits 129 129
Misses 1877 1877
Partials 125 125
Files Changed | Coverage Δ | |
---|---|---|
src/mappings/event/loans.ts | 0.00% <0.00%> (ø) |
|
src/mappings/utils/pools.ts | 0.00% <0.00%> (ø) |
|
src/server-extension/resolvers/index.ts | 0.00% <0.00%> (ø) |
|
src/mappings/_utils.ts | 30.05% <34.61%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
Kintsugi numbers seem to add up.
Compared with the existing cumulativeDexTradingVolumePerPool
query which has the total volume since beginning of recording.
query:
query MyQuery {
cumulativeVols: cumulativeDexTradingVolumePerPools(limit: 1, orderBy: tillTimestamp_DESC, where: {poolId_eq: "(KSM,KBTC)", tillTimestamp_lte: "2023-08-29T00:00:00Z"}) {
id
amounts {
amount
amountHuman
token {
... on NativeToken {
__typename
token
}
... on ForeignAsset {
__typename
asset
}
}
}
poolId
poolType
tillTimestamp
}
separateVols: getGeneralDexTradingVolumesByPool(token1: "KSM", token2: "KBTC", endDate: "2023-08-29T00:00:00Z", startDate: "1971-01-01T00:00:00Z") {
poolId
endDate
poolType
volumesIn {
amount
amountHuman
ticker
}
volumesOut {
amount
ticker
amountHuman
}
}
}
Results:
{
"data": {
"cumulativeVols": [
{
"id": "(KSM,KBTC)-Standard-1693262136546",
"amounts": [
{
"amount": "19221849095618647",
"amountHuman": "19221.849095618647",
"token": {
"__typename": "NativeToken",
"token": "KSM"
}
},
{
"amount": "1833436437",
"amountHuman": "18.33436437",
"token": {
"__typename": "NativeToken",
"token": "KBTC"
}
}
],
"poolId": "(KSM,KBTC)",
"poolType": "Standard",
"tillTimestamp": "2023-08-28T22:35:36.546000Z"
}
],
"separateVols": {
"poolId": "(KSM,KBTC)",
"endDate": "2023-08-29T00:00:00.000Z",
"poolType": "Standard",
"volumesIn": [
{
"amount": "9895892932229253",
"amountHuman": "9895.892932229253",
"ticker": "KSM"
},
{
"amount": "889952777",
"amountHuman": "8.89952777",
"ticker": "KBTC"
}
],
"volumesOut": [
{
"amount": "9325956163389394",
"ticker": "KSM",
"amountHuman": "9325.956163389394"
},
{
"amount": "943483660",
"ticker": "KBTC",
"amountHuman": "9.4348366"
}
]
}
}
}
In a nutshell, the numbers from the cumulative volume entity (which includes both in and out volumes) are the same as the numbers from the new query when adding up in + out volumes.
e.g. KSM from cumulativeDexTradingVolumePerPools
: 19221849095618647
KSM in + out from the new query getGeneralDexTradingVolumesByPool
:
9895892932229253 + 9325956163389394 = 19221849095618647
Did a few spot checks of volumes for Interlay mainnet, too. Looking good and adding up as expected.
Resolves #123
Get separate in/out volumes for swaps, as opposed to a grand total cumulative value only.
Added this as a custom resolver
getGeneralDexTradingVolumesByPool
since squid has all swap data stored. So, no need to update totals for each swap event. Keeping the "old"cumulativeDexTradingVolumePerPools
entity which does not separate in/out volumes for the time being in order to avoid introducing a breaking change for the UI team / dashboards using it.TODO before ready for review: