-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update base class to faciliate fetching envvars
- Loading branch information
1 parent
a223cb2
commit 0e91e5e
Showing
4 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.12; | ||
|
||
import {StringUtils} from "./StringUtils.sol"; | ||
import {Script} from "forge-std/Script.sol"; | ||
|
||
contract ZeusScript is Script { | ||
using StringUtils for string; | ||
|
||
string internal constant addressPrefix = "ZEUS_DEPLOYED_"; | ||
|
||
/** | ||
* @notice Returns the address of a contract based on the provided key, querying the envvars injected by Zeus. This is typically the name of the contract. | ||
* @param key The key to look up the address for. Should be the contract name, with an optional suffix if deploying multiple instances. (E.g. "MyContract_1" and "MyContract_2") | ||
* @return The address of the contract associated with the provided key. Reverts if envvar not found. | ||
*/ | ||
function zeusAddress(string memory key) internal view returns (address) { | ||
string memory envvar = addressPrefix.concat(key); | ||
return vm.envAddress(envvar); | ||
} | ||
} |