Skip to content

Commit

Permalink
fix: skip tracking pmm swap out inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
lehainam-dev committed Dec 13, 2024
1 parent c4c32cd commit 6bbf51c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/swaplimit/swapped_inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ func (k *SwappedInventory) UpdateLimit(decreaseTokenAddress, increaseTokenAddres
k.lock.Lock()
defer k.lock.Unlock()

swappedOut, ok := k.swapped[decreaseTokenAddress]
if !ok {
swappedOut = new(big.Int)
}
swappedOut = swappedOut.Sub(swappedOut, decreaseDelta)
k.swapped[decreaseTokenAddress] = swappedOut
// Comment out these, since we only keep track of swapped in.
// Subtract swapped out may make the future swap in value
// reduce, cause the swap limit to be lower than expected.

// swappedOut, ok := k.swapped[decreaseTokenAddress]
// if !ok {
// swappedOut = new(big.Int)
// }
// swappedOut = swappedOut.Sub(swappedOut, decreaseDelta)
// k.swapped[decreaseTokenAddress] = swappedOut

swappedIn, ok := k.swapped[increaseTokenAddress]
if !ok {
Expand Down
1 change: 1 addition & 0 deletions pkg/util/bignumber/bignumber.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
BasisPoint = big.NewInt(10000)

MAX_UINT_128 = new(big.Int).Sub(new(big.Int).Lsh(One, 128), One)
MAX_UINT_256 = new(big.Int).Sub(new(big.Int).Lsh(One, 256), One)
)

var BONE = new(big.Int).Exp(Ten, big.NewInt(18), nil)
Expand Down

0 comments on commit 6bbf51c

Please sign in to comment.