From 9a45fdb778b3b48ecedcc68db8b206b147efacc7 Mon Sep 17 00:00:00 2001 From: Justin Brower Date: Thu, 21 Nov 2024 16:04:21 -0500 Subject: [PATCH] save --- src/utils/EncGnosisSafe.sol | 1 + src/utils/ZeusScript.sol | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/utils/EncGnosisSafe.sol b/src/utils/EncGnosisSafe.sol index b454445..3f8dca8 100644 --- a/src/utils/EncGnosisSafe.sol +++ b/src/utils/EncGnosisSafe.sol @@ -36,6 +36,7 @@ library EncGnosisSafe { pure returns (bytes memory) { + // magic value for signature. bytes1 v = bytes1(uint8(1)); bytes32 r = bytes32(uint256(uint160(from))); bytes32 s; diff --git a/src/utils/ZeusScript.sol b/src/utils/ZeusScript.sol index 8ccfbe0..a5985be 100644 --- a/src/utils/ZeusScript.sol +++ b/src/utils/ZeusScript.sol @@ -204,6 +204,32 @@ abstract contract ZeusScript is Script, Test { return uint32(vm.envUint(envvar)); } + /** + * Returns a uin16 set in the current environment. + * @param key The environment key. Corresponds to a ZEUS_* env variable. + */ + function zUint16(string memory key) public view returns (uint16) { + if (updatedTypes[key] != EnvironmentVariableType.UNMODIFIED) { + return updatedUInt16s[key]; + } + + string memory envvar = envPrefix.concat(key); + return uint16(vm.envUint(envvar)); + } + + /** + * Returns a uin16 set in the current environment. + * @param key The environment key. Corresponds to a ZEUS_* env variable. + */ + function zUint8(string memory key) public view returns (uint8) { + if (updatedTypes[key] != EnvironmentVariableType.UNMODIFIED) { + return updatedUInt8s[key]; + } + + string memory envvar = envPrefix.concat(key); + return uint8(vm.envUint(envvar)); + } + /** * Returns a uin64 set in the current environment. * @param key The environment key. Corresponds to a ZEUS_* env variable.