diff --git a/src/factories/NFTFactory.ts b/src/factories/NFTFactory.ts index d01b207e..c0c28402 100644 --- a/src/factories/NFTFactory.ts +++ b/src/factories/NFTFactory.ts @@ -11,7 +11,8 @@ import { getErcCreationParams, getPoolCreationParams, configHelperNetworks, - setContractDefaults + setContractDefaults, + ZERO_ADDRESS } from '../utils' import { Config } from '../models/index.js' import { @@ -45,7 +46,6 @@ export interface NftCreateData { owner: string } -const addressZERO = '0x0000000000000000000000000000000000000000' /** * Provides an interface for NFT Factory contract */ @@ -94,8 +94,8 @@ export class NftFactory { nftData.name, nftData.symbol, nftData.templateIndex, - addressZERO, - addressZERO, + ZERO_ADDRESS, + ZERO_ADDRESS, nftData.tokenURI, nftData.transferable, nftData.owner @@ -139,8 +139,8 @@ export class NftFactory { nftData.name, nftData.symbol, nftData.templateIndex, - addressZERO, - addressZERO, + ZERO_ADDRESS, + ZERO_ADDRESS, nftData.tokenURI, nftData.transferable, nftData.owner @@ -278,7 +278,7 @@ export class NftFactory { if ((await this.getOwner()) !== address) { throw new Error(`Caller is not Factory Owner`) } - if (templateAddress === addressZERO) { + if (templateAddress === ZERO_ADDRESS) { throw new Error(`Template cannot be ZERO address`) } @@ -445,7 +445,7 @@ export class NftFactory { if ((await this.getOwner()) !== address) { throw new Error(`Caller is not Factory Owner`) } - if (templateAddress === addressZERO) { + if (templateAddress === ZERO_ADDRESS) { throw new Error(`Template cannot be address ZERO`) } diff --git a/src/pools/fixedRate/FixedRateExchange.ts b/src/pools/fixedRate/FixedRateExchange.ts index 5104789c..90e2bab9 100644 --- a/src/pools/fixedRate/FixedRateExchange.ts +++ b/src/pools/fixedRate/FixedRateExchange.ts @@ -9,7 +9,8 @@ import { configHelperNetworks, setContractDefaults, amountToUnits, - unitsToAmount + unitsToAmount, + ZERO_ADDRESS } from '../../utils' import { Config } from '../../models/index.js' import { PriceAndFees } from '../..' @@ -164,7 +165,7 @@ export class FixedRateExchange { exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string, - consumeMarketAddress: string = '0x0000000000000000000000000000000000000000', + consumeMarketAddress: string = ZERO_ADDRESS, consumeMarketFee: string = '0' ): Promise { const exchange = await this.getExchange(exchangeId) @@ -260,7 +261,7 @@ export class FixedRateExchange { exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string, - consumeMarketAddress: string = '0x0000000000000000000000000000000000000000', + consumeMarketAddress: string = ZERO_ADDRESS, consumeMarketFee: string = '0' ): Promise { const exchange = await this.getExchange(exchangeId) diff --git a/src/tokens/Datatoken.ts b/src/tokens/Datatoken.ts index b63e911c..4b0e9aed 100644 --- a/src/tokens/Datatoken.ts +++ b/src/tokens/Datatoken.ts @@ -10,7 +10,8 @@ import { getFairGasPrice, setContractDefaults, configHelperNetworks, - getFreOrderParams + getFreOrderParams, + ZERO_ADDRESS } from '../utils' import { ConsumeMarketFee, @@ -206,8 +207,7 @@ export class Datatoken { const gasLimitDefault = this.GASLIMIT_DEFAULT - if (!fixedRateParams.allowedConsumer) - fixedRateParams.allowedConsumer = '0x0000000000000000000000000000000000000000' + if (!fixedRateParams.allowedConsumer) fixedRateParams.allowedConsumer = ZERO_ADDRESS const withMint = fixedRateParams.withMint ? 1 : 0 let estGas @@ -257,8 +257,7 @@ export class Datatoken { if (!(await this.isERC20Deployer(dtAddress, address))) { throw new Error(`User is not ERC20 Deployer`) } - if (!fixedRateParams.allowedConsumer) - fixedRateParams.allowedConsumer = '0x0000000000000000000000000000000000000000' + if (!fixedRateParams.allowedConsumer) fixedRateParams.allowedConsumer = ZERO_ADDRESS const withMint = fixedRateParams.withMint ? 1 : 0 @@ -320,8 +319,7 @@ export class Datatoken { this.config ) - if (!dispenserParams.allowedSwapper) - dispenserParams.allowedSwapper = '0x0000000000000000000000000000000000000000' + if (!dispenserParams.allowedSwapper) dispenserParams.allowedSwapper = ZERO_ADDRESS if (!dispenserParams.withMint) dispenserParams.withMint = false @@ -367,8 +365,7 @@ export class Datatoken { this.config ) - if (!dispenserParams.allowedSwapper) - dispenserParams.allowedSwapper = '0x0000000000000000000000000000000000000000' + if (!dispenserParams.allowedSwapper) dispenserParams.allowedSwapper = ZERO_ADDRESS if (!dispenserParams.withMint) dispenserParams.withMint = false @@ -975,8 +972,8 @@ export class Datatoken { ) if (!consumeMarketFee) { consumeMarketFee = { - consumeMarketFeeAddress: '0x0000000000000000000000000000000000000000', - consumeMarketFeeToken: '0x0000000000000000000000000000000000000000', + consumeMarketFeeAddress: ZERO_ADDRESS, + consumeMarketFeeToken: ZERO_ADDRESS, consumeMarketFeeAmount: '0' } } diff --git a/src/utils/ContractUtils.ts b/src/utils/ContractUtils.ts index 139791dd..827cd13d 100644 --- a/src/utils/ContractUtils.ts +++ b/src/utils/ContractUtils.ts @@ -11,6 +11,7 @@ import { import { Config } from '../models' import { minAbi } from './minAbi' import LoggerInstance from './Logger' +import { ZERO_ADDRESS } from './Constants' export function setContractDefaults(contract: Contract, config: Config): Contract { if (config) { @@ -65,8 +66,7 @@ export function getFreOrderParams(freParams: FreOrderParams): any { } export function getFreCreationParams(freParams: FreCreationParams): any { - if (!freParams.allowedConsumer) - freParams.allowedConsumer = '0x0000000000000000000000000000000000000000' + if (!freParams.allowedConsumer) freParams.allowedConsumer = ZERO_ADDRESS const withMint = freParams.withMint ? 1 : 0 return {