Intro To The Spigot
Before diving into the technicals of the Spigot you should read into the Spigot product docs, to learn why we built it, why we designed it this way, and how we use it ourselves at Debt DAO before you use it yourself.
The most important thing to know is this. The Spigot is the first time anyone has been able to trustlessly collateralize onchain revenue streams allowing DeFi protocols to access an entirely new primitive for financial applications.
Integrating The Spigot
TK link to guides
Interface
ABI
Contract | Function Name | Modifiers | Description | Calls (sequential order DESC) | Called By | Function Signature |
---|---|---|---|---|---|---|
Spigot.sol | addSpigot(address revenueContract, SpigotSettings memory setting) | onlyOwner | Attach a new Revenue Contract to a Spigot. MUST include revenue split + valid | |||
Spigot.sol | updateWhitelistedFunction(bytes4 func, bool isAllowed) | onlyOwner | Allows the Owner to update Spigot whitelist of functions Operator can call on Revenue Contracts. This allows Operator to perform managerial tasks on its Revenue Contracts so they continue generating revenue while they are collateralized in the Spigot to repay debt. | |||
Spigot.sol | claimRevenue(address revenueContract, bytes calldata claimData) | ANYONE | Claims Revenue Tokens earned by one or more Revenue Contracts and updates amount claimable by Owner and Operator.
If push payments: When revenue is sent directly to the Spigot without us doing anything. We must calculate how many have been sent to us and disburse. (push payments = | |||
Spigot.sol | claimOwnerTokens(address token, uint256 amount) | onlyOwner | Owner withdraws their share of Revenue Tokens that have already been claimed via claimRevenue() | |||
Spigot.sol | claimOperatorTokens(address token, uint256 amount) | onlyOperator | - Operator withdraws their share of Revenue Tokens that have already been claimed via claimRevenue() | |||
Spigot.sol | getOwnerTokens(address token) | view | Returns the amount of Revenue Tokens held by Spigot that the Owner can withdraw. |
| ||
Spigot.sol | getOperatorTokens(address token) | view | Returns the amount of Revenue Tokens held by Spigot that the Operator can withdraw. |
| ||
Spigot.sol | isWhitelisted(bytes4 functionSignature) | view | Returns if the function has been whitelisted across Revenue Contracts for the Operator to call in operate() | |||
Spigot.sol | getSetting(address revenueContract) | view | Returns the config for a Revenue Contract: - uint8 ownerSplit - % of revenue that goes to Owner. 0 decimals - bytes4 claimFunction - function selector on Revenue Contract to claim revenue - bytes4 transferOwnerFunction - function selector on Revenue Contract to relinquish ownership from Spigot | |||
Spigot.sol | operate(address revenueContract, bytes calldata msgData) | onlyOperator | - Allows an Operator to call the whitelisted functions on its Revenue Contracts attached to the Spigot and carry on its business as usual activities. | |||
Spigot.sol | updateOwnerSplit(address revenueContract, uint8 split) | onlyOwner | Changes the revenue split between the Operator and the Owner based upon programmed conditions or otherwise if the Owner and Operator wish to change the split. | |||
Spigot.sol | updateOwner(address newOwner) | onlyOwner | Puts a new Owner in control the Spigot. | |||
Spigot.sol | updateOperator(address newOperator) | onlyOperator | - Puts a new Operator address in place to interact with the Revenue Contracts if ever this were needed. | |||
Spigot.sol | removeSpigot(address revenueContract) | onlyOwner | - Calls | |||
Spigot.sol | owner() | view | Returns the address of the current Spigot Owner. |
| ||
Spigot.sol | operator() | view | Returns the address of the current Spigot Operator. |
|