Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticks-based DEX] Set timestamp from subgraph for entity.Pool #661

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

sunspirit99
Copy link
Contributor

Why did we need it?

Related Issue

Release Note

How Has This Been Tested?

Screenshots (if appropriate):

@kyber-ci-bot
Copy link

kyber-ci-bot commented Dec 19, 2024

Test coverage changes:
Package Before After Diff
github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity 26.30% 26.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/algebra/integral 28.50% 33.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/algebra/v1 16.40% 17.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/ambient 11.80% 17.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/balancer-v1 29.60% 42.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/balancer-v2/composable-stable 36.40% 48.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/balancer-v2/math 49.00% 49.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/balancer-v2/stable 21.20% 33.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/balancer-v2/weighted 28.90% 44.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/bancor-v21 25.10% 31.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/bancor-v3 34.80% 51.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/bebop 21.90% 45.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/bedrock/unieth 6.00% 16.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/clipper 23.60% 50.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/curve/plain 21.00% 59.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/curve/stable-meta-ng 9.00% 41.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/curve/stable-ng 11.40% 37.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/curve/tricrypto-ng 23.60% 62.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/curve/twocrypto-ng 22.90% 61.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/dai-usds 10.50% 21.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/deltaswap-v1 36.20% 46.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/dexalot 29.80% 45.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/dodo/classical 25.40% 60.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/dodo/dpp 10.80% 38.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/dodo/dsp 11.20% 40.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/dodo/dvm 11.70% 49.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/dodo/libv1 73.30% 73.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/dodo/libv2 37.60% 37.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/ethena/susde 9.00% 27.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/ether-vista 2.00% 2.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/etherfi/eeth 7.70% 16.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/etherfi/vampire 4.50% 27.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/etherfi/weeth 6.20% 12.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/fluid/dex-t1 53.00% 68.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/fluid/vault-t1 9.30% 17.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/frax/sfrxeth 8.90% 18.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/frax/sfrxeth-convertor 16.90% 37.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/generic-simple-rate 17.40% 32.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/gyroscope/2clp 30.30% 42.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/gyroscope/3clp 32.60% 43.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/gyroscope/eclp 50.10% 58.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/gyroscope/math 14.30% 14.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/hashflow-v3 53.50% 74.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/integral 21.90% 35.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/kelp/rseth 6.90% 11.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/lo1inch 48.10% 84.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/mantle/meth 14.20% 28.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/mkr-sky 14.30% 29.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/mx-trading 35.00% 72.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/native-v1 30.90% 69.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/nomiswap/nomiswapstable 6.60% 83.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/ondo-usdy 13.50% 23.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/puffer/pufeth 10.60% 22.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/renzo/ezeth 5.70% 9.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/ringswap 11.00% 10.60%
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/rocketpool/reth 10.30% 26.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/staderethx 15.50% 28.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/swaap-v2 19.90% 56.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/swell/rsweth 4.30% 6.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/swell/sweth 4.30% 6.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/syncswapv2/aqua 18.00% 22.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/syncswapv2/classic 15.40% 32.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/syncswapv2/stable 20.70% 40.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/uniswap-v1 8.60% 14.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/uniswap-v2 7.60% 8.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/usd0pp 13.70% 27.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/velocore-v2/cpmm 40.30% 54.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/velocore-v2/math 16.80% 16.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/velocore-v2/math/sd59x18 51.90% 51.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/velocore-v2/wombat-stable 19.10% 30.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/velodrome-v1 26.40% 35.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/velodrome-v2 28.50% 39.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/virtual-fun 27.90% 39.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/woofi-v2 37.40% 55.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/liquidity-source/woofi-v21 36.30% 57.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/algebrav1 16.40% 17.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/balancer-composable-stable 39.90% 55.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/balancer/stable 29.50% 78.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/balancer/weighted 29.60% 56.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/camelot 27.50% 38.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/curve/aave 19.00% 70.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/curve/base 11.80% 43.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/curve/compound 11.30% 75.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/curve/meta 19.10% 87.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/curve/plain-oracle 10.00% 38.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/curve/tricrypto 25.00% 70.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/curve/two 11.10% 29.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/dmm 19.40% 33.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/dodo 28.50% 36.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/equalizer 18.00% 28.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/fraxswap 13.40% 23.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/fulcrom 22.70% 31.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/fxdx 17.60% 20.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/gmx 22.70% 27.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/gmx-glp 22.60% 26.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/iziswap 19.40% 25.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/kokonut-crypto 19.90% 55.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/kyber-pmm 29.10% 38.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/lido 15.60% 22.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/lido-steth 12.60% 33.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/limitorder 36.60% 51.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/liquiditybookv20 24.90% 38.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/liquiditybookv21 33.00% 48.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/madmex 21.70% 25.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/makerpsm 23.30% 37.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/mantisswap 32.90% 53.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/maverickv1 48.30% 70.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/metavault 24.00% 28.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/nuriv2 14.50% 22.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pancakev3 30.30% 47.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/platypus 18.70% 25.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pol-matic 7.70% 18.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/quickperps 19.90% 23.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/ramsesv2 14.40% 22.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/saddle 47.30% 64.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/slipstream 14.00% 21.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/smardex 29.90% 46.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/solidly-v3 16.70% 28.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/swapbased-perp 26.60% 31.40% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/syncswap/syncswapclassic 20.10% 68.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/syncswap/syncswapstable 28.60% 82.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/synthetix 31.10% 38.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/traderjoev20 2.60% 12.80% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/traderjoev21 2.60% 12.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/uniswap 15.50% 17.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/uniswapv3 29.70% 45.20% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/usdfi 28.60% 44.10% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/velocimeter 29.80% 46.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/velodrome 29.40% 44.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/velodromev2 29.40% 45.60% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/vooi 22.00% 36.90% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/wombat/wombatlsd 20.10% 55.30% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/wombat/wombatmain 20.40% 56.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/woofiv2 36.10% 54.70% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/util 4.50% 4.50% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/abi 75.00% 75.00% ✔️
github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/bignumber 14.80% 14.80% ✔️

@sunspirit99 sunspirit99 changed the title [ticks-based DEX] Set timestamp from subgraph for entityp.Pool [ticks-based DEX] Set timestamp from subgraph for entity.Pool Dec 19, 2024
Comment on lines 150 to 161
createdAtTimestamp, ok := new(big.Int).SetString(p.CreatedAtTimestamp, 10)
if !ok {
return nil, metadataBytes, fmt.Errorf("invalid CreatedAtTimestamp: %v, pool: %v", p.CreatedAtTimestamp, p.ID)
}

var newPool = entity.Pool{
Address: p.ID,
ReserveUsd: 0,
AmplifiedTvl: 0,
Exchange: d.config.DexID,
Type: DexType,
Timestamp: time.Now().Unix(),
Timestamp: createdAtTimestamp.Int64(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yo

@sunspirit99 sunspirit99 merged commit 0e2d718 into main Dec 19, 2024
5 checks passed
@sunspirit99 sunspirit99 deleted the improve-ticksbased-bootstrap branch December 19, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants