I followed your docs and managed to advance quite a bit. I got stuck while trying to programmatically access the ERC20PresetMinterPauserUpgradeSafe I deployed as is, following the instructions here:
So far I only tested programmatically the sample Box contract, which I compiled and deployed. But since I am deploying an instance of ERC20PresetMinterPauserUpgradeSafe there is no reference to this at the build folder and thus the way that I was accessing the contract programmatically via loader.fromArtifact is not working anymore and I am getting this error when running a similar code that I used for the Box contract:
at Object.openSync (fs.js:462:3) at Object.readFileSync (fs.js:364:35) at Object.readFileSync (/home/luis/token/node_modules/jsonfile/index.js:61:22) at loadArtifact (/home/luis/token/node_modules/@openzeppelin/contract-loader/lib/index.js:47:23) at Web3Loader.BaseLoader.fromArtifact (/home/luis/token/node_modules/@openzeppelin/contract-loader/lib/index.js:65:18) at main (/home/luis/token/src/index.js:14:26) at Object.<anonymous> (/home/luis/token/src/index.js:38:1) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 (node:318) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:318) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
In summary what I need is a code example of how to access this contract in this situation where I did not compile it myself.
I am running Ubuntu 20.04 LTS
Code to reproduce
const token = loader.fromArtifact('ERC20', address);