Skip to content

Commit 7a526f6

Browse files
committed
chore: remove unnecessary mutex in dodo
1 parent 58d3459 commit 7a526f6

File tree

6 files changed

+0
-21
lines changed

6 files changed

+0
-21
lines changed

pkg/liquidity-source/dodo/dpp/pool_simulator.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"math/big"
55
"slices"
66
"strings"
7-
"sync"
87

98
"github.com/KyberNetwork/blockchain-toolkit/integer"
109
"github.com/KyberNetwork/blockchain-toolkit/number"
@@ -19,7 +18,6 @@ import (
1918
)
2019

2120
type PoolSimulator struct {
22-
*sync.RWMutex
2321
pool.Pool
2422
libv2.PMMState
2523
Meta shared.V2Meta
@@ -78,7 +76,6 @@ func NewPoolSimulator(entityPool entity.Pool) (*PoolSimulator, error) {
7876
}
7977

8078
return &PoolSimulator{
81-
RWMutex: &sync.RWMutex{},
8279
Pool: pool.Pool{
8380
Info: info,
8481
},
@@ -148,7 +145,6 @@ func (p *PoolSimulator) CalcAmountOut(param pool.CalcAmountOutParams) (*pool.Cal
148145

149146
func (p *PoolSimulator) CloneState() pool.IPoolSimulator {
150147
cloned := *p
151-
cloned.RWMutex = &sync.RWMutex{}
152148
cloned.Info.Reserves = slices.Clone(p.Info.Reserves)
153149
return &cloned
154150
}

pkg/liquidity-source/dodo/dpp/storage.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import (
99

1010
// https://github.com/DODOEX/contractV2/blob/c58c067c4038437610a9cc8aef8f8025e2af4f63/contracts/DODOPrivatePool/impl/DPPStorage.sol#L51
1111
func (p *PoolSimulator) getPMMState() libv2.PMMState {
12-
p.Lock()
13-
defer p.Unlock()
14-
1512
libv2.AdjustedTarget(&p.PMMState)
1613
return p.PMMState
1714
}

pkg/liquidity-source/dodo/dsp/pool_simulator.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"math/big"
55
"slices"
66
"strings"
7-
"sync"
87

98
"github.com/KyberNetwork/blockchain-toolkit/integer"
109
"github.com/KyberNetwork/blockchain-toolkit/number"
@@ -19,7 +18,6 @@ import (
1918
)
2019

2120
type PoolSimulator struct {
22-
*sync.RWMutex
2321
pool.Pool
2422
libv2.PMMState
2523
Meta shared.V2Meta
@@ -78,7 +76,6 @@ func NewPoolSimulator(entityPool entity.Pool) (*PoolSimulator, error) {
7876
}
7977

8078
return &PoolSimulator{
81-
RWMutex: &sync.RWMutex{},
8279
Pool: pool.Pool{
8380
Info: info,
8481
},
@@ -148,7 +145,6 @@ func (p *PoolSimulator) CalcAmountOut(param pool.CalcAmountOutParams) (*pool.Cal
148145

149146
func (p *PoolSimulator) CloneState() pool.IPoolSimulator {
150147
cloned := *p
151-
cloned.RWMutex = &sync.RWMutex{}
152148
cloned.Info.Reserves = slices.Clone(p.Info.Reserves)
153149
return &cloned
154150
}

pkg/liquidity-source/dodo/dsp/storage.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import (
99

1010
// https://github.com/DODOEX/contractV2/blob/c58c067c4038437610a9cc8aef8f8025e2af4f63/contracts/DODOStablePool/impl/DSPStorage.sol#L70
1111
func (p *PoolSimulator) getPMMState() libv2.PMMState {
12-
p.Lock()
13-
defer p.Unlock()
14-
1512
libv2.AdjustedTarget(&p.PMMState)
1613
return p.PMMState
1714
}

pkg/liquidity-source/dodo/dvm/pool_simulator.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"math/big"
55
"slices"
66
"strings"
7-
"sync"
87

98
"github.com/KyberNetwork/blockchain-toolkit/integer"
109
"github.com/KyberNetwork/blockchain-toolkit/number"
@@ -19,7 +18,6 @@ import (
1918
)
2019

2120
type PoolSimulator struct {
22-
*sync.RWMutex
2321
pool.Pool
2422
libv2.PMMState
2523
Meta shared.V2Meta
@@ -78,7 +76,6 @@ func NewPoolSimulator(entityPool entity.Pool) (*PoolSimulator, error) {
7876
}
7977

8078
return &PoolSimulator{
81-
RWMutex: &sync.RWMutex{},
8279
Pool: pool.Pool{
8380
Info: info,
8481
},
@@ -148,7 +145,6 @@ func (p *PoolSimulator) CalcAmountOut(param pool.CalcAmountOutParams) (*pool.Cal
148145

149146
func (p *PoolSimulator) CloneState() pool.IPoolSimulator {
150147
cloned := *p
151-
cloned.RWMutex = &sync.RWMutex{}
152148
cloned.Info.Reserves = slices.Clone(p.Info.Reserves)
153149
return &cloned
154150
}

pkg/liquidity-source/dodo/dvm/storage.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import (
99

1010
// https://github.com/DODOEX/contractV2/blob/c58c067c4038437610a9cc8aef8f8025e2af4f63/contracts/DODOVendingMachine/impl/DVMStorage.sol#L66
1111
func (p *PoolSimulator) getPMMState() libv2.PMMState {
12-
p.Lock()
13-
defer p.Unlock()
14-
1512
libv2.AdjustedTarget(&p.PMMState)
1613
return p.PMMState
1714
}

0 commit comments

Comments
 (0)