Skip to content

Commit

Permalink
Update deps and aggregator resources
Browse files Browse the repository at this point in the history
  • Loading branch information
violog committed Feb 23, 2023
1 parent b738914 commit abe4d86
Show file tree
Hide file tree
Showing 20 changed files with 161 additions and 70 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/Swapica/indexer-svc
go 1.19

require (
github.com/Swapica/order-aggregator-svc v0.0.0-20230216133821-90bc2f97f60d
github.com/Swapica/order-aggregator-svc v0.0.0-20230223111550-c21489f844fa
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/ethereum/go-ethereum v1.10.26
gitlab.com/distributed_lab/figure/v3 v3.1.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ github.com/Masterminds/squirrel v1.4.0/go.mod h1:yaPeOnPG5ZRwL9oKdTsO/prlkPbXWZl
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/Swapica/order-aggregator-svc v0.0.0-20230216133821-90bc2f97f60d h1:JPgg2UCQp3NCheE7NXGFcxtPEgO3HzgutJIM/p/1pw0=
github.com/Swapica/order-aggregator-svc v0.0.0-20230216133821-90bc2f97f60d/go.mod h1:DpHbDXMoAAygZD0L91fCHN7DtFKjz9qcUZlQL09VkjU=
github.com/Swapica/order-aggregator-svc v0.0.0-20230223111550-c21489f844fa h1:knM8F0PQ2wcdSog3yQjqDr29qkdVdqWjQh30g2otpW4=
github.com/Swapica/order-aggregator-svc v0.0.0-20230223111550-c21489f844fa/go.mod h1:DpHbDXMoAAygZD0L91fCHN7DtFKjz9qcUZlQL09VkjU=
github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/alecthomas/kingpin v2.2.6+incompatible h1:5svnBTFgJjZvGKyYBtMB0+m5wvrbUHiqye8wRJMlnYI=
Expand Down
22 changes: 9 additions & 13 deletions internal/service/requests/add_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,21 @@ import (
"github.com/Swapica/order-aggregator-svc/resources"
)

func NewAddMatch(mo gobind.ISwapicaMatch, chainID int64) resources.AddMatchRequest {
matchId := mo.MatchId.Int64()
originChain := mo.OriginChainId.Int64()
originOrder := mo.OriginOrderId.Int64()

func NewAddMatch(m gobind.ISwapicaMatch, chainID int64) resources.AddMatchRequest {
return resources.AddMatchRequest{
Data: resources.AddMatch{
Key: resources.Key{
Type: resources.MATCH_ORDER,
},
Attributes: resources.AddMatchAttributes{
AmountToSell: mo.AmountToSell.String(),
Creator: mo.Creator.String(),
MatchId: &matchId,
State: mo.State,
TokenToSell: mo.TokenToSell.String(),
OriginChainId: &originChain,
OriginOrderId: &originOrder,
SrcChainId: &chainID,
AmountToSell: m.AmountToSell.String(),
Creator: m.Creator.String(),
MatchId: m.MatchId.Int64(),
State: m.State,
TokenToSell: m.TokenToSell.String(),
OriginChainId: m.OriginChainId.Int64(),
OriginOrderId: m.OriginOrderId.Int64(),
SrcChainId: chainID,
},
},
}
Expand Down
9 changes: 3 additions & 6 deletions internal/service/requests/add_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import (
)

func NewAddOrder(o gobind.ISwapicaOrder, chainID int64) resources.AddOrderRequest {
orderId := o.OrderId.Int64()
destChain := o.DestinationChain.Int64()

return resources.AddOrderRequest{
Data: resources.AddOrder{
Key: resources.Key{
Expand All @@ -19,12 +16,12 @@ func NewAddOrder(o gobind.ISwapicaOrder, chainID int64) resources.AddOrderReques
AmountToSell: o.AmountToSell.String(),
Creator: o.Creator.String(),
MatchSwapica: nil, // must be nil by the Swapica contract
OrderId: &orderId,
OrderId: o.OrderId.Int64(),
State: o.Status.State,
TokenToBuy: o.TokenToBuy.String(),
TokenToSell: o.TokenToSell.String(),
DestChainId: &destChain,
SrcChainId: &chainID,
DestChainId: o.DestinationChain.Int64(),
SrcChainId: chainID,
},
},
}
Expand Down
15 changes: 5 additions & 10 deletions internal/service/requests/update_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ func NewUpdateOrder(id *big.Int, status gobind.ISwapicaOrderStatus) resources.Up
matchSwapica = &str
}

var rel *resources.UpdateOrderRelationships
if m := status.MatchId; m != nil && m.Int64() != 0 {
rel = &resources.UpdateOrderRelationships{
Match: &resources.Relation{
Data: &resources.Key{
ID: m.String(),
Type: resources.MATCH_ORDER,
},
}}
var matchId *int64
if mid := status.MatchId; mid != nil && mid.Int64() != 0 {
i := mid.Int64()
matchId = &i
}

return resources.UpdateOrderRequest{
Expand All @@ -33,10 +28,10 @@ func NewUpdateOrder(id *big.Int, status gobind.ISwapicaOrderStatus) resources.Up
Type: resources.ORDER,
},
Attributes: resources.UpdateOrderAttributes{
MatchId: matchId,
MatchSwapica: matchSwapica,
State: status.State,
},
Relationships: rel,
},
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit abe4d86

Please sign in to comment.