1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

add ERC20Deployer check, fix isERC20Deployer

This commit is contained in:
lacoop6tu 2021-12-14 12:39:48 -05:00
parent fed45acb55
commit a9b95d3c15

View File

@ -313,9 +313,9 @@ export class Nft {
): Promise<TransactionReceipt> { ): Promise<TransactionReceipt> {
const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress) const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress)
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) { if ((await this.getNftPermissions(nftAddress, address)).manager !== true) {
// throw new Error(`Caller is not Manager`) throw new Error(`Caller is not Manager`)
// } }
// Estimate gas for addToCreateERC20List method // Estimate gas for addToCreateERC20List method
const estGas = await this.estGasAddErc20Deployer( const estGas = await this.estGasAddErc20Deployer(
@ -381,10 +381,9 @@ export class Nft {
): Promise<TransactionReceipt> { ): Promise<TransactionReceipt> {
const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress) const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress)
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) { if ((await this.getNftPermissions(nftAddress, address)).manager !== true) {
// throw new Error(`Caller is not Manager`) throw new Error(`Caller is not Manager`)
// } }
const estGas = await this.estGasRemoveErc20Deployer( const estGas = await this.estGasRemoveErc20Deployer(
nftAddress, nftAddress,
address, address,
@ -447,9 +446,9 @@ export class Nft {
): Promise<TransactionReceipt> { ): Promise<TransactionReceipt> {
const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress) const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress)
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) { if ((await this.getNftPermissions(nftAddress, address)).manager !== true) {
// throw new Error(`Caller is not Manager`) throw new Error(`Caller is not Manager`)
// } }
const estGas = await this.estGasAddMetadataUpdater( const estGas = await this.estGasAddMetadataUpdater(
nftAddress, nftAddress,
@ -512,9 +511,10 @@ export class Nft {
): Promise<TransactionReceipt> { ): Promise<TransactionReceipt> {
const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress) const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress)
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
// throw new Error(`Caller is not Manager`) if ((await this.getNftPermissions(nftAddress, address)).manager !== true) {
// } throw new Error(`Caller is not Manager`)
}
const estGas = await this.esGasRemoveMetadataUpdater( const estGas = await this.esGasRemoveMetadataUpdater(
nftAddress, nftAddress,
@ -549,6 +549,10 @@ export class Nft {
storeUpdater: string, storeUpdater: string,
contractInstance?: Contract contractInstance?: Contract
): Promise<any> { ): Promise<any> {
if ((await this.getNftPermissions(nftAddress, address)).manager !== true) {
throw new Error(`Caller is not Manager`)
}
const nftContract = const nftContract =
contractInstance || new this.web3.eth.Contract(this.nftAbi, nftAddress) contractInstance || new this.web3.eth.Contract(this.nftAbi, nftAddress)
@ -578,9 +582,10 @@ export class Nft {
): Promise<TransactionReceipt> { ): Promise<TransactionReceipt> {
const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress) const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress)
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
// throw new Error(`Caller is not Manager`) if ((await this.getNftPermissions(nftAddress, address)).manager !== true) {
// } throw new Error(`Caller is not Manager`)
}
const estGas = await this.estGasAddStoreUpdater( const estGas = await this.estGasAddStoreUpdater(
nftAddress, nftAddress,
@ -642,9 +647,10 @@ export class Nft {
): Promise<TransactionReceipt> { ): Promise<TransactionReceipt> {
const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress) const nftContract = new this.web3.eth.Contract(this.nftAbi, nftAddress)
// if ((await this.getNFTPermissions(nftAddress, address)).manager !== true) {
// throw new Error(`Caller is not Manager`) if ((await this.getNftPermissions(nftAddress, address)).manager !== true) {
// } throw new Error(`Caller is not Manager`)
}
const estGas = await this.estGasRemoveStoreUpdater( const estGas = await this.estGasRemoveStoreUpdater(
nftAddress, nftAddress,
@ -898,7 +904,7 @@ export class Nft {
): Promise<any> { ): Promise<any> {
const nftContract = const nftContract =
contractInstance || new this.web3.eth.Contract(this.nftAbi, nftAddress) contractInstance || new this.web3.eth.Contract(this.nftAbi, nftAddress)
const gasLimitDefault = this.GASLIMIT_DEFAULT const gasLimitDefault = this.GASLIMIT_DEFAULT
let estGas let estGas
try { try {
@ -1050,7 +1056,6 @@ export class Nft {
/** Estimate gas for setTokenURI method /** Estimate gas for setTokenURI method
* @param {String} dtAddress Datatoken address * @param {String} dtAddress Datatoken address
* @param {String} address User address * @param {String} address User address
* @param {String} value Data to be stored into 725Y standard
* @param {Contract} contractInstance optional contract instance * @param {Contract} contractInstance optional contract instance
* @return {Promise<any>} * @return {Promise<any>}
*/ */