library JBGlobalFundingCycleMetadataResolver {
function setTerminalsAllowed(uint8 _data) internal pure returns (bool) {
return (_data & 1) == 1;
}
function setControllerAllowed(uint8 _data) internal pure returns (bool) {
return ((_data >> 1) & 1) == 1;
}
function transfersPaused(uint8 _data) internal pure returns (bool) {
return ((_data >> 2) & 1) == 1;
}
function packFundingCycleGlobalMetadata(JBGlobalFundingCycleMetadata memory _metadata)
internal
pure
returns (uint256 packed)
{
if (_metadata.allowSetTerminals) packed |= 1;
if (_metadata.allowSetController) packed |= 1 << 1;
if (_metadata.pauseTransfers) packed |= 1 << 2;
}
function expandMetadata(uint8 _packedMetadata)
internal
pure
returns (JBGlobalFundingCycleMetadata memory metadata)
{
return
JBGlobalFundingCycleMetadata(
setTerminalsAllowed(_packedMetadata),
setControllerAllowed(_packedMetadata),
transfersPaused(_packedMetadata)
);
}
}