Skip to content

Commit

Permalink
sync with core
Browse files Browse the repository at this point in the history
  • Loading branch information
1kresh committed Aug 1, 2024
1 parent 241ccf3 commit f618a0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/contracts/DefaultCollateralMigrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ contract DefaultCollateralMigrator is IDefaultCollateralMigrator {
/**
* @inheritdoc IDefaultCollateralMigrator
*/
function migrate(address collateral, address vault, address onBehalfOf, uint256 amount) external {
function migrate(
address collateral,
address vault,
address onBehalfOf,
uint256 amount
) external returns (uint256, uint256) {
IERC20(collateral).transferFrom(msg.sender, address(this), amount);
IDefaultCollateral(collateral).withdraw(address(this), amount);

address asset = IDefaultCollateral(collateral).asset();
amount = IERC20(asset).balanceOf(address(this));
IERC20(asset).approve(vault, amount);
IVault(vault).deposit(onBehalfOf, amount);
return IVault(vault).deposit(onBehalfOf, amount);
}
}
9 changes: 8 additions & 1 deletion src/interfaces/IDefaultCollateralMigrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ interface IDefaultCollateralMigrator {
* @param vault address of the vault to deposit the collateral's underlying asset
* @param onBehalfOf address of the account to deposit the underlying asset on behalf of
* @param amount amount of the default collateral to unwrap and deposit
* @return amount of the asset deposited
* @return amount of the active shares minted
*/
function migrate(address collateral, address vault, address onBehalfOf, uint256 amount) external;
function migrate(
address collateral,
address vault,
address onBehalfOf,
uint256 amount
) external returns (uint256, uint256);
}

0 comments on commit f618a0f

Please sign in to comment.