Questions tagged [declaration]
The declaration tag has no usage guidance.
11
questions
1
vote
1
answer
42
views
How to fix naming scheme and undeclared identifier errors?
I have a question about something that has been bugging me for quite some time now. I am a bit confused on naming schemes in solidity and how I should go about it. For example, the biggest thing for ...
0
votes
1
answer
44
views
Data location must be "calldata" for parameter in external function, but none was given. --> Undeclared identifier
In Remix, I'm getting the following error.
contracts/TestBench.sol:138:30:
TypeError: Data location must be "calldata" for parameter
in external function, but none was given.
function ...
0
votes
1
answer
128
views
Warning: This declaration shadows an existing declaration
Can you please help me out with this code, where I get the six warnings shown bellow? As a result, the withdrawal doesn't go through with the specified amount. But I don't know how to get around it. ...
0
votes
1
answer
53
views
Declaration Error when defining function to return token name
I am trying to create an ERC20 contract. Below is my code for it.
pragma solidity ^0.8.0;
contract ERC20Interface {
mapping(address => uint256) private _balances;
mapping(address => mapping(...
0
votes
0
answers
63
views
contracts/FlashLoan DeclarationError: Identifier already declared
Error message
contracts/FlashLoanReceiverBase.sol:9:1: DeclarationError: Identifier already declared.
import "./Withdrawable.sol";
^--------------------------^
github.com/OpenZeppelin/...
0
votes
1
answer
292
views
Variable declaration
I am new to solidity.Below is the snippet of solidity source code which I came across :-
pragma solidity ^0.5.1;
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (...
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 "./...
0
votes
1
answer
34
views
A function made in my contract while trying to compile the contract showed this; TypeError: Referenced declaration is neither modifier nor base class
//SPDX-Licence-Identifier: MIT
pragma solidity ^0.8.11;
contract PurchaseAgreement {
// VARIABLES
uint public value;
address payable public seller;
address payable public buyer;
...
0
votes
1
answer
83
views
Why do I have a declaration error showing Identifier not found or not unique
I am writing the smart contract for NFT. it is my first one. it is showing the DeclarationError as below and I do not know how to solve it. Could you please kindly help me? Thank you
from solidity:
...
0
votes
2
answers
434
views
Warning: Unused function parameter. Remove or comment out the variable name to silence this warning. This declaration shadows an existing declaration
function Createvault(string memory name, address[] memory users, uint initialamount)public returns(uint vaultId){
vault storage vault = vaults[totalvaults];
vault.creator = msg.sender;
...
1
vote
2
answers
462
views
Value assignment for storage variable (in declaration VS in constructor)
What difference does it make if I assign the value of a storage variable in the same line where it is declared vs if I assign its value in the constructor? Which would be the preferred approach? And ...