Link To Source Code: payment-stream - GitHub
Link To Contract Deployer: Create New Payment Stream - Arbiscan
Overview
This forum post describes how to use a payment-stream smart contract alongside the Livepeer Treasury to facilitate time-released payments from the on-chain Treasury. This approach provides an alternative to the default lump sum payment method with a more suitable gradual fund release, all while ensuring that custody of the funds remains decentralized.
How It Works
After a proposal is successfully voted on, funds are transferred from the Treasury into a smart contract. Two guardians are appointed with the authority to terminate the contract and refund any unspent funds back to the Treasury if necessary.
The payee can gradually claim the available tokens on a linear scale as the contract period nears its end. At any point, the payee can access and claim the currently available tokens by invoking the claim() function.
Why Stream Payments?
Accountability: The individual or entity receiving the funds will have to meet their commitments on an on-going basis to continue receiving funds. If these obligations are not met, the guardians have the authority to return the funds to the Treasury.
Voter fatigue: Reduces voter fatigue by bundling many phases, milestone or commitments into one proposal to vote on.
Non-custodial: Funds are securely locked in a contract that ensures payment either to the payee or back to the treasury, with no risk of the funds being lost or stolen.
Improved Cash Flow: Recipients benefit from a steady flow of funds, aiding in better financial planning and management.
Price impact: Streaming payments can mitigate the price impact on LPT tokens that might occur if a lump sum were sold into the market.
Deploying The Contract
Link To Contract Deployer: Create New Payment Stream - Arbiscan
The author of the Treasury proposal would deploy a payment stream contract with the link above and include the parameters needed for the proposal. For any Livepeer Treasury proposals you will need the following information:
Livepeer Treasury Address - 0xf82C1FF415F1fCf582554fDba790E27019c8E8C4
LPT token address - 0x289ba1701C2F088cf0faf8B3705246331cB8A839
You will then fill in the appropriate fields with your information.
Once your contract has been deployed, you can view the contract by viewing the tx hash.
Select “Logs” and locate the payment stream contract address.
Then you can select the “Contract” tab where payees can claim the current available tokens and guardians can submit their vote to terminate the contract to return all funds to the Treasury.
During the Treasury proposal please use the payment stream contract that was created NOT the payment stream deployer address. Be sure to match the LPT funding amount from the contract (18 decimal points) with the standard LPT unit amount in the proposal (1 decimal point). Any over funding will require guardians to terminate the contract to return excess LPT to the Treasury.
That is how the payment stream contract is created
Other Options
While this is just one option to achieve a payment stream, there are other options such as SuperFluid, Sablier, or modifying OpenZeplins vesting contract to achieve a similar result. Based on my initial research, both Superfluid and Sablier require their contracts to allow token spend from the Treasury, a mechanism I’m not entirely sure if the Treasury can accomplish. Meanwhile, OpenZeppelin’s vesting contracts are highly secure but require rewriting some code to prevent the guardians from having the ability to steal funds. The reason for building a contract from scratch was to accommodate how the current Treasury operates.
Conclusion
I am eager to see our on-chain Treasury thrive and become more robust through these efforts. I welcome any projects interested in utilizing this payment method. If you require further details about this approach or need help setting up the smart contract for your proposal, please don’t hesitate to contact me.
Titan