This repository contains a Forge test for the Blacklistable
smart contract. The test demonstrates how a blacklisted user can renounce their BLACKLISTED_ROLE
. This test was created for the PeterSRWeb3 Challenge.
To import this test into your project:
-
Clone the Repository:
git clone https://github.com/0xChaddB/X_BlacklistableTest
-
Install Dependencies: Ensure you have Forge installed. If not, install Foundry by running:
curl -L https://foundry.paradigm.xyz | bash foundryup
-
Run the Tests: Navigate to the repository directory and run the test:
cd X_BlacklistableTest forge test
To run a specific test with detailed output:
forge test --mt testBlacklistedUserCanRenounceRole -vvvvv
test/BlacklistableTest.t.sol
: Contains the Forge test for theBlacklistable
contract.src/Blacklistable.sol
: Smart contract implementation.
The test validates the following:
- A user is successfully added to the blacklist.
- The blacklisted user can renounce their
BLACKLISTED_ROLE
. - After renouncing, the user is no longer blacklisted.
This test was created as part of the PeterSRWeb3 Challenge. It demonstrates a use case involving role management and blacklisting mechanics in smart contracts.
For any questions, reach out to me on X/Twitter.