synapsecns/sanguine

View on GitHub
services/rfq/relayer/inventory/rebalance.go

Summary

Maintainability
A
3 hrs
Test Coverage

Function getRebalanceAmount has 73 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func getRebalanceAmount(ctx context.Context, cfg relconfig.Config, tokens map[int]map[common.Address]*TokenMetadata, rebalance *RebalanceData) (amount *big.Int, err error) {
    span := trace.SpanFromContext(ctx)

    // get the maintenance and initial values for the destination chain
    maintenancePctDest, err := cfg.GetMaintenanceBalancePct(rebalance.DestMetadata.ChainID, rebalance.DestMetadata.Addr.Hex())
Severity: Minor
Found in services/rfq/relayer/inventory/rebalance.go - About 1 hr to fix

    Function getRebalanceAmount has 9 return statements (exceeds 4 allowed).
    Open

    func getRebalanceAmount(ctx context.Context, cfg relconfig.Config, tokens map[int]map[common.Address]*TokenMetadata, rebalance *RebalanceData) (amount *big.Int, err error) {
        span := trace.SpanFromContext(ctx)
    
        // get the maintenance and initial values for the destination chain
        maintenancePctDest, err := cfg.GetMaintenanceBalancePct(rebalance.DestMetadata.ChainID, rebalance.DestMetadata.Addr.Hex())
    Severity: Major
    Found in services/rfq/relayer/inventory/rebalance.go - About 55 mins to fix

      Function getRebalanceForMethod has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func getRebalanceForMethod(ctx context.Context, cfg relconfig.Config, inv map[int]map[common.Address]*TokenMetadata, method relconfig.RebalanceMethod, tokenName string) (rebalance *RebalanceData, err error) {
      Severity: Minor
      Found in services/rfq/relayer/inventory/rebalance.go - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status