Skip to content

Commit

Permalink
chore: codegen Vm.sol to mark envOr functions as view (#491)
Browse files Browse the repository at this point in the history
* Codegen after adding view to envOr functions in foundry

* style: fmt

---------

Co-authored-by: Matt Solomon <[email protected]>
  • Loading branch information
anikaraghu and mds1 authored Jan 11, 2024
1 parent 87a2a0a commit 9454fee
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
6 changes: 5 additions & 1 deletion src/StdChains.sol
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ abstract contract StdChains {

// lookup rpcUrl, in descending order of priority:
// current -> config (foundry.toml) -> environment variable -> default
function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain) private returns (Chain memory) {
function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain)
private
view
returns (Chain memory)
{
if (bytes(chain.rpcUrl).length == 0) {
try vm.rpcUrl(chainAlias) returns (string memory configRpcUrl) {
chain.rpcUrl = configRpcUrl;
Expand Down
23 changes: 15 additions & 8 deletions src/Vm.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/StdUtils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ contract StdUtilsMock is StdUtils {
return getTokenBalances(token, addresses);
}

function exposed_bound(int256 num, int256 min, int256 max) external view returns (int256) {
function exposed_bound(int256 num, int256 min, int256 max) external pure returns (int256) {
return bound(num, min, max);
}

function exposed_bound(uint256 num, uint256 min, uint256 max) external view returns (uint256) {
function exposed_bound(uint256 num, uint256 min, uint256 max) external pure returns (uint256) {
return bound(num, min, max);
}

Expand Down

0 comments on commit 9454fee

Please sign in to comment.