Import a local library
Load a ready-made second file and use its library function.
Solidity 0.8.36REPL modeIncludes local files
Why use this example
Use this pattern to test contract composition, external calls, events, and return values inside one reproducible run. The entry isolates import a local library so its input, result, and state changes stay easy to compare.
Solidity to run
import "./MathLib.sol"
MathLib.double(21)Included local files
Solidity REPL creates these files before compiling the main entry, so its imports resolve without additional setup.
MathLib.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.20;
library MathLib {
function double(uint256 value) internal pure returns (uint256) {
return value * 2;
}
}
What to expect
The local MathLib.sol file resolves through the import and MathLib.double(21) returns 42.
Continue the investigation
Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.
Read about calls and logs Reproducible investigation