Skip to content

Commit c77972b

Browse files
committed
tests: Inventory: add all .tree files
1 parent 549dd39 commit c77972b

File tree

13 files changed

+270
-1
lines changed

13 files changed

+270
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
collectWethFees.t.sol
2+
├── given the collect weth fees operation is paused
3+
│ └── when the caller is not the owner
4+
│ └── it should revert
5+
└── given the collect weth fees operation is not paused
6+
├── when the caller is not the position owner
7+
│ └── it should revert
8+
└── when the caller is the position owner
9+
├── it should transfer the total accumulated weth fees to the caller
10+
├── it should update the position weth fees per vtoken shares snapshot to the current global value
11+
├── it should set the position weth owed to zero
12+
└── it should emit {CollectWethFees} event
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
combinePositions.t.sol
2+
├── when the caller is not the owner of the parent position
3+
│ └── it should revert
4+
└── when the caller is the owner of the parent position
5+
├── given the parent position is timelocked
6+
│ └── it should revert
7+
├── given the parent position is vtoken timelocked
8+
│ └── it should revert
9+
└── given the parent position is not timelocked or vtoken timelocked
10+
├── when the caller is not the owner of the child position
11+
│ └── it should revert
12+
└── when the caller is the owner of the child position
13+
├── given the child position is timelocked
14+
│ └── it should revert
15+
├── given the child position is vtoken timelocked
16+
│ └── it should revert
17+
└── given the child position is not timelocked or vtoken timelocked
18+
├── given the child and parent position's vault ids mismatch
19+
│ └── it should revert
20+
└── given the child and parent position's vault ids match
21+
├── when the child and parent positions are the same
22+
│ └── it should revert
23+
└── when the child and parent positions are different
24+
├── it should set the vtoken share balance of children positions to zero
25+
├── it should set the weth owed of children positions to zero
26+
├── it should increase the parent position's vtoken share balance by the sum of the children positions' vtoken share balances
27+
├── it should increase the parent position's weth owed by the sum of the children positions' weth owed
28+
├── it should set the parent position weth fees per vtoken shares snapshot to the current global value
29+
└── it should emit {CombinePositions} event
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
depositWithNFT.t.sol
2+
├── given the deposit with nft operation is paused
3+
│ └── when the caller is not the owner
4+
│ └── it should revert
5+
└── given the deposit with nft operation is not paused
6+
├── when the vault id is invalid
7+
│ └── it should revert
8+
└── when the vauld id is valid
9+
├── given the caller is not on the timelock exclude list
10+
│ ├── given the underlying NFT is ERC721
11+
│ │ ├── given the total vtoken shares are zero
12+
│ │ │ ├── it should mint vtokens to the inventory contract
13+
│ │ │ ├── it should mint xnft position to the recipient
14+
│ │ │ ├── it should mint vtoken shares after deducting minimum liquidity
15+
│ │ │ ├── it should increase the total vtoken shares
16+
│ │ │ ├── it should set the position nonce to zero
17+
│ │ │ ├── it should set the position vault id
18+
│ │ │ ├── it should set the position timelocked until
19+
│ │ │ ├── it should set the position timelock to the current value
20+
│ │ │ ├── it should set the position vtoken timelocked until to zero
21+
│ │ │ ├── it should set the position weth fees per vtoken share snapshot to the global value
22+
│ │ │ ├── it should set the position weth owed to zero
23+
│ │ │ └── it should emit {DepositWithNFT} event
24+
│ │ └── given the total vtoken shares are greater than zero
25+
│ │ ├── it should mint vtokens to the inventory contract
26+
│ │ ├── it should mint xnft position to the recipient
27+
│ │ ├── it should mint proportional vtoken shares
28+
│ │ ├── it should increase the total vtoken shares
29+
│ │ ├── it should set the position nonce to zero
30+
│ │ ├── it should set the position vault id
31+
│ │ ├── it should set the position timelocked until
32+
│ │ ├── it should set the position timelock to the current value
33+
│ │ ├── it should set the position vtoken timelocked until to zero
34+
│ │ ├── it should set the position weth fees per vtoken share snapshot to the global value
35+
│ │ ├── it should set the position weth owed to zero
36+
│ │ └── it should emit {DepositWithNFT} event
37+
│ └── given the underlying NFT is ERC1155
38+
│ ├── it should mint vtokens to the inventory contract
39+
│ └── it should mint xnft position to the recipient
40+
└── given the caller is on the timelock exclude list
41+
├── it should mint vtokens to the inventory contract
42+
├── it should mint xnft position to the recipient
43+
├── it should set the position timelocked until to zero
44+
├── it should set the position timelock to the current value
45+
└── it should set the position vtoken timelocked until to zero
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
deposit.t.sol
2+
├── given the deposit operation is paused
3+
│ └── when the caller is not the owner
4+
│ └── it should revert
5+
└── given the deposit operation is not paused
6+
├── when the vault id is invalid
7+
│ └── it should revert
8+
└── when the vault id is valid
9+
├── when the {viaPermit2} param is false
10+
│ ├── when the force timelock is false
11+
│ │ ├── given the total vtoken shares are zero
12+
│ │ │ ├── when the deposit amount is less than minimum liquidity
13+
│ │ │ │ └── it should revert
14+
│ │ │ ├── when the deposit amount is equal to minimum liquidity
15+
│ │ │ │ └── it should revert
16+
│ │ │ └── when the deposit amount is greater than minimum liquidity
17+
│ │ │ ├── it should mint xnft position to the recipient
18+
│ │ │ ├── it should mint vtoken shares after deducting minimum liquidity
19+
│ │ │ ├── it should increase the total vtoken shares
20+
│ │ │ ├── it should set the position nonce to zero
21+
│ │ │ ├── it should set the position vault id
22+
│ │ │ ├── it should set the position timelocked until to zero
23+
│ │ │ ├── it should set the position timelock to the current value
24+
│ │ │ ├── it should set the position vtoken timelocked until
25+
│ │ │ ├── it should set the position weth fees per vtoken share snapshot to the global value
26+
│ │ │ ├── it should set the position weth owed to zero
27+
│ │ │ └── it should emit {Deposit} event
28+
│ │ └── given the total vtoken shares are greater than zero
29+
│ │ ├── it should mint xnft position to the recipient
30+
│ │ ├── it should mint proportional vtoken shares
31+
│ │ ├── it should increase the total vtoken shares
32+
│ │ ├── it should set the position nonce to zero
33+
│ │ ├── it should set the position vault id
34+
│ │ ├── it should set the position timelocked until to zero
35+
│ │ ├── it should set the position timelock to the current value
36+
│ │ ├── it should set the position vtoken timelocked until
37+
│ │ ├── it should set the position weth fees per vtoken share snapshot to the global value
38+
│ │ ├── it should set the position weth owed to zero
39+
│ │ └── it should emit {Deposit} event
40+
│ └── when the force timelock is true
41+
│ ├── it should mint xnft position to the recipient
42+
│ ├── it should set the position timelocked until
43+
│ ├── it should set the position timelock to the current value
44+
│ └── it should set the position vtoken timelocked until
45+
└── when the {viaPermit2} param is true
46+
├── when the {encodedPermit2} is empty
47+
│ ├── given the permit hasn't already been set
48+
│ │ └── it should revert
49+
│ └── given the permit has already been set
50+
│ └── it should mint xnft position
51+
└── when the {encodedPermit2} is not empty
52+
└── it should mint xnft position
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
increasePosition.t.sol
2+
├── given the increase position operation is paused
3+
│ └── when the caller is not the owner
4+
│ └── it should revert
5+
└── given the increase position operation is not paused
6+
├── when the caller is not the position owner
7+
│ └── it should revert
8+
└── when the caller is the position owner
9+
├── given the position was not created with just vtokens, vTokenTimelockedUntil is zero
10+
│ └── it should revert
11+
└── given the position was created with just vtokens, vTokenTimelockedUntil is not zero
12+
├── when the {viaPermit2} param is false
13+
│ ├── when the force timelock is false
14+
│ │ ├── it should update the position weth owed to account for weth fees accumulated till now
15+
│ │ ├── it should set the position weth fees per vtoken share snapshot to the current global value
16+
│ │ ├── it should increase the position vtoken share balance
17+
│ │ ├── it should increase the total vtoken share balance
18+
│ │ ├── it should set the position vtoken timelocked until
19+
│ │ └── it should emit {IncreasePosition} event
20+
│ └── when the force timelock is true
21+
│ ├── it should increase the position
22+
│ ├── it should set the position timelocked until
23+
│ └── it should set the position timelock
24+
└── when the {viaPermit2} param is true
25+
├── when the {encodedPermit2} is empty
26+
│ ├── given the permit hasn't already been set
27+
│ │ └── it should revert
28+
│ └── given the permit has already been set
29+
│ └── it should increase the position
30+
└── when the {encodedPermit2} is not empty
31+
└── it should increase the position
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11
init.t.sol
2-
#
2+
├── given the contract is initialized
3+
│ └── it should revert
4+
└── given the contract is not initialized
5+
├── when the timelock is greater than the max timelock
6+
│ └── it should revert
7+
└── when the timelock is less than or equal to the max timelock
8+
├── when the early withdraw penalty is greater than the max early withdraw penalty
9+
│ └── it should revert
10+
└── when the early withdraw penalty is less than or equal to the max early withdraw penalty
11+
├── it should set the contract as initialized
12+
├── it should set the owner
13+
├── it should have correct weth address set
14+
├── it should have correct permit2 address set
15+
├── it should set the token name
16+
├── it should set the token symbol
17+
├── it should set the timelock
18+
├── it should set the early withdraw penalty
19+
├── it should set the timelock exclude list
20+
├── it should set the descriptor
21+
└── it should set the next id
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pricePerShareVToken.t.sol
2+
├── it should return the correct price per share of vtoken
3+
└── when the vtoken is sent externally to this contract as reward
4+
└── it should increase the price per share of vtoken
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
receiveWethRewards.t.sol
2+
├── when the caller is not the fee distributor
3+
│ └── it should revert
4+
└── when the caller is the fee distributor
5+
├── given the total vtoken shares are less than or equal to the minimum liquidity
6+
│ ├── it should not pull any weth from the fee distributor
7+
│ ├── it should not increase the global weth fees per vtoken shares
8+
│ └── it should return false
9+
└── given the total vtoken shares are greater than the minimum liquidity
10+
├── it should pull the required weth from the fee distributor
11+
├── it should increase the global weth fees per vtoken shares
12+
└── it should return true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
setDescriptor.t.sol
2+
├── when the caller is not the owner
3+
│ └── it should revert
4+
└── when the caller is the owner
5+
├── when the descriptor is zero address
6+
│ └── it should revert
7+
└── when the descriptor is not zero address
8+
└── it should set the descriptor
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
setEarlyWithdrawPenalty.t.sol
2+
├── when the caller is not the owner
3+
│ └── it should revert
4+
└── when the caller is the owner
5+
├── when the early withdraw penalty is greater than the max value
6+
│ └── it should revert
7+
└── when the early withdraw penalty is less than or equal to the max value
8+
├── it should set the early withdraw penalty
9+
└── it should emit {UpdateEarlyWithdrawPenalty}

0 commit comments

Comments
 (0)