terminalsOf(uint256) :
This function returns an array of IJBPaymentTerminal objects associated with a given project ID. It works by accessing the _terminalsOf mapping, which stores the project ID as a key and the associated IJBPaymentTerminal objects as the value. The function then returns the value associated with the given project ID. (autogenerated documentation)
primaryTerminalOf(uint256,address) :
This function returns the primary terminal of a given project ID and token. It first checks if the primary terminal of the project ID and token is not equal to address 0 and is a terminal of the project ID. If so, it returns the primary terminal. Otherwise, it iterates through the terminals of the project ID and checks if each terminal accepts the given token. If so, it returns the terminal. If not, it returns address 0. (autogenerated documentation)
isTerminalOf(uint256) :
This function checks if a given IJBPaymentTerminal is a terminal of a given project ID. It does this by looping through the _terminalsOf array associated with the project ID and comparing each element to the given IJBPaymentTerminal. If a match is found, the function returns true, otherwise it returns false. (autogenerated documentation)
setControllerOf(uint256,address) :
This function sets the controller of a given project ID. It requires the sender to have permission to override the current controller, either by being the current controller or by being allowed to set the first controller. It also checks that the project ID is valid and that the current funding cycle allows for the controller to be set. If all of these conditions are met, the controller of the project ID is set to the given address and an event is emitted. (autogenerated documentation)
setTerminalsOf(uint256) :
This function sets the terminals of a given project ID. It requires the permission of the project owner, the project ID, and the sender must be the controller of the project ID. It then checks if the sender is the controller of the project ID and if setting terminals is allowed. If so, it sets the terminals of the project ID to the given terminals and checks for duplicate terminals. Finally, it emits an event to indicate that the terminals have been set. (autogenerated documentation)
setPrimaryTerminalOf(uint256,address) :
This function sets the primary terminal of a given project for a given token. It requires the caller to have permission to set the primary terminal, and checks that the terminal accepts the token. If the terminal is not already registered, it is added. Finally, the primary terminal is set and an event is emitted. (autogenerated documentation)
setIsAllowedToSetFirstController(address,bool) :
This function allows the owner of the contract to set a flag that determines whether a given address is allowed to set the first controller. It takes two parameters, an address and a boolean flag. The address is used to set the flag in a mapping, and the boolean flag is used to determine whether the address is allowed to set the first controller. The function emits an event to log the action. (autogenerated documentation)
_addTerminalIfNeeded(uint256) :
This function adds a terminal to a project if it is not already present. It first checks if the terminal is already present, and if not, it checks if the sender is the controller of the project or if the funding cycle allows for terminals to be added. If either of these conditions are met, the terminal is added to the project and an event is emitted. (autogenerated documentation)