mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
use ZERO_ADDRESS constant
This commit is contained in:
parent
b3e3cdce7f
commit
ea74e4fc38
@ -12,7 +12,8 @@ import {
|
||||
getPoolCreationParams,
|
||||
configHelperNetworks,
|
||||
setContractDefaults,
|
||||
estimateGas
|
||||
estimateGas,
|
||||
ZERO_ADDRESS
|
||||
} from '../utils'
|
||||
import { Config } from '../models/index.js'
|
||||
import {
|
||||
@ -46,7 +47,6 @@ export interface NftCreateData {
|
||||
owner: string
|
||||
}
|
||||
|
||||
const addressZERO = '0x0000000000000000000000000000000000000000'
|
||||
/**
|
||||
* Provides an interface for NFT Factory contract
|
||||
*/
|
||||
@ -92,8 +92,8 @@ export class NftFactory {
|
||||
nftData.name,
|
||||
nftData.symbol,
|
||||
nftData.templateIndex,
|
||||
addressZERO,
|
||||
addressZERO,
|
||||
ZERO_ADDRESS,
|
||||
ZERO_ADDRESS,
|
||||
nftData.tokenURI
|
||||
)
|
||||
}
|
||||
@ -128,8 +128,8 @@ export class NftFactory {
|
||||
nftData.name,
|
||||
nftData.symbol,
|
||||
nftData.templateIndex,
|
||||
addressZERO,
|
||||
addressZERO,
|
||||
ZERO_ADDRESS,
|
||||
ZERO_ADDRESS,
|
||||
nftData.tokenURI
|
||||
)
|
||||
|
||||
@ -139,8 +139,8 @@ export class NftFactory {
|
||||
nftData.name,
|
||||
nftData.symbol,
|
||||
nftData.templateIndex,
|
||||
addressZERO,
|
||||
addressZERO,
|
||||
ZERO_ADDRESS,
|
||||
ZERO_ADDRESS,
|
||||
nftData.tokenURI
|
||||
)
|
||||
.send({
|
||||
@ -271,7 +271,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`)
|
||||
}
|
||||
|
||||
@ -430,7 +430,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`)
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,8 @@ import {
|
||||
setContractDefaults,
|
||||
amountToUnits,
|
||||
unitsToAmount,
|
||||
estimateGas
|
||||
estimateGas,
|
||||
ZERO_ADDRESS
|
||||
} from '../../utils'
|
||||
import { Config } from '../../models/index.js'
|
||||
import { PriceAndFees } from '../..'
|
||||
@ -158,7 +159,7 @@ export class FixedRateExchange {
|
||||
exchangeId: string,
|
||||
datatokenAmount: string,
|
||||
maxBaseTokenAmount: string,
|
||||
consumeMarketAddress: string = '0x0000000000000000000000000000000000000000',
|
||||
consumeMarketAddress: string = ZERO_ADDRESS,
|
||||
consumeMarketFee: string = '0'
|
||||
): Promise<TransactionReceipt> {
|
||||
const exchange = await this.getExchange(exchangeId)
|
||||
@ -249,7 +250,7 @@ export class FixedRateExchange {
|
||||
exchangeId: string,
|
||||
datatokenAmount: string,
|
||||
minBaseTokenAmount: string,
|
||||
consumeMarketAddress: string = '0x0000000000000000000000000000000000000000',
|
||||
consumeMarketAddress: string = ZERO_ADDRESS,
|
||||
consumeMarketFee: string = '0'
|
||||
): Promise<TransactionReceipt> {
|
||||
const exchange = await this.getExchange(exchangeId)
|
||||
|
@ -11,7 +11,8 @@ import {
|
||||
setContractDefaults,
|
||||
configHelperNetworks,
|
||||
getFreOrderParams,
|
||||
estimateGas
|
||||
estimateGas,
|
||||
ZERO_ADDRESS
|
||||
} from '../utils'
|
||||
import {
|
||||
ConsumeMarketFee,
|
||||
@ -193,8 +194,7 @@ export class Datatoken {
|
||||
this.config
|
||||
)
|
||||
|
||||
if (!fixedRateParams.allowedConsumer)
|
||||
fixedRateParams.allowedConsumer = '0x0000000000000000000000000000000000000000'
|
||||
if (!fixedRateParams.allowedConsumer) fixedRateParams.allowedConsumer = ZERO_ADDRESS
|
||||
const withMint = fixedRateParams.withMint ? 1 : 0
|
||||
|
||||
return estimateGas(
|
||||
@ -237,8 +237,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
|
||||
|
||||
@ -312,8 +311,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
|
||||
|
||||
@ -351,8 +349,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
|
||||
|
||||
@ -894,8 +891,8 @@ export class Datatoken {
|
||||
)
|
||||
if (!consumeMarketFee) {
|
||||
consumeMarketFee = {
|
||||
consumeMarketFeeAddress: '0x0000000000000000000000000000000000000000',
|
||||
consumeMarketFeeToken: '0x0000000000000000000000000000000000000000',
|
||||
consumeMarketFeeAddress: ZERO_ADDRESS,
|
||||
consumeMarketFeeToken: ZERO_ADDRESS,
|
||||
consumeMarketFeeAmount: '0'
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
import { Config } from '../models'
|
||||
import { minAbi } from './minAbi'
|
||||
import LoggerInstance from './Logger'
|
||||
import { GASLIMIT_DEFAULT } from './Constants'
|
||||
import { GASLIMIT_DEFAULT, ZERO_ADDRESS } from './Constants'
|
||||
|
||||
export function setContractDefaults(contract: Contract, config: Config): Contract {
|
||||
if (config) {
|
||||
@ -66,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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user