Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions trees/CommunityVault.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;

contract CommunityVaultTest {
function test_WhenInitialized() external {
// It should set the security context.
// It should revert if security context is zero address.
}

modifier whenDepositIsCalled() {
_;
}

function test_WhenDepositingETH() external whenDepositIsCalled {
// It should accept ETH when msg.value matches amount.
// It should revert if msg.value does not match amount.
}

function test_WhenDepositingERC20() external whenDepositIsCalled {
// It should transfer tokens from sender and update balance.
}

modifier whenWithdrawIsCalled() {
_;
}

modifier whenCallerHasSYSTEM_ROLEForWithdraw() {
_;
}

function test_WhenCallerHasSYSTEM_ROLEForWithdraw()
external
whenWithdrawIsCalled
whenCallerHasSYSTEM_ROLEForWithdraw
{
// It should revert if insufficient balance.
}

function test_WhenWithdrawingETH() external whenWithdrawIsCalled whenCallerHasSYSTEM_ROLEForWithdraw {
// It should send ETH to recipient.
// It should revert if ETH transfer fails.
}

function test_WhenWithdrawingERC20() external whenWithdrawIsCalled whenCallerHasSYSTEM_ROLEForWithdraw {
// It should transfer tokens and reduce balance.
}

function test_RevertWhen_CallerLacksSYSTEM_ROLEForWithdraw() external whenWithdrawIsCalled {
// It should revert.
}

modifier whenDistributeIsCalled() {
_;
}

function test_WhenCallerHasSYSTEM_ROLEForDistribute() external whenDistributeIsCalled {
// It should distribute tokens to recipients.
// It should revert if recipients and amounts mismatch.
}

function test_RevertWhen_CallerLacksSYSTEM_ROLEForDistribute() external whenDistributeIsCalled {
// It should revert.
}

modifier whenDistributeRewardsIsCalled() {
_;
}

modifier whenCallerHasSYSTEM_ROLEForDistributeRewards() {
_;
}

function test_WhenRewardsCalculatorAndPurchaseTrackerAreSet()
external
whenDistributeRewardsIsCalled
whenCallerHasSYSTEM_ROLEForDistributeRewards
{
// It should calculate and distribute rewards.
}

function test_WhenRewardsCalculatorOrPurchaseTrackerNotSet()
external
whenDistributeRewardsIsCalled
whenCallerHasSYSTEM_ROLEForDistributeRewards
{
// It should do nothing.
}

function test_RevertWhen_CallerLacksSYSTEM_ROLEForDistributeRewards() external whenDistributeRewardsIsCalled {
// It should revert.
}

function test_WhenClaimRewardsIsCalled() external {
// It should distribute rewards to msg.sender using rewardsCalculator.
}

modifier whenSetGovernanceVaultIsCalled() {
_;
}

function test_WhenCallerHasSYSTEM_ROLEForGovernanceVault() external whenSetGovernanceVaultIsCalled {
// It should set the governanceVault address.
// It should approve lootToken with max allowance.
// It should revert if vault or lootToken is zero.
}

function test_RevertWhen_CallerLacksSYSTEM_ROLEForGovernanceVault() external whenSetGovernanceVaultIsCalled {
// It should revert.
}

modifier whenSetPurchaseTrackerIsCalled() {
_;
}

function test_WhenCallerHasSYSTEM_ROLEForPurchaseTracker() external whenSetPurchaseTrackerIsCalled {
// It should set the purchase tracker.
// It should revert if address is zero.
}

function test_RevertWhen_CallerLacksSYSTEM_ROLEForPurchaseTracker() external whenSetPurchaseTrackerIsCalled {
// It should revert.
}

modifier whenSetCommunityRewardsCalculatorIsCalled() {
_;
}

function test_WhenCallerHasSYSTEM_ROLEForRewardsCalculator() external whenSetCommunityRewardsCalculatorIsCalled {
// It should set the rewards calculator.
}

function test_RevertWhen_CallerLacksSYSTEM_ROLEForRewardsCalculator()
external
whenSetCommunityRewardsCalculatorIsCalled
{
// It should revert.
}

function test_WhenGetBalanceIsCalled() external {
// It should return the correct token balance.
}
}
56 changes: 56 additions & 0 deletions trees/CommunityVault.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
CommunityVaultTest
├── When initialized
│ ├── It should set the security context.
│ └── It should revert if security context is zero address.
├── When deposit is called
│ ├── When depositing ETH
│ │ ├── It should accept ETH when msg.value matches amount.
│ │ └── It should revert if msg.value does not match amount.
│ └── When depositing ERC20
│ └── It should transfer tokens from sender and update balance.
├── When withdraw is called
│ ├── When caller has SYSTEM_ROLE for withdraw
│ │ ├── When withdrawing ETH
│ │ │ ├── It should send ETH to recipient.
│ │ │ └── It should revert if ETH transfer fails.
│ │ ├── When withdrawing ERC20
│ │ │ └── It should transfer tokens and reduce balance.
│ │ └── It should revert if insufficient balance.
│ └── When caller lacks SYSTEM_ROLE for withdraw
│ └── It should revert.
├── When distribute is called
│ ├── When caller has SYSTEM_ROLE for distribute
│ │ ├── It should distribute tokens to recipients.
│ │ └── It should revert if recipients and amounts mismatch.
│ └── When caller lacks SYSTEM_ROLE for distribute
│ └── It should revert.
├── When distributeRewards is called
│ ├── When caller has SYSTEM_ROLE for distributeRewards
│ │ ├── When rewardsCalculator and purchaseTracker are set
│ │ │ └── It should calculate and distribute rewards.
│ │ └── When rewardsCalculator or purchaseTracker not set
│ │ └── It should do nothing.
│ └── When caller lacks SYSTEM_ROLE for distributeRewards
│ └── It should revert.
├── When claimRewards is called
│ └── It should distribute rewards to msg.sender using rewardsCalculator.
├── When setGovernanceVault is called
│ ├── When caller has SYSTEM_ROLE for governanceVault
│ │ ├── It should set the governanceVault address.
│ │ ├── It should approve lootToken with max allowance.
│ │ └── It should revert if vault or lootToken is zero.
│ └── When caller lacks SYSTEM_ROLE for governanceVault
│ └── It should revert.
├── When setPurchaseTracker is called
│ ├── When caller has SYSTEM_ROLE for purchaseTracker
│ │ ├── It should set the purchase tracker.
│ │ └── It should revert if address is zero.
│ └── When caller lacks SYSTEM_ROLE for purchaseTracker
│ └── It should revert.
├── When setCommunityRewardsCalculator is called
│ ├── When caller has SYSTEM_ROLE for rewardsCalculator
│ │ └── It should set the rewards calculator.
│ └── When caller lacks SYSTEM_ROLE for rewardsCalculator
│ └── It should revert.
└── When getBalance is called
└── It should return the correct token balance.