Skip to content

feat: add claim rewards functionality for morpho vaults#12701

Open
frazarshad wants to merge 5 commits into
fraz/claim-rewards-flowfrom
fraz/claim-rewards-morpho
Open

feat: add claim rewards functionality for morpho vaults#12701
frazarshad wants to merge 5 commits into
fraz/claim-rewards-flowfrom
fraz/claim-rewards-morpho

Conversation

@frazarshad

@frazarshad frazarshad commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

closes: https://linear.app/agoric/issue/PAK-431/ymax-contract-should-be-able-to-claim-reward-tokens-on-morpho

Description

Adds a new claimRewards function in the to the erc4626 morpho protocol which can be used to claim rewards for a users position on a chain

rewards can be claimed by a step similar to this to the flow:


  {
    dest: '@Ethereum',
    src: 'ERC4626_morphoGauntletUsdcRwa_Ethereum',
    amount: 0n,
    fee: feeCall,
    claim: true,
    claimParams: {
        users: ['0x0000000000000000000000000000000000000001'],
        tokens: ['0x0000000000000000000000000000000000000002']],
        amounts: [1_234_567n],
        proofs: [
          [
            '0x1111111111111111111111111111111111111111111111111111111111111111',
            '0x2222222222222222222222222222222222222222222222222222222222222222',
          ],
        ],
  }

where the claimParams can be obtained from the merkl api. An example API call is here

Testing Considerations

unit tests have been added, but e2e testing has not been performed, since that can only be done in a mainnet environment

Upgrade Considerations

this adds new addresses to the axelar-config, so redepolyment of ymax contract is required with new args

@frazarshad frazarshad force-pushed the fraz/claim-rewards-morpho branch from d5e3ca0 to abac886 Compare June 3, 2026 13:25
@frazarshad frazarshad marked this pull request as ready for review June 3, 2026 14:45
dckc
dckc previously requested changes Jun 3, 2026

@dckc dckc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just started looking at this, but I found one change worth making.

const { addresses: a } = ctx;
const distributor =
a.merkleDistributor ||
assert.fail(X`merkleDistributor address not configured`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Upgrade Considerations

this adds new addresses to the axelar-config, so redepolyment of ymax contract is required with new args

Please update these to include the new args:

Odd... the tests for ymax1 contract addresses match golden snapshot and such in evm-overrides.test.ts should have triggered an update. I wonder why they didn't. Maybe because the new stuff is optional?

@frazarshad frazarshad requested a review from dckc June 4, 2026 08:40

@dckc dckc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd have to understand the project better to approve.

But I'm withdrawing my request for changes.

]);
});

test('wayFromSrcToDest handles claimRewards for ERC4626 position', t => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Testing Considerations

unit tests have been added, but e2e testing has not been performed, since that can only be done in a mainnet environment

contract-level tests are closer to e2e. A feat usually comes with one or more. In particular, vstorage snapshots help to understand how the feature impacts the rest of the system.

@dckc dckc dismissed their stale review June 4, 2026 14:31

addressed

@frazarshad frazarshad requested a review from dckc June 5, 2026 15:35
@dckc dckc removed their request for review June 5, 2026 16:21
@frazarshad frazarshad force-pushed the fraz/claim-rewards-morpho branch from 8b391af to 6ec75f2 Compare June 9, 2026 14:57
@frazarshad frazarshad changed the base branch from master to fraz/claim-rewards-flow June 9, 2026 14:58
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 462f5dad-50fe-4049-9c31-47c0089413fe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fraz/claim-rewards-morpho

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants