Skip to content

Commit

Permalink
Revert "Msgpack encoding (#21)" (#24)
Browse files Browse the repository at this point in the history
This reverts commit f6a6ae8.
  • Loading branch information
phqb authored Jun 14, 2024
1 parent b4e5755 commit e7df54d
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 1,078 deletions.
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

0 comments on commit e7df54d

Please sign in to comment.