-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: flow examples #37
base: main
Are you sure you want to change the base?
Conversation
build: update PRBMath build: add flow/lockup foundry profiles feat: implement a FlowUtilities library feat: implement flow creator contract refactor: rename v2 to lockup chore: add scripts in package json for the new profiles
3dcfadb
to
da161e5
Compare
build: install flow repo via package.json test: add tests for FlowStreamCreator test: add tests for FlowBatchable
@andreivladbrg this might need some refactor with the |
indeed it needs, will updated it also, since the repo is public now, it can be removed via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on Flow examples especially FlowUtilities
library. I have an idea for an example:
- An example to salaries to multiple people through a single contract.
Let me know what you think if it would be useful or an overkill for this repo? I was thinking of examples from the use case point of view. And this may be a useful for users.
package.json
Outdated
@@ -16,7 +16,8 @@ | |||
}, | |||
"dependencies": { | |||
"@openzeppelin/contracts": "5.0.2", | |||
"@prb/math": "4.0.3", | |||
"@prb/math": "4.1.0", | |||
"@sablier/flow": "github:sablier-labs/flow#main", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main
is by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
import { ISablierFlow } from "@sablier/flow/src/interfaces/ISablierFlow.sol"; | ||
|
||
contract FlowManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add create
as well. Without it, all the txns would revert since this contract may not be the msg.sender
.
IIUC, is the objective to introduce a manager that acts on behalf of the users?
flow/FlowStreamCreator.sol
Outdated
} | ||
|
||
// Create a stream that sends 1000 USDC per month | ||
function createStream_1T_PerMonth() external returns (uint256 streamId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be createStream_1K_PerMonth
. T is best suited to represent Trillions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flow/FlowUtilities.sol
Outdated
// Calculate the duration. | ||
uint40 duration = end - start; | ||
|
||
if (decimals < 18) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be ==
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b12104e
to
9fedb7a
Compare
Adding a note that after merging this PR, the links should be updated in sablier-labs/docs#186 |
Closes #36
Note: this PR merge must be synchronized with docs reference changes due to
v2
rename tolockup
(e.g. this one). Will work on that once you finish with your refactor @smol-ninja.The
flow
example contracts are represented by these 4:FlowBatchable
adjustRatePerSecondAndDeposit
,createMultiple
,createAndDepositViaBroker
etc.) to declare the calldata as bytes for multiple function calls into a single txFlowManager
FlowStreamCreator
FlowUtilities
rps
using a desired amount and duration.@sablier-labs/solidity lmk if you have anything else in mind, or if the current ones should suffice