currentOverflowOf(uint256) :
This function returns the current overflow of a given project. It does this by first retrieving the current funding cycle of the project from the fundingCycles mapping. If the funding cycle is 0, it returns 0. Otherwise, it calls the _overflowFrom() function to calculate the overflow and returns the result. (autogenerated documentation)
reservedTicketBalanceOf(uint256,uint256) :
This function returns the balance of reserved tickets for a given project ID and reserved rate. It does this by first calculating the amount of processed tickets for the given project ID using the _processedTicketTrackerOf mapping, then calculating the reserved ticket amount from the processed tickets, reserved rate, and total supply of tickets for the given project ID using the _reservedTicketAmountFrom function. Finally, the reserved ticket balance is returned. (autogenerated documentation)
claimableOverflowOf(address,uint256,uint256) :
This function calculates the amount of overflow that can be claimed by a given account for a given project. It first checks that the account has enough tickets to claim the overflow, then it checks the current funding cycle of the project and retrieves the current overflow amount. It then calculates the total supply of tickets for the project, including any reserved tickets, and calculates the base overflow amount. Finally, it adjusts the base overflow amount based on the bonding curve rate of the current funding cycle. (autogenerated documentation)
canPrintPreminedTickets(uint256) :
This function checks if the total supply of tickets for a given project ID matches the preconfigured ticket count for that project ID, and if the processed ticket tracker for that project ID is greater than or equal to 0 and equal to the preconfigured ticket count. If both of these conditions are met, the function returns true, indicating that the premined tickets can be printed. (autogenerated documentation)
deploy(address,bytes32,string) :
This function deploys a new Funding Cycle for a project. It takes in the address of the owner, a handle, a URI, properties, metadata, payout mods, and ticket mods as parameters. It first validates and packs the metadata, then creates a new project with the given parameters. It then configures the Funding Cycle with the given properties, metadata, and fee. Finally, it sets the payout mods and ticket mods for the project. (autogenerated documentation)
configure(uint256) :
This function configures a new Funding Cycle for a given project. It takes in the project ID, Funding Cycle Properties, Funding Cycle Metadata, Payout Mods, and Ticket Mods as parameters. It then validates and packs the Funding Cycle Metadata, checks if premined tickets should be printed, and configures the Funding Cycle. Finally, it sets the Payout Mods and Ticket Mods for the Funding Cycle. (autogenerated documentation)
printPreminedTickets(uint256,uint256,uint256,address,string,bool) :
This function is used to print premined tickets for a given project. It takes in the project ID, the amount of tickets to be printed, the currency to be used, the beneficiary address, a memo, and a boolean value indicating whether or not to prefer unstaked tickets. It then calculates the weighted amount of tickets to be printed, checks if the project can print premined tickets, and updates the processed ticket tracker and preconfigure ticket count. Finally, it calls the ticket booth to print the tickets and emits an event. (autogenerated documentation)
pay(uint256,address,string,bool) :
This function allows a user to pay a certain amount of Ether to a beneficiary address. It requires that the amount of Ether is greater than 0, and that the beneficiary address is not the zero address. It then calls the _pay function, passing in the project ID, the amount of Ether, the beneficiary address, a memo, and a boolean indicating whether the user prefers to use unstaked tickets. The _pay function will then process the payment and return the amount of Ether that was sent. (autogenerated documentation)
tap(uint256,uint256,uint256,uint256) :
This function is used to tap into a project's funding cycle. It takes in the project ID, the amount to be tapped, the currency, and the minimum amount of Wei to be returned. It then checks the funding cycle associated with the project ID and verifies that the currency is correct. It then calculates the amount of Wei to be tapped based on the ETH price for the currency. It then checks that the minimum amount of Wei to be returned is less than or equal to the tapped amount. It then checks that the tapped amount is less than or equal to the balance of the project. It then takes a fee from the tapped amount if the fee is greater than 0 and distributes the remaining amount to the payout mods. If there (autogenerated documentation)
redeem(address,uint256,uint256,uint256,address,bool) :
This function allows a user to redeem a certain number of tickets for a given project. It requires the user to provide an address for the beneficiary, the project ID, the number of tickets to be redeemed, and the minimum amount of wei to be returned. The function then checks that the user has the necessary permissions to redeem the tickets, and that the beneficiary address is valid. It then calculates the amount of overflow that can be claimed, and subtracts it from the balance of the project. It then updates the processed ticket tracker for the project, and calls the ticket booth's redeem function. Finally, it sends the amount of overflow to the beneficiary address and emits a Redeem event. (autogenerated documentation)
migrate(uint256) :
This function is used to migrate a project from one terminal to another. It requires the owner of the project to have permission to migrate the project, and it also requires that the migration is allowed to the new terminal. It then checks if all the tickets have been processed, and if so, it transfers the balance of the project to the new terminal. Finally, it updates the terminal directory to reflect the new terminal and emits an event to log the migration. (autogenerated documentation)
addToBalance(uint256) :
This function adds a specified amount of Ether to the balance of a project with a given ID. It requires that the amount of Ether sent is greater than 0, and emits an event to notify of the addition. (autogenerated documentation)
allowMigration() :
This function allows the migration of a contract from one version to another. It takes in an ITerminal contract as an argument and checks that it is not the zero address or the same address as the current contract. If these checks pass, it sets the migrationIsAllowed boolean for the contract to true and emits an AllowMigration event. (autogenerated documentation)
setFee(uint256) :
This function sets the fee for the TerminalV1 contract. It can only be called by the government and the fee must be less than or equal to 200. If the fee is successfully set, an event is emitted. (autogenerated documentation)
appointGovernance(address) :
This function allows the current governance to appoint a new governance. It takes an address payable as an argument and sets it as the pendingGovernance. It then emits an AppointGovernance event with the new pendingGovernance address. The function also has a require statement to ensure that the address is not 0 and that it is not the same as the current governance address. (autogenerated documentation)
acceptGovernance() :
This function allows the pendingGovernance address to accept governance of the contract. It first checks that the msg.sender is the same as the pendingGovernance address. If it is, it sets the governance address to the pendingGovernance address and emits an event to signal that the governance has been accepted. (autogenerated documentation)
printReservedTickets(uint256) :
This function is used to print reserved tickets for a given project. It first checks if the project has an active funding cycle, and if so, it calculates the total amount of tickets that have been reserved for the project. It then checks if the total amount of tickets is within the maximum limit, and if so, it updates the processed ticket tracker for the project. It then distributes the reserved tickets to the ticket mods, and if there are any leftover tickets, it prints them to the owner of the project. Finally, it emits an event to log the details of the ticket printing. (autogenerated documentation)
_distributeToPayoutMods(uint256,string) :
This function distributes a given amount of funds to the payout mods associated with a given funding cycle. It first retrieves the payout mods associated with the funding cycle from the mod store. It then iterates through the payout mods and calculates the amount of funds to be allocated to each mod based on the percentage specified in the mod. If the mod has an allocator, the funds are allocated to the allocator. If the mod has a projectId, the funds are sent to the associated terminal. If the mod does not have a projectId, the funds are sent directly to the beneficiary. Finally, an event is emitted to track the distribution of funds. (autogenerated documentation)
_distributeToTicketMods(uint256) :
This function distributes a given amount of funds to ticket mods associated with a given funding cycle. It takes in two parameters, a FundingCycle memory object and an amount of funds to distribute, and returns the leftover amount of funds. It first sets the leftover amount to the given amount. It then retrieves an array of TicketMod memory objects associated with the given FundingCycle. It then iterates through the array, calculating the cut for each TicketMod based on their percentage and subtracting it from the leftover amount. Finally, it prints tickets for each TicketMod and emits an event for each distribution. (autogenerated documentation)
_pay(uint256,uint256,address,string,bool) :
This function is used to pay a beneficiary for a project. It takes in the project ID, the amount to be paid, the beneficiary address, a memo, and a boolean value indicating whether the beneficiary prefers unstaked tickets. The function first retrieves the current funding cycle of the project. It then calculates the weight of the funding cycle, the weighted amount, the reserved rate, and the unreserved weighted amount. The balance of the project is then increased by the amount to be paid. If the unreserved weighted amount is greater than 0, tickets are printed for the beneficiary. Otherwise, the processed ticket tracker of the project is decreased by the weighted amount. Finally, an event is emitted to indicate that the payment has been made. (autogenerated documentation)
_overflowFrom() :
This function calculates the amount of overflow from a given FundingCycle. It does this by first calculating the ETH price for the given currency, then calculating the limit of the FundingCycle by subtracting the tapped amount from the target amount. It then calculates the ETH limit by dividing the limit by the ETH price. Finally, it calculates the balance of the project and returns the difference between the balance and the ETH limit, or 0 if the balance is less than the ETH limit. (autogenerated documentation)
_reservedTicketAmountFrom(int256,uint256,uint256) :
This function calculates the amount of reserved tickets from a given total eligible tickets, processed ticket tracker, and reserved rate. It first calculates the unprocessed ticket balance of the total eligible tickets by subtracting the processed ticket tracker from the total eligible tickets if the processed ticket tracker is greater than 0, or adding the negative of the processed ticket tracker to the total eligible tickets if the processed ticket tracker is less than 0. If the unprocessed ticket balance of the total eligible tickets is 0, the function returns 0. If the reserved rate is 200, the function returns the unprocessed ticket balance of the total eligible tickets. Otherwise, the function returns the amount of reserved tickets by multiplying the unprocessed ticket balance of the total eligible tickets (autogenerated documentation)
_validateAndPackFundingCycleMetadata() :
This function validates and packs the metadata associated with a Funding Cycle. It takes in a FundingCycleMetadata memory struct as an argument and checks that the reservedRate, bondingCurveRate, and reconfigurationBondingCurveRate are all less than or equal to 200. If any of these values are greater than 200, an error is thrown. The function then packs the metadata into a uint256 value, with the reservedRate being stored in the least significant 8 bits, the bondingCurveRate being stored in the next 8 bits, and the reconfigurationBondingCurveRate being stored in the most significant 8 bits. (autogenerated documentation)
_takeFee(uint256,uint256,address,string) :
This function takes a fee from a given amount, _from, and sends it to a given beneficiary, _beneficiary. The fee is calculated by subtracting the result of a multiplication and division operation from _from. The operation multiplies _from by 200 and divides it by the sum of _percent and 200. The fee is then sent to the beneficiary using either the _pay() function or the pay() function of the JuiceboxProject contract, depending on the terminalDirectory.terminalOf() function. (autogenerated documentation)