oceanprotocol/ocean.js

View on GitHub
src/contracts/FixedRateExchange.ts

Summary

Maintainability
F
2 wks
Test Coverage
A
95%

File FixedRateExchange.ts has 488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import FixedRateExchangeAbi from '@oceanprotocol/contracts/artifacts/contracts/pools/fixedRate/FixedRateExchange.sol/FixedRateExchange.json'
import { sendTx, ZERO_ADDRESS } from '../utils'
import {
  PriceAndFees,
  FeesInfo,
Severity: Minor
Found in src/contracts/FixedRateExchange.ts - About 7 hrs to fix

    FixedRateExchange has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class FixedRateExchange extends SmartContractWithAddress {
      getDefaultAbi() {
        return FixedRateExchangeAbi.abi as AbiItem[]
      }
    
    
    Severity: Minor
    Found in src/contracts/FixedRateExchange.ts - About 3 hrs to fix

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

        public async getExchange(exchangeId: string): Promise<FixedPriceExchange> {
          const result: FixedPriceExchange = await this.contract.getExchange(exchangeId)
          const exchange: FixedPriceExchange = {
            active: result.active,
            datatoken: result.datatoken,
      Severity: Minor
      Found in src/contracts/FixedRateExchange.ts - About 1 hr to fix

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

          public async calcBaseInGivenDatatokensOut(
            exchangeId: string,
            datatokenAmount: string,
            consumeMarketFee: string = '0'
          ): Promise<PriceAndFees> {
        Severity: Minor
        Found in src/contracts/FixedRateExchange.ts - About 1 hr to fix

          Function buyDatatokens has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public async buyDatatokens<G extends boolean = false>(
              exchangeId: string,
              datatokenAmount: string,
              maxBaseTokenAmount: string,
              consumeMarketAddress: string = ZERO_ADDRESS,
          Severity: Minor
          Found in src/contracts/FixedRateExchange.ts - About 1 hr to fix

            Function sellDatatokens has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public async sellDatatokens<G extends boolean = false>(
                exchangeId: string,
                datatokenAmount: string,
                minBaseTokenAmount: string,
                consumeMarketAddress: string = ZERO_ADDRESS,
            Severity: Minor
            Found in src/contracts/FixedRateExchange.ts - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async sellDatatokens<G extends boolean = false>(
                  exchangeId: string,
                  datatokenAmount: string,
                  minBaseTokenAmount: string,
                  consumeMarketAddress: string = ZERO_ADDRESS,
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 1 day to fix
              src/contracts/FixedRateExchange.ts on lines 38..80

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 281.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async buyDatatokens<G extends boolean = false>(
                  exchangeId: string,
                  datatokenAmount: string,
                  maxBaseTokenAmount: string,
                  consumeMarketAddress: string = ZERO_ADDRESS,
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 1 day to fix
              src/contracts/FixedRateExchange.ts on lines 92..132

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 281.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async collectBasetokens<G extends boolean = false>(
                  exchangeId: string,
                  amount: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 1 day to fix
              src/contracts/FixedRateExchange.ts on lines 546..572

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 240.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async collectDatatokens<G extends boolean = false>(
                  exchangeId: string,
                  amount: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 1 day to fix
              src/contracts/FixedRateExchange.ts on lines 511..537

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 240.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async activateMint<G extends boolean = false>(
                  exchangeId: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
                  const exchange = await this.getExchange(exchangeId)
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 7 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 483..502

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 194.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async deactivateMint<G extends boolean = false>(
                  exchangeId: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
                  const exchange = await this.getExchange(exchangeId)
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 7 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 456..475

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 194.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async deactivate<G extends boolean = false>(
                  exchangeId: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
                  const exchange = await this.getExchange(exchangeId)
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 7 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 206..223

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 192.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async activate<G extends boolean = false>(
                  exchangeId: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
                  const exchange = await this.getExchange(exchangeId)
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 7 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 231..249

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 192.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async updateMarketFee<G extends boolean = false>(
                  exchangeId: string,
                  newMarketFee: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 7 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 150..170

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 182.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async setRate<G extends boolean = false>(
                  exchangeId: string,
                  newRate: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 7 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 661..681

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 182.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async collectMarketFee<G extends boolean = false>(
                  exchangeId: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
                  const exchange = await this.getExchange(exchangeId)
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 7 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 606..624

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 177.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async collectOceanFee<G extends boolean = false>(
                  exchangeId: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
                  const exchange = await this.getExchange(exchangeId)
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 7 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 580..598

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 177.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                public async setAllowedSwapper<G extends boolean = false>(
                  exchangeId: string,
                  newAllowedSwapper: string,
                  estimateGas?: G
                ): Promise<ReceiptOrEstimate<G>> {
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 2 other locations - About 6 hrs to fix
              src/contracts/AccessList.ts on lines 92..108
              src/contracts/Dispenser.ts on lines 140..159

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 158.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async getDatatokenSupply(exchangeId: string): Promise<string> {
                  const dtSupply = await this.contract.getDTSupply(exchangeId)
                  const exchange = await this.getExchange(exchangeId)
                  return await this.unitsToAmount(exchange.datatoken, dtSupply, +exchange.dtDecimals)
                }
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 2 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 277..281

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 90.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async getBasetokenSupply(exchangeId: string): Promise<string> {
                  const btSupply = await this.contract.getBTSupply(exchangeId)
                  const exchange = await this.getExchange(exchangeId)
                  return await this.unitsToAmount(exchange.baseToken, btSupply, +exchange.btDecimals)
                }
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 2 hrs to fix
              src/contracts/FixedRateExchange.ts on lines 266..270

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 90.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                public async getRate(exchangeId: string): Promise<string> {
                  const weiRate = await this.contract.getRate(exchangeId)
                  return await this.unitsToAmount(null, weiRate, 18)
                }
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 1 hr to fix
              src/contracts/AccessList.ts on lines 80..83

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  const outDT = await this.contract.calcBaseInGivenOutDT(
                    exchangeId,
                    await this.amountToUnits(
                      fixedRateExchange.datatoken,
                      datatokenAmount,
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 1 hr to fix
              src/contracts/FixedRateExchange.ts on lines 352..356

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 57.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  const amount = await this.contract.calcBaseOutGivenInDT(
                    exchangeId,
                    await this.amountToUnits(exchange.datatoken, datatokenAmount, +exchange.dtDecimals),
                    await this.amountToUnits(null, consumeMarketFee, 18)
                  )
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 1 other location - About 1 hr to fix
              src/contracts/FixedRateExchange.ts on lines 305..313

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 57.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                public async isActive(exchangeId: string): Promise<boolean> {
                  const active = await this.contract.isActive(exchangeId)
                  return active
                }
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 2 other locations - About 50 mins to fix
              src/contracts/AccessListFactory.ts on lines 110..113
              src/contracts/AccessListFactory.ts on lines 120..123

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 51.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                public async getRouter(): Promise<string> {
                  const address = await this.contract.router()
                  return address
                }
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 3 other locations - About 30 mins to fix
              src/contracts/AccessListFactory.ts on lines 100..103
              src/contracts/FixedRateExchange.ts on lines 630..633
              src/contracts/NFTFactory.ts on lines 122..125

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                public async getNumberOfExchanges(): Promise<number> {
                  const numExchanges = await this.contract.getNumberOfExchanges()
                  return numExchanges
                }
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 4 other locations - About 30 mins to fix
              src/contracts/NFTFactory.ts on lines 104..107
              src/contracts/NFTFactory.ts on lines 113..116
              src/contracts/NFTFactory.ts on lines 131..134
              src/contracts/NFTFactory.ts on lines 140..143

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                async getOPCCollector(): Promise<string> {
                  const address = await this.contract.opcCollector()
                  return address
                }
              Severity: Major
              Found in src/contracts/FixedRateExchange.ts and 3 other locations - About 30 mins to fix
              src/contracts/AccessListFactory.ts on lines 100..103
              src/contracts/FixedRateExchange.ts on lines 639..642
              src/contracts/NFTFactory.ts on lines 122..125

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status