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

enable rebaseOptIn by the governor #1961

Merged
merged 3 commits into from
Dec 21, 2023

Conversation

sparrowDom
Copy link
Member

  • 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

Copy link

github-actions bot commented Dec 19, 2023

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against 92e034d

Copy link

codecov bot commented Dec 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2909efd) 69.05% compared to head (92e034d) 66.34%.
Report is 2 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

DanielVF
DanielVF previously approved these changes Dec 20, 2023
Copy link
Contributor

@DanielVF DanielVF left a 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
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()

@sparrowDom
Copy link
Member Author

Thanks @DanielVF you make some great points. I've applied the corrections in this commit: 92e034d

@sparrowDom
Copy link
Member Author

@naddison36 @shahthepro this PR has a bit of a higher priority. In case you have some free cycles, could you take a look please?

Copy link
Collaborator

@naddison36 naddison36 left a 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";
Copy link
Collaborator

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

Copy link
Member Author

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.

@sparrowDom sparrowDom merged commit 2314ccc into master Dec 21, 2023
12 of 15 checks passed
@sparrowDom sparrowDom deleted the sparrowDom/strategistEnableRebasing branch December 21, 2023 22:31
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.

None yet

3 participants