Questions tagged [import]
This question is related to importing one file to another which means content of imported file is partially or fully accessible to this file.
153 questions
0
votes
2
answers
128
views
Forge install is not installing the dependencies
I used to clone the code from this repo https://github.com/Gearbox-protocol/dev-bots-tutorial and work on that. Here, when calling forge install the dependencies are properly getting installed. ...
0
votes
0
answers
11
views
Compilation of inheritance chain
I came to know that given contracts
fileA.sol
pragma solidity >= 0.7.0;
contract A {}
is imported by
fileB.sol
import './fileA.sol';
pragma solidity 0.8.0;
contract B {}
where B is the top-level ...
0
votes
1
answer
25
views
Which is most common or best practice for import syntax?
I have used both of these syntax styles for importing Solidity contracts:
import "./contract.sol";
or
import { ContractName } from "./contract.sol";
I would like to know which one ...
0
votes
2
answers
45
views
Error import : "File import callback not supported" (using remappings) [Pyth Network]
Im following the "create a contract" part in the tutorial of Pyth Network (https://docs.pyth.network/price-feeds/create-your-first-pyth-app/evm/part-1) and i have this error in the import. ...
0
votes
1
answer
43
views
Why does super._update work in 1 function but not the other?
I am trying to override the _update function in an ERC1155 contract. However I get the following compiler error on my code:
Member "_update" not found or not visible after argument-...
0
votes
1
answer
39
views
I am getting error while importing files on Remix IDE from GitHub
Error: not found https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol. I am getting this error while importing the files from OpenZepplin GitHub ...
2
votes
0
answers
73
views
Withdrawing ETH from a Locked-out Account - Need Help!
I have some ETH on LocalCryptos.com (now shut down), but unfortunately, I have lost my access to the 2FA code, though I do have the password and a wallet backup file in JSON format.
I managed to ...
1
vote
0
answers
17
views
Can someone help me with the steps to fix the imports in this contract so that it will compile?
When I clone a contract from a repo from github on vscode (take, e.g., the one linked below), and I try to compile it, I always get errors with the imports...the imports will have stuff like @...
0
votes
0
answers
65
views
Cannot import correctly uniswap's permit2
Hello i am trying to import the permit2 following the official uniswap's guide but i cannot manage to import it correctly since it lacks of the structs and more things even if i don't get any error ...
0
votes
1
answer
29
views
What is the purpose of the import statement in Solidity?
Could someone explain to me what the pupose of the import statement is, in Solidity? Is it the similar to inheriting from another contract where you have access to the state variables and function of ...
3
votes
1
answer
650
views
How can I install multiple versions of a dependency in foundry?
In hardhat multiple versions of a dependency can be installed as follows in the package.json(assuming yarn is being used):
"@openzeppelin/contracts": "^4.3.2",
"openzeppelin-...
0
votes
1
answer
81
views
Use of { } when importing libraries?
Can anybody tell me the exact use of { } in import/require library statements?
I've seen some other questions where people said it's to import just a part of a library, let's say the 'ethers' part of ...
0
votes
1
answer
82
views
ERC20 Token Creation: error says ERC20: transfer amount exceeds balance
I am running the following code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; //file
imported
contract ...
0
votes
1
answer
31
views
How to use another deployed smart contract functions?
What I want to do is deploy a smart contract with functions that other deployed smart contracts can call and get a response from.
How do I implement this? Is there any useful guides you guys know I ...
1
vote
1
answer
371
views
How to import file with hardhat
I'm following the Alchemy tutorial to build an NFT Marketplace with hardhat. I want to import my smart contract which is an APIConsumer by Chainlink. I can't do it by path since I'm not allowed by ...
1
vote
1
answer
89
views
@openzeppelin/contracts import failed
The issue I am having is when I am trying to compile my contract, I am getting multiple errors for ERC721. As imported ERC721 is importing more contracts, as seen from the errors, the issue is that it ...
0
votes
0
answers
86
views
Unable to use a function from imported library
I'm trying to import and use a library to verify ring signatures. On doing so I'm getting an error while loading smart contract using w3.eth.contract(abi=abi, bytecode=bytecode).
ValueError at /sc/...
1
vote
1
answer
183
views
Solc: Source file requires different compiler version
in my brownie project i have imported LinkTokenReceiver.sol contract which its pragma solidity is pragma solidity ^0.7.0;, which means that it requires compiler version equal or greater than 0.7.0, ...
2
votes
1
answer
630
views
How can msg.sender call a payable function with set price from another contract?
hello everyone and happy '23.
I'm having issues sorting out the following system.
Contract TipWallet: receives tips with a takeTip() and updates the tip +1 every time it receives one.
Contract Tipper: ...
1
vote
2
answers
160
views
Contract storing array returning addresses
Below is the contract which imports another contract
pragma solidity ^0.8.7;
import "./SimpleStorage.sol";
contract StorageFactory {
SimpleStorage[] public simpleStorageArray;
...
1
vote
2
answers
419
views
Can I import specific functions from other contracts and not the whole contract?
I am importing Access.sol by OpenZeppelin ("@openzeppelin/contracts/access/AccessControl.sol") in a contract. The main functions I am concerned with are setupRole(),hasRole() and grantRole()....
2
votes
1
answer
515
views
ERC1155 supply extension on OpenZeppelin not importing functions
I'm doing some experiments with OpenZeppelin's ERC1155 contracts and the ERC1155Supply extension does not seem to be working as it should. Even though I'm importing it to the contract, after ...
1
vote
0
answers
166
views
Geth import a local backup slower than syncing
System: Linux, SSD, 64G RAM
Is there a way to speed up the process of importing a local Backup?
So I run a node for a while (completly synced until yesterday) and wanted to play around a bit more.
I ...
1
vote
1
answer
482
views
How is this scam code transferring tokens to the unspecified wallet within?
Below is the exact solidity code that the scammer were manipulating people to run by themselves. I checked that there is no wallet address specified within the code but this code will transfer the ...
0
votes
2
answers
383
views
Brownie Error cannot find contract/file
Hello I was starting to write some solidity code with brownie as eth-environment, I tried to compile the code and the import statement is showing en error -
ParserError: Source "@smartcontractkit/...
1
vote
1
answer
1k
views
I can not import openzeppelin, but get error 'File import callback not supported'
I get 'File import callback not supported' when I try to compile my simple solidity contract, that imports ERC721. Can anybody help?
Here is what I have already done:
I have installed openzeppelin in ...
6
votes
1
answer
528
views
Can I import solidity code (or ABIs) into vyper?
Let's say I have a contract in solidity:
pragma solidity 0.8.8;
contract MyContract{
function getFive() public pure returns (uint256){
return 5;
}
}
Could I import, inhert, etc in ...
0
votes
1
answer
253
views
importing qs to a html/javascript page
I'm experimenting with 0x samples. I'm not a back-end dev so I'm NOT running NodeJS. I don't want to go full blown ReactJS on it so I built this html wrapper for the example 0x code for retrieving a ...
1
vote
1
answer
358
views
How to import struct members from Solidity Library
Trying to implement the diamond upgrade following Nick Mudge implementation in aave. Been getting this error (struct member not found or not visible after argument dependent lookup in struct) ...
0
votes
2
answers
1k
views
How to import Openzep ERC20: Identifier not found
Can I get someone's perspective on why I'm unable to find the ERC20 contract I've npm install @openzeppelin/contracts.
After import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; I get a ...
1
vote
1
answer
218
views
unbale to import smart contract into brownie scripts
I was trying to run a deploy script with brownie but i couldnt import required .sol smartContract into my scripts
This is my folder structure
My code in deploy.py
from brownie import Fundme, accounts,...
2
votes
1
answer
305
views
DeclarationError: "Identifier already declared" when compiling SmartContract with solc
I have a Smart Contract "MyCoin". It has another SmartContract "Dex" as dependency.
MyCoin:
import "./openzeppelin/contracts/token/ERC721/IERC721.sol"; //
import "./...
1
vote
2
answers
623
views
Why does OpenZeppelin import interfaces to its own contracts?
I've noticed that all OpenZeppelin's token contracts import their interfaces into them.
Why does OpenZeppelin import and inherit its own contract interface to the contract?
Does importing a contract'...
0
votes
2
answers
504
views
having trouble importing web3
getting this import web3 error although pip install web3 was a successs
0
votes
1
answer
118
views
What does import {} do?
For example,
import { FlashLoanReceiverBase } from "./FlashLoanReceiverBase.sol";
FlashLoanReceiverBase.sol is here:
https://github.com/aave/aave-protocol/blob/master/contracts/flashloan/...
1
vote
1
answer
2k
views
Account Extended Private Key / BIP32 Extended Private Key need to import MetaMask?
I would withdraw ETH from my Binance account and give ETH as christmas gift to my nephew and my niece.
1: Is it any drawback in a long run if I use not the ETH network but BSC? In 10-20 years or so. ...
1
vote
1
answer
67
views
Changing imports for a contract that has been deployed
I am very new to writing smart contracts and deployed one via remix.ethereum. However, during the process I imported the wrong dependency links and need to change them.
I know smart contracts are ...
7
votes
1
answer
2k
views
Why do many Solidity projects prefer importing specific names over whole modules?
In the Solidity docs and also in OZ libaries, I mainly find this way of importing :
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
But in most ...
0
votes
1
answer
338
views
I can't import my Geth account, where do I get the 64 hex character while my UTC file shows only the mac I've loaded and it said too short
please give a solution. I can't Import my geth account.
It said:
C:\Windows\system32>geth account import --datadir value 092426c0333f315bd569f279d*****
Fatal: Failed to load the private key: key ...
1
vote
1
answer
363
views
Does Ethereum have a builtin package manager to prevent code duplication?
Does Ethereum have a package manager that is hosted on chain to mitigate code duplication? I've been learning Solidity development in brownie and as per my understanding in the brownie-config.yaml you ...
2
votes
1
answer
1k
views
Failed brownie import when running scripts
I am trying to setup eth-brownie to get a feel of the framework but face a couple of import-related problems.
Im working from a MBP running macOS with Catalina v10.15.7
$ python --version
Python 3.9.9
...
1
vote
0
answers
124
views
Undeclared identifier when using function from imported file
I want to import this function in another contract but I received the error from the screenshot below.
This is the function I want to import:
function assetTransfer (string memory order_id,string ...
0
votes
1
answer
111
views
Relative import issue while testing brownie
I am using brownie to interact with my Ethereum smart contracts. The scripts and tests are located in parallel scripts/ and test/ folders. How can I access the functions from scripts/ in test/ files?
...
0
votes
3
answers
775
views
Can't compile Truffle project that imports a .sol with different pragma version
I have a contract pragma solidity 0.6.12 version that imports several 0.6.12 version contracts and one pragma solidity 0.8.0.
My truffle-config:
compilers: {
solc: {
version: "^0.6.12 &...
1
vote
1
answer
881
views
Getting a compile error every time I try to compile a contract with Brownie that includes an import statement from the web
I have a contract that starts with the following import statements:
import 'https://github.com/aave/protocol-v2/blob/master/contracts/flashloan/base/FlashLoanReceiverBase.sol';
import 'https://github....
0
votes
1
answer
38
views
I staked ZRX through Metamask on OX Protocol and it was an account linked to my Exodus Wallet. now I can't link to my staking
ok connected metamask to stake ZRX on OX protocol. imported OX keys from my exodus wallet to a new account in metamask. seemed to work for a bit then one day i tried to check on things and it wouldn'...
1
vote
1
answer
2k
views
Where to find SafeMath pragma solidity ^0.6.6?
While trying to use SafeMath to compute the modulo of a uint256 like shown in this video:https://www.youtube.com/watch?v=JqZWariqh5s (without SafeMath) I'm having some trouble finding a pragma ...
0
votes
1
answer
148
views
OpenZeppelin import problem
I am trying to import a couple of OpenZeppelin contracts to my project, but each time I am given an error related to unsuccessful imports from sources. I'm gonna attach a screenshot of my code. I have ...
4
votes
2
answers
2k
views
How to use contracts from project dependencies in Brownie scripts?
I want to deploy a contract directly accessible in OpenZeppelin/[email protected] Brownie package without changes, namely ERC1967Proxy
and other non-abstract contracts from Brownie console.
...
2
votes
1
answer
225
views
searching for an elegant solc compiler solution
I firstly had a problem with import statement inside my contracts, I figured out that the solc compiler didn't handle import statement, and that we needed to make out own. With the help of some nice ...