Skip to content

Commit

Permalink
feat: Add registry trees
Browse files Browse the repository at this point in the history
  • Loading branch information
jdubpark committed Apr 12, 2024
1 parent ce42b7f commit 93daaa9
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/foundry/registries/IPAccountRegistry.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
IPAccountRegistry.sol
├── when registering IP Account
│ ├── it should call ERC-6551 registry with SP IP Account impl and salt
│ ├── it should create a SP IP Account
│ └── it should emit an event
└── when checking address of IP Account
├── when ERC-6551 implementation is incorrect
│ └── it should return unexpected address
├── when ERC-6551 salt is incorrect
│ └── it should return unexpected address
├── when chain ID is incorrect
│ └── it should return unexpected address
├── when token contract is incorrect
│ └── it should return unexpected address
├── when token ID is incorrect
│ └── it should return unexpected address
└── when all inputs are correct
└── it should return expected address
27 changes: 27 additions & 0 deletions test/foundry/registries/IPAssetRegistry.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
IPAssetRegistry.sol
├── when registering IP Account
│ ├── given the token contract does not support IERC721Metadata interface
│ │ └── it should revert
│ ├── given the owner of token ID is zero address (DNE or burned)
│ │ └── it should revert
│ └── given the token contract supports IERC721Metadata and token ID exists
│ ├── when IP already has name set in storage (previously registered)
│ │ └── it should revert
│ └── when IP does not have name set in storage
│ ├── it should set the IP name
│ ├── it should set the IP uri
│ ├── it should set the IP registration date
│ └── it should emit an event
└── when checking if IP is registered
├── given the IP ID is zero address
│ └── it should return false
├── given the IP ID has no code
│ └── it should return false
├── given the IP ID does not support IIPAccount interface
│ └── it should return false
├── given the IP ID does not match the expected registered IP ID
│ └── it should return false
├── given the IP ID does not have name set in storage
│ └── it should return false
└── given the IP ID is valid, matches the expected ID, and has name set in storage
└── it should return true
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
LicenseRegistry.sol:attachLicenseTermsToIp
├── when caller is not licensing module
│ └── it should revert
└── when caller is licensing module
├── given the license template is not registered
│ └── it should revert
├── given the license terms ID is not registered (DNE)
│ └── it should revert
├── given the IP has parents (is derivative)
│ └── it should revert
├── given the IP is expired
│ └── it should revert
└── given license template and terms ID are registered, IP is root, and IP is not expired
├── it should add the license template to IP's set of license templates
├── it should add the license terms ID to IP's set of attached license terms
└── it should associate the set index of attahced license template with that of attached license terms ID
31 changes: 31 additions & 0 deletions test/foundry/registries/LicenseRegistry.registerDerivativeIp.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
LicenseRegistry.sol:registerDerivativeIp
├── when caller is not licensing module
│ └── it should revert
└── when caller is licensing module
├── given the parent IP list is empty
│ └── it should revert
├── given the length of parent IP list does not equal the length of license term ID list
│ └── it should revert
├── given the child IP already has license terms attached (not default terms)
│ └── it should revert
├── given the child IP already has one or more parents (is derivative)
│ └── it should revert
└── given the parent IP list is non-empty and child has no parents and attached liceense terms
├── given any parent IP is the child IP
│ └── it should revert
├── given any parent IP has dispute tag
│ └── it should revert
├── given any parent IP has expired
│ └── it should revert
└── given the parent IP is not disputed or expired and is not child IP
├── given the license template and terms are not default
│ ├── when the parent IP does not have license template in its set of used license templates
│ │ └── it should revert
│ └── when the parent IP does not have license terms ID in its set of attached license terms ID
│ └── it should revert
└── given all the license terms are either from parent IPs or default license terms
├── it should, for each parent, add parent IP to the child IP's set of parent IPs
├── it should, for each parent, add child IP to the parent's set of child IPs
├── it should, for each license terms, add license terms to child's set of attached license terms
├── it should add license template to the child IP's set of license templates
└── it should set the expiry time of child IP
54 changes: 54 additions & 0 deletions test/foundry/registries/LicenseRegistry.setters.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
LicenseRegistry.sol:setters
.
├── when setting dispute module
│ ├── when caller is not protocol manager
│ │ └── it should revert
│ └── when caller is protocol manager
│ ├── when address is zero
│ │ └── it should revert
│ └── when address is non-zero
│ ├── when address does not support IModule interface
│ │ └── it should revert
│ └── when address supports IModule interface
│ └── it set the dispute module address
├── when setting licensing module
│ ├── when caller is not protocol manager
│ │ └── it should revert
│ └── when caller is protocol manager
│ ├── when address is zero
│ │ └── it should revert
│ └── when address is non-zero
│ ├── when address does not support IModule interface
│ │ └── it should revert
│ └── when address supports IModule interface
│ └── it set the licensing module address
├── when setting defaut license terms
│ ├── when caller is not protocol manager
│ │ └── it should revert
│ └── when caller is protocol manager
│ ├── when default license terms are set
│ │ └── it should revert
│ └── when default license terms are unset
│ ├── it should set the default license template
│ └── it should set the default license terms
├── when setting expiration time
│ ├── when caller is not licensing module
│ │ └── it should revert
│ └── when caller is licensing module
│ ├── it should set expiration time in IP Account storage
│ └── it should emit an event
├── when setting minting license config for license
│ ├── when caller is not licensing module
│ │ └── it should revert
│ └── when caller is licensing module
│ ├── when license template is not registered
│ │ └── it should revert
│ └── when license template is registered
│ ├── it should set
│ └── it should emit an event
└── when setting minting license config for IP
├── when caller is not licensing module
│ └── it should revert
└── when caller is licensing module
├── it should set the minting license config struct for IP
└── it should emit an event
66 changes: 66 additions & 0 deletions test/foundry/registries/ModuleRegistry.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
ModuleRegistry.sol
├── when registering module type
│ ├── when caller is not protocol manager
│ │ └── it should revert
│ └── when caller is protocol manager
│ ├── given the name is null
│ │ └── it should revert
│ ├── given the interface ID is null
│ │ └── it should revert
│ └── given the name and interface ID are valid
│ ├── when name is already registered with interface ID
│ │ └── it should revert
│ └── when name is not registered
│ ├── it should set the key `name` with value `interfaceId`
│ └── it should emit an event
├── when removing module type
│ ├── when caller is not protocol manager
│ │ └── it should revert
│ └── when caller is protocol manager
│ ├── when name is null
│ │ └── it should revert
│ └── when name is not null
│ ├── given the name is not registered with any interface ID
│ │ └── it should revert
│ └── given the name is registered
│ ├── it should delete the interface ID
│ └── it should emit an event
├── when registering module
│ ├── when caller is not protocol manager
│ │ └── it should revert
│ └── when caller is protocol manager
│ ├── given the module type (interface ID) is null
│ │ └── it should revert
│ ├── given the module type is not registered
│ │ └── it should revert
│ ├── given the module address is zero address
│ │ └── it should revert
│ ├── given the module address is not a contract
│ │ └── it should revert
│ ├── given the module address is already registered (check name)
│ │ └── it should revert
│ ├── given the module is already registered
│ │ └── it should revert
│ ├── given the module does not support interface ID of module type
│ │ └── it should revert
│ └── given the inputs are valid, module is not registered, and type is registered
│ ├── it should add (key: module name) -> (value: module address)
│ ├── it should add (key: module address) -> (value: module type)
│ └── it should emit an event
├── when removing module
│ ├── when caller is not protocol manager
│ │ └── it should revert
│ └── when caller is protocol manager
│ ├── given the name is null
│ │ └── it should revert
│ ├── given the module with name is not registered
│ │ └── it should revert
│ └── given the module with name is registered
│ ├── it should delete (key: module name) -> (value: module address)
│ ├── it should delete (key: module address) -> (value: module type)
│ └── it should emit an event
└── when checking if module is registered
├── when the return module type of the module address is zero
│ └── it should return false
└── when the return module type of the module address is non-zero
└── it should return true

0 comments on commit 93daaa9

Please sign in to comment.