-
Notifications
You must be signed in to change notification settings - Fork 4
Chore: Automate end start swapping #235
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
base: main
Are you sure you want to change the base?
Changes from 9 commits
5fea4ec
95f2ac5
79c52d2
0fa28ea
049ac52
19455a4
cfff0f1
27dbbb3
302a3df
4b4386e
1b50cfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,12 @@ import "../utils/interface/ILBP.sol"; | |||||
| */ | ||||||
| // solhint-disable-next-line max-states-count | ||||||
| contract LBPManager { | ||||||
| enum TaskState { | ||||||
| Waiting, | ||||||
| Started, | ||||||
| Ended | ||||||
| } | ||||||
| TaskState public state; | ||||||
| // Constants | ||||||
| uint256 private constant HUNDRED_PERCENT = 1e18; // Used in calculating the fee. | ||||||
|
|
||||||
|
|
@@ -180,7 +186,6 @@ contract LBPManager { | |||||
| */ | ||||||
| function initializeLBP(address _sender) external onlyAdmin { | ||||||
| // solhint-disable-next-line reason-string | ||||||
| require(initialized == true, "LBPManager: LBPManager not initialized"); | ||||||
| require(!poolFunded, "LBPManager: pool already funded"); | ||||||
| poolFunded = true; | ||||||
|
|
||||||
|
|
@@ -192,7 +197,7 @@ contract LBPManager { | |||||
| startWeights, | ||||||
| swapFeePercentage, | ||||||
| address(this), | ||||||
| true // SwapEnabled is set to true at pool creation. | ||||||
| false // SwapEnabled is set to true at pool creation. | ||||||
| ) | ||||||
| ); | ||||||
|
|
||||||
|
|
@@ -234,6 +239,48 @@ contract LBPManager { | |||||
| vault.joinPool(lbp.getPoolId(), address(this), address(this), request); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * @dev start LBP just before one block | ||||||
| * @notice it can be invoked by anyone only once | ||||||
| */ | ||||||
| function startLbp() external { | ||||||
| uint256 startTime; | ||||||
| uint256 buffer = 5 minutes; | ||||||
| bool isSwapEnabled = lbp.getSwapEnabled(); | ||||||
| (startTime, , ) = lbp.getGradualWeightUpdateParams(); | ||||||
| require(state == TaskState.Waiting, "LBPManager: already started"); | ||||||
| require( | ||||||
| block.timestamp > startTimeEndTime[0] - buffer, | ||||||
| "LBPManager: one block before start time" | ||||||
|
||||||
| "LBPManager: one block before start time" | |
| "LBPManager: awaits start time" |
Outdated
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.
| "LBPManager: haven't reached end time" | |
| "LBPManager: awaits end time" |
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.
This documentation is wrong
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.
documentation for removeLiquidity?
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.
The documentation on the line linked to this comment. "Exit pool or remove liquidity from pool."
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.
That documentation is completely wrong for setSwapEnabled
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.
hm, This documentation is for removeLiquidity. The lines between 286-349 are hidden due to no changes. The correct docs for setSwapEnabled starts at line 347.
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.