The TestEnableGuard
contract is a test suite for the PalmeraDAO ecosystem, focusing on the PalmeraModule
and PalmeraGuard
. This suite extends the Forge Standard Library's Test
contract to verify the functionality of enabling these modules and guards within a Gnosis Safe environment. The document provides a detailed overview of the unit tests implemented to ensure the proper setup and enabling of the PalmeraModule
and PalmeraGuard
.
- Function:
setUp
- Purpose: Initialize the testing environment by setting up a new Safe and the
PalmeraModule
andPalmeraGuard
. - Details:
- Create an instance of
SafeHelper
to manage the Safe environment. - Set up a new Safe and retrieve its address.
- Initialize the
PalmeraModule
with a predefinedrolesAuthority
address and amaxTreeDepth
. - Initialize the
PalmeraGuard
with the address of thePalmeraModule
. - Link the
PalmeraModule
andPalmeraGuard
to the Safe usingsafeHelper.setPalmeraModule
andsafeHelper.setPalmeraGuard
.
- Create an instance of
- Function:
testEnablePalmeraModule
- Purpose: Verify that the
PalmeraModule
can be enabled on the Safe. - Steps:
- Call
enableModuleTx
on the Safe viasafeHelper
to enable thePalmeraModule
. - Assert that the module enabling transaction returns
true
. - Check if the
PalmeraModule
is actually enabled on the Safe by callingisModuleEnabled
. - Assert that
isModuleEnabled
returnstrue
, confirming the module is enabled.
- Call
- Function:
testEnablePalmeraGuard
- Purpose: Verify that the
PalmeraGuard
can be enabled on the Safe. - Steps:
- Call
enableGuardTx
on the Safe viasafeHelper
to enable thePalmeraGuard
. - Assert that the guard enabling transaction returns
true
. - Verify if the
PalmeraGuard
is actually enabled by decoding the storage slot value where the guard address is stored. - Assert that the decoded guard address matches the
PalmeraGuard
address, confirming the guard is enabled.
- Call
The TestEnableGuard
contract provides critical tests for validating the integration and functionality of the PalmeraModule
and PalmeraGuard
within the Gnosis Safe environment. These tests ensure that both the module and the guard can be enabled and utilized correctly, providing a robust framework for managing decentralized organizations using the PalmeraDAO infrastructure.