Skip to content

Commit

Permalink
fix: save AMM's proposed fee into snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
wwestgarth committed May 22, 2024
1 parent 7bc6864 commit d9deea4
Show file tree
Hide file tree
Showing 3 changed files with 1,423 additions and 1,404 deletions.
25 changes: 16 additions & 9 deletions core/execution/amm/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,16 @@ func NewPoolFromProto(
return nil, err
}

proposedFee, err := num.DecimalFromString(state.ProposedFee)
if err != nil {
return nil, err
}

return &Pool{
ID: state.Id,
AMMParty: state.AmmPartyId,
Commitment: num.MustUintFromString(state.Commitment, 10),
ID: state.Id,
AMMParty: state.AmmPartyId,
Commitment: num.MustUintFromString(state.Commitment, 10),
ProposedFee: proposedFee,
Parameters: &types.ConcentratedLiquidityParameters{
Base: base,
LowerBound: lower,
Expand Down Expand Up @@ -246,12 +252,13 @@ func NewCurveFromProto(c *snapshotpb.PoolMapEntry_Curve) (*curve, error) {

func (p *Pool) IntoProto() *snapshotpb.PoolMapEntry_Pool {
return &snapshotpb.PoolMapEntry_Pool{
Id: p.ID,
AmmPartyId: p.AMMParty,
Commitment: p.Commitment.String(),
Parameters: p.Parameters.ToProtoEvent(),
Market: p.market,
Asset: p.asset,
Id: p.ID,
AmmPartyId: p.AMMParty,
Commitment: p.Commitment.String(),
ProposedFee: p.ProposedFee.String(),
Parameters: p.Parameters.ToProtoEvent(),
Market: p.market,
Asset: p.asset,
Lower: &snapshotpb.PoolMapEntry_Curve{
L: p.lower.l.String(),
High: p.lower.high.String(),
Expand Down
1 change: 1 addition & 0 deletions protos/sources/vega/snapshot/v1/snapshot.proto
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ message PoolMapEntry {
Curve lower = 7;
Curve upper = 8;
vega.events.v1.AMM.Status status = 9;
string proposed_fee = 10;
}

string party = 1;
Expand Down
Loading

0 comments on commit d9deea4

Please sign in to comment.