-
Notifications
You must be signed in to change notification settings - Fork 71
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
enable rebaseOptIn by the governor #1961
Conversation
sparrowDom
commented
Dec 19, 2023
- enable the governor to toggle rebaseOptIn on
- add events to rebase opt in/out
- remove copy artefacts that is no longer needed
- enable rebasing for eigenLayer contract
…e opt in/out functions
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1961 +/- ##
==========================================
- Coverage 69.05% 66.34% -2.71%
==========================================
Files 55 55
Lines 2811 2820 +9
Branches 726 728 +2
==========================================
- Hits 1941 1871 -70
- Misses 867 946 +79
Partials 3 3 ☔ View full report in Codecov by Sentry. |
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 only change is that the events should fire on accounting changes, not user intents. In this way, in the future, we can completely offline calculate a users balances. (once we have calculated a one time snapshot of the old events we are missing.)
All this really means in practice is that we need to also emit an event in the account migration internal function, if we are making any changes there. We also might want to slight change these event names to something that does not contain "opt" since sometimes it would be user action, and sometimes automatic.
![image](https://private-user-images.githubusercontent.com/837/291997306-7b3d5087-6966-4c80-99f2-f64ae404a5b8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwMzAzNDYsIm5iZiI6MTcxOTAzMDA0NiwicGF0aCI6Ii84MzcvMjkxOTk3MzA2LTdiM2Q1MDg3LTY5NjYtNGM4MC05OWYyLWY2NGFlNDA0YTViOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjIyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyMlQwNDIwNDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05NzNkM2ZiYmFjNWI3Y2RjMzM0OWRhYjIwNTVhOWUxZDk1OGFiZmRhMjkwMjI5MTM3YjEzN2ZiZTFlMWVmMzRjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.DwY3_GptCeUI0s6jFj7mj7KMkwnzmOToAiLnXrjVEYs)
import boa
from contextlib import contextmanager
oeth = boa.load_abi("brownie/abi/oeth.json", name="OETH").at("0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3")
dripper = boa.load_abi("brownie/abi/dripper.json", name="Dripper").at("0xc0F42F73b8f01849a2DD99753524d4ba14317EB3")
EIG = "0xa4C637e0F704745D182e4D38cAb7E7485321d059"
UNISWAP_POOL = '0x52299416C469843F4e0d54688099966a6c7d720f'
def stats():
return {
'totalSupply': oeth.totalSupply(),
'nonRebasingSupply': oeth.nonRebasingSupply(),
'rebasingCredits': oeth.rebasingCredits(),
'rebasingCreditsPerTokenHighres': oeth.rebasingCreditsPerTokenHighres(),
'EIG_rebaseState': oeth.rebaseState(EIG),
'EIG_balanceOf': oeth.balanceOf(EIG),
'EIG_credits': oeth.creditsBalanceOfHighres(EIG)[0],
'EIG_creditsPerToken': oeth.creditsBalanceOfHighres(EIG)[1],
'UNISWAP_rebaseState': oeth.rebaseState(UNISWAP_POOL),
'UNISWAP_balanceOf': oeth.balanceOf(UNISWAP_POOL),
'UNISWAP_credits': oeth.creditsBalanceOfHighres(UNISWAP_POOL)[0],
'UNISWAP_creditsPerToken': oeth.creditsBalanceOfHighres(UNISWAP_POOL)[1],
}
@contextmanager
def with_stats(name):
print("----"+name+"----")
before = stats()
yield
after = stats()
for k in before.keys():
diff = after[k] - before[k]
endcolor = '\x1b[0m'
if diff > 0:
color = '\x1b[0;32;40m'
elif diff < 0:
color = '\x1b[0;33;41m'
else:
color = endcolor
print(color, k, diff / 10**18, diff, '|', before[k], '->', after[k], endcolor)
boa.env.fork(url="http://127.0.0.1:8545/")
print("Secenario 1")
with boa.env.anchor():
with with_stats("Rebase after governance"):
dripper.collectAndRebase()
print("")
print("Secenario 2")
with boa.env.anchor():
with with_stats("Uniswap Opt In"):
with boa.env.prank(oeth.governor()):
oeth.governanceRebaseOptIn(UNISWAP_POOL)
with with_stats("Rebase After Uniswap Opt In"):
dripper.collectAndRebase()
@naddison36 @shahthepro this PR has a bit of a higher priority. In case you have some free cycles, could you take a look please? |
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.
Seems simple enough
it("Should get total value", async () => { | ||
const { oeth } = fixture; | ||
const eigenLayerStrategyContract = | ||
"0xa4c637e0f704745d182e4d38cab7e7485321d059"; |
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.
nit: I'd add EigenLayerStrategy to the addresses file
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 is almost the same comment I've left on one of @shahthepro's PRs but he made a great point, that when these addresses are immutable, it is safer to leave them hardcoded in the test files, so someone doesn't mistakingly change the address in the addresses.js
and that could have unexpected consequences. This comment addresses it.
I think Shah makes a great point, though I don't have strong conviction either way regarding this topic.