diff --git a/contracts/facets/MeTokenRegistryFacet.sol b/contracts/facets/MeTokenRegistryFacet.sol index ecd56377..6ef9432c 100644 --- a/contracts/facets/MeTokenRegistryFacet.sol +++ b/contracts/facets/MeTokenRegistryFacet.sol @@ -152,8 +152,6 @@ contract MeTokenRegistryFacet is MeTokenInfo storage meTokenInfo = s.meTokens[meToken]; require(LibMeta.msgSender() == meTokenInfo.owner, "!owner"); require(meTokenInfo.targetHubId != 0, "!resubscribing"); - // TODO: validiate !IMigration(meTokenInfo.migration).migrationStarted(meToken) - // and do this interface for sameAssetMigration require( IMigration(meTokenInfo.migration).canCancelResubscribe(meToken), "cannot cancel resubscribe" diff --git a/contracts/interfaces/IVault.sol b/contracts/interfaces/IVault.sol index 29622479..15a271c6 100644 --- a/contracts/interfaces/IVault.sol +++ b/contracts/interfaces/IVault.sol @@ -91,5 +91,5 @@ interface IVault { /// when a vault is registered to a new hub /// @param encodedArgs Additional encoded arguments /// @return True if encoded args are valid, else false - function isValid(bytes memory encodedArgs) external returns (bool); + function isValid(bytes memory encodedArgs) external pure returns (bool); } diff --git a/contracts/migrations/SameAssetTransferMigration.sol b/contracts/migrations/SameAssetTransferMigration.sol index e87ff9cd..c9cda689 100644 --- a/contracts/migrations/SameAssetTransferMigration.sol +++ b/contracts/migrations/SameAssetTransferMigration.sol @@ -115,13 +115,6 @@ contract SameAssetTransferMigration is ReentrancyGuard, Vault, IMigration { usts = _sameAssetMigration[meToken]; } - /// @inheritdoc Vault - function isValid( - bytes memory /* encodedArgs */ - ) external view override returns (bool) { - return true; - } - /// @inheritdoc IMigration function migrationStarted(address meToken) external @@ -140,4 +133,11 @@ contract SameAssetTransferMigration is ReentrancyGuard, Vault, IMigration { { return !_sameAssetMigration[meToken].started; } + + /// @inheritdoc Vault + function isValid( + bytes memory /* encodedArgs */ + ) external pure override returns (bool) { + return true; + } } diff --git a/contracts/migrations/UniswapSingleTransferMigration.sol b/contracts/migrations/UniswapSingleTransferMigration.sol index fcd09773..e0d46b86 100644 --- a/contracts/migrations/UniswapSingleTransferMigration.sol +++ b/contracts/migrations/UniswapSingleTransferMigration.sol @@ -139,21 +139,6 @@ contract UniswapSingleTransferMigration is ReentrancyGuard, Vault, IMigration { usts = _uniswapSingleTransfers[meToken]; } - /// @inheritdoc Vault - function isValid(bytes memory encodedArgs) - external - view - override - returns (bool) - { - // encodedArgs empty - if (encodedArgs.length == 0) return false; - uint24 fee = abi.decode(encodedArgs, (uint24)); - - // Must have valid fees - return (fee == MINFEE || fee == MIDFEE || fee == MAXFEE); - } - /// @inheritdoc IMigration function migrationStarted(address meToken) external @@ -175,6 +160,21 @@ contract UniswapSingleTransferMigration is ReentrancyGuard, Vault, IMigration { return (usts.fee != 0 && !usts.started); } + /// @inheritdoc Vault + function isValid(bytes memory encodedArgs) + external + pure + override + returns (bool) + { + // encodedArgs empty + if (encodedArgs.length == 0) return false; + uint24 fee = abi.decode(encodedArgs, (uint24)); + + // Must have valid fees + return (fee == MINFEE || fee == MIDFEE || fee == MAXFEE); + } + /// @dev parent call must have reentrancy check function _swap(address meToken) private returns (uint256 amountOut) { UniswapSingleTransfer storage usts = _uniswapSingleTransfers[meToken]; diff --git a/contracts/vaults/Vault.sol b/contracts/vaults/Vault.sol index b5012b35..7a96e7c4 100644 --- a/contracts/vaults/Vault.sol +++ b/contracts/vaults/Vault.sol @@ -105,7 +105,7 @@ contract Vault is IVault, ReentrancyGuard { /// @inheritdoc IVault function isValid( bytes memory /* encodedArgs */ - ) external virtual override returns (bool) { + ) external pure virtual override returns (bool) { return true; } }