Skip to content
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

Add initial LockstakeEngine/Urn/Clipper logic + tests #1

Merged
merged 111 commits into from
Nov 12, 2024
Merged

Conversation

sunbreak1211
Copy link
Collaborator

No description provided.

sunbreak1211 and others added 3 commits November 24, 2023 09:36
* Create urn and allow to operate without defined delegate

* fix more error messages

* Option to remove delegate

* Move delegate function

* Improve test coverage
bytes32 immutable public ilk;
GemLike immutable public gov;
GemLike immutable public stkGov;
uint256 immutable public fee;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making fee configurable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done here: #5

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? still seems immutable there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this message was wrongly set, it was for another issue. I still have my reservations about this change. Let's leave it as it until we have some discussion.

src/LockstakeEngine.sol Show resolved Hide resolved
src/LockstakeEngine.sol Show resolved Hide resolved
src/LockstakeEngine.sol Outdated Show resolved Hide resolved
src/LockstakeEngine.sol Outdated Show resolved Hide resolved
src/LockstakeEngine.sol Outdated Show resolved Hide resolved
src/LockstakeEngine.sol Outdated Show resolved Hide resolved
src/LockstakeEngine.sol Outdated Show resolved Hide resolved
src/LockstakeUrn.sol Outdated Show resolved Hide resolved
src/LockstakeEngine.sol Outdated Show resolved Hide resolved
Co-authored-by: oldchili <[email protected]>
src/LockstakeEngine.sol Outdated Show resolved Hide resolved
sunbreak1211 and others added 3 commits December 12, 2023 16:42
* Allow urn management to another address

* Add tests

* Add isUrnAuth getter

* Remove README

* Extend testHopeNope

* Remove line

Co-authored-by: oldchili <[email protected]>

---------

Co-authored-by: oldchili <[email protected]>
src/LockstakeEngine.sol Outdated Show resolved Hide resolved
sunbreak1211 and others added 4 commits December 20, 2023 07:45
Co-authored-by: oldchili <[email protected]>
* Support multicall for LockstakeEngine

* Sketch use of converter inside LockstakeEngine

* Send out ngt from converter, separate events

* Add index parameter to open()

* Approve tokens to mkrNgt in the constructor

* gov => mkr, stkGov => stkMkr

* public => external

Co-authored-by: sunbreak1211 <[email protected]>

* Change revert message

* new line at end of file

Co-authored-by: sunbreak1211 <[email protected]>

* Put ngt functions after regular ones

* Change order of events as well

Co-authored-by: sunbreak1211 <[email protected]>

* ngt tests and testing open with wrong index

---------

Co-authored-by: sunbreak <[email protected]>
Co-authored-by: sunbreak1211 <[email protected]>
* Stake with lock, withdraw with free

* clean farm onTakeLeftovers

* Add missing farm reset in onTakeLeftovers

* Reset farm and delegate on each onKick and onTakeLeftovers

* Fixes on _selectFarm

* Minor move of call

* Fix issue in onKick + reorder some functions

* First round of adapting tests for new structure

* Fix for onTakeLeftovers

* Revert on selecting the same farm as existing one

* Use ink also for farm operations

* Use local var for ink before kick

* Modify comment - correctly undelegate and unstake

---------

Co-authored-by: oldchili <[email protected]>
Comment on lines +58 to +60
function init() external isEngine {
vat.hope(msg.sender);
lsmkr.approve(msg.sender, type(uint256).max);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small optimization here, since you seem to care about open gas, would be to use engine instead of msg.sender (since engine is immutable) and remove the isEngine modifier. But it will not make a large difference.

oldchili and others added 4 commits June 27, 2024 10:41
oldchili and others added 2 commits August 20, 2024 16:27
* Use owner/index as key for user functions

* Fix in README

* Renaming

* Change to isUrnAuth

* Minor tests change

* Use grab instead of frob in onRemove

* Use jug.drip to update rate in selectVoteDelegate
@DaiFoundation-DevOps
Copy link

DaiFoundation-DevOps commented Aug 22, 2024

CLA assistant check
All committers have signed the CLA.

sunbreak1211 and others added 6 commits August 27, 2024 15:52
* Certora setup (#37)

* builtin sanity, pre_condition rule

* folders

* more rules with advanced CVL properties

* document examples

* more options for ClipperCallee concrete implementations

* fix also fr Clipper

* where am I taken from

* fix

* remove kick summarization

* remove kick

* update links

* added rule sanity to configs

* added basic multicall spec

* adds a test solidity contract for multicall

* final setup touches and multicall

* added certora files and vim to gitignore

---------

Co-authored-by: EyalHochCertora <[email protected]>
Co-authored-by: EyalHCertora <[email protected]>

* LockstakeUrn

* Fix file header

* Use real Vat code and some changes to urn conf

* Use double quotes

* Add LockstakeMkr spec

* Fix

* Revert removal of end line

* LockstakeEngine (WIP) + Minor change for LockstakeUrn

* Remove space

* Remove factory from voteDelegate file

* Add missing check for selectVoteDelegate + add selectFarm and selectFarm_revert specs

* Add lock spec + minor changes to others

* lock_revert spec

* Improve comments

* lockNgt and lockNgt_revert specs

* Add free and feeeNgt specs

* Add free_revert and freeNgt_revert specs

* Add some new invariant rules + tidy up

* Add freeNoFee and freeNoFee_revert specs

* Simplify messages for non revert rules

* Add draw and draw_revert specs

* Add wipe, wipeAll and getReward specs

* Add wipe_revert and onKick specs

* Add wipeAll_revert spec

* Add getReward_revert spec

* farm renaming + minor changes

* Add onKick_revert spec + minor comments fix

* Fixes for inkMatchesLsmkrFarm

* Add onTake and onTake_revert specs

* Add onRemove and onRemove_revert specs

* Separate Multicall rules to different file + fix wipe_revert

* Minor changes

* Comment change

* First batch of LocstakeClipper specs

* Add redo and redo_specs + fix in storageAffected

* Clean up

* Fix specs timeouts for LockstakeEngine

* Add take spec + changes to storageAffected

* stopped revert conditions better matching with code

* Add take_revert spec

* Clipper: some variables renaming

* Add upchost upchost_revert specs

* Fix for take spec + add yank and yank_revert specs

* Engine: Rename several variables

* Update specs to newer version

* Remove unused function

* Fix CI

* Fix missing solc versions CI

* Fix timeouts

* Fix

* Change

* Some cleaning in multicall specs

* Add more invariants to LockstakeEngine

* Improve invariants for staking

* Fix

* Changes in invariants

* Include view functions invariants as well

* Fix

---------

Co-authored-by: Shoham Shamir <[email protected]>
Co-authored-by: EyalHochCertora <[email protected]>
Co-authored-by: EyalHCertora <[email protected]>
@sunbreak1211
Copy link
Collaborator Author

@telome @oldchili please give final approval and I'll get this merged. It will be used regular merging type to preserve audited commits.

telome
telome previously approved these changes Oct 22, 2024
oldchili
oldchili previously approved these changes Oct 23, 2024
@sunbreak1211 sunbreak1211 merged commit 602edbb into master Nov 12, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants