Skip to content

Commit

Permalink
fix: updated abis
Browse files Browse the repository at this point in the history
  • Loading branch information
Alok committed Apr 23, 2024
1 parent c89fbd8 commit 7485fbf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/ethereum/go-ethereum v1.13.5
github.com/google/go-cmp v0.6.0
github.com/lib/pq v1.10.9
github.com/primevprotocol/contracts-abi v0.2.4-0.20240419134844-6dd1a8c7bf60
github.com/primevprotocol/contracts-abi v0.2.4-0.20240423171419-a959d3727058
github.com/prometheus/client_golang v1.14.0
github.com/testcontainers/testcontainers-go v0.27.0
github.com/urfave/cli/v2 v2.27.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ github.com/primevprotocol/contracts-abi v0.2.4-0.20240401131709-dcd3b451314a h1:
github.com/primevprotocol/contracts-abi v0.2.4-0.20240401131709-dcd3b451314a/go.mod h1:dE2KkvEqC+itvPa3SCrqQfvH5Hfnfn6omNRwWDTdIp8=
github.com/primevprotocol/contracts-abi v0.2.4-0.20240419134844-6dd1a8c7bf60 h1:FEYkczFrI/CwTZRm0wARuWshpn185BEw4uFAKxlqQBg=
github.com/primevprotocol/contracts-abi v0.2.4-0.20240419134844-6dd1a8c7bf60/go.mod h1:dE2KkvEqC+itvPa3SCrqQfvH5Hfnfn6omNRwWDTdIp8=
github.com/primevprotocol/contracts-abi v0.2.4-0.20240423171419-a959d3727058 h1:IG9XeHGs8/S9tW/4dfLosOa6NL0LGODp+FvWVIWNIBE=
github.com/primevprotocol/contracts-abi v0.2.4-0.20240423171419-a959d3727058/go.mod h1:dE2KkvEqC+itvPa3SCrqQfvH5Hfnfn6omNRwWDTdIp8=
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiserver/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (s *Service) configureDashboard() error {

existing = append(existing, &BidderAllowance{
Bidder: upd.Bidder.Hex(),
Allowance: upd.PrepaidAmount.String(),
Allowance: upd.DepositedAmount.String(),
})
_ = s.bidderAllowances.Add(upd.WindowNumber.Uint64(), existing)
return nil
Expand Down
32 changes: 16 additions & 16 deletions pkg/events/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func TestEventHandler(t *testing.T) {
t.Parallel()

b := bidderregistry.BidderregistryBidderRegistered{
Bidder: common.HexToAddress("0xabcd"),
PrepaidAmount: big.NewInt(1000),
WindowNumber: big.NewInt(99),
Bidder: common.HexToAddress("0xabcd"),
DepositedAmount: big.NewInt(1000),
WindowNumber: big.NewInt(99),
}

evtHdlr := events.NewEventHandler(
Expand All @@ -34,8 +34,8 @@ func TestEventHandler(t *testing.T) {
if ev.Bidder.Hex() != b.Bidder.Hex() {
return fmt.Errorf("expected bidder %s, got %s", b.Bidder.Hex(), ev.Bidder.Hex())
}
if ev.PrepaidAmount.Cmp(b.PrepaidAmount) != 0 {
return fmt.Errorf("expected prepaid amount %d, got %d", b.PrepaidAmount, ev.PrepaidAmount)
if ev.DepositedAmount.Cmp(b.DepositedAmount) != 0 {
return fmt.Errorf("expected prepaid amount %d, got %d", b.DepositedAmount, ev.DepositedAmount)
}
if ev.WindowNumber.Cmp(b.WindowNumber) != 0 {
return fmt.Errorf("expected window number %d, got %d", b.WindowNumber, ev.WindowNumber)
Expand All @@ -62,7 +62,7 @@ func TestEventHandler(t *testing.T) {
}

buf, err := event.Inputs.NonIndexed().Pack(
b.PrepaidAmount,
b.DepositedAmount,
b.WindowNumber,
)
if err != nil {
Expand Down Expand Up @@ -90,14 +90,14 @@ func TestEventManager(t *testing.T) {

bidders := []bidderregistry.BidderregistryBidderRegistered{
{
Bidder: common.HexToAddress("0xabcd"),
PrepaidAmount: big.NewInt(1000),
WindowNumber: big.NewInt(99),
Bidder: common.HexToAddress("0xabcd"),
DepositedAmount: big.NewInt(1000),
WindowNumber: big.NewInt(99),
},
{
Bidder: common.HexToAddress("0xcdef"),
PrepaidAmount: big.NewInt(2000),
WindowNumber: big.NewInt(100),
Bidder: common.HexToAddress("0xcdef"),
DepositedAmount: big.NewInt(2000),
WindowNumber: big.NewInt(100),
},
}

Expand All @@ -115,8 +115,8 @@ func TestEventManager(t *testing.T) {
if ev.Bidder.Hex() != bidders[count].Bidder.Hex() {
return fmt.Errorf("expected bidder %s, got %s", bidders[count].Bidder.Hex(), ev.Bidder.Hex())
}
if ev.PrepaidAmount.Cmp(bidders[count].PrepaidAmount) != 0 {
return fmt.Errorf("expected prepaid amount %d, got %d", bidders[count].PrepaidAmount, ev.PrepaidAmount)
if ev.DepositedAmount.Cmp(bidders[count].DepositedAmount) != 0 {
return fmt.Errorf("expected prepaid amount %d, got %d", bidders[count].DepositedAmount, ev.DepositedAmount)
}
if ev.WindowNumber.Cmp(bidders[count].WindowNumber) != 0 {
return fmt.Errorf("expected window number %d, got %d", bidders[count].WindowNumber, ev.WindowNumber)
Expand All @@ -137,15 +137,15 @@ func TestEventManager(t *testing.T) {
}

data1, err := bidderABI.Events["BidderRegistered"].Inputs.NonIndexed().Pack(
bidders[0].PrepaidAmount,
bidders[0].DepositedAmount,
bidders[0].WindowNumber,
)
if err != nil {
t.Fatal(err)
}

data2, err := bidderABI.Events["BidderRegistered"].Inputs.NonIndexed().Pack(
bidders[1].PrepaidAmount,
bidders[1].DepositedAmount,
bidders[1].WindowNumber,
)
if err != nil {
Expand Down

0 comments on commit 7485fbf

Please sign in to comment.