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

try another way, debug

This commit is contained in:
paulo-ocean 2024-09-09 12:06:04 +01:00
parent 36f1865175
commit df2d5dd054

View File

@ -20,8 +20,11 @@ import { ProviderInstance } from '../services/Provider'
import { HardhatEthersHelpers } from '@nomiclabs/hardhat-ethers/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import { getContractAtFromArtifact } from '@nomiclabs/hardhat-ethers/internal/helpers'
import hre from 'hardhat'
// eslint-disable-next-line import/no-named-default
import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json'
console.log('ABI', ERC20Template.abi)
const hardhatEthers = hre as HardhatRuntimeEnvironment & { ethers: any } & {
ethers: typeof ethers & HardhatEthersHelpers
@ -141,14 +144,19 @@ export async function calculateTemplateIndexV2(
console.log(tokenTemplate)
console.log('hardhatEthers', hardhatEthers)
const artifact = await hre.artifacts.readArtifact('ERC20Template')
const erc20Template = await getContractAtFromArtifact(
hre,
artifact,
// const artifact = await hre.artifacts.readArtifact('ERC20Template')
const erc20Template = new ethers.Contract(
tokenTemplate.templateAddress,
ERC20Template.abi,
owner
)
// const erc20Template = await getContractAtFromArtifact(
// hre,
// artifact,
// tokenTemplate.templateAddress,
// owner
// )
console.log('erc20Template: ', erc20Template)
// hardhatEthers.ethers.getContractAt(
// 'ERC20Template',