synapsecns/sanguine

View on GitHub

Showing 1,971 of 13,422 total issues

Function useEthereumWallet has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const useEthereumWallet = () => {
  const [connectedAddress, setConnectedAddress] = useState<string>('')
  const [web3Provider, setWeb3Provider] = useState<any>(null)
  const [connectedNetwork, setConnectedNetwork] = useState<Network | null>()

Severity: Minor
Found in packages/widget/examples/with-next/app/hooks/useEthereumWallet.tsx - About 1 hr to fix

    Function useEthereumWallet has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useEthereumWallet = () => {
      const [connectedAddress, setConnectedAddress] = useState<string>('')
      const [web3Provider, setWeb3Provider] = useState<any>(null)
      const [connectedNetwork, setConnectedNetwork] = useState<Network | null>()
    
    

      Function ResourcesSection has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function ResourcesSection() {
        const t = useTranslations('Landing.ResourcesSection')
        return (
          <SectionContainer
            dataTestId="landing-resources-section"

        Function useMaintenance has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const useMaintenance = () => {
          const { originChainId, destinationChainId } = useBridgeState()
          const { pausedChainsList, pausedModulesList } = getMaintenanceData()
        
          const activePause = pausedChainsList.find(
        Severity: Minor
        Found in packages/widget/src/components/Maintenance/Maintenance.tsx - About 1 hr to fix

          Method queryResolver.AddressData has 14 return statements (exceeds 4 allowed).
          Open

          func (r *queryResolver) AddressData(ctx context.Context, address string) (*model.AddressData, error) {
              bridgeQuery := fmt.Sprintf("SELECT toFloat64(sumKahan(famount_usd)) AS volumeTotal, toFloat64(sumKahan(tfee_amount_usd)) AS feeTotal, toInt64(uniq(fchain_id, ftx_hash)) AS txTotal FROM (SELECT * FROM mv_bridge_events where fsender = '%s' LIMIT 1 BY fchain_id,fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash)", address)
              swapQuery := fmt.Sprintf("SELECT toFloat64(sumKahan(multiIf(event_type = 0, amount_usd[sold_id], event_type = 1, arraySum(mapValues(amount_usd)), event_type = 9, arraySum(mapValues(amount_usd)), event_type = 10, amount_usd[sold_id],0))) AS volumeTotal, toFloat64(sumKahan(arraySum(mapValues(fee_usd)))) AS feeTotal,  toInt64(uniq(chain_id, tx_hash)) AS txTotal FROM (SELECT * FROM swap_events where sender = '%s' LIMIT 1 BY chain_id, contract_address, event_type, block_number, event_index, tx_hash)", address)
              rankingQuery := fmt.Sprintf("select rowNumber from (select sender, row_number() over (order by sumTotal desc ) as rowNumber from (select fsender as sender, sumKahan(famount_usd) as sumTotal from (SELECT * FROM mv_bridge_events where fsender != '' LIMIT 1 BY fchain_id, fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash) where fsender != '' group by fsender)) where sender = '%s'", address)
              firstTx := fmt.Sprintf("SELECT min(ftimestamp) AS earliestTime FROM (SELECT * FROM mv_bridge_events where fsender = '%s' LIMIT 1 BY fchain_id,fcontract_address, fevent_type, fblock_number, fevent_index, ftx_hash)", address)
          Severity: Major
          Found in services/explorer/graphql/server/graph/queries.resolvers.go - About 1 hr to fix

            Method MessageBusParser.Parse has 14 return statements (exceeds 4 allowed).
            Open

            func (m *MessageBusParser) Parse(ctx context.Context, log ethTypes.Log, chainID uint32) (interface{}, error) {
                logTopic := log.Topics[0]
                iFace, err := func(log ethTypes.Log) (messageBusTypes.EventLog, error) {
                    switch logTopic {
                    case messagebus.Topic(messageBusTypes.ExecutedEvent):
            Severity: Major
            Found in services/explorer/consumer/parser/messagebusparser.go - About 1 hr to fix

              Method Indexer.store has 14 return statements (exceeds 4 allowed).
              Open

              func (x *Indexer) store(parentCtx context.Context, log types.Log) (err error) {
                  ctx, span := x.handler.Tracer().Start(parentCtx, "store", trace.WithAttributes(
                      attribute.String("contract", x.addressesToString(x.indexerConfig.Addresses)),
                      attribute.String("tx", log.TxHash.Hex()),
                      attribute.String("block", fmt.Sprintf("%d", log.BlockNumber)),
              Severity: Major
              Found in services/scribe/service/indexer/indexer.go - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                      if (
                        originChainSelect &&
                        destinationChainSelect &&
                        originTokenSelect &&
                        destinationTokenSelect
                Severity: Critical
                Found in packages/widget/src/hooks/useBridgeSelectionData.ts - About 1 hr to fix

                  Method Bot.rfqLookupCommand has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (b *Bot) rfqLookupCommand() *slacker.CommandDefinition {
                      return &slacker.CommandDefinition{
                          Command:     "rfq <tx>",
                          Description: "find a rfq transaction by either tx hash or txid from the rfq-indexer api",
                          Examples: []string{
                  Severity: Minor
                  Found in contrib/opbot/botmd/commands.go - About 1 hr to fix

                    Method Notary.shouldNotaryRegisteredOnDestination has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (n *Notary) shouldNotaryRegisteredOnDestination(parentCtx context.Context) (bool, bool) {
                        ctx, span := n.handler.Tracer().Start(parentCtx, "shouldNotaryRegisteredOnDestination", trace.WithAttributes(
                            attribute.Int(metrics.ChainID, int(n.destinationDomain.Config().DomainID)),
                        ))
                        defer span.End()
                    Severity: Minor
                    Found in agents/agents/notary/notary.go - About 1 hr to fix

                      Method rebalanceManagerCircleCCTP.Execute has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (c *rebalanceManagerCircleCCTP) Execute(parentCtx context.Context, rebalance *RebalanceData) (err error) {
                          ctx, span := c.handler.Tracer().Start(parentCtx, "rebalance.Execute", trace.WithAttributes(
                              attribute.Int("rebalance_origin", rebalance.OriginMetadata.ChainID),
                              attribute.Int("rebalance_dest", rebalance.DestMetadata.ChainID),
                              attribute.String("rebalance_amount", rebalance.Amount.String()),
                      Severity: Minor
                      Found in services/rfq/relayer/inventory/circle.go - About 1 hr to fix

                        Method BackfillSuite.redeemAndRemoveParity has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (b *BackfillSuite) redeemAndRemoveParity(log *types.Log, parser *parser.BridgeParser, chainID uint32, useV1 bool) error {
                            // parse the log
                            if useV1 {
                                parsedLog, err := parser.Filterer.ParseTokenRedeemAndRemove(*log)
                                if err != nil {
                        Severity: Minor
                        Found in services/explorer/backfill/chain_test.go - About 1 hr to fix

                          Method APISuite.TestRetrieveData has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (g APISuite) TestRetrieveData() {
                              contractAddressA := common.BigToAddress(big.NewInt(gofakeit.Int64()))
                              contractAddressB := common.BigToAddress(big.NewInt(gofakeit.Int64()))
                              chainID := uint32(1)
                          
                          
                          Severity: Minor
                          Found in services/scribe/api/data_test.go - About 1 hr to fix

                            Function pendingTransactionsMissingClaimController has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const pendingTransactionsMissingClaimController = async (
                              req: Request,
                              res: Response
                            ) => {
                              try {

                              Function useTransactionListener has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const useTransactionListener = () => {
                                const dispatch = useAppDispatch()
                                const {
                                  txHash,
                                  originAmount,
                              Severity: Minor
                              Found in packages/widget/src/hooks/useTransactionListener.ts - About 1 hr to fix

                                Function TokenAndChainCustomization has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const TokenAndChainCustomization = () => {
                                  return (
                                    <>
                                      <p>
                                        While the Synapse Widget supports <a href="https://synapseprotocol.com" target="_blank" rel="noreferrer">hundreds of tokens and chains</a>, you can instruct the Bridge to prioritize routes to your project for a streamlined experience.

                                  Function getMaintenanceData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const getMaintenanceData = () => {
                                    const { pausedChainsData, pausedModulesData } = getSynapsePauseData()
                                  
                                    const pausedChainsList: ChainPause[] = pausedChainsData
                                      ? pausedChainsData?.map((pause: ChainPause) => {
                                  Severity: Minor
                                  Found in packages/widget/src/components/Maintenance/Maintenance.tsx - About 1 hr to fix

                                    Function compileSolidity has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                                    Open

                                    func compileSolidity(version string, filePath string, optimizeRuns int, evmVersion *string) (map[string]*compiler.Contract, error) {
                                        runFile, err := createRunFile(version)
                                        if err != nil {
                                            return nil, err
                                        }
                                    Severity: Minor
                                    Found in tools/abigen/internal/generate.go - About 1 hr to fix

                                      Method DBSuite.TestGetPotentialSnapshotRoots has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                                      Open

                                      func (t *DBSuite) TestGetPotentialSnapshotRoots() {
                                          t.RunOnAllDBs(func(testDB db.ExecutorDB) {
                                              origin := gofakeit.Uint32()
                                              nonceA := uint32(5)
                                              nonceB := uint32(10)
                                      Severity: Minor
                                      Found in agents/agents/executor/db/state_test.go - About 1 hr to fix

                                        Method Manager.prepareAndSubmitQuotes has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                                        Open

                                        func (m *Manager) prepareAndSubmitQuotes(ctx context.Context, inv map[int]map[common.Address]*big.Int) (err error) {
                                            ctx, span := m.metricsHandler.Tracer().Start(ctx, "prepareAndSubmitQuotes")
                                            defer func() {
                                                span.SetAttributes(attribute.Bool("relay_paused", m.relayPaused.Load()))
                                                metrics.EndSpanWithErr(span, err)
                                        Severity: Minor
                                        Found in services/rfq/relayer/quoter/quoter.go - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language