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

Revert "Msgpack encoding" #24

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/workflows/go_generate.yaml

This file was deleted.

14 changes: 4 additions & 10 deletions entities/pool.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
//go:generate go run github.com/tinylib/msgp -unexported -tests=false -v
//msgp:tuple Pool
//msgp:shim *big.Int as:[]byte using:msgpencode.EncodeInt/msgpencode.DecodeInt
//msgp:shim constants.FeeAmount as:uint64 using:uint64/constants.FeeAmount
//msgp:ignore StepComputations SwapResult GetOutputAmountResult GetInputAmountResult TickDataProvider

package entities

import (
Expand Down Expand Up @@ -42,7 +36,7 @@ type Pool struct {
SqrtRatioX96 *big.Int
Liquidity *big.Int
TickCurrent int
TickDataProvider *TickDataProviderWrapper
TickDataProvider TickDataProvider

token0Price *entities.Price
token1Price *entities.Price
Expand Down Expand Up @@ -120,7 +114,7 @@ func NewPool(tokenA, tokenB *entities.Token, fee constants.FeeAmount, sqrtRatioX
SqrtRatioX96: sqrtRatioX96,
Liquidity: liquidity,
TickCurrent: tickCurrent,
TickDataProvider: NewTickDataProviderWrapper(ticks),
TickDataProvider: ticks, // TODO: new tick data provider
}, nil
}

Expand Down Expand Up @@ -199,7 +193,7 @@ func (p *Pool) GetOutputAmount(inputAmount *entities.CurrencyAmount, sqrtPriceLi
swapResult.sqrtRatioX96,
swapResult.liquidity,
swapResult.currentTick,
p.TickDataProvider.Get(),
p.TickDataProvider,
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -242,7 +236,7 @@ func (p *Pool) GetInputAmount(outputAmount *entities.CurrencyAmount, sqrtPriceLi
swapResult.sqrtRatioX96,
swapResult.liquidity,
swapResult.currentTick,
p.TickDataProvider.Get(),
p.TickDataProvider,
)
if err != nil {
return nil, err
Expand Down
Loading
Loading