Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
265 views

Can you change an overridden function's visibility/mutability?

Say I have a parent and a child contract, in the child I don't want to use one of the parent's functions, so I changed the logic to just revert if it is ever called. Now the terminal output shows me ...
Rohan Nero's user avatar
  • 1,725
1 vote
0 answers
73 views

Explicitly linked Solidity libraries produce bigger contract size than having it embedded

If I replace all the library functions' visibility to either external or public, I will have to deploy the libraries separately first, and then explicitly link them in the contract which is using them....
user2340939's user avatar
0 votes
0 answers
31 views

Function Visibility specifiers during inheritance

when am overriding a function in solidity must my child function have the same visibility as the parent function? can the parent function be public and the child function be internal
Emmanuel Anah's user avatar
0 votes
2 answers
733 views

Why gas prices vary according to state visibility (public/external/private/internal)?

Why gas prices vary according to state visibility(public/external/private/internal) to Function?
imelon2's user avatar
  • 590
0 votes
1 answer
38 views

wrapper getter functions

OpenZeppelin's ERC20 token contract contains the following declaration of decimals, and then a getter function for accessing that variable: uint8 private decimals; function decimals() public view ...
Eric Falkenstein's user avatar
1 vote
1 answer
320 views

Solidity private/internal function call from external function

what the purpose of that way to restrict access to function call? function updateQuorumNumerator(uint256 newQuorumNumerator) external virtual onlyGovernance { _updateQuorumNumerator(...
4rgon4ut's user avatar
0 votes
1 answer
72 views

Why no private constructors in solidity?

I am looking for a mechanism that allows me to restrict the creation of a contract A from anywhere but another contract B. contract A { // ... } contract B { constructor() { A a = new ...
Jacob Krieg's user avatar
1 vote
1 answer
68 views

Which one is better visibility option of solidity method?

I have a external method declared. At some point I realized that I need to call that external method from one of the another method within a contract and which is not possible. There are options to ...
NinjaMAN's user avatar
  • 419
6 votes
1 answer
519 views

Is it safe to mark library functions that modify the calling contract's state as public in Solidity?

I am using libraries to reduce the cost of deployment of a contract of which there may be many instances (using a factory contract). When I mark a library function as internal, the code seems to get ...
dorian108's user avatar
8 votes
2 answers
15k views

What are private variables in solidity?

The following variables here, assuming solidity 4.24 or later. mapping(something => something) private yourmapping; bool private yourbool; address private youraddress; uint256 private ...
Fifth Dimension Dragon's user avatar
3 votes
2 answers
1k views

What is an example of when a solidity variable must NOT be public? Where it would break the security of the contract?

I'm really struggling to understand variable visibility. I'm aware that everything is public on a blockchain. Yes you can make a variable private to make it invisible to other contracts, but so what? ...
Andrew Stanger's user avatar
1 vote
1 answer
190 views

When does it make sense to use `this.f()` instead of making the function public?

In external vs public best practices, Tjaden Hess says that: It almost never makes sense to use the this.f() pattern, as this requires a real CALL to be executed, which is expensive So why does ...
Paul Razvan Berg's user avatar
1 vote
1 answer
170 views

Unit test compilation failed due member not found or not visible

I have written an unit test but when I launch it I get following error: Test.sol:25:22: TypeError: Member "val1" not found or not visible after argument-dependent lookup in function () view external ...
kitsune's user avatar
  • 219
4 votes
1 answer
458 views

What are function types in Solidity used for?

Can you provide an example of when and why you would want to define and use a function type, as a opposed to simply calling a function? I understand how from here: https://ethereum.stackexchange.com/...
valem's user avatar
  • 317
4 votes
3 answers
2k views

Accessing not public variables

Is it possible as the creater of the smart contract to access a not public variable? E.g.: contract MyContract { uint256 someLevel; function changeLevel(uint _newLevel) public { ...
sunwarr10r's user avatar
0 votes
1 answer
1k views

Calling External Contract Function with Modifiers - Results in Unknown Error

I am attempting to call an external contract function, but modifier on the function is throwing an error. And I can't figure out why. Any help is appreciated! Info is below: I have two contracts: ...
Nick Major's user avatar
2 votes
1 answer
741 views

Why are parameters of external functions not lvalue types?

When a function's visibility is external, trying to modify the function parameters within that function gives the error: TypeError: Expression has to be an lvalue. However, if I change the ...
AnAllergyToAnalogy's user avatar