Skip to content

Commit

Permalink
chore: pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Farterson committed Jan 20, 2022
1 parent 1375731 commit 1e15513
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 3 additions & 5 deletions contracts/migrations/SameAssetTransferMigration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import "../vaults/Vault.sol";
import "../interfaces/IMigration.sol";
import "../interfaces/ISingleAssetVault.sol";

/// @title Vault migrator from erc20 to erc20 (non-lp)
/// @title Same asset vault migrator
/// @author Carl Farterson (@carlfarterson)
/// @notice create a vault that instantly swaps token A for token B
/// when recollateralizing to a vault with a different base token
/// @dev This contract moves the pooled/locked balances from
/// one erc20 to another
/// @notice create a vault to hold an asset if a meToken is resubscribing
/// to a different hub with the same asset
contract SameAssetTransferMigration is ReentrancyGuard, Vault, IMigration {
struct SameAssetMigration {
// if migration is active
Expand Down
9 changes: 5 additions & 4 deletions contracts/registries/MeTokenRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ contract MeTokenRegistry is Ownable, IMeTokenRegistry {

require(_migration != address(0), "migration address(0)");

require(
IVault(_migration).isValid(_meToken, _encodedMigrationArgs),
"Invalid _encodedMigrationArgs"
);

// Ensure the migration we're using is approved
require(
migrationRegistry.isApproved(
Expand All @@ -154,10 +159,6 @@ contract MeTokenRegistry is Ownable, IMeTokenRegistry {
meToken_.targetHubId = _targetHubId;
meToken_.migration = _migration;

require(
IVault(_migration).isValid(_meToken, _encodedMigrationArgs),
"Invalid _encodedMigrationArgs"
);
IMigration(_migration).initMigration(_meToken, _encodedMigrationArgs);

emit InitResubscribe(
Expand Down
2 changes: 1 addition & 1 deletion test/contracts/registries/MeTokenRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ const setup = async () => {
)
).to.be.revertedWith("Invalid _encodedMigrationArgs");
});
it("Fails when current and target hub has same asset", async () => {
it("Passes when current and target hub have same asset", async () => {
const tx = meTokenRegistry.callStatic.initResubscribe(
meToken,
hubId3,
Expand Down

0 comments on commit 1e15513

Please sign in to comment.