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.
141
questions
0
votes
1
answer
18
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
32
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
20
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
23
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, ...
1
vote
1
answer
118
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
76
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;
...
0
votes
2
answers
121
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
294
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 ...
0
votes
0
answers
12
views
Smart contract import differences
I hope this question is interesting for many
Smart contract import by ABI or code What's the difference? Will this give us the ability to use different FUNCTION?
1
vote
0
answers
104
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
277
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
1
answer
180
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/...
0
votes
0
answers
259
views
import path in truffle and solc
Here's my directory structure created by truffle with openzeppelin downloaded
.
├── build
│ └── contracts
├── contracts
│ ├── Migrations.sol
│ └── MyContract.sol
├── migrations
│ └── ...
1
vote
1
answer
766
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
272
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
116
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
200
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
1
answer
581
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
181
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,...
1
vote
1
answer
142
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
489
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
398
views
having trouble importing web3
getting this import web3 error although pip install web3 was a successs
0
votes
1
answer
59
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
852
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
59
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 ...
4
votes
1
answer
659
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
185
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
225
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
90
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
98
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
681
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
666
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
37
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
1k
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
121
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/openzeppelin-contracts@4.2.0 Brownie package without changes, namely ERC1967Proxy
and other non-abstract contracts from Brownie console.
...
2
votes
1
answer
161
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 ...
0
votes
1
answer
880
views
DeclarationError: Identifier already declared
I'm getting the below compile error message:
DeclarationError: Identifier already declared. --> contracts/coffeeBase/SupplyChain.sol:9:1: | 9 | import "../coffeeAccessControl/ConsumerRole.sol&...
1
vote
1
answer
39
views
ParseError after a previously successful compile
I received a successful compile message:
Compiling your contracts...
===========================
> Compiling .\contracts\coffeeAccessControl\ConsumerRole.sol
> Compiling .\contracts\...
1
vote
0
answers
76
views
Openethereum/parity import export
anyone has used export to take a backup and import to load data in openethereum(parity) blockchain? please provide information
I have tried export .rlp file and it works but when trying to import ...
0
votes
2
answers
665
views
Is it possible to import smart contracts with different compiler versions?
I'm using hardhat to compile my contracts. I am aware that hardhat is good at compiling contracts with different pragma versions, however, the contracts can't compile because they're importing ...
0
votes
2
answers
689
views
restore a deleted imported metamask account
i had my metamask wallet stoled, and my first reaction was delete the stole account. But this account has some pools os pancakeswap, and i need to restore it to save my tokens. I have the seed phrase ...
2
votes
1
answer
2k
views
ImportError: cannot import name 'Accounts' from 'brownie.network.account'
Setup
MacOS Catalina v10.15.6
IntelliJ Ultimate v2020.1.1
Python v3.7
eth-brownie v1.14.6
Ganache CLI v6.12.2
I created a VENV using my Python 3.7.
Following Patricks tutorial, I have installed eth-...
1
vote
0
answers
425
views
Event name conflicts and data out-of-bounds error in Remix
I have been getting a weird errored: Error: data out-of-bounds (length=0, offset=32, code=BUFFER_OVERRUN, version=abi/5.1.2) error when testing contract functions in Remix, even though it goes through ...
0
votes
1
answer
1k
views
Inheritance, Imports and Remix
This is the LSP3Account contract: https://github.com/lukso-network/standards-implementations/blob/master/contracts/Accounts/LSP3Account.sol
I want to create a contract on Remix that inherits from it. ...
1
vote
1
answer
92
views
1INCH Version error
I got error importing and using 1INCH. The problem is in the versions. In IOneSplit.sol version is 0.5.0 (pragma solidity ^0.5.0). And IOneSplit imports IERC20 which is in 0.8.0 (pragma solidity ^0.8....
0
votes
0
answers
708
views
Private key opens a different address than the one that it "should"
I have a small problem (hope it doesn't prove to be huge) with importing wallets using private keys.
I am not the most knowledgeable when it comes to Ethereum, and was hoping you guys could maybe help ...
0
votes
2
answers
3k
views
How to import and compile contracts of different versions solidity
How to import and compile contracts of different versions using solidity in remix?
When I import a contract I get this error:
ParserError: Source file requires different compiler version (current
...
3
votes
2
answers
224
views
What happens if GitHub path for import changes?
I wondered what happens if for example OpenZeppelin changes the path of a contract I have imported like this: import "@openzeppelin/contracts/token/ERC721/ERC721.sol";? Will my contract ...