yearn-vaults-v3
yearn-vaults-v3 copied to clipboard
feat: implement no sandwiching using share burning and minting
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Checklist
- [ ] I have run vyper and solidity linting
- [ ] I have run the tests on my machine
- [ ] I have followed commitlint guidelines
- [ ] I have rebased my changes to the latest version of the main branch
pending:
- insta burn shares when losses are reported
- tests
pending:
- tests
- constructor setup
pending:
- more tests
- precision in share burning
- constructor setup (immutable)
pending tests: no existing buffer:
- report gain, no fees, no refunds (should keep pps)
- report gain, fees, no refunds (should keep pps if fees < gain, reduce pps if fees > gain)
- report gain, no fees, refunds (should keep pps and lock both gain and refunds)
- report gain, fees, refunds (should keep pps if gain + refunds >= loss, decrease pps elsewhere)
- report loss, no fees, no refunds (should decrease pps)
- report loss, fees, no refunds (should decrease pps)
- report loss, no fees, refunds (should keep pps if refunds >= loss, reduce it otherwise)
- report loss, fees, refunds (should keep pps if loss + fees <= refunds, reduce it otherwise)
test the same with an existing buffer (i.e. previously locked shares) (pps should not change if there's enough buffer to cover fees + loss) AND
- report loss that is fully covered by existing buffer (should keep pps)
- report loss not fully covered by existing buffer (should decrease pps)