Skip to content

feat: enable yield bearing bridging via MasterVault#118

Open
waelsy123 wants to merge 18 commits intomainfrom
feat/ybb
Open

feat: enable yield bearing bridging via MasterVault#118
waelsy123 wants to merge 18 commits intomainfrom
feat/ybb

Conversation

@waelsy123
Copy link
Copy Markdown
Contributor

No description provided.

@cla-bot cla-bot Bot added the cla-signed label Sep 18, 2025
Comment thread contracts/tokenbridge/libraries/vault/MasterVault.sol Fixed
@waelsy123 waelsy123 changed the title feat: add MasterVault and its factory feat: enable yield bearing bridging via MasterVault Sep 18, 2025
* many vaults per gw and gwr, simplify initializers and creator, refactor MVF, add comments/todos/questions

* note about transferring funds

* comments
@godzillaba godzillaba marked this pull request as draft September 19, 2025 15:39
@waelsy123 waelsy123 marked this pull request as ready for review January 28, 2026 11:27
Copy link
Copy Markdown
Member

@gzeoneth gzeoneth left a comment

Choose a reason for hiding this comment

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

we should merge ybb and have actual integration test

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.

mismatch actual interface(contracts/tokenbridge/libraries/vault/IMasterVaultFactory.sol), should remove this file after merge


if (masterVaultFactory != address(0)) {
address masterVault = IMasterVaultFactory(masterVaultFactory).getVault(_l1Token);
amountReceived = IERC4626(masterVault).deposit(amountReceived, address(this));
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.

masterVault is not IERC4626

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Create2.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol";
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.

we should not assume 4626, remove this import


if (masterVaultFactory != address(0)) {
address masterVault = IMasterVaultFactory(masterVaultFactory).getVault(_l1Token);
amountReceived = IERC4626(masterVault).deposit(amountReceived, address(this));
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.

missing approval

address _router,
address _inbox
address _inbox,
address _masterVaultFactory
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.

hmm I don't like this, why are we making change to the existing gateways? we should just make a NEW ybbGateway

IERC20(_l1Token).safeTransfer(_dest, _amount);
if (masterVaultFactory != address(0)) {
address masterVault = IMasterVaultFactory(masterVaultFactory).getVault(_l1Token);
IERC20(masterVault).safeTransfer(_dest, _amount);
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.

would expect auto withdraw if MV is not underwater (and 100% fee)

bytes memory deployData = abi.encode(
callStatic(_token, ERC20.name.selector),
callStatic(_token, ERC20.symbol.selector),
callStatic(_token, ERC20.decimals.selector)
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.

this is not modified to include the MV decimals (+6) so the token would be deployed with the wrong decimal

address(l1Templates.masterVaultFactory),
proxyAdmin
);
IMasterVaultFactory(masterVaultFactory).initialize(upgradeExecutor);
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.

wrong init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants