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.
145
questions
0
votes
0
answers
10
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
15
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 ...
1
vote
1
answer
132
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
26
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
32
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
23
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
141
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
43
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
65
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
79
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
318
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
121
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
247
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
396
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
138
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
387
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
267
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
982
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
411
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
180
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
263
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
814
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
208
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
188
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
557
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
459
views
having trouble importing web3
getting this import web3 error although pip install web3 was a successs
0
votes
1
answer
97
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
1k
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
63
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 ...
6
votes
1
answer
1k
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
243
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
277
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
113
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
108
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
742
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
742
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
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
138
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
193
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
1k
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
86
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
801
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
754
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
477
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. ...