Sending transaction to a Web3 contract object in Truffle test produces 'file import callback not supported'
Sending transaction to a Web3 contract object in Truffle test produces 'file import callback not supported'
Loading saved threads...
slider · External communityPost link
External question — Ethereum Stack Exchange
Author: slider
Original post: https://ethereum.stackexchange.com/questions/83999
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I need to send a state-changing transaction to a Web3 contract object in my Truffle tests, which is hitting a fork of Kovan in my local ganache chain (
ganache-cli --fork https://kovan.infura.io/v3/[api_key]@latest
).
The contract I'm sending a transaction to is a Web3 contract object of an already-deployed contract on Kovan.
const theirContractABI = require("./abi/TheirContract");
const theirContractAddress = "0x123456789...";
const theirContract = new web3.eth.Contract(theirContractABI, theirContractAddress);
contract("MyContract", accounts => {
it("can update a TheirContract property", async () => {
await theirContract.methods.someFunction().send({ from: accounts[0] });
...
assert(some condition);
});
}
When I run this specific test, all I get is
Error: Returned error: VM Exception while processing transaction: revert
, and it's not produced by a falsified
require
statement. So, I tried using
@0x/sol-trace
. When I run
yarn trace
, I get
error InitializableAdminUpgradeabilityProxy.sol:3:1: ParserError: Source "/Users/slider/Desktop/myProject/node_modules/@openzeppelin/upgrades/contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol" not found: File import callback not supported
import './BaseAdminUpgradeabilityProxy.sol';
^------------------------------------------^
and
error InitializableAdminUpgradeabilityProxy.sol:4:1: ParserError: Source "/Users/slider/Desktop/myProject/node_modules/@openzeppelin/upgrades/contracts/upgradeability/InitializableUpgradeabilityProxy.sol" not found: File import callback not supported
import './InitializableUpgradeabilityProxy.sol';
^------------------------------------------^
TheirContract
imports
@openzeppelin/upgrades/contracts/upgradeability/InitializableAdminUpgradeabilityProxy.sol
, but I have the
@openzeppelin/upgrades
package installed, and
BaseAdminUpgradeabilityProxy.sol
&
InitializableUpgradeabilityProxy.sol
are indeed located in the same file within
node_modules
as
InitializableAdminUpgradeabilityProxy.sol
.
So, I'm fairly unsure of where the issue stems from and how to resolve it. Would greatly appreciate a point in the right direction.
Quote
Report
slider · External communityPost link
External answer — Ethereum Stack Exchange
Author: slider
Original post: https://ethereum.stackexchange.com/a/84017
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Turns out, all I had to do was specify a
gasLimit
in my
send()
method!
From this:
await theirContract.methods.someFunction().send({ from: accounts[0] });
To this:
await theirContract.methods.someFunction().send({ from: accounts[0], gasLimit: 800000 });
And I can use the Web3 contract object to do so, which is the easiest way to reference an already-deployed contract that I'm currently aware of, because you can just grab the ABI and address from EtherScan, and fork mainnet/Kovan/etc to your local ganache chain!
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Ethereum Stack Exchange Author: slider Source score (net votes, not local likes): 0 Original post: https://ethereum.stackexchange.com/a/84017 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Turns out, all I had to do was specify a gasLimit in my send() method! From this: await theirContract.methods.someFunction().send({ from: accounts[0] }); To this: await theirContract.methods.someFunction().send({ from: accounts[0], gasLimit: 800000 }); And I can use the Web3 contract object to do so, which is the easiest way to reference an already-deployed contract that I'm currently aware of, because you can just grab the ABI and address from EtherScan, and fork mainnet/Kovan/etc to your local ganache chain!
Checking account access…