Hot answers tagged


No. In Solidity 0.7.0 and later versions, the effect of using ... for is no longer inherited. Quoting from the 0.7.0 changelog: using A for B only affects the contract it is mentioned in. Previously, the effect was inherited. Now, you have to repeat the using statement in all derived contracts that make use of the feature.


Reusability, see sentence one here. Libraries are similar to contracts, but their purpose is that they are deployed only once at a specific address and their code is reused using the DELEGATECALL. Although honestly the use of reusable libraries hasn't really taken off, there is at least one project aiming to provide those:


Possibly someone with deeper knowledge of compilation details will chime in with more precision. Intuitively, one might expect a slight difference to account for the extra steps of jumping into another section of code, packing return arguments, and unpacking received arguments, and them carrying to assign the value to foo_value. The difference could be ...


Neither B nor A have storage of their own, they use the storage provided by C. I write a code similar and it works with both storage and memory. pragma solidity ^0.5.0; library A { struct S { uint256 a; } function foo(A.S memory a) internal view returns (uint256) { return a.a; } } library B { using A for A....

Only top voted, non community-wiki answers of a minimum length are eligible