yearn-vaults-v3 icon indicating copy to clipboard operation
yearn-vaults-v3 copied to clipboard

feat: implement no sandwiching using share burning and minting

Open jmonteer opened this issue 2 years ago • 2 comments

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

jmonteer avatar Nov 10 '22 19:11 jmonteer

pending:

  • insta burn shares when losses are reported
  • tests

jmonteer avatar Nov 10 '22 19:11 jmonteer

pending:

  • tests
  • constructor setup

jmonteer avatar Nov 10 '22 20:11 jmonteer

pending:

  • more tests
  • precision in share burning
  • constructor setup (immutable)

jmonteer avatar Nov 11 '22 08:11 jmonteer

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)

jmonteer avatar Nov 12 '22 10:11 jmonteer